def export_plugins(self): """ dinamically finds the available export plugins and fills the export menu entry """ plugins = gutils.read_plugins("PluginExport", self.locations["export_plugins"]) plugins.sort() for p in plugins: plugin_module = os.path.basename(p).replace(".py", "") plugin_name = plugin_module.replace("PluginExport", "") menu_items = gtk.MenuItem(plugin_name) self.widgets["menu"]["export"].append(menu_items) menu_items.connect("activate", self.on_export_activate, plugin_name) menu_items.show()
def export_plugins(self): """ dinamically finds the available export plugins and fills the export menu entry """ plugins = gutils.read_plugins('PluginExport', \ self.locations['export_plugins']) plugins.sort() for p in plugins: plugin_module = os.path.basename(p).replace('.py', '') plugin_name = plugin_module.replace('PluginExport', '') menu_items = gtk.MenuItem(plugin_name) self.widgets['menu']['export'].append(menu_items) menu_items.connect('activate', self.on_export_activate, plugin_name) menu_items.show()
def movie_plugins(self): """ dinamically finds the movie source information plugins and fills the plugins drop down list """ self.plugins = gutils.read_plugins('PluginMovie', \ self.locations['movie_plugins']) self.plugins.sort() mcounter = 0 default_plugin = self.config.get('default_movie_plugin') for p in self.plugins: plugin_module = os.path.basename(p).replace('.py', '') plugin_name = plugin_module.replace('PluginMovie', '') self.widgets['add']['source'].append_text(plugin_name) self.widgets['preferences']['default_plugin'].append_text(plugin_name) if plugin_name == default_plugin: self.widgets['preferences']['default_plugin'].set_active(mcounter) self.widgets['add']['source'].set_active(mcounter) mcounter = mcounter + 1
def movie_plugins(self): """ dinamically finds the movie source information plugins and fills the plugins drop down list """ self.plugins = gutils.read_plugins("PluginMovie", self.locations["movie_plugins"]) self.plugins.sort() self.d_plugin = 0 mcounter = 0 default_plugin = self.config.get("default_movie_plugin") for p in self.plugins: plugin_module = os.path.basename(p).replace(".py", "") plugin_name = plugin_module.replace("PluginMovie", "") self.widgets["add"]["source"].append_text(plugin_name) self.widgets["preferences"]["default_plugin"].append_text(plugin_name) if plugin_name == default_plugin: self.widgets["preferences"]["default_plugin"].set_active(mcounter) self.d_plugin = mcounter mcounter = mcounter + 1 self.widgets["add"]["source"].set_active(self.d_plugin)
def show_preferences(self): w = self.widgets['preferences'] # number if self.config.get('number', True, section='mainlist') == False: w['view_number'].set_active(False) else: w['view_number'].set_active(True) # image if self.config.get('image', True, section='mainlist') == False: w['view_image'].set_active(False) else: w['view_image'].set_active(True) # original title if self.config.get('otitle', True, section='mainlist') == False: w['view_o_title'].set_active(False) else: w['view_o_title'].set_active(True) # title if self.config.get('title', True, section='mainlist') == False: w['view_title'].set_active(False) else: w['view_title'].set_active(True) # director if self.config.get('director', True, 'mainlist') == False: w['view_director'].set_active(False) else: w['view_director'].set_active(True) # genre if self.config.get('genre', True, 'mainlist') == False: w['view_genre'].set_active(False) else: w['view_genre'].set_active(True) # seen if self.config.get('seen', True, 'mainlist') == False: w['view_seen'].set_active(False) else: w['view_seen'].set_active(True) # year if self.config.get('year', True, 'mainlist') == False: w['view_year'].set_active(False) else: w['view_year'].set_active(True) # runtime if self.config.get('runtime', True, 'mainlist') == False: w['view_runtime'].set_active(False) else: w['view_runtime'].set_active(True) # rating if self.config.get('rating', True, 'mainlist') == False: w['view_rating'].set_active(False) else: w['view_rating'].set_active(True) # email reminder if self.config.get('use_auth', False, section='mail') == False: w['mail_use_auth'].set_active(False) else: w['mail_use_auth'].set_active(True) if self.config.get('mail_use_tls', False, section='mail') == False: w['mail_use_tls'].set_active(False) else: w['mail_use_tls'].set_active(True) w['mail_smtp_server'].set_text(self.config.get('smtp_server', 'localhost', section='mail')) w['mail_smtp_port'].set_text(self.config.get('mail_smtp_port', '25', section='mail')) w['mail_username'].set_text(self.config.get('username', '', section='mail')) w['mail_password'].set_text(self.config.get('password', '', section='mail')) w['mail_email'].set_text(self.config.get('email', 'griffith@localhost', section='mail')) # pdf reader w['epdf_reader'].set_text(self.pdf_reader) # pdf font if self.config.get('font'): w['font'].set_filename(self.config.get('font')) # defaults (for static data only) w['condition'].set_active( gutils.digits_only(self.config.get('condition', 0, section='defaults'), 5) ) w['region'].set_active( gutils.digits_only(self.config.get('region', 0, section='defaults'), 8) ) w['layers'].set_active( gutils.digits_only(self.config.get('layers', 0, section='defaults'), 4) ) w['color'].set_active( gutils.digits_only(self.config.get('color', 0, section='defaults'), 3 )) tmp = self.config.get('media', 0, section='defaults') if tmp is not None and int(tmp) in self.media_ids: if int(self.config.get('media', 0, section='defaults')) > 0: w['media'].set_active( gutils.findKey(int(self.config.get('media', 0, section='defaults')), self.media_ids) ) else: w['media'].set_active(0) tmp = self.config.get('vcodec', 0, section='defaults') if tmp is not None and int(tmp) in self.vcodecs_ids: if int(self.config.get('vcodec', 0, section='defaults')) > 0: w['vcodec'].set_active( int(gutils.findKey(int(self.config.get('vcodec', 0, section='defaults')), self.vcodecs_ids)) ) else: w['vcodec'].set_active(0) # search for: w['s_classification'].set_active(bool(self.config.get('s_classification', True, section='add'))) w['s_country'].set_active(bool(self.config.get('s_country', True, section='add'))) w['s_director'].set_active(bool(self.config.get('s_director', True, section='add'))) w['s_genre'].set_active(bool(self.config.get('s_genre', True, section='add'))) w['s_image'].set_active(bool(self.config.get('s_image', True, section='add'))) w['s_notes'].set_active(bool(self.config.get('s_notes', True, section='add'))) w['s_o_site'].set_active(bool(self.config.get('s_o_site', True, section='add'))) w['s_o_title'].set_active(bool(self.config.get('s_o_title', True, section='add'))) w['s_plot'].set_active(bool(self.config.get('s_plot', True, section='add'))) w['s_rating'].set_active(bool(self.config.get('s_rating', True, section='add'))) w['s_runtime'].set_active(bool(self.config.get('s_runtime', True, section='add'))) w['s_site'].set_active(bool(self.config.get('s_site', True, section='add'))) w['s_studio'].set_active(bool(self.config.get('s_studio', True, section='add'))) w['s_title'].set_active(bool(self.config.get('s_title', True, section='add'))) w['s_trailer'].set_active(bool(self.config.get('s_trailer', True, section='add'))) w['s_cast'].set_active(bool(self.config.get('s_cast', True, section='add'))) w['s_year'].set_active(bool(self.config.get('s_year', True, section='add'))) if self.config.get('sortby', section='mainlist'): tmp = self.sort_criteria.index(self.config.get('sortby', section='mainlist')) w['sortby'].set_active(tmp) w['sortby_reverse'].set_active(bool(self.config.get('sortby_reverse', False, section='mainlist'))) w['s_limit'].set_value(gutils.digits_only(self.config.get('limit', 0, section='mainlist'))) plugins = gutils.read_plugins('PluginMovie', \ self.locations['movie_plugins']) plugins.sort() mcounter = 0 default_movie_plugin = self.config.get('default_movie_plugin') for p in plugins: plugin_module = os.path.basename(p).replace('.py','') plugin_name = plugin_module.replace('PluginMovie','') if plugin_name == default_movie_plugin: w['default_plugin'].set_active(mcounter) self.d_plugin = mcounter mcounter = mcounter + 1 # rating image try: rimage = int(self.config.get('rating_image', 0)) except: rimage = 0 w['rating_image'].set_active(rimage) # spellchecker if self.config.get('gtkspell', False, section='spell') == False: w['spellchecker'].set_active(False) else: w['spellchecker'].set_active(True) self.on_cb_spellchecker_pref_toggled(w['spellchecker']) if self.config.get('notes', True, section='spell') == False: w['spell_notes'].set_active(False) else: w['spell_notes'].set_active(True) if self.config.get('plot', True, section='spell') == False: w['spell_plot'].set_active(False) else: w['spell_plot'].set_active(True) w['spell_lang'].set_text(str(self.config.get('lang', 'en', section='spell'))) w['amazon_locale'].set_active(int(self.config.get('amazon_locale', 0, section='add'))) w['window'].show()
def show_preferences(self): # image if self.config.get('view_image', 'True')=='False': self.view_image.set_active(False) else: self.view_image.set_active(True) # original title if self.config.get('view_otitle', 'True')=='False': self.view_otitle.set_active(False) else: self.view_otitle.set_active(True) # title if self.config.get('view_title', 'True')=='False': self.view_title.set_active(False) else: self.view_title.set_active(True) # director if self.config.get('view_director', 'True')=='False': self.view_director.set_active(False) else: self.view_director.set_active(True) # email reminder if self.config.get('mail_use_auth', 'False') == 'False': self.mail_use_auth.set_active(False) else: self.mail_use_auth.set_active(True) self.mail_smtp_server.set_text(self.config.get('mail_smtp_server', 'localhost')) self.mail_username.set_text(self.config.get('mail_username', '')) self.mail_password.set_text(self.config.get('mail_password', '')) self.mail_email.set_text(self.config.get('mail_email', 'griffith')) # pdf reader self.epdf_reader.set_text(self.pdf_reader) # pdf font if self.config.get('font'): self.p_font.set_filename(self.config.get('font')) # defaults if self.config.get('media'): self.p_media.set_active(int(self.config.get('media'))) if self.config.get('condition'): self.p_condition.set_active(int(self.config.get('condition'))) if self.config.get('region'): self.p_region.set_active(int(self.config.get('region'))) if self.config.get('layers'): self.p_layers.set_active(int(self.config.get('layers'))) if self.config.get('color'): self.p_color.set_active(int(self.config.get('color'))) plugins = gutils.read_plugins('PluginMovie', \ self.locations['movie_plugins']) plugins.sort() mcounter = 0 for p in plugins: plugin_module = os.path.basename(p).replace(".py","") plugin_name = plugin_module.replace("PluginMovie","") if self.config.get('default_movie_plugin') == plugin_name: self.default_plugin.set_active(mcounter) self.d_plugin = mcounter mcounter = mcounter + 1 # rating image try: rimage = int(str(self.config.get('rating_image', '0'))) except: rimage = 0 self.rating_image.set_active(rimage) # spellchecker if self.config.get('use_gtkspell', 'False')=='False': self.spellchecker.set_active(False) else: self.spellchecker.set_active(True) if self.config.get('spell_notes', 'True')=='False': self.spell_notes.set_active(False) else: self.spell_notes.set_active(True) if self.config.get('spell_plot', 'True')=='False': self.spell_plot.set_active(False) else: self.spell_plot.set_active(True) self.spell_lang.set_text(str(self.config.get('spell_lang', 'en'))) self.w_preferences.show()
def show_preferences(self): w = self.widgets['preferences'] # image if self.config.get('view_image', 'True')=='False': w['view_image'].set_active(False) else: w['view_image'].set_active(True) # original title if self.config.get('view_otitle', 'True')=='False': w['view_o_title'].set_active(False) else: w['view_o_title'].set_active(True) # title if self.config.get('view_title', 'True')=='False': w['view_title'].set_active(False) else: w['view_title'].set_active(True) # director if self.config.get('view_director', 'True')=='False': w['view_director'].set_active(False) else: w['view_director'].set_active(True) # email reminder if self.config.get('mail_use_auth', 'False') == 'False': w['mail_use_auth'].set_active(False) else: w['mail_use_auth'].set_active(True) w['mail_smtp_server'].set_text(self.config.get('mail_smtp_server', 'localhost')) w['mail_username'].set_text(self.config.get('mail_username', '')) w['mail_password'].set_text(self.config.get('mail_password', '')) w['mail_email'].set_text(self.config.get('mail_email', 'griffith')) # pdf reader w['epdf_reader'].set_text(self.pdf_reader) # pdf font if self.config.get('font'): w['font'].set_filename(self.config.get('font')) # defaults (for static data only) w['condition'].set_active( gutils.digits_only(self.config.get('condition', 0), 5) ) w['region'].set_active( gutils.digits_only(self.config.get('region', 0), 8) ) w['layers'].set_active( gutils.digits_only(self.config.get('layers', 0), 4) ) w['color'].set_active( gutils.digits_only(self.config.get('color', 0), 3 )) if self.config.get('media', 0) in self.media_ids: if self.config.get('media', 0) > 0: w['media'].set_active( gutils.findKey(self.config.get('media', 0), self.media_ids) ) else: w['media'].set_active(0) if self.config.get('vcodec', 0) in self.vcodecs_ids >- 1: if self.config.get('vcodec', 0) > 0: w['vcodec'].set_active( int(gutils.findKey(self.config.get('vcodec', 0), self.vcodecs_ids)) ) else: w['vcodec'].set_active(0) # search for: w['s_classification'].set_active(bool(self.config.get('s_classification', True))) w['s_country'].set_active(bool(self.config.get('s_country', True))) w['s_director'].set_active(bool(self.config.get('s_director', True))) w['s_genre'].set_active(bool(self.config.get('s_genre', True))) w['s_image'].set_active(bool(self.config.get('s_image', True))) w['s_notes'].set_active(bool(self.config.get('s_notes', True))) w['s_o_site'].set_active(bool(self.config.get('s_o_site', True))) w['s_o_title'].set_active(bool(self.config.get('s_o_title', True))) w['s_plot'].set_active(bool(self.config.get('s_plot', True))) w['s_rating'].set_active(bool(self.config.get('s_rating', True))) w['s_runtime'].set_active(bool(self.config.get('s_runtime', True))) w['s_site'].set_active(bool(self.config.get('s_site', True))) w['s_studio'].set_active(bool(self.config.get('s_studio', True))) w['s_title'].set_active(bool(self.config.get('s_title', True))) w['s_trailer'].set_active(bool(self.config.get('s_trailer', True))) w['s_cast'].set_active(bool(self.config.get('s_cast', True))) w['s_year'].set_active(bool(self.config.get('s_year', True))) if self.config.get('sortby'): tmp = self.sort_criteria.index(self.config.get('sortby')) w['sortby'].set_active(tmp) w['sortby_reverse'].set_active(bool(self.config.get('sortby_reverse', False))) plugins = gutils.read_plugins('PluginMovie', \ self.locations['movie_plugins']) plugins.sort() mcounter = 0 for p in plugins: plugin_module = os.path.basename(p).replace('.py','') plugin_name = plugin_module.replace('PluginMovie','') if self.config.get('default_movie_plugin') == plugin_name: w['default_plugin'].set_active(mcounter) self.d_plugin = mcounter mcounter = mcounter + 1 # rating image try: rimage = int(str(self.config.get('rating_image', '0'))) except: rimage = 0 w['rating_image'].set_active(rimage) # spellchecker if self.config.get('use_gtkspell', 'False')=='False': w['spellchecker'].set_active(False) else: w['spellchecker'].set_active(True) if self.config.get('spell_notes', 'True')=='False': w['spell_notes'].set_active(False) else: w['spell_notes'].set_active(True) if self.config.get('spell_plot', 'True')=='False': w['spell_plot'].set_active(False) else: w['spell_plot'].set_active(True) w['spell_lang'].set_text(str(self.config.get('spell_lang', 'en'))) w['amazon_locale'].set_active(self.config.get('amazon_locale', 0)) w['window'].show()
def show_preferences(self, page=None): w = self.widgets['preferences'] # number if self.config.get('number', True, section='mainlist') == False: w['view_number'].set_active(False) else: w['view_number'].set_active(True) # image if self.config.get('image', True, section='mainlist') == False: w['view_image'].set_active(False) else: w['view_image'].set_active(True) # original title if self.config.get('otitle', True, section='mainlist') == False: w['view_o_title'].set_active(False) else: w['view_o_title'].set_active(True) # title if self.config.get('title', True, section='mainlist') == False: w['view_title'].set_active(False) else: w['view_title'].set_active(True) # director if self.config.get('director', True, 'mainlist') == False: w['view_director'].set_active(False) else: w['view_director'].set_active(True) # genre if self.config.get('genre', True, 'mainlist') == False: w['view_genre'].set_active(False) else: w['view_genre'].set_active(True) # seen if self.config.get('seen', True, 'mainlist') == False: w['view_seen'].set_active(False) else: w['view_seen'].set_active(True) # year if self.config.get('year', True, 'mainlist') == False: w['view_year'].set_active(False) else: w['view_year'].set_active(True) # runtime if self.config.get('runtime', True, 'mainlist') == False: w['view_runtime'].set_active(False) else: w['view_runtime'].set_active(True) # rating if self.config.get('rating', True, 'mainlist') == False: w['view_rating'].set_active(False) else: w['view_rating'].set_active(True) # created if self.config.get('created', True, 'mainlist') == False: w['view_created'].set_active(False) else: w['view_created'].set_active(True) # updated if self.config.get('updated', True, 'mainlist') == False: w['view_updated'].set_active(False) else: w['view_updated'].set_active(True) # email reminder if self.config.get('use_auth', False, section='mail') == False: w['mail_use_auth'].set_active(False) else: w['mail_use_auth'].set_active(True) if self.config.get('mail_use_tls', False, section='mail') == False: w['mail_use_tls'].set_active(False) else: w['mail_use_tls'].set_active(True) w['mail_smtp_server'].set_text( self.config.get('smtp_server', 'localhost', section='mail')) w['mail_smtp_port'].set_text( self.config.get('mail_smtp_port', '25', section='mail')) w['mail_username'].set_text(self.config.get('username', '', section='mail')) w['mail_password'].set_text(self.config.get('password', '', section='mail')) w['mail_email'].set_text( self.config.get('email', 'griffith@localhost', section='mail')) # pdf reader w['epdf_reader'].set_text(self.pdf_reader) # pdf font if self.config.get('font'): w['font'].set_filename(self.config.get('font')) if self.config.get('font_size'): try: w['font_size'].set_value(float(self.config.get('font_size'))) except: w['font_size'].set_value(18.0) # pdf elements pdf_elements = self.config.get('pdf_elements', 'image,director,genre,cast') for pdf_element in pdf_elements.split(','): if 'pdf_' + pdf_element.strip() in w: w['pdf_' + pdf_element.strip()].set_active(True) # defaults (for static data only) w['condition'].set_active( gutils.digits_only(self.config.get('condition', 0, section='defaults'), 5)) w['region'].set_active( gutils.digits_only(self.config.get('region', 0, section='defaults'), 8)) w['layers'].set_active( gutils.digits_only(self.config.get('layers', 0, section='defaults'), 4)) w['color'].set_active( gutils.digits_only(self.config.get('color', 0, section='defaults'), 3)) tmp = self.config.get('media', 0, section='defaults') if tmp is not None and int(tmp) in self.media_ids: if int(self.config.get('media', 0, section='defaults')) > 0: w['media'].set_active( gutils.findKey( int(self.config.get('media', 0, section='defaults')), self.media_ids)) else: w['media'].set_active(0) tmp = self.config.get('vcodec', 0, section='defaults') if tmp is not None and int(tmp) in self.vcodecs_ids: if int(self.config.get('vcodec', 0, section='defaults')) > 0: w['vcodec'].set_active( int( gutils.findKey( int(self.config.get('vcodec', 0, section='defaults')), self.vcodecs_ids))) else: w['vcodec'].set_active(0) w['seen'].set_active( bool(self.config.get('seen', True, section='defaults'))) # search for: w['s_classification'].set_active( bool(self.config.get('s_classification', True, section='add'))) w['s_country'].set_active( bool(self.config.get('s_country', True, section='add'))) w['s_director'].set_active( bool(self.config.get('s_director', True, section='add'))) w['s_genre'].set_active( bool(self.config.get('s_genre', True, section='add'))) w['s_image'].set_active( bool(self.config.get('s_image', True, section='add'))) w['s_notes'].set_active( bool(self.config.get('s_notes', True, section='add'))) w['s_o_site'].set_active( bool(self.config.get('s_o_site', True, section='add'))) w['s_o_title'].set_active( bool(self.config.get('s_o_title', True, section='add'))) w['s_plot'].set_active(bool(self.config.get('s_plot', True, section='add'))) w['s_rating'].set_active( bool(self.config.get('s_rating', True, section='add'))) w['s_runtime'].set_active( bool(self.config.get('s_runtime', True, section='add'))) w['s_site'].set_active(bool(self.config.get('s_site', True, section='add'))) w['s_studio'].set_active( bool(self.config.get('s_studio', True, section='add'))) w['s_title'].set_active( bool(self.config.get('s_title', True, section='add'))) w['s_trailer'].set_active( bool(self.config.get('s_trailer', True, section='add'))) w['s_cast'].set_active(bool(self.config.get('s_cast', True, section='add'))) w['s_year'].set_active(bool(self.config.get('s_year', True, section='add'))) w['s_screenplay'].set_active( bool(self.config.get('s_screenplay', True, section='add'))) w['s_cameraman'].set_active( bool(self.config.get('s_cameraman', True, section='add'))) w['s_resolution'].set_active( bool(self.config.get('s_resolution', True, section='add'))) w['s_barcode'].set_active( bool(self.config.get('s_barcode', True, section='add'))) if self.config.get('sortby', section='mainlist'): tmp = self.sort_criteria.index( self.config.get('sortby', section='mainlist')) w['sortby'].set_active(tmp) w['sortby_reverse'].set_active( bool(self.config.get('sortby_reverse', False, section='mainlist'))) w['s_limit'].set_value( gutils.digits_only(self.config.get('limit', 0, section='mainlist'))) plugins = gutils.read_plugins('PluginMovie', \ self.locations['movie_plugins']) plugins.sort() mcounter = 0 default_movie_plugin = self.config.get('default_movie_plugin') for p in plugins: plugin_module = os.path.basename(p).replace('.py', '') plugin_name = plugin_module.replace('PluginMovie', '') if plugin_name == default_movie_plugin: w['default_plugin'].set_active(mcounter) mcounter = mcounter + 1 # rating image try: rimage = int(self.config.get('rating_image', 0)) except: rimage = 0 w['rating_image'].set_active(rimage) # spellchecker if self.config.get('gtkspell', False, section='spell') == False: w['spellchecker'].set_active(False) else: w['spellchecker'].set_active(True) self.on_cb_spellchecker_pref_toggled(w['spellchecker']) if self.config.get('notes', True, section='spell') == False: w['spell_notes'].set_active(False) else: w['spell_notes'].set_active(True) if self.config.get('plot', True, section='spell') == False: w['spell_plot'].set_active(False) else: w['spell_plot'].set_active(True) w['spell_lang'].set_text( str(self.config.get('lang', 'en', section='spell'))) if page is not None: w['notebook'].set_current_page(page) w['window'].show()