diff --git a/PTPLogger/PTPLogger_Graphing.py b/PTPLogger/PTPLogger_Graphing.py index b3f0694..718773b 100644 --- a/PTPLogger/PTPLogger_Graphing.py +++ b/PTPLogger/PTPLogger_Graphing.py @@ -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("", 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( diff --git a/PTPLogger/version_info.txt b/PTPLogger/version_info.txt index bd0c0e2..bfdf47e 100644 --- a/PTPLogger/version_info.txt +++ b/PTPLogger/version_info.txt @@ -6,8 +6,8 @@ VSVersionInfo( ffi=FixedFileInfo( # filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4) # Set not needed items to zero 0. - filevers=(1, 1, 3, 0), - prodvers=(1, 1, 3, 0), + filevers=(1, 1, 4, 0), + prodvers=(1, 1, 4, 0), # Contains a bitmask that specifies the valid bits 'flags' mask=0x3f, # Contains a bitmask that specifies the Boolean attributes of the file. @@ -31,12 +31,12 @@ VSVersionInfo( u'040904B0', [StringStruct(u'CompanyName', u'A Pointless Space'), StringStruct(u'FileDescription', u'PTP Log Grapher'), - StringStruct(u'FileVersion', u'1.1.3'), + StringStruct(u'FileVersion', u'1.1.4'), StringStruct(u'InternalName', u'PTPLogGrapher'), StringStruct(u'LegalCopyright', u''), StringStruct(u'OriginalFilename', u'PTPLogGrapher.exe'), StringStruct(u'ProductName', u'PTP Log Grapher'), - StringStruct(u'ProductVersion', u'1.1.3')]) + StringStruct(u'ProductVersion', u'1.1.4')]) ]), VarFileInfo([VarStruct(u'Translation', [1033, 1200])]) ]