Skip to content

Commit

Permalink
Added button to skip status messages
Browse files Browse the repository at this point in the history
  • Loading branch information
TCallaghan2 committed Aug 6, 2024
1 parent de89b7a commit 247d738
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
23 changes: 18 additions & 5 deletions PythonScripts/GUI/GeoSAM/GeoSams.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,20 @@ def __init__(self, title, maxAreas, maxCorners, maxYears):
self.notebook.add(self.frame2, text='Math Setup')
self.notebook.pack()

self.isSkip = False
self.skipStatusMsgs = tk.BooleanVar(self, False)
ttk.Button(self, text='SHOW Args', style="BtnGreen.TLabel", command=self.ShowArgs).place(relx=0, rely=1, anchor='sw')
self.skipStatusMsgsRB = ttk.Radiobutton(self, text='Skip Status Msgs', value=True, variable=self.skipStatusMsgs, command=self.ToggleSkipStatusMsgs).place(relx=0.35, rely=1, anchor='s')
ttk.Button(self, text='START Sim', style="BtnGreen.TLabel", command=self.Run_Sim).place(relx=.25, rely=1, anchor='s')
ttk.Button(self, text='SAVE ALL Configs', style="BtnGreen.TLabel", command=self.SaveConfigFiles).place(relx=.5, rely=1, anchor='s')
ttk.Button(self, text= "Help", style="Help.TLabel", command = self.pop_up).place(relx=.75, rely=1, anchor='s')

##
#
def ToggleSkipStatusMsgs(self):
self.isSkip = not self.isSkip
self.skipStatusMsgs.set(self.isSkip)

##
# Display setup limits here
# Messagebox blocks entry widgets if attempted to open before the main window completes.
Expand Down Expand Up @@ -223,10 +232,10 @@ def Run_Sim(self):
else:
cmd = [os.path.join(self.root, 'Unpack.sh'), startYear, stopYear, '0', self.domainName, mathArg]
subprocess.run(['chmod','744','Unpack.sh']) # make file executable
messagebox.showinfo("Unpack", f'Starting Unpack.\nThis could take several minutes, longer if using Octave.\nPlease be patient.')
if not self.skipStatusMsgs.get(): messagebox.showinfo("Unpack", f'Starting Unpack.\nThis could take several minutes, longer if using Octave.\nPlease be patient.')
result = subprocess.run(cmd)
if result.returncode == 0:
messagebox.showinfo("Unpack", f'Completed Successfully\n{result.args}')
if not self.skipStatusMsgs.get(): messagebox.showinfo("Unpack", f'Completed Successfully\n{result.args}')
filesExist = True
else:
if result.returncode == 1:
Expand All @@ -249,11 +258,11 @@ def Run_Sim(self):
# ScallopPopDensity prepends directory structure to simConfigFile
cmd = [ex, simConfigFile, startYear, stopYear, self.domainName]
print(cmd)
messagebox.showinfo("GeoSAMS Sim", f"Program Started: {cmd}")
if not self.skipStatusMsgs.get(): messagebox.showinfo("GeoSAMS Sim", f"Program Started: {cmd}")
result = subprocess.run(cmd)

if result.returncode == 0:
messagebox.showinfo("GeoSAM Sim",
if not self.skipStatusMsgs.get(): messagebox.showinfo("GeoSAM Sim",
f'Completed Successfully\n{result.args}\nStarting UK Interp\nIf all output selected this will run over an hour.\nPlease be patient.')

# Then Continue with Interpolation and Plotting Results -----------------------------------------------------------
Expand Down Expand Up @@ -482,7 +491,7 @@ def SaveConfigFiles(self):
self.WriteUKConfig()
# cfgFile = os.path.join(self.root,configDir, interCfgDir, self.frame4.spatCfgFile.myEntry.get())
# self.WriteSpatialFncsConfig(cfgFile)
messagebox.showinfo("Save Files", "Configuration Files Saved")
if not self.skipStatusMsgs.get(): messagebox.showinfo("Save Files", "Configuration Files Saved")

##
# Saves simulation configuration file. It does so by writeing the parameters for the
Expand Down Expand Up @@ -802,6 +811,10 @@ def pop_up(self):
2) This does not save the Special Access File or the Fishing Mort File.
See Special Acces Tab and the FishingMort in Special Access Tab
Skip Status Msgs
Select to have scripts run straight through without reporting status.
Except for last ALL DONE message.
SAVE ALL Configs
Same as the first step in START Sim
'''
Expand Down
3 changes: 3 additions & 0 deletions PythonScripts/GUI/GeoSAM/MainInputFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,9 @@ def pop_up(self):
argument or two. These survey data files are stored in the "OriginalData"
subdirectory as zip files. They are too large to be managed in the git
repositiory as a CSV file. The scripts then unzip the files as necessary.
Extensions are not specified.
Use NONE to skip that survey data
'''
popup = tk.Toplevel()
nrows = 35
Expand Down

0 comments on commit 247d738

Please sign in to comment.