Skip to content
Snippets Groups Projects
Commit 57f3e945 authored by Corby Schmitz's avatar Corby Schmitz
Browse files

Updating documentation in python style.

parent 4c4345cd
No related branches found
No related tags found
No related merge requests found
......@@ -8,8 +8,14 @@ import glob
# Used for iterative operations ... can be ammended if needed
valves = ["Valve01", "Valve02", "Valve03", "Valve04"]
# Event handler for selecting a valve from the drop-down list on the Change Valves dialogue
#
def on_select(event):
""" Event handler for selecting a valve from the drop-down
list on the Change Valves dialogue
:returns:
void
"""
selected_item = updateComboBox.get()
labelUpdate.config(text="Selected Item: " + selected_item)
updateOpenTime.set(currentStatus[updateComboBox.current()][1])
......@@ -78,8 +84,12 @@ except serial.SerialException:
print(port)
sys.exit(1)
# Function to process a clean exit from the GUI, destroying both windows (even if hidden)
def leave():
""" Cleans up and exits the program, destroying both windows (even if hidden)
:returns:
void
"""
try:
s.close() # Close the serial port (if possible)
except serial.SerialException:
......@@ -94,17 +104,31 @@ window.protocol('WM_DELETE_WINDOW', leave) # Handler for clicking the x
label = tk.Label(window, text="Valve Orchestrator") # Label showing the window title
label.pack() # Place label at top middle of the window
# Reveals the sub-dialogue for setting valve specifications
def show():
""" Reveals the sub-dialogue for setting directives
:returns:
void
"""
updateWindow.deiconify()
# Hides the sub-dialogue for setting valve specifications
def hide():
""" Hides the sub-dialogue for setting directives
:returns:
void
"""
updateWindow.withdraw()
# When the update button is clicked, this function runs to set the new valve directives
# At the end, it hides the dialog and returns focus to the main window
def change():
""" Event handler for Commit Changes button.
When the update button is clicked, this function runs to set
the new valve directive. At the end, it hides the dialogue
and returns focus to the main window.
:returns:
void
"""
writable = (str(updateComboBox.current()+1) + "," + str(updateOpenTime.get()) + "," + str(updateCloseTime.get()) + "\r").encode(encoding="ascii", errors="strict")
s.write(writable)
updateWindow.withdraw()
......@@ -221,8 +245,13 @@ exitButton.place(x=585, y=280)
# Variable to hold the status data, multidimentional array
currentStatus = [[],[],[],[]]
# Core function to run the overall program
def custom_mainloop():
""" Main loop for processing updated metrics and orchestrating
control of the valve system
:returns:
void
"""
global currentStatus # Use global status data
inputData = s.readline().decode("utf-8") # Read information from the serial port connected to valve control
# Example data from the controller
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment