1
- from os import system
2
-
3
1
from gi import require_version
4
2
3
+ from ssh_manager .config .Commands .AbtractCommand import AbstractCommand
4
+
5
5
require_version ('Gdk' , '3.0' )
6
6
require_version ('Gtk' , '3.0' )
7
7
15
15
class ConnectionListWindow :
16
16
VERTICAL_MARGIN = 5
17
17
HORIZONTAL_MARGIN = 2
18
+
19
+ __command_ssh = None
20
+ __command_edit = None
21
+
18
22
_listbox = None
19
23
_frame = None
20
24
_scrollable = None
21
25
_list_store = Gtk .ListStore (str )
22
26
23
- def __init__ (self , manager : Manager , window_config : Window ):
27
+ def __init__ (
28
+ self , manager : Manager ,
29
+ window_config : Window ,
30
+ command_ssh : AbstractCommand ,
31
+ command_edit : AbstractCommand
32
+ ):
33
+ self .__command_ssh = command_ssh
34
+ self .__command_edit = command_edit
24
35
self ._manager = manager
25
36
self ._window_config = window_config
26
37
@@ -71,9 +82,8 @@ def show(self):
71
82
Gtk .main ()
72
83
73
84
# noinspection PyUnusedLocal
74
- @staticmethod
75
- def btn_settings_click (target ):
76
- system ("xdg-open " + Application .Application .get_config_file_path ())
85
+ def btn_settings_click (self , target ):
86
+ self .__command_edit .run (Application .Application .get_config_file_path ())
77
87
78
88
# noinspection PyUnusedLocal
79
89
def btn_reload_click (self , target ):
@@ -97,4 +107,4 @@ def _fill_listbox(self):
97
107
def row_activated (self , target : Gtk .TreeView , path : Gtk .TreePath , column : Gtk .TreeViewColumn ):
98
108
i = path .get_indices ()[0 ]
99
109
connection = self ._manager .get_connection (i )
100
- system ( "gnome-terminal -x ssh {} -p {}" . format (connection . host , connection .port ) )
110
+ self . __command_ssh . run (connection , connection .args )
0 commit comments