change terminal command

This commit is contained in:
Huy Pham 2020-01-20 12:04:10 -08:00
parent 8bcacf0a04
commit 510252c4a7
2 changed files with 16 additions and 2 deletions

View file

@ -38,6 +38,17 @@ OBSERVERS = {
"IPSec policies": "setkey -DP",
}
DEFAULT_TERMS = {
"xterm": "xterm -e",
"aterm": "aterm -e",
"eterm": "eterm -e",
"rxvt": "rxvt -e",
"konsole": "konsole -e",
"lxterminal": "lxterminal -e",
"xfce4-terminal": "xfce4-terminal -x",
"gnome-terminal": "gnome-terminal --window--",
}
class CoreServer:
def __init__(self, name: str, address: str, port: int):
@ -528,6 +539,9 @@ class CoreClient:
try:
terminal = self.app.guiconfig["preferences"]["terminal"]
response = self.client.get_node_terminal(self.session_id, node_id)
output = os.popen(f"echo {terminal}").read()[:-1]
if output in DEFAULT_TERMS:
terminal = DEFAULT_TERMS[output]
cmd = f'{terminal} "{response.terminal}" &'
logging.info("launching terminal %s", cmd)
os.system(cmd)

View file

@ -214,8 +214,6 @@ class CanvasGraph(tk.Canvas):
"""
Draw existing session.
"""
print("print session")
print(session)
# draw existing nodes
for core_node in session.nodes:
# peer to peer node is not drawn on the GUI
@ -268,8 +266,10 @@ class CanvasGraph(tk.Canvas):
self.core.links[edge.token] = edge
if link.HasField("interface_one"):
canvas_node_one.interfaces.append(link.interface_one)
edge.src_interface = link.interface_one
if link.HasField("interface_two"):
canvas_node_two.interfaces.append(link.interface_two)
edge.dst_interface = link.interface_two
elif link.options.unidirectional:
edge = self.edges[token]
edge.asymmetric_link = link