def restart(self): log.debug("Restarting %s client...", self.name) # Temporarily disable desktop notifications for (dis)connect events pref = get_preference('notifications', 'connection') set_preference('notifications', 'connection', 'false') yield self.stop() yield self.start() yield self.await_ready() yield deferLater(reactor, 1, lambda: None) set_preference('notifications', 'connection', pref) log.debug("Finished restarting %s client.", self.name)
def restart(self): log.debug("Restarting %s client...", self.name) if self.state in (Tahoe.STOPPING, Tahoe.STARTING): log.warning( 'Aborting restart operation; ' 'the "%s" client is already (re)starting', self.name) return # Temporarily disable desktop notifications for (dis)connect events pref = get_preference('notifications', 'connection') set_preference('notifications', 'connection', 'false') yield self.stop() yield self.start() yield self.await_ready() yield deferLater(reactor, 1, lambda: None) set_preference('notifications', 'connection', pref) log.debug("Finished restarting %s client.", self.name)
def show_message(): message_settings = settings.get('message') if not message_settings: return if get_preference('message', 'suppress') == 'true': return logging.debug("Showing custom message to user...") msgbox = QMessageBox() icon_type = message_settings.get('type') if icon_type: icon_type = icon_type.lower() if icon_type == 'information': msgbox.setIcon(QMessageBox.Information) elif icon_type == 'warning': msgbox.setIcon(QMessageBox.Warning) elif icon_type == 'critical': msgbox.setIcon(QMessageBox.Critical) if sys.platform == 'darwin': msgbox.setText(message_settings.get('title')) msgbox.setInformativeText(message_settings.get('text')) else: msgbox.setWindowTitle(message_settings.get('title')) msgbox.setText(message_settings.get('text')) checkbox = QCheckBox("Do not show this message again") checkbox.stateChanged.connect(lambda state: set_preference( 'message', 'suppress', ('true' if state else 'false'))) msgbox.setCheckBox(checkbox) msgbox.exec_() logging.debug("Custom message closed; proceeding with start...")
def show_message(): message_settings = settings.get("message") if not message_settings: return if get_preference("message", "suppress") == "true": return logging.debug("Showing custom message to user...") msgbox = QMessageBox() icon_type = message_settings.get("type") if icon_type: icon_type = icon_type.lower() if icon_type == "information": msgbox.setIcon(QMessageBox.Information) elif icon_type == "warning": msgbox.setIcon(QMessageBox.Warning) elif icon_type == "critical": msgbox.setIcon(QMessageBox.Critical) if sys.platform == "darwin": msgbox.setText(message_settings.get("title")) msgbox.setInformativeText(message_settings.get("text")) else: msgbox.setWindowTitle(message_settings.get("title")) msgbox.setText(message_settings.get("text")) checkbox = QCheckBox("Do not show this message again") checkbox.stateChanged.connect(lambda state: set_preference( "message", "suppress", ("true" if state else "false"))) msgbox.setCheckBox(checkbox) msgbox.exec_() logging.debug("Custom message closed; proceeding with start...")
def restart(self): from twisted.internet import reactor log.debug("Restarting %s client...", self.name) if self.state in (Tahoe.STOPPING, Tahoe.STARTING): log.warning( "Aborting restart operation; " 'the "%s" client is already (re)starting', self.name, ) return # Temporarily disable desktop notifications for (dis)connect events pref = get_preference("notifications", "connection") set_preference("notifications", "connection", "false") yield self.stop() yield self.start() yield self.await_ready() yield deferLater(reactor, 1, lambda: None) set_preference("notifications", "connection", pref) log.debug("Finished restarting %s client.", self.name)
def on_checkbox_minimize_changed(state): if state: set_preference("startup", "minimize", "true") else: set_preference("startup", "minimize", "false")
def on_checkbox_invite_changed(state): if state: set_preference("notifications", "invite", "true") else: set_preference("notifications", "invite", "false")
def on_checkbox_folder_changed(state): if state: set_preference("notifications", "folder", "true") else: set_preference("notifications", "folder", "false")
def on_checkbox_connection_changed(state): if state: set_preference("notifications", "connection", "true") else: set_preference("notifications", "connection", "false")
def on_checkbox_invite_changed(self, state): # pylint:disable=no-self-use if state: set_preference('notifications', 'invite', 'true') else: set_preference('notifications', 'invite', 'false')
def on_checkbox_minimize_changed(self, state): # pylint:disable=no-self-use if state: set_preference('startup', 'minimize', 'true') else: set_preference('startup', 'minimize', 'false')
def on_checkbox_minimize_changed(state): if state: set_preference('startup', 'minimize', 'true') else: set_preference('startup', 'minimize', 'false')
def on_checkbox_invite_changed(state): if state: set_preference('notifications', 'invite', 'true') else: set_preference('notifications', 'invite', 'false')
def on_checkbox_folder_changed(state): if state: set_preference('notifications', 'folder', 'true') else: set_preference('notifications', 'folder', 'false')
def on_checkbox_connection_changed(state): if state: set_preference('notifications', 'connection', 'true') else: set_preference('notifications', 'connection', 'false')