コード例 #1
0
 def load_preferences(self):
     if get_preference("notifications", "connection") == "true":
         self.checkbox_connection.setCheckState(Qt.Checked)
     else:
         self.checkbox_connection.setCheckState(Qt.Unchecked)
     if get_preference("notifications", "folder") == "false":
         self.checkbox_folder.setCheckState(Qt.Unchecked)
     else:
         self.checkbox_folder.setCheckState(Qt.Checked)
     if get_preference("notifications", "invite") == "false":
         self.checkbox_invite.setCheckState(Qt.Unchecked)
     else:
         self.checkbox_invite.setCheckState(Qt.Checked)
コード例 #2
0
ファイル: preferences.py プロジェクト: rustforfuture/gridsync
 def load_preferences(self):
     if get_preference('notifications', 'connection') == 'false':
         self.checkbox_connection.setCheckState(Qt.Unchecked)
     else:
         self.checkbox_connection.setCheckState(Qt.Checked)
     if get_preference('notifications', 'folder') == 'false':
         self.checkbox_folder.setCheckState(Qt.Unchecked)
     else:
         self.checkbox_folder.setCheckState(Qt.Checked)
     if get_preference('notifications', 'invite') == 'false':
         self.checkbox_invite.setCheckState(Qt.Unchecked)
     else:
         self.checkbox_invite.setCheckState(Qt.Checked)
コード例 #3
0
ファイル: core.py プロジェクト: probonopd/gridsync
 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
ファイル: core.py プロジェクト: ChiNeSeFree/gridsync
 def start_gateways(self):
     nodedirs = get_nodedirs(config_dir)
     if nodedirs:
         minimize_preference = get_preference('startup', 'minimize')
         if not minimize_preference or minimize_preference == 'false':
             self.gui.show_main_window()
         yield self.select_executable()
         tor_available = yield get_tor(reactor)
         logging.debug("Starting Tahoe-LAFS gateway(s)...")
         for nodedir in nodedirs:
             gateway = Tahoe(nodedir, executable=self.executable)
             tcp = gateway.config_get('connections', 'tcp')
             if tcp == 'tor' and not tor_available:
                 msg.error(
                     self.gui.main_window, "Error Connecting To Tor Daemon",
                     'The "{}" connection is configured to use Tor, '
                     'however, no running tor daemon was found.\n\n'
                     'This connection will be disabled until you launch '
                     'Tor again.'.format(gateway.name))
             self.gateways.append(gateway)
             d = gateway.start()
             d.addCallback(gateway.ensure_folder_links)
         self.gui.populate(self.gateways)
     else:
         self.gui.show_welcome_dialog()
         yield self.select_executable()
コード例 #5
0
ファイル: share.py プロジェクト: ChiNeSeFree/gridsync
    def on_send_completed(self):
        self.box.hide()
        self.progress_bar.show()
        self.progress_bar.setValue(2)
        self.checkmark.show()
        self.close_button.setText("Finish")
        if self.folder_names:
            target = self.folder_names_humanized
        else:
            target = self.gateway.name
        text = "Your invitation to {} was accepted".format(target)
        self.subtext_label.setText("Invite successful!\n {} at {}".format(
            text,
            datetime.now().strftime('%H:%M')))
        if get_preference('notifications', 'invite') != 'false':
            self.gui.show_message("Invite successful", text)

        # XXX FIXME Quick and dirty hack for user-testing
        if self.folder_names:
            for view in self.gui.main_window.central_widget.views:
                if view.gateway.name == self.gateway.name:
                    for folder in self.folder_names:
                        # Add two members for now, in case the original folder
                        # was empty (in which case the original "syncing"
                        # operation would not have occured and thus "admin"'s
                        # membership would not have been detected).
                        # FIXME Force call a Monitor.do_remote_scan() instead?
                        view.model().add_member(folder, None)
                        view.model().add_member(folder, None)
                        view.model().set_status_shared(folder)
コード例 #6
0
ファイル: core.py プロジェクト: miguelramosfdz/gridsync
 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...")
コード例 #7
0
ファイル: share.py プロジェクト: miguelramosfdz/gridsync
    def on_send_completed(self):
        self.box.hide()
        self.progress_bar.show()
        self.progress_bar.setValue(2)
        self.checkmark.show()
        self.close_button.setText("Finish")
        if self.folder_names:
            target = self.folder_names_humanized
        else:
            target = self.gateway.name
        text = "Your invitation to {} was accepted".format(target)
        self.subtext_label.setText(
            "Invite successful!\n {} at {}".format(
                text, datetime.now().strftime("%H:%M")
            )
        )
        if get_preference("notifications", "invite") != "false":
            self.gui.show_message("Invite successful", text)

        if self.folder_names:
            for view in self.gui.main_window.central_widget.views:
                if view.gateway.name == self.gateway.name:
                    for folder in self.folder_names:
                        # Immediately tell the Model that there are at least 2
                        # members for this folder, i.e., that it is now shared
                        view.model().on_members_updated(folder, [None, None])
コード例 #8
0
 def load_preferences(self):
     if get_preference("startup", "minimize") == "true":
         self.checkbox_minimize.setCheckState(Qt.Checked)
     else:
         self.checkbox_minimize.setCheckState(Qt.Unchecked)
     if autostart_is_enabled():
         self.checkbox_autostart.setCheckState(Qt.Checked)
     else:
         self.checkbox_autostart.setCheckState(Qt.Unchecked)
コード例 #9
0
ファイル: model.py プロジェクト: ChiNeSeFree/gridsync
 def on_updated_files(self, folder_name, files_list, action, author):
     if get_preference('notifications', 'folder') != 'false':
         self.gui.show_message(
             folder_name + " folder updated",
             "{} {}".format(
                 author + " " + action if author else action.capitalize(),
                 humanized_list(files_list)
             )
         )
コード例 #10
0
ファイル: preferences.py プロジェクト: rustforfuture/gridsync
 def load_preferences(self):
     if get_preference('startup', 'minimize') == 'true':
         self.checkbox_minimize.setCheckState(Qt.Checked)
     else:
         self.checkbox_minimize.setCheckState(Qt.Unchecked)
     if autostart_is_enabled():
         self.checkbox_autostart.setCheckState(Qt.Checked)
     else:
         self.checkbox_autostart.setCheckState(Qt.Unchecked)
コード例 #11
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)
コード例 #12
0
 def load_preferences(self):
     if get_preference('notifications', 'connection') == 'false':
         self.checkbox_connection.setCheckState(Qt.Unchecked)
     else:
         self.checkbox_connection.setCheckState(Qt.Checked)
     if get_preference('notifications', 'folder') == 'false':
         self.checkbox_folder.setCheckState(Qt.Unchecked)
     else:
         self.checkbox_folder.setCheckState(Qt.Checked)
     if get_preference('notifications', 'invite') == 'false':
         self.checkbox_invite.setCheckState(Qt.Unchecked)
     else:
         self.checkbox_invite.setCheckState(Qt.Checked)
     if get_preference('startup', 'minimize') == 'true':
         self.checkbox_minimize.setCheckState(Qt.Checked)
     else:
         self.checkbox_minimize.setCheckState(Qt.Unchecked)
     if autostart_is_enabled():
         self.checkbox_autostart.setCheckState(Qt.Checked)
     else:
         self.checkbox_autostart.setCheckState(Qt.Unchecked)
コード例 #13
0
 def on_send_completed(self):
     self.box.hide()
     self.progress_bar.show()
     self.progress_bar.setValue(2)
     self.checkmark.show()
     self.close_button.setText("Finish")
     if self.folder_names:
         target = self.folder_names_humanized
     else:
         target = self.gateway.name
     text = "Your invitation to {} was accepted".format(target)
     self.subtext_label.setText("Invite successful!\n {} at {}".format(
         text,
         datetime.now().strftime('%H:%M')))
     if get_preference('notifications', 'invite') != 'false':
         self.gui.show_message("Invite successful", text)
コード例 #14
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)
コード例 #15
0
ファイル: tahoe.py プロジェクト: miguelramosfdz/gridsync
    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)
コード例 #16
0
ファイル: core.py プロジェクト: miguelramosfdz/gridsync
 def start_gateways(self):
     nodedirs = get_nodedirs(config_dir)
     if nodedirs:
         minimize_preference = get_preference("startup", "minimize")
         if not minimize_preference or minimize_preference == "false":
             self.gui.show_main_window()
         yield self.select_executable()
         tor_available = yield get_tor(reactor)
         logging.debug("Starting Tahoe-LAFS gateway(s)...")
         for nodedir in nodedirs:
             gateway = Tahoe(nodedir, executable=self.executable)
             tcp = gateway.config_get("connections", "tcp")
             if tcp == "tor" and not tor_available:
                 logging.error("No running tor daemon found")
                 msg.error(
                     self.gui.main_window,
                     "Error Connecting To Tor Daemon",
                     'The "{}" connection is configured to use Tor, '
                     "however, no running tor daemon was found.\n\n"
                     "This connection will be disabled until you launch "
                     "Tor again.".format(gateway.name),
                 )
             self.gateways.append(gateway)
             d = gateway.start()
             d.addCallback(gateway.ensure_folder_links)
         self.gui.populate(self.gateways)
     else:
         self.gui.show_welcome_dialog()
         yield self.select_executable()
     try:
         yield self.get_tahoe_version()
     except Exception as e:  # pylint: disable=broad-except
         logging.critical("Error getting Tahoe-LAFS version")
         msg.critical(
             "Error getting Tahoe-LAFS version",
             "{}: {}".format(type(e).__name__, str(e)),
         )
         reactor.stop()
コード例 #17
0
ファイル: core.py プロジェクト: testimx62/gridsync
 def start_gateways(self):
     nodedirs = get_nodedirs(config_dir)
     if nodedirs:
         minimize_preference = get_preference('startup', 'minimize')
         if not minimize_preference or minimize_preference == 'false':
             self.gui.show_main_window()
         yield self.select_executable()
         logging.debug("Starting Tahoe-LAFS gateway(s)...")
         for nodedir in nodedirs:
             gateway = Tahoe(
                 nodedir,
                 executable=self.executable,
                 multi_folder_support=self.multi_folder_support
             )
             self.gateways.append(gateway)
             d = gateway.start()
             d.addCallback(gateway.ensure_folder_links)
         self.gui.populate(self.gateways)
     else:
         defaults = settings['default']
         if defaults['provider_name']:
             nodedir = os.path.join(config_dir, defaults['provider_name'])
             yield self.select_executable()
             gateway = Tahoe(
                 nodedir,
                 executable=self.executable,
                 multi_folder_support=self.multi_folder_support
             )
             self.gateways.append(gateway)
             # TODO: Show setup progress dialog
             yield gateway.create_client(**defaults)
             gateway.start()
             self.gui.populate(self.gateways)
         else:
             self.gui.show_welcome_dialog()
             yield self.select_executable()
コード例 #18
0
ファイル: model.py プロジェクト: miguelramosfdz/gridsync
 def on_disconnected(self):
     if get_preference("notifications", "connection") == "true":
         self.gui.show_message(
             self.gateway.name,
             "Disconnected from {}".format(self.gateway.name),
         )
コード例 #19
0
 def on_updated_files(self, folder_name, files_list):
     if get_preference('notifications', 'folder') != 'false':
         self.gui.show_message(folder_name + " updated and encrypted",
                               "Updated " + humanized_list(files_list))
コード例 #20
0
 def on_disconnected(self, grid_name):
     if get_preference('notifications', 'connection') != 'false':
         self.gui.show_message(grid_name,
                               "Disconnected from {}".format(grid_name))
コード例 #21
0
 def on_connected(self):
     if get_preference('notifications', 'connection') != 'false':
         self.gui.show_message(self.gateway.name,
                               "Connected to {}".format(self.gateway.name))
コード例 #22
0
 def on_disconnected(self):
     if get_preference('notifications', 'connection') == 'true':
         self.gui.show_message(
             self.gateway.name,
             "Disconnected from {}".format(self.gateway.name))