def __init__(self, syncdaemon_instance=None):
        Buildable.__init__(self)
        Gtk.Alignment.__init__(self, xscale=1, yscale=1)
        self.add(self.itself)
        self.ops_store = self.builder.get_object('ops_store')
        self._can_clear = False
        self._store_idx = {}

        if syncdaemon_instance is not None:
            self.sd = syncdaemon_instance
        else:
            self.sd = syncdaemon.SyncDaemon()
        self.sd.on_node_ops_changed_callback = self.on_node_ops_changed
        self.sd.on_transfers_callback = self.on_transfers

        self.clear_button.set_sensitive(False)
        self.show_all()
Exemple #2
0
    def __init__(self, syncdaemon_instance=None, builder=None, **kwargs):
        Buildable.__init__(self, builder=builder)

        assert self.root is not None
        assert self.store is not None
        assert self.view is not None

        flags = Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT
        _kwargs = dict(
            flags=flags,
            buttons=((Gtk.STOCK_CLOSE, Gtk.ResponseType.CLOSE))
        )
        Gtk.Dialog.__init__(self, **_kwargs)
        self.set_title(self.title)
        self.close_button = self.get_action_area().get_children()[0]

        kwargs = dict(parent=self,
                      flags=flags,
                      type=Gtk.MessageType.QUESTION,
                      buttons=Gtk.ButtonsType.YES_NO)
        self.confirm_dialog = Gtk.MessageDialog(**kwargs)
        self.confirm_dialog.set_title(ARE_YOU_SURE)

        self.warning_label = Gtk.Label()
        self.warning_label.set_selectable(True)
        self.warning_label.set_line_wrap(True)
        self.warning_label.show()
        self.get_content_area().pack_start(self.warning_label, expand=False,
                                           fill=True, padding=0)
        self.get_content_area().pack_start(self.root, expand=True,
                                           fill=True, padding=0)

        self.set_size_request(*self.default_size)

        if syncdaemon_instance is not None:
            self.sd = syncdaemon_instance
        else:
            self.sd = syncdaemon.SyncDaemon()
        self._sorting_order = {}
        self._make_view_sortable(self.view)
Exemple #3
0
    def __init__(self, syncdaemon_instance=None, **kwargs):
        """Init."""
        Buildable.__init__(self)
        Gtk.Alignment.__init__(self, **kwargs)

        if syncdaemon_instance is not None:
            self.sd = syncdaemon_instance
        else:
            self.sd = syncdaemon.SyncDaemon()
        self.sd.on_metadata_ready_callback = self.on_metadata_ready

        self._sd_actions = {
            CONNECT: (self.sd.connect, DISCONNECT),
            DISCONNECT: (self.sd.disconnect, CONNECT),
            START: (self.sd.start, STOP),
            STOP: (self.sd.quit, START),
        }
        self._metadata_dialogs = {}
        self._status_images = build_icon_dict(48)

        folders = FoldersButton(syncdaemon_instance=self.sd)
        shares_to_me = SharesToMeButton(syncdaemon_instance=self.sd)
        shares_to_others = SharesToOthersButton(syncdaemon_instance=self.sd)
        self.public_files = PublicFilesButton(syncdaemon_instance=self.sd)

        buttons = (folders, shares_to_me, shares_to_others, self.public_files)
        for button in buttons:
            self.toolbar.insert(button, -1)
        self.toolbar.set_sensitive(False)

        self.action_button.set_use_stock(True)

        self.update()

        self.add(self.info)
        self.show_all()