Skip to content

Commit

Permalink
More style tweaks for Windows, thonny#2760, thonny#2737
Browse files Browse the repository at this point in the history
  • Loading branch information
aivarannamaa committed Jul 1, 2023
1 parent 0d2b597 commit 469e004
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions thonny/base_file_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def dir_tag_click(event):
# self.menu_button = ttk.Button(header_frame, text="≡ ", style="ViewToolbar.Toolbutton")
self.menu_button = CustomToolbutton(
header_frame,
style="ViewToolbar.CustomToolbutton",
text=f" {get_menu_char()} ",
command=self.post_button_menu,
)
Expand Down
3 changes: 2 additions & 1 deletion thonny/plugins/base_ui_themes.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ def windows() -> CompoundUiThemeSettings:
},
"ViewToolbar.TFrame": {"configure": {"background": "SystemWindow"}},
"ViewToolbar.Toolbutton": {"configure": {"background": "SystemWindow"}},
"ViewToolbar.CustomToolbutton": {"configure": {"background": "SystemWindow"}},
"ViewTab.TLabel": {
"configure": {"background": "SystemWindow", "padding": [scale(5), 0]}
},
Expand All @@ -585,7 +586,7 @@ def windows() -> CompoundUiThemeSettings:
"CustomToolbutton": {
"configure": {
"background": "systemButtonFace",
"activebackground": "systemScrollbar",
"activebackground": "#dadada",
}
},
"CustomNotebook": {
Expand Down
1 change: 1 addition & 0 deletions thonny/plugins/object_inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def create_navigation_link(col, image_filename, action, tooltip, padx=0):
button = CustomToolbutton(
toolbar,
# command=handler,
style="ViewToolbar.CustomToolbutton",
image=get_workbench().get_image(image_filename),
state=tk.NORMAL,
pad=ems_to_pixels(0.2),
Expand Down
6 changes: 5 additions & 1 deletion thonny/ui_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(
self,
master,
command: Callable = None,
style: Optional[str] = None,
image=None,
state="normal",
text=None,
Expand All @@ -53,7 +54,10 @@ def __init__(
self.disabled_image = image

self.state = state
self.style = style
style_conf = get_style_configuration("CustomToolbutton")
if self.style:
style_conf |= get_style_configuration(self.style)
self.normal_background = style_conf["background"]
self.hover_background = style_conf["activebackground"]

Expand Down Expand Up @@ -88,7 +92,7 @@ def __init__(
if text and not image:
# text only button content needs adjustment
pady = pady or 0
pady = (pady, pady + ems_to_pixels(0.3))
pady = (pady, pady + ems_to_pixels(0.23))

self.label.grid(row=0, column=0, padx=padx, pady=pady, sticky="nsew")
self.command = command
Expand Down

0 comments on commit 469e004

Please sign in to comment.