From 57f3e945ab13b50e3faaaf97f7a0c35bdb1fe59c Mon Sep 17 00:00:00 2001
From: Corby Schmitz <cschmitz@anl.gov>
Date: Thu, 5 Dec 2024 16:28:50 -0600
Subject: [PATCH] Updating documentation in python style.

---
 client-code/gui-orchestrator.py | 43 +++++++++++++++++++++++++++------
 1 file changed, 36 insertions(+), 7 deletions(-)

diff --git a/client-code/gui-orchestrator.py b/client-code/gui-orchestrator.py
index 7b08d15..2440101 100644
--- a/client-code/gui-orchestrator.py
+++ b/client-code/gui-orchestrator.py
@@ -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
-- 
GitLab