diff --git a/Ccs/ccs_function_lib.py b/Ccs/ccs_function_lib.py index 052999a82920caedb521f2b13ddd3dbbc94f4be9..607d602b82b1afa3fb48a92bb426996ee1f89d4d 100644 --- a/Ccs/ccs_function_lib.py +++ b/Ccs/ccs_function_lib.py @@ -3490,7 +3490,9 @@ def add_tst_import_paths(): sys.path.append(confignator.get_option('paths', 'tst') + '/sketch_desk') sys.path.append(confignator.get_option('paths', 'tst') + '/test_specs') sys.path.append(confignator.get_option('paths', 'tst') + '/testing_library') - sys.path.append(confignator.get_option('paths', 'tst') + '/tst') + # insert this to import the tst view.py, not the one in .local folder + sys.path.insert(0, confignator.get_option('paths', 'tst') + '/tst') + return class TestReport: diff --git a/Tst/codeblockreusefeature/codeblockreuse.py b/Tst/codeblockreusefeature/codeblockreuse.py index e23f75a031a53a0a0e8501dbfdc940c7b9f9d9de..c585798a4881136bca6acbca2b1ec0e5fbb97cf8 100755 --- a/Tst/codeblockreusefeature/codeblockreuse.py +++ b/Tst/codeblockreusefeature/codeblockreuse.py @@ -450,7 +450,7 @@ class CBRSearch(Gtk.Box): self.cc_scrolled_window.add(self.cc_code_view) self.cc_box.pack_start(self.cc_label, False, False, 0) - self.cc_box.pack_start(self.cc_scrolled_window, False, False, 0) + self.cc_box.pack_start(self.cc_scrolled_window, True, True, 0) # source view for the verification code --------------------- self.vc_box = Gtk.Box() @@ -467,7 +467,7 @@ class CBRSearch(Gtk.Box): self.vc_scrolled_window.add(self.vc_code_view) self.vc_box.pack_start(self.vc_label, False, False, 0) - self.vc_box.pack_start(self.vc_scrolled_window, False, False, 0) + self.vc_box.pack_start(self.vc_scrolled_window, True, True, 0) self.code_view_pane = Gtk.Paned() self.code_view_pane.set_orientation(Gtk.Orientation.VERTICAL) diff --git a/Tst/log_viewer/log_viewer.py b/Tst/log_viewer/log_viewer.py index cd3334c820da87ebbcf757b12b986e40c3f15573..ff030c78181b1c9818d0a86dc836948073bcf9db 100755 --- a/Tst/log_viewer/log_viewer.py +++ b/Tst/log_viewer/log_viewer.py @@ -6,13 +6,13 @@ gi.require_version('GtkSource', '3.0') from gi.repository import Gtk, Gdk from gi.repository import Gio import confignator -import logging -import toolbox -import dbus import sys sys.path.append(confignator.get_option('paths', 'ccs')) import ccs_function_lib as cfl cfl.add_tst_import_paths() +import logging +import toolbox +import dbus uni_grau = '#666666' uni_weiss = '#ffffff' diff --git a/Tst/progress_view/progress_view.py b/Tst/progress_view/progress_view.py index cd0f9de137ae5b1f4ef33c6ae0e37254781af6d3..afbd779198177f267a4e3016d81781a3af149b3c 100644 --- a/Tst/progress_view/progress_view.py +++ b/Tst/progress_view/progress_view.py @@ -5,6 +5,11 @@ import logging import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk, Gio, GLib +import sys +import confignator +sys.path.append(confignator.get_option('paths', 'ccs')) +import ccs_function_lib as cfl +cfl.add_tst_import_paths() from testlib import analyse_command_log from testlib import analyse_verification_log from testlib import testing_logger @@ -12,13 +17,7 @@ import dbus import time import data_model import json -import confignator import toolbox -import sys -sys.path.append(confignator.get_option('paths', 'ccs')) -import ccs_function_lib as cfl -cfl.add_tst_import_paths() - # create a logger log_file_path = confignator.get_option(section='progress-viewer-logging', option='log-file-path') @@ -265,6 +264,9 @@ class TestProgressView(Gtk.ApplicationWindow): # expand all entries self.view.expand_all() + self.refresh_rate = 5 + self.refresh_worker() + # for styling the application with CSS context = self.get_style_context() Gtk.StyleContext.add_class(context, 'tst-css') @@ -431,10 +433,20 @@ class TestProgressView(Gtk.ApplicationWindow): def on_collapse_all_rows(self, *args): self.view.collapse_all() + def refresh_worker(self): + GLib.timeout_add_seconds(self.refresh_rate, self.on_reload_all) + def on_reload_all(self, *args): - self.load_json(self.path_json) - self.load_cmd(self.path_cmd) - self.load_vrc(self.path_vrc) + if self.path_json: + self.load_json(self.path_json) + print(1) + if self.path_cmd: + self.load_cmd(self.path_cmd) + print(2) + if self.path_vrc: + self.load_vrc(self.path_vrc) + print(3) + def on_clear_cmd_log(self, *args): with open(self.path_cmd, 'w') as cmd_log: @@ -550,7 +562,7 @@ class TestProgressView(Gtk.ApplicationWindow): data_from_file = json.loads(data) file.close() if data_from_file is not None: - self.test_model = data_model.TestSequence() + self.test_model = data_model.TestSpecification() self.test_model.decode_from_json(json_data=data_from_file) self.load_model_into_tree_store(self.progress_tree_store, self.test_model) else: @@ -583,17 +595,22 @@ class TestProgressView(Gtk.ApplicationWindow): # check which step numbers are already in the tree_store tree_store_steps = [] for row in tree_store: - step_number_tree_store = int(row[0:1][0]) + step_number_tree_store = row[0:1][0] tree_store_steps.append(step_number_tree_store) # add drawer for each step which is not in the tree_store already - for key in test_model.steps_dict: - step_number = int(test_model.steps_dict[key].step_number) + # ToDo: only the first sequence is loaded, at the moment only one is supported, but if that changes, this + # has to be changed as well, (Dominik) + for step in test_model.sequences[0].steps: + step_number = step.step_number_test_format if step_number not in tree_store_steps: step_desc = 'Step ' + str(step_number) + new_drawer_row = self.build_row_list(step_number=str(step_number), step_desc=step_desc) + tree_store.append(None, new_drawer_row) tree_store_steps.append(step_number) + # # remove all existing specifications # for row in tree_store: # for item in row.iterchildren(): @@ -637,11 +654,11 @@ class TestProgressView(Gtk.ApplicationWindow): # check which step numbers are already in the tree_store tree_store_steps = [] for row in tree_store: - step_number_tree_store = int(row[0:1][0]) + step_number_tree_store = row[0:1][0] tree_store_steps.append(step_number_tree_store) # add drawer for each step which is not in the tree_store already for item in cmd_steps: - step_number = int(item['step']) + step_number = item['step'] if step_number not in tree_store_steps: step_desc = 'Step ' + str(step_number) new_drawer_row = self.build_row_list(step_number=str(step_number), @@ -655,9 +672,9 @@ class TestProgressView(Gtk.ApplicationWindow): tree_store.remove(item.iter) # add rows for command for row in tree_store: - step_number_tree_store = int(row[0:1][0]) + step_number_tree_store = row[0:1][0] for item in cmd_steps: - step_number_cmd = int(item['step']) + step_number_cmd = item['step'] if step_number_tree_store == step_number_cmd: # already_exists = False # for i in row.iterchildren(): @@ -697,11 +714,11 @@ class TestProgressView(Gtk.ApplicationWindow): # check which step numbers are already in the tree_store tree_store_steps = [] for row in tree_store: - step_number_tree_store = int(row[0:1][0]) + step_number_tree_store = row[0:1][0] tree_store_steps.append(step_number_tree_store) # add drawer for each step which is not in the tree_store already for item in vrc_steps: - step_number = int(item['step']) + step_number = item['step'] if step_number not in tree_store_steps: step_desc = 'Step ' + str(step_number) new_drawer_row = self.build_row_list(step_number=str(step_number), @@ -715,9 +732,9 @@ class TestProgressView(Gtk.ApplicationWindow): tree_store.remove(item.iter) # add row for verification for row in tree_store: - step_number_tree_store = int(row[0:1][0]) + step_number_tree_store = row[0:1][0] for item in vrc_steps: - step_number_vrc = int(item['step']) + step_number_vrc = item['step'] if step_number_tree_store == step_number_vrc: # already_exists = False # for i in row.iterchildren(): diff --git a/Tst/tst/generator_templates/co_pre_condition_entry.py b/Tst/tst/generator_templates/co_pre_condition_entry.py index be68a95833036cfe53656fb7312cc3196aecbd0a..2a38ef36877518ee59be8d36d7178a0af28e9ef6 100644 --- a/Tst/tst/generator_templates/co_pre_condition_entry.py +++ b/Tst/tst/generator_templates/co_pre_condition_entry.py @@ -6,10 +6,14 @@ #####-None-##### logger.info('No pre-conditions have been given') -success = False +success = True #####-Example-##### print('No pre-conditions have been given') success = True + + + + diff --git a/Tst/tst/generator_templates/run_header.py b/Tst/tst/generator_templates/run_header.py index f339e6e99d7d4faa244af69518412ba8403dc507..789600dd8f525a2da24f1b4de1eaa4b68e84c104 100644 --- a/Tst/tst/generator_templates/run_header.py +++ b/Tst/tst/generator_templates/run_header.py @@ -10,7 +10,7 @@ print('current working directory: {}'.format(os.getcwd())) import confignator ccs_path = confignator.get_option('paths', 'ccs') sys.path.append(ccs_path) -sys.path.append(confignator.get_option('tst-paths', 'testing_library')) +cfl.add_tst_import_paths() from testlib import tools from testlib import report from testlib import tm diff --git a/Tst/tst/tst.cfg b/Tst/tst/tst.cfg index f8f1ef44d2c2ac12707216588c7f1a21f64ffa16..79b320baccfa7b3affd79cc2255add483c46f3a6 100644 --- a/Tst/tst/tst.cfg +++ b/Tst/tst/tst.cfg @@ -3,6 +3,7 @@ tst = egse.tst.editor [tst-paths] tst_products = ${paths:tst}/test_specs +testing_library = ${paths:tst}/testing_library [tst-logging] level = DEBUG @@ -13,7 +14,7 @@ test_run = ${paths:tst}/logs_test_runs/ [tst-preferences] show-json-view = True main-window-height = 1025 -main-window-width = 1853 +main-window-width = 1581 paned-position = 960 paned-position-codeblockreuse = 520 diff --git a/Tst/tst/tst.py b/Tst/tst/tst.py index 68e7a76ab51c02777344ae8b1352436bde63333f..6dcd37ee6286c2ae6e3e6e2847a6c082064d1bf7 100755 --- a/Tst/tst/tst.py +++ b/Tst/tst/tst.py @@ -146,7 +146,7 @@ class TstApp(Gtk.Application): def _on_start_ccs_editor(self, *args): try: - cfl.start_editor(True) + cfl.start_editor() except Exception as e: self.logger.exception(e) message = 'Failed to start the CSS-Editor' @@ -674,21 +674,23 @@ class TstAppWindow(Gtk.ApplicationWindow): self.logger.info('Progress Viewer started without running Test') print('Progress Viewer started without running Test') return '' + try: + current_file_name = os.path.basename(current_instance.filename) + path_test_specs = confignator.get_option(section='tst-paths', option='tst_products') + path_test_runs = confignator.get_option(section='tst-logging', option='test_run') - current_file_name = os.path.basename(current_instance.filename) - path_test_specs = confignator.get_option(section='tst-paths', option='tst_products') - path_test_runs = confignator.get_option(section='tst-logging', option='test_run') - - json_file_path = os.path.join(path_test_specs, current_file_name) - paths['json_file_path'] = json_file_path - - name = generator.strip_file_extension(current_file_name) - cmd_log_file_path = os.path.join(path_test_runs, name + testing_logger.cmd_log_auxiliary) - paths['cmd_log_file_path'] = cmd_log_file_path + json_file_path = os.path.join(path_test_specs, current_file_name) + paths['json_file_path'] = json_file_path - vrc_log_file_path = os.path.join(path_test_runs, name + testing_logger.vrc_log_auxiliary) - paths['vrc_log_file_path'] = vrc_log_file_path + name = generator.strip_file_extension(current_file_name) + cmd_log_file_path = os.path.join(path_test_runs, name + testing_logger.cmd_log_auxiliary) + paths['cmd_log_file_path'] = cmd_log_file_path + vrc_log_file_path = os.path.join(path_test_runs, name + testing_logger.vrc_log_auxiliary) + paths['vrc_log_file_path'] = vrc_log_file_path + except Exception as e: + self.logger.info('Json or Log Files could not be found') + return '' return paths def on_make_desktop_entry(self): @@ -714,7 +716,7 @@ class TstAppWindow(Gtk.ApplicationWindow): def on_start_ccs_editor(self, *args): try: self.logger.info('Starting CCS-Editor application.') - cfl.start_editor(False) + cfl.start_editor() except Exception as e: message = 'Could not start CCS-Editor. Further information probably can be found in the tst.log file.' self.logger.error(message) @@ -905,6 +907,8 @@ def run(): dbus.validate_bus_name(bus_name) applica = TstApp(bus_name, Gio.ApplicationFlags.FLAGS_NONE, logger=logger) + print(sys.path) + print(view) applica.run() diff --git a/Tst/tst/view.py b/Tst/tst/view.py index 5fb11b60bfc04310d624e971592c31710c3d87da..2e2edb77a84c556b8a40d857c57308ed9c239849 100644 --- a/Tst/tst/view.py +++ b/Tst/tst/view.py @@ -839,7 +839,8 @@ class StepWidget(Gtk.EventBox): description = step.description command_code = step.command_code verification_code = step.verification_code - data_string = dnd_data_parser.create_datastring(dnd_data_parser.data_type_step, + data_type = dnd_data_parser.data_type_step if verification_code else dnd_data_parser.data_type_snippet + data_string = dnd_data_parser.create_datastring(data_type, self.sequence, step_number, description,