| @@ -21,6 +21,3 @@ Claudia: | |||
| PatchCanvas: | |||
| - Implement export to Catarina file | |||
| Systray: | |||
| - Implement hide-on-close | |||
| @@ -7,7 +7,7 @@ | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>739</width> | |||
| <height>549</height> | |||
| <height>529</height> | |||
| </rect> | |||
| </property> | |||
| <property name="windowTitle"> | |||
| @@ -515,7 +515,7 @@ | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>366</width> | |||
| <height>120</height> | |||
| <height>100</height> | |||
| </rect> | |||
| </property> | |||
| <attribute name="label"> | |||
| @@ -663,7 +663,7 @@ | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>366</width> | |||
| <height>117</height> | |||
| <height>97</height> | |||
| </rect> | |||
| </property> | |||
| <attribute name="label"> | |||
| @@ -804,7 +804,7 @@ | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>366</width> | |||
| <height>117</height> | |||
| <height>97</height> | |||
| </rect> | |||
| </property> | |||
| <attribute name="label"> | |||
| @@ -1511,7 +1511,7 @@ | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>76</width> | |||
| <width>94</width> | |||
| <height>76</height> | |||
| </rect> | |||
| </property> | |||
| @@ -1529,7 +1529,7 @@ | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>89</width> | |||
| <width>94</width> | |||
| <height>76</height> | |||
| </rect> | |||
| </property> | |||
| @@ -1547,7 +1547,7 @@ | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>89</width> | |||
| <width>94</width> | |||
| <height>76</height> | |||
| </rect> | |||
| </property> | |||
| @@ -1565,7 +1565,7 @@ | |||
| <rect> | |||
| <x>0</x> | |||
| <y>0</y> | |||
| <width>89</width> | |||
| <width>94</width> | |||
| <height>76</height> | |||
| </rect> | |||
| </property> | |||
| @@ -2066,14 +2066,6 @@ Default is off</string> | |||
| </item> | |||
| </layout> | |||
| </widget> | |||
| <action name="act_quit"> | |||
| <property name="text"> | |||
| <string>&Quit</string> | |||
| </property> | |||
| <property name="shortcut"> | |||
| <string>Ctrl+Q</string> | |||
| </property> | |||
| </action> | |||
| </widget> | |||
| <customwidgets> | |||
| <customwidget> | |||
| @@ -2087,22 +2079,6 @@ Default is off</string> | |||
| <include location="../resources.qrc"/> | |||
| </resources> | |||
| <connections> | |||
| <connection> | |||
| <sender>act_quit</sender> | |||
| <signal>triggered()</signal> | |||
| <receiver>CadenceMainW</receiver> | |||
| <slot>close()</slot> | |||
| <hints> | |||
| <hint type="sourcelabel"> | |||
| <x>-1</x> | |||
| <y>-1</y> | |||
| </hint> | |||
| <hint type="destinationlabel"> | |||
| <x>399</x> | |||
| <y>299</y> | |||
| </hint> | |||
| </hints> | |||
| </connection> | |||
| <connection> | |||
| <sender>tw_tweaks</sender> | |||
| <signal>currentCellChanged(int,int,int,int)</signal> | |||
| @@ -2052,11 +2052,6 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
| if geometry: | |||
| self.restoreGeometry(self.settings.value("Geometry", "")) | |||
| self.m_savedSettings = { | |||
| "Main/UseSystemTray": self.settings.value("Main/UseSystemTray", True, type=bool), | |||
| "Main/CloseToTray": self.settings.value("Main/CloseToTray", True, type=bool) | |||
| } | |||
| self.cb_jack_autostart.setChecked(GlobalSettings.value("JACK/AutoStart", True, type=bool)) | |||
| self.cb_a2j_autostart.setChecked(GlobalSettings.value("A2J/AutoStart", True, type=bool)) | |||
| self.cb_pulse_autostart.setChecked(GlobalSettings.value("Pulse2JACK/AutoStart", havePulseAudio, type=bool)) | |||
| @@ -2097,8 +2092,7 @@ class CadenceMainW(QMainWindow, ui_cadence.Ui_CadenceMainW): | |||
| def closeEvent(self, event): | |||
| self.saveSettings() | |||
| self.systray.close() | |||
| QMainWindow.closeEvent(self, event) | |||
| self.systray.handleQtCloseEvent(event) | |||
| #--------------- main ------------------ | |||
| if __name__ == '__main__': | |||
| @@ -2494,11 +2494,10 @@ class ClaudiaMainW(QMainWindow, ui_claudia.Ui_ClaudiaMainW): | |||
| def closeEvent(self, event): | |||
| self.saveSettings() | |||
| if self.systray: | |||
| #if self.saved_settings["Main/CloseToTray"] and self.systray.isTrayAvailable() and self.isVisible(): | |||
| #self.hide() | |||
| #self.systray.setActionText("show", QStringStr(gui.tr("Restore"))) | |||
| #event.ignore() | |||
| #return | |||
| if self.m_savedSettings["Main/CloseToTray"]: | |||
| if self.systray.handleQtCloseEvent(event): | |||
| patchcanvas.clear() | |||
| return | |||
| self.systray.close() | |||
| patchcanvas.clear() | |||
| QMainWindow.closeEvent(self, event) | |||
| @@ -2542,10 +2541,10 @@ if __name__ == '__main__': | |||
| setUpSignals(gui) | |||
| # App-Loop | |||
| #if gui.systray: | |||
| #ret = gui.systray.exec_(app) | |||
| #else: | |||
| ret = app.exec_() | |||
| if gui.systray: | |||
| ret = gui.systray.exec_(app) | |||
| else: | |||
| ret = app.exec_() | |||
| # Close Jack | |||
| if jack.client: | |||
| @@ -19,7 +19,7 @@ | |||
| # Imports (Global) | |||
| import os, sys | |||
| from PyQt4.QtCore import QTimer, SIGNAL | |||
| from PyQt4.QtGui import QAction, QIcon, QMenu, QSystemTrayIcon | |||
| from PyQt4.QtGui import QAction, QIcon, QMainWindow, QMenu, QSystemTrayIcon | |||
| try: | |||
| if os.getenv("DESKTOP_SESSION") in ("ubuntu", "ubuntu-2d") and not os.path.exists("/var/cadence/no_app_indicators"): | |||
| @@ -81,6 +81,7 @@ class GlobalSysTray(object): | |||
| def __init__(self, parent, name, icon): | |||
| object.__init__(self) | |||
| self._app = None | |||
| self._parent = parent | |||
| self._gtk_running = False | |||
| self._quit_added = False | |||
| @@ -491,6 +492,17 @@ class GlobalSysTray(object): | |||
| else: | |||
| return False | |||
| def handleQtCloseEvent(self, event): | |||
| if self.isTrayAvailable() and self._parent.isVisible(): | |||
| event.ignore() | |||
| self.__hideShowCall() | |||
| return False | |||
| else: | |||
| self.close() | |||
| QMainWindow.closeEvent(self._parent, event) | |||
| return True | |||
| # ------------------------------------------------------------------------------------------- | |||
| def show(self): | |||
| @@ -531,6 +543,7 @@ class GlobalSysTray(object): | |||
| self.menu.close() | |||
| def exec_(self, app): | |||
| self._app = app | |||
| if TrayEngine == "AppIndicator": | |||
| self._gtk_running = True | |||
| return Gtk.main() | |||
| @@ -616,6 +629,10 @@ class GlobalSysTray(object): | |||
| if self._parent.isVisible(): | |||
| self.setActionText("show", self._parent.tr("Restore")) | |||
| self._parent.hide() | |||
| if self._app: | |||
| self._app.setQuitOnLastWindowClosed(False) | |||
| else: | |||
| self.setActionText("show", self._parent.tr("Minimize")) | |||
| @@ -624,9 +641,16 @@ class GlobalSysTray(object): | |||
| else: | |||
| self._parent.showNormal() | |||
| QTimer.singleShot(100, self.__raiseWindow) | |||
| if self._app: | |||
| self._app.setQuitOnLastWindowClosed(True) | |||
| QTimer.singleShot(500, self.__raiseWindow) | |||
| def __quitCall(self): | |||
| if self._app: | |||
| self._app.setQuitOnLastWindowClosed(True) | |||
| self._parent.hide() | |||
| self._parent.close() | |||
| def __raiseWindow(self): | |||