Skip to content

Commit 38dee5e

Browse files
committed
Themed integrated browser right click menu
1 parent cf7b21c commit 38dee5e

3 files changed

Lines changed: 38 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- Save URIs and relative exe path correctly in Launched timeline event (by @Willy-JL)
1313
- Add executable fuzzy matches subdirs in Default Exe Dir for game type, developer, name (by @Willy-JL)
1414
- Add executable checks best partial match to account for versions/mods/other things in dir names (#163 by @MayhemSixx)
15+
- Themed integrated browser right click menu (by @Willy-JL)
1516

1617
### Fixed:
1718
- More efficient grid/kanban cell cluster text (#200 by @Willy-JL)

modules/gui.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,9 @@ def refresh_styles(self):
654654
QMenu::item:selected:enabled {{
655655
background-color: {colors.rgba_0_1_to_hex(globals.settings.style_accent)[:-2]};
656656
}}
657+
QMenu::icon {{
658+
padding-left: 7px;
659+
}}
657660
""")
658661

659662
def refresh_fonts(self):

modules/webview.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ def create_kwargs():
108108
icon=str(globals.gui.icon_path),
109109
icon_font=str(icons.font_path),
110110
extension=str(globals.self_path / "browser/integrated.js"),
111-
col_bg=colors.rgba_0_1_to_hex(globals.settings.style_bg)[:-2],
112-
col_accent=colors.rgba_0_1_to_hex(globals.settings.style_accent)[:-2],
113-
col_text=colors.rgba_0_1_to_hex(globals.settings.style_text)[:-2],
111+
style_bg=colors.rgba_0_1_to_hex(globals.settings.style_bg)[:-2],
112+
style_accent=colors.rgba_0_1_to_hex(globals.settings.style_accent)[:-2],
113+
style_text=colors.rgba_0_1_to_hex(globals.settings.style_text)[:-2],
114+
style_text_dim=colors.rgba_0_1_to_hex(globals.settings.style_text_dim)[:-2],
115+
style_corner_radius=f"{globals.settings.style_corner_radius}px",
114116
proxy_config=proxy_config,
115117
)
116118

@@ -127,9 +129,11 @@ def create(
127129
icon: str,
128130
icon_font: str,
129131
extension: str,
130-
col_bg: str,
131-
col_accent: str,
132-
col_text: str,
132+
style_bg: str,
133+
style_accent: str,
134+
style_text: str,
135+
style_text_dim: str,
136+
style_corner_radius: str,
133137
proxy_config: dict | None,
134138
):
135139
config_qt_flags(debug, software)
@@ -327,32 +331,51 @@ def new_window_requested(request: QtWebEngineCore.QWebEngineNewWindowRequest):
327331

328332
app.window.setStyleSheet(f"""
329333
#controls * {{
330-
background: {col_bg};
331-
color: {col_text};
334+
background: {style_bg};
335+
color: {style_text};
332336
font-size: 14pt;
333337
border-radius: 0px;
334338
border: 0px;
335339
margin: 0px;
336340
padding: 0px;
337341
}}
338342
#controls QProgressBar::chunk {{
339-
background: {col_accent};
343+
background: {style_accent};
340344
}}
341345
#controls QPushButton {{
342346
font-family: '{icon_font}';
343347
padding: 5px;
344348
padding-bottom: 3px;
345349
}}
346350
#controls QPushButton:disabled {{
347-
color: #99{col_text[1:]};
351+
color: {style_text_dim};
348352
}}
349353
#controls QLineEdit {{
350354
font-size: 12px;
351355
padding: 5px;
352356
padding-bottom: 3px;
353357
}}
358+
QMenu {{
359+
padding: 5px;
360+
background-color: {style_bg};
361+
}}
362+
QMenu::item {{
363+
margin: 1px;
364+
padding: 2px 7px 2px 7px;
365+
border-radius: {style_corner_radius};
366+
color: {style_text};
367+
}}
368+
QMenu::item:disabled {{
369+
color: {style_text_dim};
370+
}}
371+
QMenu::item:selected:enabled {{
372+
background-color: {style_accent};
373+
}}
374+
QMenu::icon {{
375+
padding-left: 7px;
376+
}}
354377
""")
355-
app.window.webview.page.setBackgroundColor(QtGui.QColor(col_bg))
378+
app.window.webview.page.setBackgroundColor(QtGui.QColor(style_bg))
356379

357380
app.window.layout().addWidget(app.window.controls, stretch=0)
358381
app.window.layout().addWidget(app.window.webview, stretch=1)

0 commit comments

Comments
 (0)