Merge pull request 'Remove deprecated canMinimizeToTray option' (#13) from remove-deprecated-option into master
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Reviewed-on: #13
This commit is contained in:
raoul 2024-09-27 17:33:07 +00:00
commit b96e08436f
2 changed files with 6 additions and 8 deletions

View File

@ -27,11 +27,6 @@ Additional Options
``can_minimize_to_tray`` ``can_minimize_to_tray``
'''''''''''''''''''''''' ''''''''''''''''''''''''
.. important::
This option was changed in version 0.4.0 from ``canMinimizeToTray`` to ``can_minimize_to_tray``. The old option
is still available, but is deprecated. It will be removed in 0.6.0.
To install a system tray icon, and minimize your application to the system tray, simply pass To install a system tray icon, and minimize your application to the system tray, simply pass
``can_minimize_to_tray=True`` to the class and a tray icon will be installed with the necessary menu options. ``can_minimize_to_tray=True`` to the class and a tray icon will be installed with the necessary menu options.
@ -41,6 +36,10 @@ To install a system tray icon, and minimize your application to the system tray,
Clicking on the tray icon will show the window, while right-clicking will show the menu. Clicking on the tray icon will show the window, while right-clicking will show the menu.
.. note::
The `canMinimizeToTray` version of this option was removed in 0.6.0
.. |pypi| image:: https://img.shields.io/pypi/v/WebAppify .. |pypi| image:: https://img.shields.io/pypi/v/WebAppify
:target: https://pypi.org/project/webappify/ :target: https://pypi.org/project/webappify/
.. |license| image:: https://img.shields.io/pypi/l/WebAppify .. |license| image:: https://img.shields.io/pypi/l/WebAppify

View File

@ -209,7 +209,7 @@ class WebApp(QtWidgets.QApplication):
""" """
A generic application to open a web page in a desktop app A generic application to open a web page in a desktop app
""" """
def __init__(self, title, url, icon, can_minimize_to_tray=False, canMinimizeToTray=False): def __init__(self, title, url, icon, can_minimize_to_tray=False):
""" """
Create an application which loads a URL into a window Create an application which loads a URL into a window
""" """
@ -219,8 +219,7 @@ class WebApp(QtWidgets.QApplication):
self.title = title self.title = title
self.url = url self.url = url
self.icon = icon self.icon = icon
self.can_minimize_to_tray = QtWidgets.QSystemTrayIcon.isSystemTrayAvailable() and \ self.can_minimize_to_tray = QtWidgets.QSystemTrayIcon.isSystemTrayAvailable() and can_minimize_to_tray
(can_minimize_to_tray or canMinimizeToTray)
if self.can_minimize_to_tray: if self.can_minimize_to_tray:
self.setQuitOnLastWindowClosed(False) self.setQuitOnLastWindowClosed(False)
self.setWindowIcon(QtGui.QIcon(self.icon)) self.setWindowIcon(QtGui.QIcon(self.icon))