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 unrar(self, event, download_item, *args): """""" unrar_gui = UnRARGUI(event, download_item, self.parent, self.widgets_list) if not unrar_gui.is_extracting: #wont extract event.set() return False
class Addon(AddonCore): """""" 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) #self.ip_renewer_cls = IPRenewer() def get_preferences(self): """""" return Preferences() def save(self): """""" passwords_handler.save() def set_menu_item(self): self.action = self.parent.menu.addAction(self.name, self.on_toggle) #can toggle self.action.setCheckable(True) if conf.get_addon_option(OPTION_UNRAR_ACTIVE, default=False, is_bool=True): self.action.setChecked(True) self.connect() def on_toggle(self): if self.action.isChecked(): #se activo conf.set_addon_option(OPTION_UNRAR_ACTIVE, "True") self.connect() else: conf.set_addon_option(OPTION_UNRAR_ACTIVE, "False") events.disconnect(cons.EVENT_DL_COMPLETE, self.event_id) def connect(self): """""" self.event_id = events.connect(cons.EVENT_DL_COMPLETE, self.trigger) def trigger(self, download_item, *args, **kwargs): """""" self.unrar_gui.add_file(download_item)
def __init__(self, parent, *args, **kwargs): """""" AddonCore.__init__(self, parent) self.name = _("Auto extraction") self.unrar_gui = UnRARGUI(self.parent) events.add_password.connect(passwords_handler.add)