Пример #1
0
    def _new_download_action(self, action):
        ui_file = sucker.find_data('ui/downloads-add-dialog.ui')

        builder = gtk.Builder()
        builder.add_from_file(ui_file)

        ok = builder.get_object('ok')
        ok.set_sensitive(False)

        dir = builder.get_object('dir')

        dir.set_filename(self.config.get_default_download_dir())

        combo = builder.get_object('manager')
        combo.connect('changed', self._add_combo_changed, builder)

        model = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING)
        combo.set_model(model)

        renderer = gtk.CellRendererPixbuf()
        combo.pack_start(renderer)
        combo.add_attribute(renderer, 'pixbuf', 0)

        renderer = gtk.CellRendererText()
        combo.pack_start(renderer)
        combo.add_attribute(renderer, 'text', 1)

        for info in self.plugin_engine.get_active_infos():
            if 'downloader' in info['type']:
                iter = model.append()
                model.set(iter, 0, None, 1, info['name'])

        dialog = builder.get_object('general')
        dialog.connect('response', self._add_response, builder)
        dialog.run()
Пример #2
0
    def _new_download_action(self, action):
        ui_file = sucker.find_data('ui/downloads-add-dialog.ui')

        builder = gtk.Builder()
        builder.add_from_file(ui_file)

        ok = builder.get_object('ok')
        ok.set_sensitive(False)

        dir = builder.get_object('dir')

        dir.set_filename(self.config.get_default_download_dir())

        combo = builder.get_object('manager')
        combo.connect('changed', self._add_combo_changed, builder)

        model = gtk.ListStore(gtk.gdk.Pixbuf, gobject.TYPE_STRING)
        combo.set_model(model)

        renderer = gtk.CellRendererPixbuf()
        combo.pack_start(renderer)
        combo.add_attribute(renderer, 'pixbuf', 0)

        renderer = gtk.CellRendererText()
        combo.pack_start(renderer)
        combo.add_attribute(renderer, 'text', 1)

        for info in self.plugin_engine.get_active_infos():
            if 'downloader' in info['type']:
                iter = model.append()
                model.set(iter, 0, None, 1, info['name'])

        dialog = builder.get_object('general')
        dialog.connect('response', self._add_response, builder)
        dialog.run()
Пример #3
0
    def get_menubar_actiongroup(self):
        entries = (
            ('Downloads'  , None         , _("_Downloads")          , None    , None ,None),
            ('NewDownload', gtk.STOCK_ADD, _("_Create New Download"), '<ctl>n', None , self._new_download_action),
        )

        action = gtk.ActionGroup('DownloadsTabAction')
        action.add_actions(entries)

        ui_file = sucker.find_data('ui/downloads-menubar.ui')
        with open(ui_file) as f:
            string = f.read()

        return action, string
Пример #4
0
    def _setup_menubar(self):
        entries = (('Add', gtk.STOCK_ADD, None, None, None,
                    self._new_download_action), )

        action = gtk.ActionGroup('DownloadTabAction')
        action.add_actions(entries)

        ui_file = sucker.find_data('ui/downloads-toolbar.ui')

        self._toolbar = gtk.UIManager()
        self._toolbar.add_ui_from_file(ui_file)
        self._toolbar.insert_action_group(action)

        self.pack_start(self._toolbar.get_widget('/ToolBar'), False, True, 0)
Пример #5
0
    def _setup_menubar(self):
        entries = (
            ('Add', gtk.STOCK_ADD, None, None, None, self._new_download_action),
        )

        action = gtk.ActionGroup('DownloadTabAction')
        action.add_actions(entries)

        ui_file = sucker.find_data('ui/downloads-toolbar.ui')

        self._toolbar = gtk.UIManager()
        self._toolbar.add_ui_from_file(ui_file)
        self._toolbar.insert_action_group(action)

        self.pack_start(self._toolbar.get_widget('/ToolBar'), False, True, 0)
Пример #6
0
    def get_menubar_actiongroup(self):
        entries = (
            ('Downloads', None, _("_Downloads"), None, None, None),
            ('NewDownload', gtk.STOCK_ADD, _("_Create New Download"), '<ctl>n',
             None, self._new_download_action),
        )

        action = gtk.ActionGroup('DownloadsTabAction')
        action.add_actions(entries)

        ui_file = sucker.find_data('ui/downloads-menubar.ui')
        with open(ui_file) as f:
            string = f.read()

        return action, string
Пример #7
0
    def __init__(self, engine):
        gtk.Dialog.__init__(self)

        self.Plugin_engine = engine

        ui_file = sucker.find_data('ui/plugins.ui')

        self.builder = gtk.Builder()
        self.builder.add_from_file(ui_file)
        self.builder.connect_signals(self)

        obj = self.builder.get_object('general')
        box = self.get_content_area()
        box.pack_start(obj, True, True, 0)

        self.setup_treeview()
        self.create_rows()
Пример #8
0
    def __init__(self, engine):
        gtk.Dialog.__init__(self)

        self.Plugin_engine = engine

        ui_file = sucker.find_data('ui/plugins.ui')

        self.builder = gtk.Builder()
        self.builder.add_from_file(ui_file)
        self.builder.connect_signals(self)

        obj = self.builder.get_object('general')
        box = self.get_content_area()
        box.pack_start(obj, True, True, 0)

        self.setup_treeview()
        self.create_rows()
Пример #9
0
    def _setup_menubar(self):
        entries = (
            ('File'   , None           , _("_File")   , None     , None, None),
            ('Close'  , gtk.STOCK_CLOSE, None         , '<ctl>w' , None, self._close_action),
            ('Quit'   , gtk.STOCK_QUIT , None         , '<ctl>q' , None, self._quit_action),
            ('Edit'   , None           , _("_Edit")   , None     , None, None),
            ('Plugins', None           , _("_Plugins"), None     , None, self._plugin_action),
            ('Help'   , None           , _("_Help")   , None     , None, None),
            ('About'  , gtk.STOCK_ABOUT, None         , None     , None, self._about_action),
        )

        action = gtk.ActionGroup('MenuBarAction')
        action.add_actions(entries)

        ui_file = sucker.find_data('ui/menubar.ui')

        self._menubar= gtk.UIManager()
        self._menubar.add_ui_from_file(ui_file)
        self._menubar.insert_action_group(action)

        self._box.pack_start(self._menubar.get_widget('/MenuBar'), False, True, 0)
        self.add_accel_group(self._menubar.get_accel_group())
Пример #10
0
    def _setup_menubar(self):
        entries = (
            ('File', None, _("_File"), None, None, None),
            ('Close', gtk.STOCK_CLOSE, None, '<ctl>w', None,
             self._close_action),
            ('Quit', gtk.STOCK_QUIT, None, '<ctl>q', None, self._quit_action),
            ('Edit', None, _("_Edit"), None, None, None),
            ('Plugins', None, _("_Plugins"), None, None, self._plugin_action),
            ('Help', None, _("_Help"), None, None, None),
            ('About', gtk.STOCK_ABOUT, None, None, None, self._about_action),
        )

        action = gtk.ActionGroup('MenuBarAction')
        action.add_actions(entries)

        ui_file = sucker.find_data('ui/menubar.ui')

        self._menubar = gtk.UIManager()
        self._menubar.add_ui_from_file(ui_file)
        self._menubar.insert_action_group(action)

        self._box.pack_start(self._menubar.get_widget('/MenuBar'), False, True,
                             0)
        self.add_accel_group(self._menubar.get_accel_group())