Improvements for Hydrus on macOS (#1521)

* New macOS icon

* Add .DS_Store to .gitignore

* Attempt to use global menu bar

* Use Qt palette colors for some things in default qss

* Better handling of native menu bar

* Explicitly set menu bar roles for macOS

* Enable system tray for macOS

* Change CFBundleName to Hydrus

* Bump pyoxidizer version and use python 3.10 for macOS build

* Fix minimize to system tray option text

* Use square hydrus SVG for help menu

* Default do_macos_debug_dialog_menus to False

* Remove commented code for menu roles
This commit is contained in:
Paul Friederichsen 2024-02-17 14:25:39 -06:00 committed by GitHub
parent 6ace03f784
commit 518376ef2b
No account linked to committer's email address
12 changed files with 30 additions and 40 deletions

View File

@ -25,7 +25,7 @@ jobs:
mkdocs build -d help
-
name: Install PyOxidizer
run: python3 -m pip install pyoxidizer==0.22.0
run: python3 -m pip install pyoxidizer==0.24.0
-
name: Download ffmpeg
uses: carlosperate/download-file-action@v2

2
.gitignore vendored
View File

@ -82,3 +82,5 @@ venv.bak/
# docs builds
/site/
/help/
.DS_Store

View File

@ -618,7 +618,7 @@ class GlobalIcons( object ):
def _Initialise( self ):
self.hydrus = QG.QIcon( os.path.join( HC.STATIC_DIR, 'hydrus_black.svg' ) )
self.hydrus = QG.QIcon( os.path.join( HC.STATIC_DIR, 'hydrus_black_square.svg' ) )
self.github = QG.QIcon( os.path.join( HC.STATIC_DIR, 'github.svg' ) )
self.twitter = QG.QIcon( os.path.join( HC.STATIC_DIR, 'twitter.svg' ) )
self.tumblr = QG.QIcon( os.path.join( HC.STATIC_DIR, 'tumblr.svg' ) )

View File

@ -272,7 +272,7 @@ class ClientOptions( HydrusSerialisable.SerialisableBase ):
self._dictionary[ 'booleans' ][ 'remember_last_advanced_file_deletion_reason' ] = True
self._dictionary[ 'booleans' ][ 'remember_last_advanced_file_deletion_special_action' ] = False
self._dictionary[ 'booleans' ][ 'do_macos_debug_dialog_menus' ] = True
self._dictionary[ 'booleans' ][ 'do_macos_debug_dialog_menus' ] = False
self._dictionary[ 'booleans' ][ 'save_default_tag_service_tab_on_change' ] = True

View File

@ -2244,10 +2244,12 @@ class FrameGUI( CAC.ApplicationCommandProcessorMixin, ClientGUITopLevelWindows.M
def _InitialiseMenubar( self ):
self._menubar = QW.QMenuBar( self )
self._menubar.setNativeMenuBar( False )
self._menubar = QW.QMenuBar( )
if not self._menubar.isNativeMenuBar():
self._menubar.setParent( self )
self._menu_updater_file = self._InitialiseMenubarGetMenuUpdaterFile()
self._menu_updater_database = self._InitialiseMenubarGetMenuUpdaterDatabase()
self._menu_updater_network = self._InitialiseMenubarGetMenuUpdaterNetwork()
@ -3265,19 +3267,19 @@ class FrameGUI( CAC.ApplicationCommandProcessorMixin, ClientGUITopLevelWindows.M
ClientGUIMenus.AppendSeparator( menu )
ClientGUIMenus.AppendMenuItem( menu, 'options', 'Change how the client operates.', self._ManageOptions )
ClientGUIMenus.AppendMenuItem( menu, 'shortcuts', 'Edit the shortcuts your client responds to.', ClientGUIShortcutControls.ManageShortcuts, self )
ClientGUIMenus.AppendMenuItem( menu, 'options', 'Change how the client operates.', self._ManageOptions, role = QW.QAction.MenuRole.PreferencesRole )
ClientGUIMenus.AppendMenuItem( menu, 'shortcuts', 'Edit the shortcuts your client responds to.', ClientGUIShortcutControls.ManageShortcuts, self, role = QW.QAction.MenuRole.ApplicationSpecificRole )
ClientGUIMenus.AppendSeparator( menu )
label = 'minimise to system tray'
if not HC.PLATFORM_WINDOWS:
if not (HC.PLATFORM_WINDOWS or HC.PLATFORM_MACOS):
label += ' (may be buggy/crashy!)'
self._menubar_file_minimise_to_system_tray = ClientGUIMenus.AppendMenuItem( menu, label, 'Hide the client to an icon on your system tray.', self._FlipShowHideWholeUI )
self._menubar_file_minimise_to_system_tray = ClientGUIMenus.AppendMenuItem( menu, label, 'Hide the client to an icon on your system tray.', self._FlipShowHideWholeUI, role = QW.QAction.MenuRole.ApplicationSpecificRole )
ClientGUIMenus.AppendSeparator( menu )
@ -3285,12 +3287,12 @@ class FrameGUI( CAC.ApplicationCommandProcessorMixin, ClientGUITopLevelWindows.M
if not we_borked_linux_pyinstaller:
ClientGUIMenus.AppendMenuItem( menu, 'restart', 'Shut the client down and then start it up again.', self.TryToExit, restart = True )
ClientGUIMenus.AppendMenuItem( menu, 'restart', 'Shut the client down and then start it up again.', self.TryToExit, role = QW.QAction.MenuRole.ApplicationSpecificRole, restart = True )
ClientGUIMenus.AppendMenuItem( menu, 'exit and force shutdown maintenance', 'Shut the client down and force any outstanding shutdown maintenance to run.', self.TryToExit, force_shutdown_maintenance = True )
ClientGUIMenus.AppendMenuItem( menu, 'exit and force shutdown maintenance', 'Shut the client down and force any outstanding shutdown maintenance to run.', self.TryToExit, role = QW.QAction.MenuRole.ApplicationSpecificRole, force_shutdown_maintenance = True )
ClientGUIMenus.AppendMenuItem( menu, 'exit', 'Shut the client down.', self.TryToExit )
ClientGUIMenus.AppendMenuItem( menu, 'exit', 'Shut the client down.', self.TryToExit, role = QW.QAction.MenuRole.QuitRole )
return ( menu, '&file' )
@ -3471,8 +3473,8 @@ class FrameGUI( CAC.ApplicationCommandProcessorMixin, ClientGUITopLevelWindows.M
ClientGUIMenus.AppendSeparator( menu )
ClientGUIMenus.AppendMenuItem( menu, 'about Qt', 'See information about the Qt framework.', QW.QMessageBox.aboutQt, self )
ClientGUIMenus.AppendMenuItem( menu, 'about', 'See this client\'s version and other information.', self._AboutWindow )
ClientGUIMenus.AppendMenuItem( menu, 'about Qt', 'See information about the Qt framework.', QW.QMessageBox.aboutQt, self, role = QW.QAction.MenuRole.AboutQtRole )
ClientGUIMenus.AppendMenuItem( menu, 'about', 'See this client\'s version and other information.', self._AboutWindow, role = QW.QAction.MenuRole.AboutRole )
return ( menu, '&help' )
@ -6790,7 +6792,7 @@ The password is cleartext here but obscured in the entry dialog. Enter a blank p
def _UpdateSystemTrayIcon( self, currently_booting = False ):
if not ClientGUISystemTray.SystemTrayAvailable() or ( not HC.PLATFORM_WINDOWS and not CG.client_controller.new_options.GetBoolean( 'advanced_mode' ) ):
if not ClientGUISystemTray.SystemTrayAvailable() or ( not (HC.PLATFORM_WINDOWS or HC.PLATFORM_MACOS) and not CG.client_controller.new_options.GetBoolean( 'advanced_mode' ) ):
return

View File

@ -28,11 +28,6 @@ def AppendMenuIconItem( menu: QW.QMenu, label: str, description: str, icon: QG.Q
menu_item = QW.QAction( menu )
if HC.PLATFORM_MACOS:
menu_item.setMenuRole( QW.QAction.ApplicationSpecificRole )
SetMenuTexts( menu_item, label, description )
menu_item.setIcon( icon )
@ -53,11 +48,6 @@ def AppendMenuCheckItem( menu, label, description, initial_value, callable, *arg
menu_item = QW.QAction( menu )
if HC.PLATFORM_MACOS:
menu_item.setMenuRole( QW.QAction.ApplicationSpecificRole )
SetMenuTexts( menu_item, label, description )
menu_item.setCheckable( True )
@ -69,14 +59,14 @@ def AppendMenuCheckItem( menu, label, description, initial_value, callable, *arg
return menu_item
def AppendMenuItem( menu, label, description, callable, *args, **kwargs ):
def AppendMenuItem( menu, label, description, callable, *args, role: QW.QAction.MenuRole = None, **kwargs ):
menu_item = QW.QAction( menu )
if HC.PLATFORM_MACOS:
menu_item.setMenuRole( QW.QAction.ApplicationSpecificRole )
menu_item.setMenuRole( role if role is not None else QW.QAction.MenuRole.NoRole )
SetMenuTexts( menu_item, label, description )
@ -105,11 +95,6 @@ def AppendMenuLabel( menu, label, description = '', copy_text = '' ):
menu_item = QW.QAction( menu )
if HC.PLATFORM_MACOS:
menu_item.setMenuRole( QW.QAction.ApplicationSpecificRole )
SetMenuTexts( menu_item, label, description )

View File

@ -179,7 +179,7 @@ class ClientSystemTrayIcon( QW.QSystemTrayIcon ):
def _WasActivated( self, activation_reason ):
if not QP.isValid( self ):
if not QP.isValid( self ) or HC.PLATFORM_MACOS:
return

View File

@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Hydrus Client</string>
<string>Hydrus</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>

View File

@ -1,5 +1,5 @@
def make_dist():
return default_python_distribution( python_version = "3.9" )
return default_python_distribution( python_version = "3.10" )
def make_packaging_policy(dist):
policy = dist.make_python_packaging_policy()

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2" viewBox="0 0 1000 1000"><path d="M301.334 0v678.8l-6.267-.8c-15.2-1.734-19.067-2.4-30.4-4.934-47.467-10.533-79.467-35.466-96-74.666-4.133-9.6-8.8-24.267-10.8-33.467-2.4-10.933-4.667-23.733-5.333-29.467-.4-3.733-1.067-8.266-1.334-10.133-1.866-10.667-2.533-52.267-2.533-171.6V220H0v25.333l3.734.8c24.666 5.467 41.2 17.067 46.666 32.8 6 17.067 7.2 31.334 7.734 89.734.933 93.2 1.733 145.199 2.4 149.999.266 2.534.933 7.6 1.333 11.334 1.067 8 2.8 18.266 5.6 33.466.267 1.467 2.4 9.067 4.667 16.667 18 60.667 52.533 98.267 110.666 120.533 29.467 11.334 72 18.534 114.267 19.2l4.267.134v213.333h85.333V720l3.066-.134c15.6-.666 32.534-1.866 44.934-3.2 28.8-3.333 58.666-12 84.666-24.666 50.667-24.934 82-65.867 98-128.134 1.6-6.133 3.2-12.666 3.467-14.533.4-1.867 1.2-6.4 1.867-10 .666-3.733 1.6-9.333 2-12.667.533-3.333 1.066-7.866 1.466-10 2-14.133 2.534-32 3.867-150.666.267-30.8.8-57.867 1.2-60 .267-2.267 1.067-7.333 1.467-11.333 3.2-25.6 12.8-36.134 42-45.734l12.666-4.266L687.2 234c-.133-5.867-.267-11.467-.4-12.4-.133-1.333-15.333-1.6-73.733-1.333l-73.6.4L539.333 358c-.133 75.467-.666 142.4-1.2 148.666-2.133 23.067-2.666 27.067-4.933 40.667-.8 4.4-1.733 9.467-2 11.333-1.2 6.267-7.2 27.334-9.733 34.134-7.6 19.6-15.067 31.6-28 44.266-19.067 18.8-42.534 29.734-80.134 37.467-6.933 1.333-15.866 2.933-19.6 3.333l-7.066.8V0h-85.333Z" style="fill-rule:nonzero" transform="translate(131.786) scale(1.07143)"/></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

View File

@ -128,12 +128,12 @@ This is the Command Palette (default Ctrl+P), and specifically the background co
QLocatorResultWidget#selectedLocatorResult
{
background-color: #006ffa
background-color: palette(highlight);
}
QLocatorResultWidget QWidget
{
background: transparent
background: transparent;
}
@ -169,5 +169,5 @@ We hack it with hardcoded 'style' attribute in the html in python code.
QLabel#HydrusHyperlink
{
qproperty-link_color: #0000ff;
qproperty-link_color: palette(link);
}