summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@macaw.me>2020-11-14 17:24:09 +0800
committerFrederick Yin <fkfd@macaw.me>2020-11-14 17:24:09 +0800
commita8bc203a996ff593fdae4cfdb173a8992575c8de (patch)
tree309ba786f03c51d9dabed66b4bf414d9c4618abc
parent759c5aee3519322559fd20fe1e9b32fa19091dcc (diff)
Expand theming to entire UI
The entire UI, including the central document, the tab list and the ToC list is now themable. The width of the ToC has also been increased.
-rw-r--r--picross/conf.py3
-rw-r--r--picross/gui/view.py20
2 files changed, 20 insertions, 3 deletions
diff --git a/picross/conf.py b/picross/conf.py
index 0f09e34..53a08ad 100644
--- a/picross/conf.py
+++ b/picross/conf.py
@@ -21,6 +21,9 @@ conf_definitions = [
ConfDef("link-color", "l", str, "#3daee9"),
ConfDef("list-item-color", "i", str, "#27ae60"),
ConfDef("window-geometry", "g", str, "800x600+0+0"),
+ ConfDef("select-background", None, str, "#3daee9"),
+ ConfDef("select-foreground", None, str, "white"),
+ ConfDef("download-dest", "d", str, "~/Downloads"),
]
diff --git a/picross/gui/view.py b/picross/gui/view.py
index bdabc36..287cbb6 100644
--- a/picross/gui/view.py
+++ b/picross/gui/view.py
@@ -157,7 +157,13 @@ class View:
# tabs listbox
tabs_list = Listbox(tabs_pane, listvariable=self.tab_titles)
- tabs_list.config(font=(text_font, 12))
+ tabs_list.config(
+ font=(text_font, 12),
+ bg=conf.get("background-color"),
+ fg=conf.get("text-color"),
+ selectbackground=conf.get("select-background"),
+ selectforeground=conf.get("select-foreground"),
+ )
tabs_list.pack(side="top", fill="both", expand=True)
tabs_list.bind("<<ListboxSelect>>", lambda _: self.switchtab_callback())
self.tabs_list = tabs_list
@@ -167,8 +173,14 @@ class View:
toc_pane.pack(side="right", fill="y")
# TOC list
- toc_list = Listbox(toc_pane, listvariable=self.toc)
- toc_list.config(font=(text_font, 12))
+ toc_list = Listbox(toc_pane, listvariable=self.toc, width=24)
+ toc_list.config(
+ font=(text_font, 12),
+ bg=conf.get("background-color"),
+ fg=conf.get("text-color"),
+ selectbackground=conf.get("select-background"),
+ selectforeground=conf.get("select-foreground"),
+ )
toc_list.pack(side="top", fill="both", expand=True)
toc_list.bind("<<ListboxSelect>>", lambda _: self.toc_click_callback())
self.toc_list = toc_list
@@ -256,6 +268,8 @@ class View:
# prevent text widget from pushing scrollbar/status bar out of the window:
width=1,
height=1,
+ selectbackground=conf.get("select-background"),
+ selectforeground=conf.get("select-foreground"),
)
text.pack(side="left", fill="both", expand=True)
text.tag_config("link", foreground=conf.get("link-color"))