Skip to content

Commit 9b63f0c

Browse files
committed
[app] Add button to open log folder
1 parent 291691e commit 9b63f0c

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

dvr_scan/app/application.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
ConfigLoadFailure,
3535
ConfigRegistry,
3636
)
37+
from dvr_scan.platform import open_path
3738
from dvr_scan.scanner import OutputMode, Point
38-
from dvr_scan.shared import ScanSettings
39+
from dvr_scan.shared import ScanSettings, logfile_path
3940
from dvr_scan.subtractor import SubtractorCudaMOG2
4041
from dvr_scan.video_joiner import BackendUnavailable
4142

@@ -1366,13 +1367,18 @@ def _create_menubar(self):
13661367
underline=0,
13671368
)
13681369
help_menu.add_command(
1369-
label="Join Discord Chat",
1370+
label="Open Discord",
13701371
command=lambda: webbrowser.open_new_tab("https://discord.gg/69kf6f2Exb"),
13711372
underline=5,
13721373
)
1374+
help_menu.add_separator()
1375+
help_menu.add_command(
1376+
label="Open Logs",
1377+
command=lambda: open_path(logfile_path("dvr-scan.log").parent),
1378+
underline=5,
1379+
)
13731380
# TODO: Add window to show log messages and copy them to clipboard or save to a logfile.
13741381
# help_menu.add_command(label="Debug Log", underline=0, state=tk.DISABLED)
1375-
help_menu.add_separator()
13761382

13771383
help_menu.add_command(
13781384
label="About DVR-Scan",

dvr_scan/platform.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,16 @@
6161
)
6262

6363

64+
def open_path(path: str):
65+
"""Open a path in the default file explorer."""
66+
if platform.system() == "Windows":
67+
os.startfile(path)
68+
elif platform.system() == "Darwin":
69+
subprocess.run(["open", path], check=True)
70+
else:
71+
subprocess.run(["xdg-open", path], check=True)
72+
73+
6474
def get_min_screen_bounds():
6575
"""Attempts to get the minimum screen resolution of all monitors using the `screeninfo` package.
6676
Returns the minimum of all monitor's heights and widths with 10% padding, or None if the package

0 commit comments

Comments
 (0)