Skip to content

Commit e9a132f

Browse files
authored
"user_variable_dialogs" folder is now in the "config" directory (#36)
* fixed bug where leftover "add" button widgets were hiding beneath table when a new row was added, a new "add" button was created, while the old add button still active but hidden underneath the table. If the table columns were made skinnier, the extra "add" buttons were revealed, and were active/connected to the add row function. This commit fixes this bug, so only a single "add" button exists. * handle changed or missing variable error After creating a custom variable dialog the user could potentially change the name of or delete a variable in the task file. The next time the task is uploaded the custom variable dialog.json file will potentially try to create a control widget for a variable that no longer exists. Previously, this situation would throw an error in the terminal and then disconnect the board. Now the task will still load, omitting the unfound variable, and an error message for each missing control variable will appear in the log. Leftover (or newly named variables) will go into the "..." tab as usual. * "user_variable_dialogs" folder is now in the "config" directory
1 parent c749160 commit e9a132f

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

File renamed without changes.
File renamed without changes.

gui/custom_variables_dialog.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def __init__(self, parent, gui_name, is_experiment=False):
313313
self.gui_name = gui_name
314314
self.generator_data = self.get_custom_gui_data(is_experiment)
315315
if self.generator_data:
316-
self.parent.print_to_log(f"\nLoading \"{gui_name}\" custom variable dialog")
316+
self.parent.print_to_log(f'\nLoading "{gui_name}" custom variable dialog')
317317
self.setWindowTitle("Set Variables")
318318
self.layout = QtGui.QVBoxLayout(self)
319319
toolBar = QtGui.QToolBar()
@@ -339,7 +339,7 @@ def __init__(self, parent, gui_name, is_experiment=False):
339339
def get_custom_gui_data(self, is_experiment):
340340
custom_variables_dict = None
341341
try: # Try to import and instantiate the user custom variable dialog
342-
json_file = os.path.join(dirs["gui"], "user_variable_dialogs", f"{self.gui_name}.json")
342+
json_file = os.path.join(dirs["config"], "user_variable_dialogs", f"{self.gui_name}.json")
343343
with open(json_file, "r") as j:
344344
custom_variables_dict = json.loads(j.read())
345345
except FileNotFoundError: # couldn't find the json data
@@ -504,10 +504,10 @@ def save_gui_data(self):
504504

505505
gui_dict["ordered_tabs"] = ordered_tabs
506506

507-
user_guis_folder = os.path.join(dirs["gui"], "user_variable_dialogs")
507+
user_guis_folder = os.path.join(dirs["config"], "user_variable_dialogs")
508508
try:
509509
os.mkdir(user_guis_folder)
510-
print(f"User GUIs folder not found, therefore creating new directory: {user_guis_folder}")
510+
print(f'"user_variable_dialogs" folder not found, therefore creating new directory: {user_guis_folder}')
511511
except FileExistsError:
512512
pass
513513
savename = os.path.join(user_guis_folder, f"{self.gui_name}.json")

0 commit comments

Comments
 (0)