Skip to content
Snippets Groups Projects

Load schedule without asking if there is a single schedule in the file

Merged Oscar Gustafsson requested to merge singleloadschedulergui into master
1 file
+ 22
18
Compare changes
  • Side-by-side
  • Inline
@@ -255,35 +255,39 @@ class MainWindow(QMainWindow, Ui_MainWindow):
@@ -255,35 +255,39 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self,
self,
self.tr("File not found"),
self.tr("File not found"),
self.tr(
self.tr(
"Could not find any Schedule object in file '{}'."
"Cannot find any Schedule object in file '{}'."
).format(os.path.basename(abs_path_filename)),
).format(os.path.basename(abs_path_filename)),
)
)
log.info(
log.info(
"Could not find any Schedule object in file '{}'.".format(
"Cannot find any Schedule object in file '{}'.".format(
os.path.basename(abs_path_filename)
os.path.basename(abs_path_filename)
)
)
)
)
del module
del module
return
return
ret_tuple = QInputDialog.getItem(
if len(schedule_obj_list) == 1:
self,
schedule = [val for val in schedule_obj_list.values()][0]
self.tr("Load object"),
else:
self.tr(
ret_tuple = QInputDialog.getItem(
"Found the following Schedule object(s) in file.\n\n"
self,
"Select an object to proceed:"
self.tr("Load object"),
),
self.tr(
schedule_obj_list.keys(),
"Found the following Schedule objects in file.\n\n"
0,
"Select an object to proceed:"
False,
),
)
schedule_obj_list.keys(),
 
0,
 
False,
 
)
if not ret_tuple[1]: # User canceled the operation
if not ret_tuple[1]: # User canceled the operation
log.debug("Load schedule operation: user canceled")
log.debug("Load schedule operation: user canceled")
del module
del module
return
return
 
schedule = schedule_obj_list[ret_tuple[0]]
self.open(schedule_obj_list[ret_tuple[0]])
self.open(schedule)
del module
del module
settings.setValue("mainwindow/last_opened_file", abs_path_filename)
settings.setValue("mainwindow/last_opened_file", abs_path_filename)
Loading