Exemplo n.º 1
0
    def load_preferences_page(self):
        """Initializes the preferences page and adds it to the preferences dialog"""
        # Load the preferences page
        self.glade = gtk.glade.XML(common.get_resource("blocklist_pref.glade"))

        self.progress_bar = self.glade.get_widget("progressbar")
        self.table_info = self.glade.get_widget("table_info")

        # Hide the progress bar initially
        self.progress_bar.hide()
        self.table_info.show()

        self.glade.signal_autoconnect({
            "on_button_check_download_clicked":
            self._on_button_check_download_clicked,
            "on_button_force_download_clicked":
            self._on_button_force_download_clicked
        })

        # Set button icons
        self.glade.get_widget("image_download").set_from_file(
            common.get_resource("blocklist_download24.png"))

        self.glade.get_widget("image_import").set_from_file(
            common.get_resource("blocklist_import24.png"))

        # Update the preferences page with config values from the core
        self._on_show_prefs()

        # Add the page to the preferences dialog
        self.plugin.add_preferences_page(
            _("Blocklist"), self.glade.get_widget("blocklist_prefs_box"))
Exemplo n.º 2
0
    def load_preferences_page(self):
        """Initializes the preferences page and adds it to the preferences dialog"""
        # Load the preferences page
        self.glade = gtk.glade.XML(common.get_resource("blocklist_pref.glade"))

        self.progress_bar = self.glade.get_widget("progressbar")
        self.table_info = self.glade.get_widget("table_info")

        # Hide the progress bar initially
        self.progress_bar.hide()
        self.table_info.show()

        self.glade.signal_autoconnect({
            "on_button_check_download_clicked": self._on_button_check_download_clicked,
            "on_button_force_download_clicked": self._on_button_force_download_clicked
        })

        # Set button icons
        self.glade.get_widget("image_download").set_from_file(
            common.get_resource("blocklist_download24.png"))

        self.glade.get_widget("image_import").set_from_file(
            common.get_resource("blocklist_import24.png"))

        # Update the preferences page with config values from the core
        self._on_show_prefs()

        # Add the page to the preferences dialog
        self.plugin.add_preferences_page(
            _("Blocklist"),
            self.glade.get_widget("blocklist_prefs_box"))
Exemplo n.º 3
0
    def load_preferences_page(self):
        """Initializes the preferences page and adds it to the preferences dialog"""
        # Load the preferences page
        self.builder = Gtk.Builder()
        self.builder.add_from_file(common.get_resource('blocklist_pref.ui'))

        self.whitelist_frame = self.builder.get_object('whitelist_frame')
        self.progress_bar = self.builder.get_object('progressbar')
        self.table_info = self.builder.get_object('table_info')

        # Hide the progress bar initially
        self.progress_bar.hide()
        self.table_info.show()

        # Create the whitelisted model
        self.build_whitelist_model_treeview()

        self.builder.connect_signals(
            {
                'on_button_check_download_clicked': self._on_button_check_download_clicked,
                'on_button_force_download_clicked': self._on_button_force_download_clicked,
                'on_whitelist_add_clicked': (
                    self.on_add_button_clicked,
                    self.whitelist_treeview,
                ),
                'on_whitelist_remove_clicked': (
                    self.on_delete_button_clicked,
                    self.whitelist_treeview,
                ),
            }
        )

        # Set button icons
        self.builder.get_object('image_download').set_from_file(
            common.get_resource('blocklist_download24.png')
        )

        self.builder.get_object('image_import').set_from_file(
            common.get_resource('blocklist_import24.png')
        )

        # Update the preferences page with config values from the core
        self._on_show_prefs()

        # Add the page to the preferences dialog
        self.plugin.add_preferences_page(
            _('Blocklist'), self.builder.get_object('blocklist_prefs_box')
        )
Exemplo n.º 4
0
    def __init__(self, path, recent, parent, RootDirectory,
                 RootDirectoryDisableTraverse):
        self.selectedfolder = path
        self.builder = gtk.Builder()
        self.builder.add_from_file(
            common.get_resource('folder_browse_dialog.glade'))
        self.dialog = self.builder.get_object("browse_folders_dialog")
        self.dialog.set_transient_for(parent)

        self.recentliststore = gtk.ListStore(str)
        self.label = self.builder.get_object("selected_folder")
        self.label.set_model(self.recentliststore)
        cell = gtk.CellRendererText()
        self.label.pack_start(cell, True)
        self.label.add_attribute(cell, "text", 0)
        self.handler_id = self.label.connect("changed", self.recent_chosed)

        self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str)
        self.iconview = self.builder.get_object("iconview1")
        self.iconview.set_model(self.liststore)
        self.iconview.set_pixbuf_column(0)
        self.iconview.set_text_column(1)
        self.iconview.set_item_width(300)
        self.iconview.connect("item-activated", self.subfolder_activated)
        self.refillList("")
        self.recent = recent
        self.RootDirectory = RootDirectory
        self.RootDirectoryDisableTraverse = RootDirectoryDisableTraverse
Exemplo n.º 5
0
    def show_move_storage_dialog(self, status):
        glade = gtk.glade.XML(
            common.get_resource("myMove_storage_dialog.glade"))
        self.move_storage_dialog = glade.get_widget("move_storage_dialog")
        self.move_storage_dialog.set_transient_for(
            component.get("MainWindow").window)
        self.move_storage_dialog_entry = glade.get_widget("entry_destination")
        self.move_storage_browse_button = glade.get_widget("browse")
        self.move_storage_entry_destination = glade.get_widget(
            "entry_destination")
        self.move_storage_dialog_entry.set_text(status["save_path"])

        def on_dialog_response_event(widget, response_id):
            def on_core_result(result):
                # Delete references
                del self.move_storage_dialog
                del self.move_storage_dialog_entry

            if response_id == gtk.RESPONSE_OK:
                log.debug("Moving torrents to %s",
                          self.move_storage_dialog_entry.get_text())
                path = self.move_storage_dialog_entry.get_text()
                client.core.move_storage(
                    component.get("TorrentView").get_selected_torrents(),
                    path).addCallback(on_core_result)
            self.move_storage_dialog.hide()

        def browseClicked(something):
            self.chooseFolder(self.move_storage_entry_destination, None)

        self.move_storage_dialog.connect("response", on_dialog_response_event)
        self.move_storage_browse_button.connect("clicked", browseClicked)
        self.move_storage_dialog.show()
Exemplo n.º 6
0
    def __init__(self, path, recent, parent, RootDirectory, RootDirectoryDisableTraverse):
        self.selectedfolder = path
        self.builder = gtk.Builder()
        self.builder.add_from_file(common.get_resource('folder_browse_dialog.glade'))
        self.dialog = self.builder.get_object("browse_folders_dialog")
        self.dialog.set_transient_for(parent)

        self.recentliststore = gtk.ListStore(str)
        self.label = self.builder.get_object("selected_folder")
        self.label.set_model(self.recentliststore)
        cell = gtk.CellRendererText()
        self.label.pack_start(cell, True)
        self.label.add_attribute(cell, "text", 0)
        self.handler_id = self.label.connect("changed", self.recent_chosed)

        self.liststore = gtk.ListStore(gtk.gdk.Pixbuf, str)
        self.iconview = self.builder.get_object("iconview1")
        self.iconview.set_model(self.liststore)
        self.iconview.set_pixbuf_column(0)
        self.iconview.set_text_column(1)
        self.iconview.set_item_width(300)
        self.iconview.connect("item-activated", self.subfolder_activated)
        self.refillList("")
        self.recent = recent
        self.RootDirectory = RootDirectory
        self.RootDirectoryDisableTraverse = RootDirectoryDisableTraverse
Exemplo n.º 7
0
    def show_move_storage_dialog(self, status):
        glade = gtk.glade.XML(common.get_resource("myMove_storage_dialog.glade"))
        self.move_storage_dialog = glade.get_widget("move_storage_dialog")
        self.move_storage_dialog.set_transient_for(component.get("MainWindow").window)
        self.move_storage_dialog_entry = glade.get_widget("entry_destination")
        self.move_storage_browse_button = glade.get_widget("browse")
        self.move_storage_entry_destination = glade.get_widget("entry_destination")
        self.move_storage_dialog_entry.set_text(status["save_path"])
        def on_dialog_response_event(widget, response_id):

            def on_core_result(result):
                # Delete references
                del self.move_storage_dialog
                del self.move_storage_dialog_entry

            if response_id == gtk.RESPONSE_OK:
                log.debug("Moving torrents to %s",
                          self.move_storage_dialog_entry.get_text())
                path = self.move_storage_dialog_entry.get_text()
                client.core.move_storage(
                    component.get("TorrentView").get_selected_torrents(), path
                ).addCallback(on_core_result)
            self.move_storage_dialog.hide()

        def browseClicked(something):
            self.chooseFolder(self.move_storage_entry_destination, None)
        self.move_storage_dialog.connect("response", on_dialog_response_event)
        self.move_storage_browse_button.connect("clicked", browseClicked)
        self.move_storage_dialog.show()
Exemplo n.º 8
0
    def load_preferences_page(self):
        """Initializes the preferences page and adds it to the preferences dialog"""
        # Load the preferences page
        self.glade = gtk.glade.XML(common.get_resource('blocklist_pref.glade'))

        self.whitelist_frame = self.glade.get_widget('whitelist_frame')
        self.progress_bar = self.glade.get_widget('progressbar')
        self.table_info = self.glade.get_widget('table_info')

        # Hide the progress bar initially
        self.progress_bar.hide()
        self.table_info.show()

        # Create the whitelisted model
        self.build_whitelist_model_treeview()

        self.glade.signal_autoconnect({
            'on_button_check_download_clicked': self._on_button_check_download_clicked,
            'on_button_force_download_clicked': self._on_button_force_download_clicked,
            'on_whitelist_add_clicked': (self.on_add_button_clicked,
                                         self.whitelist_treeview),
            'on_whitelist_remove_clicked': (self.on_delete_button_clicked,
                                            self.whitelist_treeview),
        })

        # Set button icons
        self.glade.get_widget('image_download').set_from_file(
            common.get_resource('blocklist_download24.png'))

        self.glade.get_widget('image_import').set_from_file(
            common.get_resource('blocklist_import24.png'))

        # Update the preferences page with config values from the core
        self._on_show_prefs()

        # Add the page to the preferences dialog
        self.plugin.add_preferences_page(
            _('Blocklist'),
            self.glade.get_widget('blocklist_prefs_box'))
Exemplo n.º 9
0
 def initializeGUI(self):
     self.glade = gtk.glade.XML(common.get_resource("config.glade"))
     self.load_recent()
     self.load_RootDirectory()
     component.get("Preferences").add_page("Browse Button", self.glade.get_widget("prefs_box"))
     component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
     component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
     self.buttons = { 'store' : { 'id': 'entry_download_path' , 'editbox': None, 'widget': None , 'window': None}, \
                  'completed' : { 'id' : 'entry_move_completed_path' , 'editbox': None, 'widget': None , 'window': None}, \
              'completed_tab' : { 'id' : 'entry_move_completed' , 'editbox': None, 'widget': None , 'window': None} }
     self.makeButtons()
     self.addMoveMenu()
     self.handleError()
Exemplo n.º 10
0
    def enable(self):
        log.debug("Blocklist GtkUI enable..")
        self.plugin = component.get("PluginManager")

        self.load_preferences_page()

        self.status_item = component.get("StatusBar").add_item(
            image=common.get_resource("blocklist16.png"),
            text="",
            callback=self._on_status_item_clicked,
            tooltip="Blocked IP Ranges")

        # Register some hooks
        self.plugin.register_hook("on_apply_prefs", self._on_apply_prefs)
        self.plugin.register_hook("on_show_prefs", self._on_show_prefs)
Exemplo n.º 11
0
    def enable(self):
        log.debug("Blocklist GtkUI enable..")
        self.plugin = component.get("PluginManager")

        self.load_preferences_page()

        self.status_item = component.get("StatusBar").add_item(
            image=common.get_resource("blocklist16.png"),
            text="",
            callback=self._on_status_item_clicked,
            tooltip="Blocked IP Ranges")

        # Register some hooks
        self.plugin.register_hook("on_apply_prefs", self._on_apply_prefs)
        self.plugin.register_hook("on_show_prefs", self._on_show_prefs)
Exemplo n.º 12
0
    def enable(self):
        log.debug('Blocklist GtkUI enable..')
        self.plugin = component.get('PluginManager')

        self.load_preferences_page()

        self.status_item = component.get('StatusBar').add_item(
            image=common.get_resource('blocklist16.png'),
            text='',
            callback=self._on_status_item_clicked,
            tooltip=_('Blocked IP Ranges /Whitelisted IP Ranges'),
        )

        # Register some hooks
        self.plugin.register_hook('on_apply_prefs', self._on_apply_prefs)
        self.plugin.register_hook('on_show_prefs', self._on_show_prefs)
Exemplo n.º 13
0
 def initializeGUI(self):
     self.glade = gtk.glade.XML(common.get_resource("config.glade"))
     self.load_recent()
     self.load_RootDirectory()
     component.get("Preferences").add_page(
         "Browse Button", self.glade.get_widget("prefs_box"))
     component.get("PluginManager").register_hook("on_apply_prefs",
                                                  self.on_apply_prefs)
     component.get("PluginManager").register_hook("on_show_prefs",
                                                  self.on_show_prefs)
     self.buttons = { 'store' : { 'id': 'entry_download_path' , 'editbox': None, 'widget': None , 'window': None}, \
                  'completed' : { 'id' : 'entry_move_completed_path' , 'editbox': None, 'widget': None , 'window': None}, \
              'completed_tab' : { 'id' : 'entry_move_completed' , 'editbox': None, 'widget': None , 'window': None} }
     self.makeButtons()
     self.addMoveMenu()
     self.handleError()
Exemplo n.º 14
0
    def enable(self):
        log.debug('Blocklist GtkUI enable..')
        self.plugin = component.get('PluginManager')

        self.load_preferences_page()

        self.status_item = component.get('StatusBar').add_item(
            image=common.get_resource('blocklist16.png'),
            text='',
            callback=self._on_status_item_clicked,
            tooltip=_('Blocked IP Ranges /Whitelisted IP Ranges')
        )

        # Register some hooks
        self.plugin.register_hook('on_apply_prefs', self._on_apply_prefs)
        self.plugin.register_hook('on_show_prefs', self._on_show_prefs)
Exemplo n.º 15
0
class GtkUI(GtkPluginBase):
    def enable(self):
        log.debug("Blocklist GtkUI enable..")
        self.plugin = component.get("PluginManager")

        try:
            self.load_preferences_page()
        except Exception, err:
            log.exception(err)
            raise

        self.status_item = component.get("StatusBar").add_item(
            image=common.get_resource("blocklist16.png"),
            text="",
            callback=self._on_status_item_clicked,
            tooltip=_("Blocked IP Ranges /Whitelisted IP Ranges")
        )

        # Register some hooks
        self.plugin.register_hook("on_apply_prefs", self._on_apply_prefs)
        self.plugin.register_hook("on_show_prefs", self._on_show_prefs)