forked from zietzm/Helmholtz_Test_Bench
User test feedback
- added cancel option for "clear log data" pop-up - removed "!" for Execute! button - separated start and stop logging buttons
This commit is contained in:
+27
-17
@@ -204,7 +204,7 @@ class ManualMode(Frame):
|
||||
Label(self.buttons_frame, text="").grid(row=0, column=0) # add spacer
|
||||
|
||||
# add button for executing the current entries
|
||||
execute_button = Button(self.buttons_frame, text="Execute!", command=self.execute,
|
||||
execute_button = Button(self.buttons_frame, text="Execute", command=self.execute,
|
||||
pady=5, padx=5, font=BIG_BUTTON_FONT)
|
||||
execute_button.grid(row=row_counter, column=0, padx=5)
|
||||
|
||||
@@ -805,22 +805,22 @@ class ConfigureLogging(Frame):
|
||||
self.top_buttons_frame.grid_columnconfigure(ALL, weight=1)
|
||||
self.top_buttons_frame.grid(row=row_counter, column=0, sticky=W, padx=20, pady=5)
|
||||
|
||||
# button to stop data logging
|
||||
self.stop_logging_button = Button(self.top_buttons_frame, text="Stop Logging", command=self.stop_logging,
|
||||
pady=5, padx=5, font=SMALL_BUTTON_FONT)
|
||||
self.stop_logging_button.grid(row=0, column=0, padx=5)
|
||||
# button to start data logging
|
||||
self.start_logging_button = Button(self.top_buttons_frame, text="Start Logging", command=self.start_logging,
|
||||
pady=5, padx=5, font=SMALL_BUTTON_FONT)
|
||||
self.start_logging_button.grid(row=0, column=0, padx=5) # same place as stop logging button, replace each other
|
||||
self.start_logging_button.grid(row=0, column=0, padx=5)
|
||||
# button to stop data logging
|
||||
self.stop_logging_button = Button(self.top_buttons_frame, text="Stop Logging", command=self.stop_logging,
|
||||
pady=5, padx=5, font=SMALL_BUTTON_FONT, state="disabled")
|
||||
self.stop_logging_button.grid(row=0, column=1, padx=5)
|
||||
# button to write log data to a file
|
||||
self.write_to_file_button = Button(self.top_buttons_frame, text="Write data to file", font=SMALL_BUTTON_FONT,
|
||||
command=self.write_to_file, pady=5, padx=5, state="disabled")
|
||||
self.write_to_file_button.grid(row=0, column=1, padx=5)
|
||||
self.write_to_file_button.grid(row=0, column=2, padx=5)
|
||||
# button to clear all logged data
|
||||
self.clear_data_button = Button(self.top_buttons_frame, text="Clear logged data", font=SMALL_BUTTON_FONT,
|
||||
command=self.clear_data, pady=5, padx=5, state="disabled")
|
||||
self.clear_data_button.grid(row=0, column=2, padx=5)
|
||||
self.clear_data_button.grid(row=0, column=3, padx=5)
|
||||
|
||||
row_counter += 1
|
||||
|
||||
@@ -896,10 +896,15 @@ class ConfigureLogging(Frame):
|
||||
self.checkboxes.append(checkbox) # add created checkbox to list of all checkboxes
|
||||
row += 1
|
||||
|
||||
# self.controller.bind('<Escape>', self.escape_press) ToDo: implement escape button press event
|
||||
|
||||
def page_switch(self): # function that is called when switching to this window
|
||||
# every class in the UI needs this, even if it doesn't do anything
|
||||
pass
|
||||
|
||||
# def escape_press(self, event): ToDo: implement escape button press event
|
||||
# stop_logging()
|
||||
|
||||
def start_logging(self): # start logging data (called by button)
|
||||
ui_print("Started data logging.")
|
||||
self.update_choices() # update list with ticked checkboxes
|
||||
@@ -926,18 +931,20 @@ class ConfigureLogging(Frame):
|
||||
|
||||
if (self.regular_logging or self.event_logging) and not error: # logging is active and no error during setup
|
||||
# lock/unlock buttons and checkboxes:
|
||||
self.stop_logging_button["state"] = "normal"
|
||||
self.start_logging_button["state"] = "disabled"
|
||||
self.write_to_file_button["state"] = "disabled"
|
||||
self.clear_data_button["state"] = "normal"
|
||||
self.lock_checkboxes()
|
||||
self.stop_logging_button.tkraise() # switch button to "stop"
|
||||
|
||||
def stop_logging(self): # stop the data logging, called by "Stop Logging" button
|
||||
ui_print("Stopped data logging. Remember to save data to file!")
|
||||
self.regular_logging = False # tell everything its time to stop periodic logging
|
||||
self.event_logging = False # tell everything its time to stop logging on test stand commands
|
||||
self.write_to_file_button["state"] = "normal" # enable write to file button
|
||||
self.stop_logging_button["state"] = "disabled" # disable stop logging button
|
||||
self.start_logging_button["state"] = "normal" # enable start logging button
|
||||
self.unlock_checkboxes() # enable checkboxes
|
||||
self.start_logging_button.tkraise() # switch start/stop button to "start"
|
||||
|
||||
def write_to_file(self): # lets user select a file and writes logged data to it
|
||||
filepath = log.select_file() # select a file to write to
|
||||
@@ -952,14 +959,17 @@ class ConfigureLogging(Frame):
|
||||
def clear_data(self): # called on button press, asks user if he want to save logged data and then deletes it
|
||||
if log.unsaved_data: # there is logged data that has not been written to a file yet
|
||||
# open pop-up to ask user if he wants to save the data:
|
||||
save_log = messagebox.askquestion("Save log data?", "There seems to be unsaved logging data. "
|
||||
"Do you wish to write it to a file before deleting?")
|
||||
if save_log == 'yes': # user has chosen yes
|
||||
save_log = messagebox.askyesnocancel("Save log data?", "There seems to be unsaved logging data. "
|
||||
"Do you wish to write it to a file before deleting?")
|
||||
if save_log: # user has chosen yes
|
||||
self.write_to_file() # run write to file function to save data
|
||||
log.clear_logged_data() # delete the logged data
|
||||
log.unsaved_data = False # tell everything that there is no unsaved data remaining
|
||||
self.logged_datapoints.set(len(log.log_data)) # update the label showing how much data has been logged
|
||||
ui_print("Log data cleared.")
|
||||
if save_log is not None:
|
||||
log.clear_logged_data() # delete the logged data
|
||||
log.unsaved_data = False # tell everything that there is no unsaved data remaining
|
||||
self.logged_datapoints.set(len(log.log_data)) # update the label showing how much data has been logged
|
||||
ui_print("Log data cleared.")
|
||||
else:
|
||||
ui_print("Log data not cleared.")
|
||||
|
||||
def update_choices(self): # updates the list storing which checkboxes are currently ticked
|
||||
# (this is passed to logging functions and determines which data is logged)
|
||||
|
||||
Reference in New Issue
Block a user