This repository was archived by the owner on Nov 9, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathlinux_installer.py
More file actions
1470 lines (1248 loc) · 51.7 KB
/
Copy pathlinux_installer.py
File metadata and controls
1470 lines (1248 loc) · 51.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
HellFire GUI Installer
"""
import glob
import io
import os
import sys
import tarfile
import threading
import webbrowser
from pathlib import Path
import requests
try:
from PIL import Image, ImageDraw, ImageTk
PIL_AVAILABLE = True
except ImportError:
PIL_AVAILABLE = False
import tkinter as tk
from tkinter import font as tkfont
# ---------------------------------------------------------------------------
# Font fallback for broad Linux distro coverage
# ---------------------------------------------------------------------------
SANS_PREFERENCES = (
"Inter", "Inter Variable", "SF Pro Display",
"Ubuntu", "Cantarell", "Noto Sans", "Roboto",
"DejaVu Sans", "Liberation Sans", "FreeSans", "Sans",
)
SANS_BOLD_PREFERENCES = (
"Inter Black", "Inter SemiBold",
"Ubuntu Bold", "Cantarell Bold", "Noto Sans Bold",
*SANS_PREFERENCES,
)
def pick_font(preferred, size, weight="normal"):
try:
available = {f.lower() for f in tkfont.families()}
except Exception:
available = set()
for name in preferred:
if name.lower() in available:
return (name, size, weight)
return ("TkDefaultFont", size, weight)
# ---------------------------------------------------------------------------
# Custom widgets
# ---------------------------------------------------------------------------
class RoundedFrame(tk.Canvas):
"""Canvas with a rounded-rect background. Use .interior for content."""
def __init__(self, parent, width, height, parent_bg, card_bg,
border_color=None, radius=14):
super().__init__(
parent, width=width, height=height,
highlightthickness=0, bd=0, bg=parent_bg,
)
self._cw, self._ch, self._r = width, height, radius
self._parent_bg = parent_bg
self._card_bg = card_bg
self._border_color = border_color
self._draw()
self.interior = tk.Frame(self, bg=card_bg)
self.create_window(
radius, radius, anchor="nw", window=self.interior,
width=width - 2 * radius, height=height - 2 * radius,
)
def _draw(self):
self.delete("bg")
w, h, r = self._cw, self._ch, self._r
c = self._card_bg
self.create_arc(0, 0, 2 * r, 2 * r, start=90, extent=90,
fill=c, outline=c, tags="bg")
self.create_arc(w - 2 * r, 0, w, 2 * r, start=0, extent=90,
fill=c, outline=c, tags="bg")
self.create_arc(0, h - 2 * r, 2 * r, h, start=180, extent=90,
fill=c, outline=c, tags="bg")
self.create_arc(w - 2 * r, h - 2 * r, w, h, start=270, extent=90,
fill=c, outline=c, tags="bg")
self.create_rectangle(r, 0, w - r, h, fill=c, outline=c, tags="bg")
self.create_rectangle(0, r, w, h - r, fill=c, outline=c, tags="bg")
self.tag_lower("bg")
def update_theme(self, parent_bg, card_bg, border_color=None):
self._parent_bg = parent_bg
self._card_bg = card_bg
self._border_color = border_color
self.configure(bg=parent_bg)
self.interior.configure(bg=card_bg)
self._draw()
class RoundedButton(tk.Canvas):
"""Pill button with hover/press/disabled states."""
def __init__(self, parent, text="", command=None,
width=160, height=42, radius=21,
bg="#ff6b3d", hover_bg="#ff8559", active_bg="#e55a2e",
disabled_bg="#cccccc", disabled_fg="#777",
fg="white", font=None, parent_bg="#ffffff"):
super().__init__(
parent, width=width, height=height,
highlightthickness=0, bd=0, bg=parent_bg,
)
self._text = text
self._command = command
self._cw, self._ch, self._r = width, height, radius
self._bg, self._hover, self._active = bg, hover_bg, active_bg
self._disabled_bg, self._disabled_fg = disabled_bg, disabled_fg
self._fg = fg
self._font = font or pick_font(SANS_BOLD_PREFERENCES, 11, "bold")
self._enabled = True
self._current_bg = bg
self._draw()
self.bind("<Enter>", self._on_enter)
self.bind("<Leave>", self._on_leave)
self.bind("<ButtonPress-1>", self._on_press)
self.bind("<ButtonRelease-1>", self._on_release)
def _draw(self):
self.delete("all")
w, h, r = self._cw, self._ch, self._r
bg = self._current_bg if self._enabled else self._disabled_bg
fg = self._fg if self._enabled else self._disabled_fg
self.create_arc(0, 0, 2 * r, h, start=90, extent=180,
fill=bg, outline=bg)
self.create_arc(w - 2 * r, 0, w, h, start=270, extent=180,
fill=bg, outline=bg)
self.create_rectangle(r, 0, w - r, h, fill=bg, outline=bg)
self.create_text(w // 2, h // 2, text=self._text,
fill=fg, font=self._font)
def configure_text(self, text):
self._text = text
self._draw()
def set_enabled(self, enabled):
self._enabled = enabled
self._current_bg = self._bg
self.configure(cursor="hand2" if enabled else "arrow")
self._draw()
def update_colors(self, parent_bg, bg, hover_bg, active_bg,
disabled_bg, disabled_fg, fg):
self._bg, self._hover, self._active = bg, hover_bg, active_bg
self._disabled_bg, self._disabled_fg = disabled_bg, disabled_fg
self._fg = fg
self._current_bg = bg
self.configure(bg=parent_bg)
self._draw()
def _on_enter(self, _):
if self._enabled:
self._current_bg = self._hover
self.configure(cursor="hand2")
self._draw()
def _on_leave(self, _):
if self._enabled:
self._current_bg = self._bg
self._draw()
def _on_press(self, _):
if self._enabled:
self._current_bg = self._active
self._draw()
def _on_release(self, _):
if not self._enabled:
return
self._current_bg = self._hover
self._draw()
if self._command:
self._command()
class SmoothProgressBar(tk.Canvas):
"""Rounded progress bar with eased animation + indeterminate shimmer."""
def __init__(self, parent, width=440, height=8,
bg_track="#ecebf3", fg="#ff6b3d", parent_bg="#ffffff"):
super().__init__(
parent, width=width, height=height,
highlightthickness=0, bd=0, bg=parent_bg,
)
self._cw, self._ch = width, height
self._track = bg_track
self._fg = fg
self._target = 0.0
self._current = 0.0
self._animating = False
self._indeterminate = False
self._shimmer_x = -0.3
self._draw()
def _rounded_rect(self, x1, y1, x2, y2, r, fill):
if x2 - x1 < 2 * r:
r = max(0, (x2 - x1) // 2)
if r <= 0:
self.create_rectangle(x1, y1, x2, y2, fill=fill, outline=fill)
return
self.create_arc(x1, y1, x1 + 2 * r, y2, start=90, extent=180,
fill=fill, outline=fill)
self.create_arc(x2 - 2 * r, y1, x2, y2, start=270, extent=180,
fill=fill, outline=fill)
self.create_rectangle(x1 + r, y1, x2 - r, y2,
fill=fill, outline=fill)
def _draw(self):
self.delete("all")
w, h = self._cw, self._ch
r = h // 2
self._rounded_rect(0, 0, w, h, r, self._track)
if self._indeterminate:
seg = int(w * 0.3)
x = int(self._shimmer_x * w)
x1 = max(0, x)
x2 = min(w, x + seg)
if x2 > x1:
self._rounded_rect(x1, 0, x2, h, r, self._fg)
else:
fw = int(self._current * w)
if fw > 0:
self._rounded_rect(0, 0, fw, h, r, self._fg)
def set_value(self, value):
self._indeterminate = False
self._target = max(0.0, min(1.0, value))
if not self._animating:
self._animating = True
self._tick()
def _tick(self):
if self._indeterminate:
self._shimmer_x += 0.02
if self._shimmer_x > 1.05:
self._shimmer_x = -0.3
self._draw()
self.after(30, self._tick)
return
delta = self._target - self._current
if abs(delta) < 0.002:
self._current = self._target
self._draw()
self._animating = False
return
self._current += delta * 0.25
self._draw()
self.after(16, self._tick)
def start_indeterminate(self):
self._indeterminate = True
self._shimmer_x = -0.3
if not self._animating:
self._animating = True
self._tick()
def stop_indeterminate(self):
self._indeterminate = False
self._animating = False
self._current = 0.0
self._draw()
def update_colors(self, parent_bg, track, fg):
self._track = track
self._fg = fg
self.configure(bg=parent_bg)
self._draw()
class ToggleSwitch(tk.Canvas):
"""iOS-style sliding toggle for theme switching."""
def __init__(self, parent, parent_bg, track_off, track_on, knob,
command=None, on=False):
super().__init__(
parent, width=44, height=24,
highlightthickness=0, bd=0, bg=parent_bg,
)
self._on = on
self._track_off = track_off
self._track_on = track_on
self._knob = knob
self._command = command
self.configure(cursor="hand2")
self._draw()
self.bind("<Button-1>", self._click)
def _draw(self):
self.delete("all")
track = self._track_on if self._on else self._track_off
self.create_arc(0, 0, 24, 24, start=90, extent=180,
fill=track, outline=track)
self.create_arc(20, 0, 44, 24, start=270, extent=180,
fill=track, outline=track)
self.create_rectangle(12, 0, 32, 24, fill=track, outline=track)
kx = 22 if self._on else 2
self.create_oval(kx, 2, kx + 20, 22,
fill=self._knob, outline=self._knob)
def _click(self, _):
self._on = not self._on
self._draw()
if self._command:
self._command(self._on)
def update_colors(self, parent_bg, track_off, track_on, knob):
self._track_off = track_off
self._track_on = track_on
self._knob = knob
self.configure(bg=parent_bg)
self._draw()
class PillNavItem(tk.Frame):
"""Sidebar nav row with a pill-shaped active/hover background."""
HEIGHT = 38
RADIUS = 10
LEFT_PAD = 16
def __init__(self, parent, text, font, on_click=None):
super().__init__(parent, height=self.HEIGHT)
self.pack_propagate(False)
self._text = text
self._font = font
self._on_click = on_click
self._active = False
self._hover = False
self._colors = None
self._canvas = tk.Canvas(
self, height=self.HEIGHT,
highlightthickness=0, bd=0,
)
self._canvas.pack(fill=tk.BOTH, expand=True)
self._canvas.bind("<Configure>", lambda e: self._draw())
self._canvas.bind("<Button-1>", self._click)
self._canvas.bind("<Enter>", self._enter)
self._canvas.bind("<Leave>", self._leave)
def _draw(self):
if not self._colors:
return
c = self._canvas
c.delete("all")
w = c.winfo_width()
h = self.HEIGHT
r = self.RADIUS
if w < 2 * r:
return
bg = self._colors["sidebar_bg"]
if self._active:
fill = self._colors["accent"]
text_color = "#ffffff"
elif self._hover:
fill = self._colors["nav_hover"]
text_color = self._colors["text"]
else:
fill = bg
text_color = self._colors["text_muted"]
c.configure(bg=bg)
self.configure(bg=bg)
if fill != bg:
c.create_arc(0, 0, 2 * r, 2 * r, start=90, extent=90,
fill=fill, outline=fill)
c.create_arc(w - 2 * r, 0, w, 2 * r, start=0, extent=90,
fill=fill, outline=fill)
c.create_arc(0, h - 2 * r, 2 * r, h, start=180, extent=90,
fill=fill, outline=fill)
c.create_arc(w - 2 * r, h - 2 * r, w, h, start=270, extent=90,
fill=fill, outline=fill)
c.create_rectangle(r, 0, w - r, h, fill=fill, outline=fill)
c.create_rectangle(0, r, w, h - r, fill=fill, outline=fill)
c.create_text(self.LEFT_PAD, h // 2, text=self._text,
fill=text_color, anchor="w", font=self._font)
def set_active(self, active):
self._active = active
self._draw()
def _enter(self, _):
self._hover = True
self._canvas.configure(cursor="hand2")
self._draw()
def _leave(self, _):
self._hover = False
self._draw()
def _click(self, _):
if self._on_click:
self._on_click()
def update_colors(self, colors):
self._colors = colors
self._draw()
# ---------------------------------------------------------------------------
# Themes
# ---------------------------------------------------------------------------
THEMES = {
"light": {
"bg": "#f4f1fb",
"sidebar_bg": "#ffffff",
"card_bg": "#ffffff",
"card_alt": "#faf9ff",
"border": "#ecebf3",
"text": "#1a1a2e",
"text_muted": "#6b6b80",
"text_dim": "#a0a0b0",
"accent": "#ff6b3d",
"accent_hover": "#ff8559",
"accent_active": "#e55a2e",
"accent_soft": "#fff1eb",
"secondary": "#7c6ef0",
"secondary_soft": "#efedff",
"track": "#ecebf3",
"success": "#22c55e",
"error": "#ef4444",
"nav_hover": "#f5f3ff",
"toggle_off": "#dcd9e8",
"toggle_on": "#ff6b3d",
"toggle_knob": "#ffffff",
"cta_grad_a": "#7c6ef0",
"cta_grad_b": "#a594ff",
},
"dark": {
"bg": "#0e0c14",
"sidebar_bg": "#15131c",
"card_bg": "#1a1822",
"card_alt": "#211e2c",
"border": "#2a2734",
"text": "#f4f1ee",
"text_muted": "#a39ab0",
"text_dim": "#6b6673",
"accent": "#ff6b3d",
"accent_hover": "#ff8559",
"accent_active": "#e55a2e",
"accent_soft": "#2a1d18",
"secondary": "#9787f5",
"secondary_soft": "#1f1b2e",
"track": "#2a2734",
"success": "#4ade80",
"error": "#f87171",
"nav_hover": "#211e2c",
"toggle_off": "#2a2734",
"toggle_on": "#ff6b3d",
"toggle_knob": "#f4f1ee",
"cta_grad_a": "#5b4fc7",
"cta_grad_b": "#7c6ef0",
},
}
# ---------------------------------------------------------------------------
# Main installer
# ---------------------------------------------------------------------------
class HellFireInstallerTk:
WINDOW_W = 1024
WINDOW_H = 660
SIDEBAR_W = 220
PADDING = 24
def __init__(self, root):
self.root = root
self.root.title("HellFire Installer")
self.root.geometry(f"{self.WINDOW_W}x{self.WINDOW_H}")
self.root.resizable(False, False)
self._center_window()
self.theme_name = "dark"
self.colors = THEMES[self.theme_name]
self._themed_widgets = []
self._themed_custom = []
self.root.configure(bg=self.colors["bg"])
self.keyword = "hellfire"
self.base_dir = Path.home() / "HellFire"
self.firefox_bin = self.base_dir / "firefox" / "firefox"
self.user_bin = Path.home() / ".local" / "bin"
self.user_bin_symlink = self.user_bin / "hellfire"
self.desktop_file_path = (
Path.home() / ".local/share/applications/hellfire.desktop"
)
self.file_to_extract = None
self.avatar_image = None
self._installed = False
self.hero_image_url = "https://github.com/CYFARE.png?size=256"
self.social_links = {
"GitHub": "https://github.com/CYFARE/HellFire",
"Twitter": "https://x.com/cyfarelabs",
"Website": "https://cyfare.net/",
}
self.fonts = {
"logo": pick_font(SANS_BOLD_PREFERENCES, 16, "bold"),
"title": pick_font(SANS_BOLD_PREFERENCES, 22, "bold"),
"subtitle": pick_font(SANS_PREFERENCES, 11, "normal"),
"body": pick_font(SANS_PREFERENCES, 10, "normal"),
"body_bold": pick_font(SANS_BOLD_PREFERENCES, 10, "bold"),
"small": pick_font(SANS_PREFERENCES, 9, "normal"),
"tiny": pick_font(SANS_PREFERENCES, 8, "normal"),
"section": pick_font(SANS_BOLD_PREFERENCES, 8, "bold"),
"nav": pick_font(SANS_PREFERENCES, 11, "normal"),
"stat_num": pick_font(SANS_BOLD_PREFERENCES, 18, "bold"),
"card_h": pick_font(SANS_BOLD_PREFERENCES, 13, "bold"),
"btn": pick_font(SANS_BOLD_PREFERENCES, 11, "bold"),
"cta_h": pick_font(SANS_BOLD_PREFERENCES, 17, "bold"),
"cta_b": pick_font(SANS_PREFERENCES, 11, "normal"),
}
self._stats = {
"source": ("Source", "—", "Awaiting"),
"size": ("Size", "—", "Pending"),
"files": ("Files", "—", "Pending"),
"status": ("Status", "Ready", "Click install"),
}
self._stat_widgets = {}
self._build_ui()
self._load_avatar()
threading.Thread(target=self._refresh_stats, daemon=True).start()
# ----- window helpers ----------------------------------------------------
def _center_window(self):
self.root.update_idletasks()
x = (self.root.winfo_screenwidth() - self.WINDOW_W) // 2
y = (self.root.winfo_screenheight() - self.WINDOW_H) // 2
self.root.geometry(f"{self.WINDOW_W}x{self.WINDOW_H}+{x}+{y}")
# ----- theme system ------------------------------------------------------
def _theme(self, widget, **roles):
self._themed_widgets.append((widget, roles))
self._apply_theme_to(widget, roles)
def _apply_theme_to(self, widget, roles):
try:
widget.configure(**{
opt: self.colors[role] for opt, role in roles.items()
})
except tk.TclError:
pass
def _theme_custom(self, fn):
self._themed_custom.append(fn)
fn(self.colors)
def _toggle_theme(self, is_dark):
self.theme_name = "dark" if is_dark else "light"
self.colors = THEMES[self.theme_name]
self.root.configure(bg=self.colors["bg"])
for widget, roles in self._themed_widgets:
self._apply_theme_to(widget, roles)
for fn in self._themed_custom:
fn(self.colors)
# ----- UI construction ---------------------------------------------------
def _build_ui(self):
self.outer = tk.Frame(self.root)
self._theme(self.outer, bg="bg")
self.outer.pack(fill=tk.BOTH, expand=True)
self._build_sidebar(self.outer)
self.main_area = tk.Frame(self.outer)
self._theme(self.main_area, bg="bg")
self.main_area.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
self._build_main(self.main_area)
# ----- sidebar -----------------------------------------------------------
def _build_sidebar(self, parent):
self.sidebar = tk.Frame(parent, width=self.SIDEBAR_W)
self.sidebar.pack_propagate(False)
self.sidebar.pack(side=tk.LEFT, fill=tk.Y)
self._theme(self.sidebar, bg="sidebar_bg")
logo_frame = tk.Frame(self.sidebar, height=80)
logo_frame.pack(fill=tk.X, padx=24, pady=(28, 28))
self._theme(logo_frame, bg="sidebar_bg")
logo_a = tk.Label(logo_frame, text="HELL", font=self.fonts["logo"])
logo_a.pack(side=tk.LEFT)
self._theme(logo_a, bg="sidebar_bg", fg="text")
logo_b = tk.Label(logo_frame, text="FIRE", font=self.fonts["logo"])
logo_b.pack(side=tk.LEFT)
self._theme(logo_b, bg="sidebar_bg", fg="accent")
# Only Install nav — About and Settings removed (no features behind them)
nav_data = [("Install", True)]
self._nav_items = []
for label, active in nav_data:
item = PillNavItem(
self.sidebar, text=label,
font=self.fonts["nav"],
on_click=lambda l=label: self._on_nav_click(l),
)
item.pack(fill=tk.X, padx=14, pady=2)
item.set_active(active)
self._theme_custom(item.update_colors)
self._nav_items.append((label, item))
section_lbl = tk.Label(
self.sidebar, text="OTHER LINKS",
font=self.fonts["section"], anchor="w",
)
section_lbl.pack(fill=tk.X, padx=24, pady=(28, 8))
self._theme(section_lbl, bg="sidebar_bg", fg="text_dim")
for name, url in self.social_links.items():
item = PillNavItem(
self.sidebar, text=name,
font=self.fonts["nav"],
on_click=lambda u=url: webbrowser.open(u),
)
item.pack(fill=tk.X, padx=14, pady=2)
self._theme_custom(item.update_colors)
spacer = tk.Frame(self.sidebar)
spacer.pack(fill=tk.BOTH, expand=True)
self._theme(spacer, bg="sidebar_bg")
toggle_row = tk.Frame(self.sidebar)
toggle_row.pack(fill=tk.X, padx=24, pady=(12, 28))
self._theme(toggle_row, bg="sidebar_bg")
sun = tk.Label(toggle_row, text="☀", font=self.fonts["body_bold"])
sun.pack(side=tk.LEFT)
self._theme(sun, bg="sidebar_bg", fg="text_muted")
self.theme_toggle = ToggleSwitch(
toggle_row,
parent_bg=self.colors["sidebar_bg"],
track_off=self.colors["toggle_off"],
track_on=self.colors["toggle_on"],
knob=self.colors["toggle_knob"],
on=(self.theme_name == "dark"),
command=self._toggle_theme,
)
self.theme_toggle.pack(side=tk.LEFT, padx=10)
def _update_toggle(colors):
self.theme_toggle.update_colors(
parent_bg=colors["sidebar_bg"],
track_off=colors["toggle_off"],
track_on=colors["toggle_on"],
knob=colors["toggle_knob"],
)
self._theme_custom(_update_toggle)
moon = tk.Label(toggle_row, text="☾", font=self.fonts["body_bold"])
moon.pack(side=tk.LEFT)
self._theme(moon, bg="sidebar_bg", fg="text_muted")
def _on_nav_click(self, label):
for name, item in self._nav_items:
item.set_active(name == label)
# ----- main area --------------------------------------------------------
def _build_main(self, parent):
wrap = tk.Frame(parent)
wrap.pack(fill=tk.BOTH, expand=True, padx=self.PADDING, pady=(16, 20))
self._theme(wrap, bg="bg")
self._build_header(wrap)
spacer1 = tk.Frame(wrap, height=20)
self._theme(spacer1, bg="bg")
spacer1.pack(fill=tk.X)
self._build_stat_cards(wrap)
spacer2 = tk.Frame(wrap, height=16)
self._theme(spacer2, bg="bg")
spacer2.pack(fill=tk.X)
self._build_middle_row(wrap)
spacer3 = tk.Frame(wrap, height=16)
self._theme(spacer3, bg="bg")
spacer3.pack(fill=tk.X)
self._build_cta_card(wrap)
def _build_header(self, parent):
header = tk.Frame(parent, height=44)
header.pack(fill=tk.X)
header.pack_propagate(False)
self._theme(header, bg="bg")
left = tk.Frame(header)
left.pack(side=tk.LEFT, fill=tk.Y)
self._theme(left, bg="bg")
welcome = tk.Label(left, text="Welcome to ",
font=self.fonts["title"])
welcome.pack(side=tk.LEFT)
self._theme(welcome, bg="bg", fg="text")
brand = tk.Label(left, text="HellFire", font=self.fonts["title"])
brand.pack(side=tk.LEFT)
self._theme(brand, bg="bg", fg="accent")
right = tk.Frame(header)
right.pack(side=tk.RIGHT, fill=tk.Y)
self._theme(right, bg="bg")
version_pill = RoundedFrame(
right, width=130, height=36,
parent_bg=self.colors["bg"],
card_bg=self.colors["card_bg"], radius=18,
)
version_pill.pack(side=tk.RIGHT, padx=(0, 4))
# Colored dot + text inside the pill
pill_inner = tk.Frame(version_pill.interior, bg=self.colors["card_bg"])
pill_inner.pack(expand=True)
dot = tk.Canvas(pill_inner, width=8, height=8,
highlightthickness=0, bd=0,
bg=self.colors["card_bg"])
dot.pack(side=tk.LEFT, padx=(0, 6))
dot.create_oval(0, 0, 8, 8, fill=self.colors["accent"], outline="")
def _upd_dot(colors):
dot.configure(bg=colors["card_bg"])
dot.delete("all")
dot.create_oval(0, 0, 8, 8, fill=colors["accent"], outline="")
self._theme_custom(_upd_dot)
ver_label = tk.Label(
pill_inner, text="Linux build",
font=self.fonts["small"], anchor="center",
bg=self.colors["card_bg"], fg=self.colors["text_muted"],
)
ver_label.pack(side=tk.LEFT)
self._theme(ver_label, bg="card_bg", fg="text_muted")
def _upd_pill(colors):
version_pill.update_theme(colors["bg"], colors["card_bg"])
pill_inner.configure(bg=colors["card_bg"])
self._theme_custom(_upd_pill)
# ----- stat cards row ---------------------------------------------------
def _build_stat_cards(self, parent):
row = tk.Frame(parent, height=98)
row.pack(fill=tk.X)
row.pack_propagate(False)
self._theme(row, bg="bg")
inner_w = self.WINDOW_W - self.SIDEBAR_W - 2 * self.PADDING
gap = 12
card_w = (inner_w - gap * 3) // 4
card_h = 98
keys = ["source", "size", "files", "status"]
accent_colors = ["accent", "secondary", "accent", "secondary"]
for i, (key, accent) in enumerate(zip(keys, accent_colors)):
label, value, sub = self._stats[key]
card = RoundedFrame(
row, width=card_w, height=card_h,
parent_bg=self.colors["bg"],
card_bg=self.colors["card_bg"], radius=14,
)
card.pack(side=tk.LEFT, padx=(0 if i == 0 else gap, 0))
def _upd_card(colors, c=card):
c.update_theme(colors["bg"], colors["card_bg"])
self._theme_custom(_upd_card)
content = tk.Frame(card.interior)
content.pack(fill=tk.BOTH, expand=True, padx=10, pady=8)
self._theme(content, bg="card_bg")
top = tk.Frame(content)
top.pack(fill=tk.X)
self._theme(top, bg="card_bg")
lbl = tk.Label(top, text=label, font=self.fonts["small"],
anchor="w")
lbl.pack(side=tk.LEFT)
self._theme(lbl, bg="card_bg", fg="text_muted")
dot = tk.Label(top, text="●", font=self.fonts["small"])
dot.pack(side=tk.RIGHT)
self._theme(dot, bg="card_bg", fg=accent)
val = tk.Label(content, text=value,
font=self.fonts["stat_num"], anchor="w")
val.pack(fill=tk.X, pady=(6, 0))
self._theme(val, bg="card_bg", fg="text")
sub_lbl = tk.Label(content, text=sub,
font=self.fonts["tiny"], anchor="w")
sub_lbl.pack(fill=tk.X)
self._theme(sub_lbl, bg="card_bg", fg="text_dim")
self._stat_widgets[key] = (val, sub_lbl)
def _set_stat(self, key, value=None, sub=None):
def apply():
val_w, sub_w = self._stat_widgets[key]
if value is not None:
val_w.configure(text=value)
if sub is not None:
sub_w.configure(text=sub)
self.root.after(0, apply)
# ----- middle row: progress + about -------------------------------------
def _build_middle_row(self, parent):
row = tk.Frame(parent, height=236)
row.pack(fill=tk.X)
row.pack_propagate(False)
self._theme(row, bg="bg")
inner_w = self.WINDOW_W - self.SIDEBAR_W - 2 * self.PADDING
gap = 12
progress_w = int(inner_w * 0.66)
about_w = inner_w - progress_w - gap
self._build_progress_card(row, progress_w, 236)
spacer = tk.Frame(row, width=gap)
spacer.pack(side=tk.LEFT)
self._theme(spacer, bg="bg")
self._build_about_card(row, about_w, 236)
def _build_progress_card(self, parent, w, h):
card = RoundedFrame(
parent, width=w, height=h,
parent_bg=self.colors["bg"],
card_bg=self.colors["card_bg"], radius=14,
)
card.pack(side=tk.LEFT)
def _upd(colors):
card.update_theme(colors["bg"], colors["card_bg"])
self._theme_custom(_upd)
body = tk.Frame(card.interior)
body.pack(fill=tk.BOTH, expand=True, padx=14, pady=10)
self._theme(body, bg="card_bg")
head = tk.Frame(body)
head.pack(fill=tk.X)
self._theme(head, bg="card_bg")
title = tk.Label(head, text="Installation",
font=self.fonts["card_h"], anchor="w")
title.pack(side=tk.LEFT)
self._theme(title, bg="card_bg", fg="text")
self.percent_label = tk.Label(head, text="",
font=self.fonts["body_bold"])
self.percent_label.pack(side=tk.RIGHT)
self._theme(self.percent_label, bg="card_bg", fg="text_muted")
sub = tk.Label(
body,
text="Custom-compiled Firefox build, installed to your home folder.",
font=self.fonts["small"], anchor="w", justify="left",
)
sub.pack(fill=tk.X, pady=(4, 12))
self._theme(sub, bg="card_bg", fg="text_muted")
status_row = tk.Frame(body)
status_row.pack(fill=tk.X, pady=(0, 6))
self._theme(status_row, bg="card_bg")
self.status_dot = tk.Canvas(
status_row, width=10, height=10,
highlightthickness=0, bd=0,
)
self.status_dot.pack(side=tk.LEFT, padx=(0, 10))
self._set_status_dot(self.colors["text_dim"])
def _upd_dot(colors):
self.status_dot.configure(bg=colors["card_bg"])
self._theme_custom(_upd_dot)
self.status_label = tk.Label(
status_row, text="Ready to install",
font=self.fonts["body"], anchor="w",
)
self.status_label.pack(side=tk.LEFT, fill=tk.X, expand=True)
self._theme(self.status_label, bg="card_bg", fg="text")
bar_w = w - 2 * 14 - 28
self.progress = SmoothProgressBar(
body, width=bar_w, height=6,
bg_track=self.colors["track"],
fg=self.colors["accent"],
parent_bg=self.colors["card_bg"],
)
self.progress.pack(fill=tk.X, pady=(0, 10))
def _upd_bar(colors):
self.progress.update_colors(
colors["card_bg"], colors["track"], colors["accent"]
)
self._theme_custom(_upd_bar)
path_note = tk.Label(
body,
text=f"📁 Installs to {self._tilde(self.base_dir)}",
font=self.fonts["small"], anchor="w",
)
path_note.pack(fill=tk.X, pady=(0, 10))
self._theme(path_note, bg="card_bg", fg="text_dim")
self.action_button = RoundedButton(
body, text="Install HellFire",
command=self._on_action_clicked,
width=170, height=42, radius=21,
bg=self.colors["accent"],
hover_bg=self.colors["accent_hover"],
active_bg=self.colors["accent_active"],
disabled_bg=self.colors["track"],
disabled_fg=self.colors["text_dim"],
fg="white",
font=self.fonts["btn"],
parent_bg=self.colors["card_bg"],
)
self.action_button.pack(anchor="w")
def _upd_btn(colors):
self.action_button.update_colors(
parent_bg=colors["card_bg"],
bg=colors["accent"],
hover_bg=colors["accent_hover"],
active_bg=colors["accent_active"],
disabled_bg=colors["track"],
disabled_fg=colors["text_dim"],
fg="white",
)
self._theme_custom(_upd_btn)
def _build_about_card(self, parent, w, h):
card = RoundedFrame(
parent, width=w, height=h,
parent_bg=self.colors["bg"],
card_bg=self.colors["card_bg"], radius=14,
)
card.pack(side=tk.LEFT)
def _upd(colors):
card.update_theme(colors["bg"], colors["card_bg"])
self._theme_custom(_upd)
body = tk.Frame(card.interior)
body.pack(fill=tk.BOTH, expand=True, padx=10, pady=8)
self._theme(body, bg="card_bg")
self.avatar_canvas = tk.Canvas(
body, width=72, height=72,
highlightthickness=0, bd=0,
)
self.avatar_canvas.pack(pady=(8, 8))
self._draw_avatar_placeholder()
def _upd_avatar(colors):
self.avatar_canvas.configure(bg=colors["card_bg"])
self._draw_avatar_placeholder()
self._theme_custom(_upd_avatar)
name = tk.Label(body, text="HellFire Browser",
font=self.fonts["card_h"])
name.pack()
self._theme(name, bg="card_bg", fg="text")
handle = tk.Label(body, text="@cyfarelabs",
font=self.fonts["small"])