def __init__(self, parent, *args, **kwargs): """""" AddonCore.__init__(self) self.name = _("Auto Extraction") self.event_id = None self.parent = parent self.unrar_gui = UnRARGUI(parent) events.connect(cons.EVENT_PASSWORD, passwords_handler.add)
def __init__(self, parent, *args, **kwargs): """""" AddonCore.__init__(self) self.name = _("Auto Extraction") self.event_id = None self.parent = parent self.lock = threading.Lock() self.widgets_list = [] events.connect(cons.EVENT_PASSWORD, passwords_handler.add)
def on_toggle(self): if self.action.isChecked(): #se activo #self.config.set_shutdown_active("True") self.event_id = events.connect(cons.EVENT_ALL_COMPLETE, self.trigger) self.config.set_retries_limit(str(RETRIES_LIMIT)) else: #self.config.set_shutdown_active("False") events.disconnect(cons.EVENT_ALL_COMPLETE, self.event_id) self.config.set_retries_limit(str(self.old_retries_count))
def on_shutdown(self, widget): if widget.get_active(): #se activo #self.config.set_shutdown_active("True") self.event_id = events.connect(cons.EVENT_ALL_COMPLETE, self.trigger) self.config.set_retries_limit(str(RETRIES_LIMIT)) else: #self.config.set_shutdown_active("False") events.disconnect(cons.EVENT_ALL_COMPLETE, self.event_id) self.config.set_retries_limit(str(self.old_retries_count))
def __init__(self, parent, *args, **kwargs): """""" AddonCore.__init__(self) self.name = _("History") self.event_id = events.connect(cons.EVENT_DL_COMPLETE, self.trigger) self.parent = parent self.config = conf self.history = History() self.history_tab = HistoryContainer(self.history, self.parent)
def connect(self): """""" self.event_id = events.connect(cons.EVENT_DL_COMPLETE, self.trigger)
def connect(self): """""" self.event_id = events.connect(cons.EVENT_CAPTCHA_DLG, self.trigger) #connect event
def __init__(self): QMainWindow.__init__(self) self.setWindowTitle(cons.APP_TITLE) self.setWindowIcon(QIcon(os.path.join(cons.MEDIA_PATH, "misc", "ochd.ico"))) self.resize(MIN_WIDTH, MIN_HEIGHT) self.center() self.restore_wnd_geometry() self.stop = (QToolButton(), media.get_icon(media.STOP, media.MEDIUM), _('Stop Download'), self.on_stop_download, False) self.start = (QToolButton(), media.get_icon(media.START, media.MEDIUM), _('Start Download'), self.on_start_download, False) accounts = (QToolButton(), media.get_icon(media.ACCOUNTS, media.MEDIUM), _('Accounts'), self.on_accounts, True) preferences = (QToolButton(), media.get_icon(media.PREFERENCES, media.MEDIUM), _('Preferences'), self.on_preferences, True) about = (QToolButton(), media.get_icon(media.ABOUT, media.MEDIUM), _('About'), self.on_about, True) self.menu = QMenu() preferences[BTN].setPopupMode(QToolButton.MenuButtonPopup) preferences[BTN].setMenu(self.menu) toolbar = Toolbar(self, [self.start, self.stop, None, accounts, preferences, None, about]) self.toolbar = self.addToolBar(toolbar) #self.vbox = QVBoxLayout(self) #tabs self.previous_tab = None self.tab = QTabWidget(self) # self.downloads = Downloads(self) self.tab.addTab(self.downloads, _('Downloads')) # self.add_downloads = AddDownloads(self.downloads, self) self.tab_add_downloads = QWidget() self.tab_add_downloads.setLayout(self.add_downloads) self.tab.addTab(self.tab_add_downloads, _('Add downloads')) # #addons self.addons_manager = AddonsManager(self) self.addons_list = self.addons_manager.addons_list #...tabs self.addon_tab_widgets = [] self.load_addon_tabs() # self.log = Log() self.tab_log = QWidget() self.tab_log.setLayout(self.log) self.tab.addTab(self.tab_log, _('Log')) # self.preferences = Preferences(self.addons_list, self) #self.tab.addTab(self.preferences, 'Preferences') # self.tab.currentChanged.connect(self.on_tab_switch) # self.setCentralWidget(self.tab) #status bar self.status_bar = StatusBar(self) self.setStatusBar(self.status_bar) #drop down menu [addon.set_menu_item() for addon in self.addons_list] #self.menu.addSeparator() #self.menu.addAction('Preferences', self.on_preferences) #system tray icon self.tray = Tray(self) if self.tray.available: self.can_close = False else: self.can_close = True #on select button state self.downloads.selectionModel().selectionChanged.connect(self.on_selected) #load session. self.load_session() #add core's event loop self.idle_timeout(500, self.queue_loop) #quit event events.connect(cons.EVENT_QUIT, self.event_close) self.show()
def __init__(self): """""" gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) self.set_title(cons.APP_TITLE) self.set_size_request(MIN_WIDTH, MIN_HEIGHT) self.set_position(gtk.WIN_POS_CENTER) self.resize(600, 300) self.config = conf #config.py #app window position and size x, y, w, h = self.config.get_window_settings() if gtk.gdk.screen_width() <= w or gtk.gdk.screen_height() <= h: self.maximize() elif w >= MIN_WIDTH or h >= MIN_HEIGHT: self.resize(w, h) if x >= 0 and y >= 0: self.move(x, y) #widgets for tabs. self.downloads_list_gui = List(parent=self) self.downloads_list_gui.treeView.get_selection().connect("changed", self.on_selected) self.add_downloads_gui = AddDownloads(self.downloads_list_gui, parent=self) self.addons_gui = addons_gui.AddonsManager(self) self.preferences = Preferences(self.addons_gui.addons_list) self.log_gui = Log() self.vbox = gtk.VBox() self.add(self.vbox) #toolbar. button = ToolButton(icon, label), handler, sensitive. #add_download = gtk.ToolButton(gtk.ToolButton(gtk.STOCK_ADD), "Add Download"), self.add_links, True stop = (gtk.ToolButton(media.get_image(media.STOP, media.MEDIUM), None), _("Stop Download"), self.stop_download, False) #tuple start = (gtk.ToolButton(media.get_image(media.START, media.MEDIUM), None), _("Start Download"), self.start_download, False) accounts = (gtk.ToolButton(media.get_image(media.ACCOUNTS, media.MEDIUM), None), _("Accounts"), self.accounts_app, True) preferences = (gtk.MenuToolButton(media.get_image(media.PREFERENCES, media.MEDIUM), None), _("Preferences"), self.on_preferences, True) about = (gtk.ToolButton(media.get_image(media.ABOUT, media.MEDIUM), None), _("About"), self.about_dlg, True) self.stop = stop[WIDGET] #self.stop = gtk.ToolButton(gtk.ToolButton(gtk.STOCK_STOP), "Stop Download"). Para poder cambiar el set_sensitive self.start = start[WIDGET] self.Toolbar = Toolbar([start, stop, None, accounts, preferences, None, about]) #los botones se agregan al Toolbar en el orden de esta lista. None = separador self.vbox.pack_start(self.Toolbar, False) #menu config_preferences = (gtk.MenuItem(), _("Preferences"), self.on_preferences) config_about = (gtk.MenuItem(), _("About"), self.about_dlg) #addons-menu menu_items = [menu_item for menu_item in [addon.get_menu_item() for addon in self.addons_gui.addons_list] if menu_item is not None] menu_items.extend([None, config_preferences, config_about]) menu = Menu(menu_items) preferences[WIDGET].set_menu(menu) #Sessions self.load_session() #tabs (notebooks) self.vbox2 = gtk.VBox() self.notebook = Notebook() self.notebook.set_tab_pos(gtk.POS_BOTTOM) #weird butg in gtk+ 2.24.10 on resizing to often (make the app crash). self.notebook.set_show_border(False) self.notebook.append_page(self.downloads_list_gui, gtk.Label(_("Downloads"))) self.notebook.append_page(self.add_downloads_gui, gtk.Label(_("Add downloads"))) [self.notebook.append_page(tab, gtk.Label(addon.name)) for tab, addon in [(addon.get_tab(), addon) for addon in self.addons_gui.addons_list] if tab is not None] self.notebook.append_page(self.log_gui, gtk.Label(_("Log"))) self.notebook.connect("switch-page", self.on_tab_switch) self.vbox2.pack_start(self.notebook) self.vbox.pack_start(self.vbox2) #status bar self.status_bar = StatusBar(self.add_downloads_gui) #self.pack_start(self.status_bar, False, False, 0) self.vbox.pack_start(self.status_bar, False, False) #Quit Event events.connect(cons.EVENT_QUIT, self.on_close) #self.connect("destroy", self.on_close) #boton cerrar de la barra de arriba self.connect("delete-event", self.on_quit) self.show_all()
def connect(self): """""" self.event_id = events.connect(cons.EVENT_LIMIT_EXCEEDED, self.trigger, self.parent)
def __init__(self): QMainWindow.__init__(self) self.setWindowTitle(cons.APP_TITLE) self.setWindowIcon( QIcon(os.path.join(cons.MEDIA_PATH, "misc", "ochd.ico"))) self.resize(MIN_WIDTH, MIN_HEIGHT) self.center() self.restore_wnd_geometry() self.stop = (QToolButton(), media.get_icon(media.STOP, media.MEDIUM), _('Stop Download'), self.on_stop_download, False) self.start = (QToolButton(), media.get_icon(media.START, media.MEDIUM), _('Start Download'), self.on_start_download, False) accounts = (QToolButton(), media.get_icon(media.ACCOUNTS, media.MEDIUM), _('Accounts'), self.on_accounts, True) preferences = (QToolButton(), media.get_icon(media.PREFERENCES, media.MEDIUM), _('Preferences'), self.on_preferences, True) about = (QToolButton(), media.get_icon(media.ABOUT, media.MEDIUM), _('About'), self.on_about, True) self.menu = QMenu() preferences[BTN].setPopupMode(QToolButton.MenuButtonPopup) preferences[BTN].setMenu(self.menu) toolbar = Toolbar( self, [self.start, self.stop, None, accounts, preferences, None, about]) self.toolbar = self.addToolBar(toolbar) #self.vbox = QVBoxLayout(self) #tabs self.previous_tab = None self.tab = QTabWidget(self) # self.downloads = Downloads(self) self.tab.addTab(self.downloads, _('Downloads')) # self.add_downloads = AddDownloads(self.downloads, self) self.tab_add_downloads = QWidget() self.tab_add_downloads.setLayout(self.add_downloads) self.tab.addTab(self.tab_add_downloads, _('Add downloads')) # #addons self.addons_manager = AddonsManager(self) self.addons_list = self.addons_manager.addons_list #...tabs self.addon_tab_widgets = [] self.load_addon_tabs() # self.log = Log() self.tab_log = QWidget() self.tab_log.setLayout(self.log) self.tab.addTab(self.tab_log, _('Log')) # self.preferences = Preferences(self.addons_list, self) #self.tab.addTab(self.preferences, 'Preferences') # self.tab.currentChanged.connect(self.on_tab_switch) # self.setCentralWidget(self.tab) #status bar self.status_bar = StatusBar(self) self.setStatusBar(self.status_bar) #drop down menu [addon.set_menu_item() for addon in self.addons_list] #self.menu.addSeparator() #self.menu.addAction('Preferences', self.on_preferences) #system tray icon self.tray = Tray(self) if self.tray.available: self.can_close = False else: self.can_close = True #on select button state self.downloads.selectionModel().selectionChanged.connect( self.on_selected) #load session. self.load_session() #add core's event loop self.idle_timeout(500, self.queue_loop) #quit event events.connect(cons.EVENT_QUIT, self.event_close) self.show()