Upload files to "PTPLogger"
This commit is contained in:
@@ -84,7 +84,7 @@ ANOMALY_THRESHOLD_FREQ = 1_000_000_000 # ppb
|
||||
|
||||
# --- Version check ---
|
||||
# Bump this on every build, and keep PTPLogger/VERSION in the repo matching it.
|
||||
__version__ = "1.1.3"
|
||||
__version__ = "1.1.4"
|
||||
|
||||
VERSION_URL = "https://gitea.apointless.space/bsncubed/RiedelScripts/raw/branch/main/PTPLogger/VERSION"
|
||||
DOWNLOAD_PAGE_URL = "https://gitea.apointless.space/bsncubed/RiedelScripts/src/branch/main/PTPLogger"
|
||||
@@ -523,6 +523,24 @@ def plot_data(t, rms, freq, delay, max_offset, state_events, master_events, link
|
||||
ha='center', fontsize=7, color='gray'
|
||||
)
|
||||
|
||||
# Capture the y-limits as they stand right now (either the shared
|
||||
# cross-interface scale set above, or matplotlib's own auto-fit) so the
|
||||
# "Reset Scale" button can restore exactly this later, independent of
|
||||
# whatever the time-axis zoom/pan ends up being.
|
||||
fig.canvas.draw()
|
||||
original_ylims = {ax: ax.get_ylim() for ax in all_axes}
|
||||
|
||||
def show_absolute_scale():
|
||||
for ax in all_axes:
|
||||
ymin, ymax = original_ylims[ax]
|
||||
ax.set_ylim(*_padded_range(min(ymin, 0), max(ymax, 0)))
|
||||
fig.canvas.draw_idle()
|
||||
|
||||
def reset_scale():
|
||||
for ax in all_axes:
|
||||
ax.set_ylim(original_ylims[ax])
|
||||
fig.canvas.draw_idle()
|
||||
|
||||
# Add a "Copy Graph" button to this figure's own window (TkAgg backend)
|
||||
try:
|
||||
host_window = fig.canvas.manager.window
|
||||
@@ -537,6 +555,9 @@ def plot_data(t, rms, freq, delay, max_offset, state_events, master_events, link
|
||||
copy_btn = tk.Button(btn_bar, text="Copy Graph",
|
||||
command=lambda f=fig: copy_figure_to_clipboard(f))
|
||||
copy_btn.pack(side=tk.LEFT, padx=5, pady=2)
|
||||
|
||||
tk.Button(btn_bar, text="Show Absolute Scale", command=show_absolute_scale).pack(side=tk.LEFT, padx=5, pady=2)
|
||||
tk.Button(btn_bar, text="Reset Scale", command=reset_scale).pack(side=tk.LEFT, padx=5, pady=2)
|
||||
except Exception:
|
||||
pass # non-Tk backend or headless — skip silently
|
||||
|
||||
@@ -846,9 +867,24 @@ def check_for_updates():
|
||||
pass
|
||||
|
||||
|
||||
def show_about():
|
||||
about_win = tk.Toplevel(root)
|
||||
about_win.title("About")
|
||||
about_win.resizable(False, False)
|
||||
|
||||
tk.Label(about_win, text="PTP Log Grapher", font=("", 12, "bold")).pack(padx=30, pady=(15, 2))
|
||||
tk.Label(about_win, text=f"Version {__version__}", fg="gray").pack(pady=(0, 10))
|
||||
|
||||
link = tk.Label(about_win, text="View project on Gitea", fg="#3b6ea5", cursor="hand2")
|
||||
link.pack(pady=(0, 10))
|
||||
link.bind("<Button-1>", lambda e: webbrowser.open(DOWNLOAD_PAGE_URL))
|
||||
|
||||
tk.Label(about_win, text="Created by Ben Nicholson", fg="gray").pack(padx=30, pady=(0, 15))
|
||||
|
||||
|
||||
# GUI
|
||||
root = tk.Tk()
|
||||
root.title("PTP Log Viewer")
|
||||
root.title("PTP Log Grapher")
|
||||
root.geometry("900x650")
|
||||
root.protocol("WM_DELETE_WINDOW", on_main_window_close)
|
||||
|
||||
@@ -858,6 +894,8 @@ frame.pack(pady=5)
|
||||
open_button = tk.Button(frame, text="Open Log", command=open_file)
|
||||
open_button.pack(side=tk.LEFT, padx=10)
|
||||
|
||||
tk.Button(frame, text="About", command=show_about).pack(side=tk.LEFT, padx=(0, 10))
|
||||
|
||||
detail_var = tk.StringVar(value="Auto")
|
||||
|
||||
tk.OptionMenu(
|
||||
|
||||
Reference in New Issue
Block a user