diff --git a/Tst/connect_apps.py b/Tst/connect_apps.py index 378e366e82a4b562ab36f6b9b4cd0968b3ed4e57..1da982206d8dd1df18bcc1fa45253fa824fd5c2e 100644 --- a/Tst/connect_apps.py +++ b/Tst/connect_apps.py @@ -61,14 +61,13 @@ def connect_to_tst(logger=module_logger): obj = bus.get_object(bus_name=bus_name, object_path=obj_path) interface_actions = dbus.Interface(obj, 'org.gtk.Actions') actions = interface_actions.List() - print('Available Actions:') + logger.debug('Available Actions for {}:'.format(bus_name)) for item in actions: - print(item) - print('closing the current page in Tst') - interface_actions.Activate(actions[0], [], []) + logger.debug('{}'.format(item)) return interface_actions except dbus.exceptions.DBusException as dbe: logger.exception(dbe) + raise dbe def connect_to_progress_viewer(logger=module_logger): diff --git a/Tst/progress_view/progress_view.py b/Tst/progress_view/progress_view.py index 4373c7643cccb0d4175f74bdae2249c41baf8f7e..e86f87764833c62ce37f3ba68bcb15cd502f6972 100644 --- a/Tst/progress_view/progress_view.py +++ b/Tst/progress_view/progress_view.py @@ -153,8 +153,8 @@ class TestProgressView(Gtk.ApplicationWindow): self.open_json_btn = Gtk.Button() self.open_json_btn.set_label('Open JSON in TST') self.open_json_btn.set_size_request(185, -1) - # self.open_json_btn.connect('clicked', self.on_open_json_tst) - # self.box_file_path_1.pack_start(self.open_json_btn, False, True, 5) + self.open_json_btn.connect('clicked', self.on_open_json_tst) + self.box_file_path_1.pack_start(self.open_json_btn, False, True, 5) self.path_box.pack_start(self.box_file_path_1, True, True, 0) # select file - command log @@ -196,7 +196,7 @@ class TestProgressView(Gtk.ApplicationWindow): self.title_box = Gtk.HBox() self.test_label = Gtk.Label() - self.test_label.set_markup('<big>Test:</big>') + # self.test_label.set_markup('<big>Test:</big>') self.test_title = Gtk.Label() self.set_test_title() diff --git a/Tst/tst/file_management.py b/Tst/tst/file_management.py index 91570433e7748ba3e28cded6685722b221f1cb7d..dfa4873697f135d393d3dd4c4cbeedcc7ff159de 100644 --- a/Tst/tst/file_management.py +++ b/Tst/tst/file_management.py @@ -48,7 +48,6 @@ def open_file(file_name, *args): data_from_file = None with open(file_name, 'r') as file: data_from_file = _from_json(file) - file.close() return data_from_file diff --git a/Tst/tst/tst.py b/Tst/tst/tst.py index 2b554a0ce92f1b6fc7514830a57186641ac0cdb0..d06ce7e48272a1fe4d647ad5597376f49f2fbbd3 100755 --- a/Tst/tst/tst.py +++ b/Tst/tst/tst.py @@ -621,14 +621,19 @@ class TstAppWindow(Gtk.ApplicationWindow): file_selected = dialog.get_filename() cfg.save_option_to_file('tst-history', 'last-folder', os.path.dirname(file_selected)) - self.load_test_spec(file_selected) + self.load_test_spec(None, file_selected) dialog.destroy() - def load_test_spec(self, json_path): + def load_test_spec(self, simple_action, json_path, *args): + + # cast to string if called from open-test-spec action via DBus + if isinstance(json_path, GLib.Variant): + json_path = json_path.get_string() + try: json_type = True - data_from_file = file_management.open_file(file_name=json_path) + data_from_file = file_management.open_file(json_path) filename = json_path except json.decoder.JSONDecodeError: data_from_file = spec_to_json.run(specfile=json_path, gen_cmd=True, save_json=False)