diff options
author | Rael <rael.gc@gmail.com> | 2015-09-30 09:01:00 -0300 |
---|---|---|
committer | Rael <rael.gc@gmail.com> | 2015-09-30 09:01:00 -0300 |
commit | b357373f0e9ee9e7b5c44c26e73f7c485a5b336e (patch) | |
tree | 740a5f98284cfd2ae9044b8f0dfbd84868fef1d4 | |
parent | c4ce0374efe4ea4b311289116a68ea8d0e1c4195 (diff) | |
download | scudcloud-b357373f0e9ee9e7b5c44c26e73f7c485a5b336e.zip scudcloud-b357373f0e9ee9e7b5c44c26e73f7c485a5b336e.tar.gz scudcloud-b357373f0e9ee9e7b5c44c26e73f7c485a5b336e.tar.bz2 |
Listening for resume event
-rw-r--r-- | scudcloud-1.0/debian/control | 1 | ||||
-rwxr-xr-x | scudcloud-1.0/lib/scudcloud.py | 17 | ||||
-rwxr-xr-x | scudcloud-1.0/scudcloud | 2 |
3 files changed, 19 insertions, 1 deletions
diff --git a/scudcloud-1.0/debian/control b/scudcloud-1.0/debian/control index d25cae5..b4ed8f9 100644 --- a/scudcloud-1.0/debian/control +++ b/scudcloud-1.0/debian/control @@ -11,6 +11,7 @@ Architecture: all Depends: libqtwebkit4 (>= 2.3.2), python3, python3-dbus, + python3-dbus.mainloop.qt, python3-pyqt4, xdg-utils, ${misc:Depends} diff --git a/scudcloud-1.0/lib/scudcloud.py b/scudcloud-1.0/lib/scudcloud.py index debc808..3385035 100755 --- a/scudcloud-1.0/lib/scudcloud.py +++ b/scudcloud-1.0/lib/scudcloud.py @@ -14,6 +14,13 @@ from PyQt4.QtCore import QUrl, QSettings from PyQt4.QtWebKit import QWebSettings from PyQt4.QtNetwork import QNetworkDiskCache +# Auto-detection of dbus and dbus.mainloop.qt +try: + import dbus + from dbus.mainloop.qt import DBusQtMainLoop +except ImportError: + DBusQtMainLoop = None + # Auto-detection of Unity and Dbusmenu in gi repository try: from gi.repository import Unity, Dbusmenu @@ -63,6 +70,16 @@ class ScudCloud(QtGui.QMainWindow): self.statusBar().showMessage('Loading Slack...') # Starting unread msgs counter self.setupTimer() + # Watch for suspend/resume events + if DBusQtMainLoop is not None: + DBusQtMainLoop(set_as_default=True) + dbus.SystemBus().add_signal_receiver(self.sleep, 'PrepareForSleep', 'org.freedesktop.login1.Manager', 'org.freedesktop.login1') + + def sleep(self, suspended): + # We want the Resume event + if not suspended: + for i in range(0, self.stackedWidget.count()): + self.stackedWidget.widget(i).loadFinished() def addWrapper(self, url): webView = Wrapper(self) diff --git a/scudcloud-1.0/scudcloud b/scudcloud-1.0/scudcloud index 15bf087..7fe14b7 100755 --- a/scudcloud-1.0/scudcloud +++ b/scudcloud-1.0/scudcloud @@ -14,7 +14,7 @@ from qsingleapplication import QSingleApplication # The ScudCloud QMainWindow win = None -VERSION = '1.0.71' +VERSION = '1.0.72' def main(): global win; |