Skip to content

Commit

Permalink
Toolbar spinner
Browse files Browse the repository at this point in the history
Toolbar spinner will darken (for "light" color windows) or lighten (for "dark" colored windows)
  • Loading branch information
danhetrick committed Dec 10, 2020
1 parent 8a9a140 commit fa353b2
Show file tree
Hide file tree
Showing 9 changed files with 31,971 additions and 31,247 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ Version 0.822
* Changed the custom menubar widgets to use the host os' color palette
* Ported Windows-centric development tools to Linux
* Fixed a minor cosmetic issue on the "Preferences" dialog
* Toolbar spinner will darken (for "light" color windows) or lighten (for "dark" colored windows)

Version 0.820
* The main menu bar is no longer movable/floatable
Expand Down
Binary file modified downloads/erk-0.822.zip
Binary file not shown.
Binary file modified downloads/erk-latest.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion erk/data/minor.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
175
176
28 changes: 26 additions & 2 deletions erk/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,19 @@ def __init__(self,app,info=None,block_plugins=False,block_macros=False,block_set

self.logdir = logdir


# Determine if window color is dark or light
mbcolor = self.palette().color(QPalette.Window).name()
c = tuple(int(mbcolor[i:i + 2], 16) / 255. for i in (1, 3, 5))
luma = 0.2126 * c[0] + 0.7152 * c[1] + 0.0722 * c[2]
luma = luma*100

if luma>=40:
self.is_light_colored = True
else:
self.is_light_colored = False


textformat.get_text_format_settings(self.stylefile)

global DISABLED_PLUGINS
Expand Down Expand Up @@ -395,7 +408,10 @@ def __init__(self,app,info=None,block_plugins=False,block_macros=False,block_set
self.toolbar = generate_menu_toolbar(self)
self.addToolBar(Qt.TopToolBarArea,self.toolbar)

self.toolbar_icon = TOOLBAR_ICON
if self.is_light_colored:
self.toolbar_icon = TOOLBAR_ICON
else:
self.toolbar_icon = LIGHT_TOOLBAR_ICON

# MENU TOOLBAR
self.mainMenu = QMenu()
Expand Down Expand Up @@ -748,7 +764,15 @@ def buildMenuInterface(self):
if config.SCHWA_ANIMATION:
add_toolbar_stretch(self.toolbar)
self.corner_widget = add_toolbar_image(self.toolbar,self.toolbar_icon)
self.spinner = QMovie(SPINNER_ANIMATION)

if self.is_light_colored:
ANIM = SPINNER_ANIMATION
else:
ANIM = LIGHT_SPINNER_ANIMATION

#self.spinner = QMovie(SPINNER_ANIMATION)
self.spinner = QMovie(ANIM)

self.spinner.frameChanged.connect(lambda state,b=self.corner_widget: self.corner_widget.setIcon( QIcon(self.spinner.currentPixmap()) ) )

def menuExportLog(self):
Expand Down
6 changes: 6 additions & 0 deletions erk/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,13 @@
SPELLCHECK_ICON = ":/gui-spellcheck.png"
FONT_ICON = ":/gui-font.png"
SPINNER_ANIMATION = ":/gui-spinner.gif"

LIGHT_SPINNER_ANIMATION = ":/gui-light_spinner.gif"

TOOLBAR_ICON = ":/gui-toolbar.png"

LIGHT_TOOLBAR_ICON = ":/gui-light_toolbar.png"

CONNECT_MENU_ICON = ":/connect.png"
UPTIME_ICON = ":/gui-uptime.png"
LEFT_ICON = ":/gui-left.png"
Expand Down
63,181 changes: 31,937 additions & 31,244 deletions erk/resources/resources.py

Large diffs are not rendered by default.

Binary file added resources/gui/light_spinner.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/gui/light_toolbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fa353b2

Please sign in to comment.