Skip to content

Commit 6a883c7

Browse files
authored
Merge pull request #649 from czbiohub-sf/disable-site-selection-if-default-set
If default site set, disable site selection in form
2 parents e6a2abc + 25ac017 commit 6a883c7

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

ulc_mm_package/QtGUI/form_gui.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from PyQt5.QtWidgets import QDateEdit, QTimeEdit
2626
from ulc_mm_package.QtGUI.gui_constants import (
2727
ICON_PATH,
28+
SITE_ENV_VAR,
2829
SITE_LIST,
2930
SAMPLE_LIST,
3031
TOOLBAR_OFFSET,
@@ -130,6 +131,9 @@ def _load_ui(self):
130131
self.site_val.addItems(SITE_LIST)
131132
self.sample_val.addItems(SAMPLE_LIST)
132133

134+
if SITE_ENV_VAR is not None:
135+
self.site_val.setEnabled(False)
136+
133137
# Set tab behavior
134138
self.notes_val.setTabChangesFocus(True)
135139

ulc_mm_package/QtGUI/gui_constants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ class QR(enum.Enum):
6868
]
6969

7070
# Reorder the site list to move the environment variable specified default site to the first location
71-
site_env_var = os.getenv("DEFAULT_SITE")
71+
SITE_ENV_VAR = os.getenv("DEFAULT_SITE")
7272

73-
if site_env_var in SITE_LIST:
74-
SITE_LIST.insert(0, SITE_LIST.pop(SITE_LIST.index(site_env_var)))
73+
if SITE_ENV_VAR in SITE_LIST:
74+
SITE_LIST.insert(0, SITE_LIST.pop(SITE_LIST.index(SITE_ENV_VAR)))
7575

7676

7777
CLINICAL_SAMPLE = "Whole blood (clinical, P. falciparum endemic)"

0 commit comments

Comments
 (0)