Skip to content

Commit 9477008

Browse files
Added light mode and dark mode auto detection
1 parent f227344 commit 9477008

File tree

4 files changed

+130
-47
lines changed

4 files changed

+130
-47
lines changed

Extras/Wormhole_Setup.iss

Lines changed: 78 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
33
; Non-commercial use only
44
#define MyAppName "Wormhole"
5-
#define MyAppVersion "1.2.0"
5+
#define MyAppVersion "1.2.1"
66
#define MyAppPublisher "Nova Foundry"
77
#define MyAppURL "novafoundry.ca/wormhole"
88
#define MyAppExeName "wormhole.exe"
@@ -30,9 +30,11 @@ ArchitecturesAllowed=x64compatible
3030
ArchitecturesInstallIn64BitMode=x64compatible
3131
DisableProgramGroupPage=yes
3232
LicenseFile=C:\Users\jackp\Downloads\Wormhole\LICENSE.txt
33-
; Uncomment the following line to run in non administrative install mode (install for current user only).
34-
;PrivilegesRequired=lowest
33+
34+
; *** MODIFICATION: Chocolatey requires Admin rights ***
35+
PrivilegesRequired=admin
3536
PrivilegesRequiredOverridesAllowed=dialog
37+
3638
OutputDir=C:\Users\jackp\Downloads
3739
OutputBaseFilename=Wormhole_setup
3840
SetupIconFile=C:\Users\jackp\Downloads\Installer Icon template.ico
@@ -140,15 +142,12 @@ begin
140142
end;
141143
142144
// 4. Verify installation using full path (since PATH may not update yet)
143-
// Primary path for 64-bit all-users install
144145
PandocExePath := ExpandConstant('{commonpf}\Pandoc\pandoc.exe');
145146
if not FileExists(PandocExePath) then
146147
begin
147-
// Fallback: Check x86 Program Files (older or misconfigured installs)
148148
PandocExePath := ExpandConstant('{pf}\Pandoc\pandoc.exe');
149149
if not FileExists(PandocExePath) then
150150
begin
151-
// Fallback: Per-user install (if ALLUSERS failed)
152151
PandocExePath := ExpandConstant('{localappdata}\Programs\Pandoc\pandoc.exe');
153152
if not FileExists(PandocExePath) then
154153
begin
@@ -158,7 +157,6 @@ begin
158157
end;
159158
end;
160159
161-
// Run --version with full path
162160
if not Exec(PandocExePath, '--version', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) or (ResultCode <> 0) then
163161
begin
164162
Result := 'Pandoc installed but --version failed even with full path. Code: ' + IntToStr(ResultCode);
@@ -169,61 +167,112 @@ begin
169167
Result := ''; // Success
170168
end;
171169
170+
// *** NEW FUNCTION: Helper to install Chocolatey ***
171+
function InstallChocolatey(): String;
172+
var
173+
ResultCode: Integer;
174+
ChocoInstallScript: String;
175+
begin
176+
WizardForm.StatusLabel.Caption := 'Installing Chocolatey package manager...';
177+
178+
// Official Chocolatey install command
179+
ChocoInstallScript := 'Set-ExecutionPolicy Bypass -Scope Process -Force; ' +
180+
'[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; ' +
181+
'iex ((New-Object System.Net.WebClient).DownloadString(''https://community.chocolatey.org/install.ps1''))';
182+
183+
// Run PowerShell with SW_SHOW to show the terminal to the user
184+
if not Exec('powershell.exe', '-NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "' + ChocoInstallScript + '"', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
185+
begin
186+
Result := 'Failed to launch PowerShell for Chocolatey installation. Code: ' + IntToStr(ResultCode);
187+
Exit;
188+
end;
189+
190+
if ResultCode <> 0 then
191+
begin
192+
Result := 'Chocolatey installation failed. Code: ' + IntToStr(ResultCode);
193+
Exit;
194+
end;
195+
196+
Result := '';
197+
end;
198+
172199
// Function to handle FFmpeg installation
173200
function InstallFFmpeg(): String;
174201
var
175202
ResultCode: Integer;
176203
FFmpegExePath: String;
204+
ChocoExePath: String;
205+
ChocoInstallResult: String;
177206
begin
178207
InstalledFFmpeg := False;
208+
179209
// 1. Check if FFmpeg is already installed via PATH
180210
if Exec(ExpandConstant('{cmd}'), '/C ffmpeg -version', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) and (ResultCode = 0) then
181211
begin
182212
Result := ''; // Already installed, success
183213
Exit;
184214
end;
185-
// 2. If not, check if Chocolatey is installed
215+
216+
// 2. Check if Chocolatey is installed
186217
if not Exec(ExpandConstant('{cmd}'), '/C choco -v', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) or (ResultCode <> 0) then
187218
begin
188-
// Choco is not installed. Inform the user.
189-
MsgBox('FFmpeg (a required dependency) is not installed.' + #13#10 + #13#10 +
190-
'This installer can use Chocolatey (choco) to install it, but choco was not found on your system.' + #13#10 + #13#10 +
191-
'Please install FFmpeg manually, or install Chocolatey and re-run this setup.',
192-
mbInformation, MB_OK);
193-
// Optional: Abort if FFmpeg is required (uncomment if needed)
194-
// Result := 'FFmpeg installation required but Chocolatey not found.';
195-
// Exit;
196-
Result := ''; // Don't abort setup, just inform
197-
Exit;
219+
// *** MODIFICATION: Install Chocolatey if missing ***
220+
ChocoInstallResult := InstallChocolatey();
221+
222+
if ChocoInstallResult <> '' then
223+
begin
224+
// If Chocolatey failed to install, we can't proceed with FFmpeg
225+
Result := ChocoInstallResult;
226+
Exit;
227+
end;
198228
end;
199-
// 3. Choco is installed, but FFmpeg is not. Install it.
200-
// Show a marquee progress bar since choco can take a while
201-
WizardForm.StatusLabel.Caption := 'Chocolatey is found. Installing FFmpeg (this may take a few minutes)...';
229+
230+
// 3. Choco is installed (or was just installed), install FFmpeg.
231+
WizardForm.StatusLabel.Caption := 'Installing FFmpeg via Chocolatey (this may take a few minutes)...';
202232
WizardForm.ProgressGauge.Style := npbstMarquee;
233+
203234
try
204-
// Run choco install. Using SW_SHOW lets the user see choco's progress.
205-
if not Exec(ExpandConstant('{cmd}'), '/C choco install ffmpeg -y', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
235+
// Determine path to choco. If we just installed it, it might not be in PATH yet for the installer process.
236+
// Try the standard install location first.
237+
ChocoExePath := 'C:\ProgramData\chocolatey\bin\choco.exe';
238+
239+
if FileExists(ChocoExePath) then
206240
begin
207-
Result := 'Failed to launch Chocolatey to install FFmpeg. Code: ' + IntToStr(ResultCode);
208-
Exit;
241+
// Use absolute path
242+
if not Exec(ChocoExePath, 'install ffmpeg -y', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
243+
begin
244+
Result := 'Failed to launch Chocolatey (Absolute Path) to install FFmpeg. Code: ' + IntToStr(ResultCode);
245+
Exit;
246+
end;
247+
end
248+
else
249+
begin
250+
// Fallback to global PATH
251+
if not Exec(ExpandConstant('{cmd}'), '/C choco install ffmpeg -y', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then
252+
begin
253+
Result := 'Failed to launch Chocolatey (Global PATH) to install FFmpeg. Code: ' + IntToStr(ResultCode);
254+
Exit;
255+
end;
209256
end;
257+
210258
if ResultCode <> 0 then
211259
begin
212260
Result := 'Chocolatey failed to install FFmpeg. Code: ' + IntToStr(ResultCode);
213261
Exit;
214262
end;
215263
finally
216-
// Restore normal progress bar and clear status
217264
WizardForm.ProgressGauge.Style := npbstNormal;
218265
WizardForm.StatusLabel.Caption := '';
219266
end;
220-
// 4. Verify installation using full path (in case PATH not updated)
267+
268+
// 4. Verify installation using full path
221269
FFmpegExePath := 'C:\ProgramData\chocolatey\bin\ffmpeg.exe';
222270
if not FileExists(FFmpegExePath) then
223271
begin
224272
Result := 'FFmpeg installed but executable not found in expected path.';
225273
Exit;
226274
end;
275+
227276
if not Exec(FFmpegExePath, '-version', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) or (ResultCode <> 0) then
228277
begin
229278
Result := 'FFmpeg installed but -version failed even with full path. Code: ' + IntToStr(ResultCode);
@@ -250,7 +299,8 @@ begin
250299
Result := PandocResult; // Return Pandoc error
251300
Exit;
252301
end;
253-
// Second, check/install FFmpeg
302+
303+
// Second, check/install FFmpeg (and Choco if needed)
254304
FFmpegResult := InstallFFmpeg();
255305
if FFmpegResult <> '' then
256306
begin

Requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ ezodf
1212
moviepy
1313
pozalabs-pydub
1414
requests
15-
trimesh
15+
trimesh
16+
darkdetect

wormhole.exe

1.23 KB
Binary file not shown.

wormhole.py

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import webbrowser
2525
import subprocess
2626
import re
27+
import darkdetect
2728
try:
2829
from striprtf.striprtf import rtf_to_text
2930
RTF_SUPPORT = True
@@ -43,12 +44,20 @@
4344
print("Python version:", sys.version)
4445
print("sys.path (search paths for imports):", sys.path)
4546

46-
BG = "#0a0812"
47-
CARD = "#120f1e"
48-
CARD_HOVER = "#19172b"
49-
ACCENT = "#7aa3ff"
50-
ACCENT_DIM = "#4d6bbc"
51-
TEXT = "#e8e6f5"
47+
if (darkdetect.theme() == "Light"):
48+
BG = "#f7f8ff"
49+
CARD = "#ffffff"
50+
CARD_HOVER = "#e7e9f5"
51+
ACCENT = "#3a63d9"
52+
ACCENT_DIM = "#2a4ba8"
53+
TEXT = "#1a1b25"
54+
else:
55+
BG = "#0a0812"
56+
CARD = "#120f1e"
57+
CARD_HOVER = "#19172b"
58+
ACCENT = "#7aa3ff"
59+
ACCENT_DIM = "#4d6bbc"
60+
TEXT = "#e8e6f5"
5261

5362
def resource_path(relative_path):
5463
"""Get absolute path to resource, works for dev and for PyInstaller onefile."""
@@ -58,8 +67,10 @@ def resource_path(relative_path):
5867
except AttributeError:
5968
base_path = os.path.abspath(".")
6069
return os.path.join(base_path, relative_path)
61-
62-
WORMHOLE_IMAGE_PATH = resource_path(os.path.join("Icons", "wormhole_Transparent_Light.png"))
70+
if (darkdetect.theme() == "Light"):
71+
WORMHOLE_IMAGE_PATH = resource_path(os.path.join("Icons", "wormhole_Transparent.png"))
72+
else:
73+
WORMHOLE_IMAGE_PATH = resource_path(os.path.join("Icons", "wormhole_Transparent_Light.png"))
6374
try:
6475
WORMHOLE_PIL_IMAGE = Image.open(WORMHOLE_IMAGE_PATH)
6576
except Exception as e:
@@ -82,7 +93,7 @@ def resource_path(relative_path):
8293
"PathwayExtreme_36pt-Thin.ttf"
8394
]
8495

85-
VERSION = "1.2.0"
96+
VERSION = "1.2.1"
8697
GITHUB_URL = "https://github.com/DirectedHunt42/Wormhole"
8798

8899
# Set up customtkinter
@@ -534,15 +545,15 @@ class WormholeApp(ctk.CTk):
534545
def __init__(self):
535546
super().__init__()
536547
self.title("Wormhole File Converter")
537-
self.geometry("400x775")
548+
self.geometry("400x740")
538549
self.configure(fg_color=BG)
539550
# Center the main window
540551
self.update_idletasks()
541552
screen_width = self.winfo_screenwidth()
542553
screen_height = self.winfo_screenheight()
543554
x = (screen_width // 2) - (400 // 2)
544-
y = (screen_height // 2) - (775 // 2)
545-
self.geometry(f"400x775+{x}+{y}")
555+
y = (screen_height // 2) - (740 // 2) - 30
556+
self.geometry(f"400x740+{x}+{y}")
546557
self._build_ui()
547558
self.check_for_updates()
548559
if sys.platform.startswith('win'):
@@ -660,18 +671,39 @@ def _build_ui(self):
660671

661672
about_label = ctk.CTkLabel(self, text=f"Wormhole File Converter\nVersion {VERSION}\n© 2025 Nova Foundry", fg_color=BG, text_color=TEXT, font=(FONT_FAMILY_REGULAR, 10))
662673
about_label.pack(pady=20)
663-
support_link = ctk.CTkLabel(self, text="Support Nova Foundry", font=("Nunito", 12, "underline"),
664-
text_color=ACCENT, fg_color=BG, cursor="hand2")
665-
support_link.pack(pady=(0, 12))
666-
official_link = ctk.CTkLabel(self, text="Visit Official Website", font=("Nunito", 12, "underline"),
667-
text_color=ACCENT, fg_color=BG, cursor="hand2")
668-
official_link.pack(pady=(0, 12))
674+
675+
links_frame = ctk.CTkFrame(self, fg_color=BG)
676+
677+
support_link = ctk.CTkLabel(
678+
links_frame, text="Support Nova Foundry",
679+
font=("Nunito", 12, "underline"), text_color=ACCENT,
680+
fg_color=BG, cursor="hand2"
681+
)
682+
support_link.pack(side="left", padx=10)
683+
684+
official_link = ctk.CTkLabel(
685+
links_frame, text="Visit Official Website",
686+
font=("Nunito", 12, "underline"), text_color=ACCENT,
687+
fg_color=BG, cursor="hand2"
688+
)
689+
690+
help_link = ctk.CTkLabel(links_frame, text="Help", font=("Nunito", 12, "underline"), text_color=ACCENT, fg_color=BG, cursor="hand2")
691+
help_link.pack(side="left", padx=10)
692+
693+
official_link.pack(side="left", padx=10)
694+
695+
links_frame.pack()
696+
697+
669698
def open_official_link(event):
670699
webbrowser.open_new("https://novafoundry.ca")
671700
def open_support_link(event):
672701
webbrowser.open_new("https://buymeacoffee.com/novafoundry")
702+
def open_help_link(event):
703+
webbrowser.open_new("https://github.com/DirectedHunt42/Wormhole/wiki")
673704
support_link.bind("<Button-1>", open_support_link)
674705
official_link.bind("<Button-1>", open_official_link)
706+
help_link.bind("<Button-1>", open_help_link)
675707

676708
def check_for_updates(self):
677709
try:

0 commit comments

Comments
 (0)