diff --git a/CHANGELOG.md b/CHANGELOG.md index edc54e0..dc3f8ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Change log of DVH Analytics +v0.9.5 (2021.02.13) +------------ + - [GUI] Fixed bug preventing User Preferences window from loading if on Windows without Edge being available [Issue 144](https://github.com/cutright/DVH-Analytics/issues/144) + - [ROI Map] Fixed bug where ROI Map edits didn't update previous imports [Issue 142](https://github.com/cutright/DVH-Analytics/issues/142) + - [Misc] Catch locale issue between wxWidgets and python [140](https://github.com/cutright/DVH-Analytics/issues/140) + v0.9.4 (2021.02.06) ------------------------- - [Import] New OVH calculation [Issue 111](https://github.com/cutright/DVH-Analytics/issues/111) diff --git a/docs/requirements.txt b/docs/requirements.txt index b5251f6..655ddbe 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,13 +1,18 @@ -dicompyler-core +dicompyler-core>=0.5.5 +wxPython>=4.1.1 pypubsub -pydicom -bokeh<2.0.0 +numpy +scipy +pydicom>=1.4.0 +bokeh>=1.2.0,<2.0.0 psycopg2-binary shapely[vectorized] python-dateutil -statsmodels -scikit-learn +statsmodels>=0.8.0 +scikit-learn>=0.21.0 regressors rapidfuzz selenium +pandas>=1.1.5 scikit-image +dvha-mlca>=0.2.3.post1 diff --git a/dvha/_version.py b/dvha/_version.py index bba52f6..f1fc4d5 100644 --- a/dvha/_version.py +++ b/dvha/_version.py @@ -9,6 +9,6 @@ __author__ = "Dan Cutright" __email__ = "dan.cutright@gmail.com" -__version__ = "0.9.4" -__release__ = "0.9.4" -__version_info__ = (0, 9, 4) +__version__ = "0.9.5" +__release__ = "0.9.5" +__version_info__ = (0, 9, 5) diff --git a/dvha/dialogs/main.py b/dvha/dialogs/main.py index d1d2a1e..9729fd2 100644 --- a/dvha/dialogs/main.py +++ b/dvha/dialogs/main.py @@ -25,7 +25,6 @@ set_msw_background_color, set_frame_icon, backup_sqlite_db, - is_edge_backend_available, is_windows, ) from dvha.db import sql_columns @@ -836,12 +835,14 @@ class UserSettings(wx.Frame): Customize directories and visual settings for DVHA """ - def __init__(self, parent): + def __init__(self, parent, is_edge_backend_available=False): """ :param parent: main application frame """ wx.Frame.__init__(self, None, title="User Settings") + self.is_edge_backend_available = is_edge_backend_available + self.parent = parent self.options = parent.options self.options.edit_detected = False @@ -963,7 +964,7 @@ def __init__(self, parent): self.checkbox_edge_backend = wx.CheckBox( self, wx.ID_ANY, "Enable Edge WebView Backend" ) - if not is_edge_backend_available(): + if not self.is_edge_backend_available: self.checkbox_edge_backend.Disable() self.button_restore_defaults = wx.Button( @@ -1392,7 +1393,7 @@ def __do_bind(self): self.update_alpha_val, id=self.spin_ctrl_alpha_input.GetId(), ) - if is_windows() and is_edge_backend_available(): + if is_windows() and self.is_edge_backend_available: self.Bind( wx.EVT_CHECKBOX, self.on_enable_edge, diff --git a/dvha/main.py b/dvha/main.py index 1a494ad..0c750eb 100644 --- a/dvha/main.py +++ b/dvha/main.py @@ -17,6 +17,7 @@ logger.setLevel(logging.DEBUG) import wx +import wx.html2 as webview from datetime import datetime import webbrowser from pubsub import pub @@ -87,6 +88,13 @@ def __init__(self, *args, **kwds): self.allow_window_size_save = False + self.is_edge_backend_available = None + try: + self.is_edge_backend_available = \ + webview.WebView.IsBackendAvailable(webview.WebViewBackendEdge) + except Exception: + self.is_edge_backend_available = False + ############################################################################# # The following block of code for logging adapted from dicompyler ############################################################################# @@ -1525,7 +1533,7 @@ def on_report_issue(evt): def on_pref(self, *args): if self.user_settings is None: - self.user_settings = UserSettings(self) + self.user_settings = UserSettings(self, self.is_edge_backend_available) self.user_settings.Show() else: self.user_settings.Raise() @@ -1855,11 +1863,12 @@ def OnExit(self): return super().OnExit() # May cause crash, another solution needed? - # def InitLocale(self): - # # https://docs.wxpython.org/MigrationGuide.html#possible-locale-mismatch-on-windows - # if is_windows(): - # return - # super().InitLocale() + def InitLocale(self): + # https://docs.wxpython.org/MigrationGuide.html#possible-locale-mismatch-on-windows + if is_windows(): + self.ResetLocale() + return + super().InitLocale() def start(): diff --git a/dvha/models/roi_map.py b/dvha/models/roi_map.py index 713187a..e1fe729 100644 --- a/dvha/models/roi_map.py +++ b/dvha/models/roi_map.py @@ -219,6 +219,8 @@ def __init__(self, roi_map): self.physicians_to_delete = [] + pub.subscribe(self.update_uncategorized_ignored_choices, "update_uncategorized_ignored_choices") + self.run() def __set_properties(self): @@ -1406,6 +1408,7 @@ def run(self): wx.CallAfter(pub.sendMessage, "roi_map_close") def update_variation(self, variation, physician, cnx): + variation = clean_name(variation) new_physician_roi = self.roi_map.get_physician_roi( physician, variation @@ -1528,6 +1531,7 @@ def __do_subscribe(self): def close(self): self.roi_map.write_to_file() self.roi_map.import_from_file() + pub.sendMessage("update_uncategorized_ignored_choices") self.Destroy() def update_gauge_1_info(self, msg): diff --git a/dvha/tools/roi_name_manager.py b/dvha/tools/roi_name_manager.py index a845262..7c03e80 100644 --- a/dvha/tools/roi_name_manager.py +++ b/dvha/tools/roi_name_manager.py @@ -1438,8 +1438,13 @@ def variations_to_update(self): for physician, physician_roi_data in changes.items(): variations = [] for p_roi_data in physician_roi_data.values(): - for delta_data in p_roi_data.values(): - variations.extend(delta_data["variations"]) + add_vars, del_vars = set(), set() + if '-' in p_roi_data: + del_vars = set(csv_to_list(p_roi_data['-']['variations'][0])) + if '+' in p_roi_data: + add_vars = set(csv_to_list(p_roi_data['+']['variations'][0])) + edited_vars = del_vars.symmetric_difference(add_vars) + variations.extend(edited_vars) variations_to_update[physician] = list(set(variations)) for physician in list(variations_to_update): @@ -1461,10 +1466,7 @@ def remap_rois(self): physician, new_physician_roi ) - condition = ( - "REPLACE(REPLACE(LOWER(roi_name), ''', '`'), '_', ' ') == '%s'" - % variation - ) + condition = f"roi_name = '{variation}'" sql_query = ( "SELECT DISTINCT study_instance_uid, roi_name FROM DVHs WHERE %s;" % condition diff --git a/dvha/tools/utilities.py b/dvha/tools/utilities.py index ca94725..9209f64 100644 --- a/dvha/tools/utilities.py +++ b/dvha/tools/utilities.py @@ -1614,16 +1614,3 @@ def get_windows_webview_backend(include_edge=False): for id, name in backends: if webview.WebView.IsBackendAvailable(id): return {"id": id, "name": name} - - -def is_edge_backend_available(): - """Check if WebViewBackendEdge is available - - Returns - ------- - bool - True if wx.html2.WebViewBackendEdge is available - """ - if is_windows(): - return webview.WebView.IsBackendAvailable(webview.WebViewBackendEdge) - return False