def StatusChanged(self, status): '''Client status has been changed''' client_log.info('[dbus] client status changed: %s' % status) self._status = status # Connect to web server OK if self._status == constants.CLIENT_STATUS_PAGE_READY: self.connected_to_webserver = True # Connect to web server failed elif self._status == constants.CLIENT_STATUS_CONNECT_FAILED: self.Stop() # Peer id is invalid elif self._status == constants.CLIENT_STATUS_UNAVAILABLE: self.Stop() # Connect to remote peer OK elif self._status == constants.CLIENT_STATUS_CONNECT_OK: self.remoting_connected = True # Disconnected, by remote peer or network failed elif self._status == constants.CLIENT_STATUS_DISCONNECTED: notify(_('Remoting service terminated!')) self.Stop()
def StatusChanged(self, status): '''Server status changed''' server_log.info('[dbus] StatusChanged: %s' % status) self._status = status # If failed to connect to web server, stop local service if self._status == constants.SERVER_STATUS_PEERID_FAILED: notify(_('Failed to get access code!')) self.Stop() # Get peeer ID successfully elif self._status == constants.SERVER_STATUS_PEERID_OK: self.connected_to_webserver = True # Show disconnection window elif self._status == constants.SERVER_STATUS_SHARING: self.remoting_connected = True self.disconnect_window = DisconnectWindow() self.disconnect_window.disconnected.connect(self.disconnected) self.disconnect_window.show() # If remote peer has closed remoting connection, terminate local service elif self._status == constants.SERVER_STATUS_DISCONNECTED: notify(_('Remoting service terminated!')) self.Stop()
def StatusChanged(self, status): '''Server status changed''' server_log.info('[dbus] StatusChanged: %s' % status) self._status = status # If failed to connect to web server, stop local service if self._status == constants.SERVER_STATUS_PEERID_FAILED: notify(_('Failed to get access code!')) QtCore.QTimer.singleShot(1000, self.Stop) # Get peeer ID successfully elif self._status == constants.SERVER_STATUS_PEERID_OK: self.connected_to_webserver = True # Show disconnection window elif self._status == constants.SERVER_STATUS_SHARING: self.remoting_connected = True self.disconnect_window = DisconnectWindow() self.disconnect_window.disconnected.connect(self.Stop) self.disconnect_window.show() # If remote peer has closed remoting connection, terminate local service elif self._status == constants.SERVER_STATUS_DISCONNECTED: notify(_('Remoting service terminated!')) QtCore.QTimer.singleShot(1000, self.Stop)
#!/usr/bin/env python3 import sys sys.path.insert(0, '..') from PyQt5 import QtCore from dra_utils.notify import notify app = QtCore.QCoreApplication([]) notify('Hello') app.exec()