示例#1
0
 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)
示例#2
0
文件: tahoe.py 项目: exarkun/gridsync
 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)
示例#3
0
 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...")
示例#4
0
 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...")
示例#5
0
    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)
示例#6
0
 def on_checkbox_minimize_changed(state):
     if state:
         set_preference("startup", "minimize", "true")
     else:
         set_preference("startup", "minimize", "false")
示例#7
0
 def on_checkbox_invite_changed(state):
     if state:
         set_preference("notifications", "invite", "true")
     else:
         set_preference("notifications", "invite", "false")
示例#8
0
 def on_checkbox_folder_changed(state):
     if state:
         set_preference("notifications", "folder", "true")
     else:
         set_preference("notifications", "folder", "false")
示例#9
0
 def on_checkbox_connection_changed(state):
     if state:
         set_preference("notifications", "connection", "true")
     else:
         set_preference("notifications", "connection", "false")
示例#10
0
 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')
示例#11
0
 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')
示例#12
0
 def on_checkbox_minimize_changed(state):
     if state:
         set_preference('startup', 'minimize', 'true')
     else:
         set_preference('startup', 'minimize', 'false')
示例#13
0
 def on_checkbox_invite_changed(state):
     if state:
         set_preference('notifications', 'invite', 'true')
     else:
         set_preference('notifications', 'invite', 'false')
示例#14
0
 def on_checkbox_folder_changed(state):
     if state:
         set_preference('notifications', 'folder', 'true')
     else:
         set_preference('notifications', 'folder', 'false')
示例#15
0
 def on_checkbox_connection_changed(state):
     if state:
         set_preference('notifications', 'connection', 'true')
     else:
         set_preference('notifications', 'connection', 'false')