[new] disable event selection of folder is empty

This commit is contained in:
Marcel Paffrath 2018-04-25 13:48:06 +02:00
parent 073a71e150
commit d6150c5d1a

View File

@ -1302,7 +1302,7 @@ class MainWindow(QMainWindow):
item_mag, item_nmp, item_nap, item_ref, item_test, item_notes]
for item in itemlist:
item.setTextAlignment(Qt.AlignCenter)
if event_test and select_events == 'ref':
if event_test and select_events == 'ref' or self.isEmpty(event_path):
for item in itemlist:
item.setEnabled(False)
model.appendRow(itemlist)
@ -1316,6 +1316,16 @@ class MainWindow(QMainWindow):
eventBox.setCurrentIndex(index)
self.refreshRefTestButtons()
def isEmpty(self, event_path):
wf_stat = {True: 'processed',
False: 'raw',
None: None}
wf_dir = wf_stat[self.data.processed]
if wf_dir is not None:
event_path = os.path.join(event_path, wf_dir)
return not bool(os.listdir(event_path))
def filename_from_action(self, action):
if action.data() is None:
filt = "Supported file formats" \