Skip to content

Commit d7e7274

Browse files
Fixed help buttons
1 parent 3ff4875 commit d7e7274

File tree

3 files changed

+23
-44
lines changed

3 files changed

+23
-44
lines changed

spectrometer/CCDpanelsetup.py

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import numpy as np
3030
import serial
3131
import math
32+
import webbrowser
3233

3334
from spectrometer import config, CCDhelp, CCDserial, CCDfiles
3435
from spectrometer.calibration import default_calibration
@@ -207,11 +208,6 @@ def devicefields(self, device_row):
207208
)
208209
self.firmware_dropdown.grid(column=1, row=device_row + 2, padx=5, sticky="w")
209210
self.firmware_type.trace_add("write", self.update_firmware)
210-
# help button
211-
self.bhdev = ttk.Button(
212-
self, text="?", command=lambda helpfor=0: CCDhelp.helpme(helpfor)
213-
)
214-
self.bhdev.grid(row=device_row, column=3, padx=5)
215211

216212
def update_firmware(self, *args):
217213
if self.firmware_type.get() == "STM32F103":
@@ -270,12 +266,6 @@ def CCDparamfields(self, shicg_row):
270266
self.ltint = tk.Label(self, textvariable=self.tint_statuscolor)
271267
self.ltint.grid(column=1, row=shicg_row + 4, pady=5, sticky="w")
272268

273-
# Help button
274-
self.bhccd = ttk.Button(
275-
self, text="?", command=lambda helpfor=1: CCDhelp.helpme(helpfor)
276-
)
277-
self.bhccd.grid(row=shicg_row, column=3)
278-
279269
# Set initial values
280270
self.SH.set(str(config.SHperiod))
281271
self.ICG.set(str(config.ICGperiod))
@@ -633,11 +623,6 @@ def collectmodefields(self, continuous_row):
633623
command=lambda CONTvar=self.CONTvar: self.modeset(CONTvar),
634624
)
635625
self.rcontinuous.grid(column=1, row=continuous_row + 1, sticky="w", padx=5)
636-
# help button
637-
self.bhcon = ttk.Button(
638-
self, text="?", command=lambda helpfor=2: CCDhelp.helpme(helpfor)
639-
)
640-
self.bhcon.grid(row=continuous_row, column=3)
641626
# set initial state
642627
self.CONTvar.set(config.AVGn[0])
643628

@@ -659,11 +644,6 @@ def avgfields(self, avg_row):
659644
self.AVGlabel.grid(column=2, row=avg_row, padx=5, pady=5, sticky="w")
660645
self.AVGscale.set(config.AVGn[1])
661646
self.AVGlabel.config(text=str(config.AVGn[1]))
662-
# help button
663-
self.bhavg = ttk.Button(
664-
self, text="?", command=lambda helpfor=3: CCDhelp.helpme(helpfor)
665-
)
666-
self.bhavg.grid(row=avg_row, column=3)
667647

668648
def collectfields(self, collect_row, SerQueue, progress_var):
669649
# collect and stop buttons
@@ -687,11 +667,6 @@ def collectfields(self, collect_row, SerQueue, progress_var):
687667
state=tk.DISABLED,
688668
)
689669
self.bstop.pack(side=tk.RIGHT, padx=5, pady=5, anchor="e")
690-
# help button
691-
self.bhcol = ttk.Button(
692-
self, text="?", command=lambda helpfor=4: CCDhelp.helpme(helpfor)
693-
)
694-
self.bhcol.grid(row=collect_row, column=3)
695670
# progressbar
696671
self.progress = ttk.Progressbar(
697672
self, variable=progress_var, maximum=10, length=200
@@ -749,8 +724,6 @@ def plotmodefields(self, plotmode_row, CCDplot):
749724
)
750725
# moved down one row because mirror checkbox was inserted
751726
self.cshowcolors.grid(column=1, row=plotmode_row + 3, sticky="w", padx=5)
752-
753-
# setup traces to update the plot
754727
self.invert.trace_add(
755728
"write",
756729
lambda name, index, mode, invert=self.invert, CCDplot=CCDplot: self.RAWcallback(
@@ -777,12 +750,6 @@ def plotmodefields(self, plotmode_row, CCDplot):
777750
self.mirror.set(config.datamirror)
778751
self.show_colors.set(0)
779752

780-
# help button
781-
self.bhplo = ttk.Button(
782-
self, text="?", command=lambda helpfor=6: CCDhelp.helpme(helpfor)
783-
)
784-
self.bhplo.grid(row=plotmode_row, column=3)
785-
786753
def saveopenfields(self, save_row, CCDplot):
787754
# setup save/open buttons
788755
self.fileframe = ttk.Frame(self)
@@ -818,12 +785,6 @@ def saveopenfields(self, save_row, CCDplot):
818785
side=tk.LEFT, padx=(5, 0), pady=5
819786
) # Add some padding to separate from save button
820787

821-
# help button
822-
self.bhsav = ttk.Button(
823-
self, text="?", command=lambda helpfor=5: CCDhelp.helpme(helpfor)
824-
)
825-
self.bhsav.grid(row=save_row, column=3)
826-
827788
# Add a little vertical spacing before the placeholder controls
828789
self.grid_rowconfigure(save_row + 1, minsize=12)
829790

@@ -981,9 +942,27 @@ def callback(self):
981942
return ()
982943

983944
def aboutbutton(self, about_row):
945+
# Create a frame to hold both buttons
946+
button_frame = ttk.Frame(self)
947+
button_frame.grid(row=about_row, columnspan=3, sticky="EW", padx=5)
948+
984949
self.babout = ttk.Button(
985-
self,
950+
button_frame,
986951
text="About",
987952
command=lambda helpfor=10: CCDhelp.helpme(helpfor),
988953
)
989-
self.babout.grid(row=about_row, columnspan=3, sticky="EW", padx=5)
954+
self.babout.pack(side=tk.LEFT, expand=True, fill=tk.X, padx=(0, 2))
955+
956+
self.bhelp = ttk.Button(
957+
button_frame,
958+
text="Help",
959+
command=self.open_help_url,
960+
)
961+
self.bhelp.pack(side=tk.RIGHT, expand=True, fill=tk.X, padx=(2, 0))
962+
963+
def open_help_url(self):
964+
"""Open the help URL in the default browser"""
965+
try:
966+
webbrowser.open("https://www.astrolens.net/pyspec-help")
967+
except Exception as e:
968+
print(f"Failed to open browser: {e}")

spectrometer/pyCCDGUI.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def resource_path(relative_path: str) -> str:
2626

2727

2828
icon = Image.open(resource_path("assets/icon.png"))
29-
icon = icon.resize((32, 32))
29+
icon = icon.resize((1024, 1024))
3030
icon_tk = ImageTk.PhotoImage(icon)
3131
root.iconphoto(True, cast(tk.PhotoImage, icon_tk))
3232
root.state("zoomed")

spectrometer/spectrum_gradient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def add_spectrum_gradient(ax, x_min, x_max, y_min, y_max):
7474
extent=(x_min, x_max, y_min, y_max),
7575
origin="lower",
7676
aspect="auto",
77-
regression="bilinear",
77+
interpolation="bilinear",
7878
alpha=0.6,
7979
zorder=-1,
8080
)

0 commit comments

Comments
 (0)