diff --git a/MRICenterline/app/config/config_parser.py b/MRICenterline/app/config/config_parser.py index 1e536b1..2762e60 100644 --- a/MRICenterline/app/config/config_parser.py +++ b/MRICenterline/app/config/config_parser.py @@ -63,11 +63,16 @@ def get_color(self, section, key): as_list = [int(i) / 255 for i in rgb_str] return tuple(as_list) - def get_testing_status(self, testing): - if self.config_file['testing'][testing]: - return self.config_file.getboolean('testing', testing) - else: + def get_testing_status(self, testing: str or None): + if (self.config_file['testing']['disable-all-testing-features'] + and self.config_file.getboolean('testing', 'disable-all-testing-features')) \ + or testing is None: return False + else: + if self.config_file['testing'][testing]: + return self.config_file.getboolean('testing', testing) + else: + return False def get_boolean(self, section, key): return self.config_file.getboolean(section, key) diff --git a/MRICenterline/app/database/openable_sessions.py b/MRICenterline/app/database/openable_sessions.py index 5ab15b5..4aeddab 100644 --- a/MRICenterline/app/database/openable_sessions.py +++ b/MRICenterline/app/database/openable_sessions.py @@ -25,6 +25,7 @@ def get_all_sessions(): def get_latest_sessions(): + # TODO: show only latest sessions on custom open dialog # select * from 'sessions' group by case_id order by timestamp desc pass diff --git a/MRICenterline/app/gui_data_handling/case_model.py b/MRICenterline/app/gui_data_handling/case_model.py index de55996..aed4418 100644 --- a/MRICenterline/app/gui_data_handling/case_model.py +++ b/MRICenterline/app/gui_data_handling/case_model.py @@ -93,7 +93,9 @@ def calculate(self, status: PointStatus): self.centerline_model.calculate_length() def timer_status(self, status): - logging.info(f"Timer set to {status}") + import time + + logging.info(f"Timer set to {status} on {int(time.time())}") self.timer.command(status) def undo(self, undo_all: bool = False): diff --git a/MRICenterline/app/gui_data_handling/centerline_model.py b/MRICenterline/app/gui_data_handling/centerline_model.py index 5ef4231..cb28356 100644 --- a/MRICenterline/app/gui_data_handling/centerline_model.py +++ b/MRICenterline/app/gui_data_handling/centerline_model.py @@ -62,7 +62,7 @@ def save(self): print("save points") def refresh_panel(self, angle_change=None, height_change=None): - if CFG.get_testing_status("test-mode"): + if CFG.get_testing_status("running-for-tests"): self.calculate_centerline() self.centerline_viewer.refresh_panel(angle_change, height_change) else: diff --git a/MRICenterline/gui/display/toolbar.py b/MRICenterline/gui/display/toolbar.py index 5c019d9..dbefe56 100644 --- a/MRICenterline/gui/display/toolbar.py +++ b/MRICenterline/gui/display/toolbar.py @@ -4,6 +4,7 @@ from MRICenterline.app.points.status import PickerStatus, PointStatus from MRICenterline.app.gui_data_handling.case_model import CaseModel from MRICenterline.gui.display import toolbar_connect +from MRICenterline import CFG class DisplayPanelToolbarButtons(QWidget): @@ -25,6 +26,8 @@ def __init__(self, export_button.setFlat(True) layout.addWidget(export_button, 1, column, 1, 1) export_button.clicked.connect(lambda: toolbar_connect.export(model, parent)) + export_button.setEnabled(CFG.get_testing_status(testing=None)) # TODO: populate the export functions + # endregion # region length @@ -123,6 +126,8 @@ def show_hide_mpr_markers(s): comment_button.setFlat(True) layout.addWidget(comment_button, 1, column, 1, 1) comment_button.clicked.connect(lambda: toolbar_connect.comment(model, parent)) + comment_button.setEnabled(CFG.get_testing_status(testing=None)) # TODO: implement the comment dialog + # endregion # region window/level + intermediate points diff --git a/MRICenterline/gui/window/Toolbar.py b/MRICenterline/gui/window/Toolbar.py index 3d37697..401a719 100644 --- a/MRICenterline/gui/window/Toolbar.py +++ b/MRICenterline/gui/window/Toolbar.py @@ -2,6 +2,7 @@ from PyQt5.QtWidgets import QToolBar, QPushButton from MRICenterline.gui.window import toolbar_connect +from MRICenterline import CFG class IUToolbar(QToolBar): @@ -14,6 +15,7 @@ def __init__(self, parent=None): new_case_button.setFlat(True) self.addWidget(new_case_button) new_case_button.clicked.connect(parent.open_new_case) + new_case_button.setEnabled(CFG.get_testing_status(testing=None)) # TODO: fix the new case bug setting_button = QPushButton(qta.icon('fa.gear'), "Settings") setting_button.setFlat(True) @@ -24,3 +26,4 @@ def __init__(self, parent=None): help_button.setFlat(True) self.addWidget(help_button) help_button.clicked.connect(lambda: toolbar_connect.open_help_dialog(self)) + help_button.setEnabled(CFG.get_testing_status(testing=None)) # TODO: populate the help dialog diff --git a/config.ini.bak b/config.ini.bak deleted file mode 100644 index 4dab2f4..0000000 --- a/config.ini.bak +++ /dev/null @@ -1,57 +0,0 @@ -[folders] -data-folder = C:/Users/ang.a/Database/Rambam/clean_cases_test/100 -script-folder = C:\Users\ang.a\Documents\TCML-repos\ImageUntangler - -[display] -start-maximized = on -horizontal-number-of-panels = 1 -vertical-number-of-panels = 1 -display-width = 1920 -display-height = 1080 -toolbar-style = icon-and-text -font-size = 30 -window-percentile = 90 -show-interactor-coords = off -text-color = 0, 34, 158 -show-interactor-help = on -help-text-color = 230, 0, 0 -show-interactor-debug = off -debug-text-color = 0, 0, 0 -show-interactor-cursor = off -cursor-color = 255, 0, 0 - -[length-display-style] -color = 55, 230, 128 -highlighted-color = 55, 150, 128 -marker-size = 1 -show-line = on -line-thickness = 10 -line-style = dotted - -[mpr-display-style] -color = 255, 0, 0 -highlighted-color = 150, 0, 0 -marker-size = 1 -line-thickness = 10 -line-style = line -mpr-markers = on - -[mpr-length-display-style] -color = 255, 255, 0 -highlighted-color = 255, 255, 0 -marker-size = 1 -show-line = on -line-thickness = 10 -line-style = line - -[testing] -use-slice-location = off -draw-connecting-lines = off -ignore-uneven-slices = off -point-editing = off -show-memory-usage = on -show-fixer-button = on -show-sliders = off -point-shifter = on -test-mode = off - diff --git a/default_config.ini b/default_config.ini index e743442..805f203 100644 --- a/default_config.ini +++ b/default_config.ini @@ -45,12 +45,11 @@ line-thickness = 10 line-style = line [testing] +disable-all-testing-features = on use-slice-location = off draw-connecting-lines = off ignore-uneven-slices = off point-editing = off -show-memory-usage = on -show-fixer-button = on show-sliders = off point-shifter = on -test-mode = off +running-for-tests = off