Skip to content

Commit

Permalink
Themed integrated browser right click menu
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy-JL committed Dec 15, 2024
1 parent cf7b21c commit 38dee5e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Save URIs and relative exe path correctly in Launched timeline event (by @Willy-JL)
- Add executable fuzzy matches subdirs in Default Exe Dir for game type, developer, name (by @Willy-JL)
- Add executable checks best partial match to account for versions/mods/other things in dir names (#163 by @MayhemSixx)
- Themed integrated browser right click menu (by @Willy-JL)

### Fixed:
- More efficient grid/kanban cell cluster text (#200 by @Willy-JL)
Expand Down
3 changes: 3 additions & 0 deletions modules/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,9 @@ def refresh_styles(self):
QMenu::item:selected:enabled {{
background-color: {colors.rgba_0_1_to_hex(globals.settings.style_accent)[:-2]};
}}
QMenu::icon {{
padding-left: 7px;
}}
""")

def refresh_fonts(self):
Expand Down
45 changes: 34 additions & 11 deletions modules/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ def create_kwargs():
icon=str(globals.gui.icon_path),
icon_font=str(icons.font_path),
extension=str(globals.self_path / "browser/integrated.js"),
col_bg=colors.rgba_0_1_to_hex(globals.settings.style_bg)[:-2],
col_accent=colors.rgba_0_1_to_hex(globals.settings.style_accent)[:-2],
col_text=colors.rgba_0_1_to_hex(globals.settings.style_text)[:-2],
style_bg=colors.rgba_0_1_to_hex(globals.settings.style_bg)[:-2],
style_accent=colors.rgba_0_1_to_hex(globals.settings.style_accent)[:-2],
style_text=colors.rgba_0_1_to_hex(globals.settings.style_text)[:-2],
style_text_dim=colors.rgba_0_1_to_hex(globals.settings.style_text_dim)[:-2],
style_corner_radius=f"{globals.settings.style_corner_radius}px",
proxy_config=proxy_config,
)

Expand All @@ -127,9 +129,11 @@ def create(
icon: str,
icon_font: str,
extension: str,
col_bg: str,
col_accent: str,
col_text: str,
style_bg: str,
style_accent: str,
style_text: str,
style_text_dim: str,
style_corner_radius: str,
proxy_config: dict | None,
):
config_qt_flags(debug, software)
Expand Down Expand Up @@ -327,32 +331,51 @@ def new_window_requested(request: QtWebEngineCore.QWebEngineNewWindowRequest):

app.window.setStyleSheet(f"""
#controls * {{
background: {col_bg};
color: {col_text};
background: {style_bg};
color: {style_text};
font-size: 14pt;
border-radius: 0px;
border: 0px;
margin: 0px;
padding: 0px;
}}
#controls QProgressBar::chunk {{
background: {col_accent};
background: {style_accent};
}}
#controls QPushButton {{
font-family: '{icon_font}';
padding: 5px;
padding-bottom: 3px;
}}
#controls QPushButton:disabled {{
color: #99{col_text[1:]};
color: {style_text_dim};
}}
#controls QLineEdit {{
font-size: 12px;
padding: 5px;
padding-bottom: 3px;
}}
QMenu {{
padding: 5px;
background-color: {style_bg};
}}
QMenu::item {{
margin: 1px;
padding: 2px 7px 2px 7px;
border-radius: {style_corner_radius};
color: {style_text};
}}
QMenu::item:disabled {{
color: {style_text_dim};
}}
QMenu::item:selected:enabled {{
background-color: {style_accent};
}}
QMenu::icon {{
padding-left: 7px;
}}
""")
app.window.webview.page.setBackgroundColor(QtGui.QColor(col_bg))
app.window.webview.page.setBackgroundColor(QtGui.QColor(style_bg))

app.window.layout().addWidget(app.window.controls, stretch=0)
app.window.layout().addWidget(app.window.webview, stretch=1)
Expand Down

0 comments on commit 38dee5e

Please sign in to comment.