def __init__(self, shell): ''' Initializes the singleton interface, assigning all the constants used to access the plugin's settings. ''' super(Views._impl, self).__init__() from coverart_covericonview import CoverIconView from coverart_coverflowview import CoverFlowView from coverart_artistview import ArtistView from coverart_listview import ListView from coverart_browser_prefs import webkit_support library_name = shell.props.library_source.props.name self._values = OrderedDict() cl = CoverLocale() cl.switch_locale(cl.Locale.LOCALE_DOMAIN) self._values[CoverIconView.name] = [_('Tiles'), GLib.Variant.new_string('coverart-browser-tile')] if webkit_support(): self._values[CoverFlowView.name] = [_('Flow'), GLib.Variant.new_string('coverart-browser-coverflow')] self._values[ArtistView.name] = [_('Artist'), GLib.Variant.new_string('coverart-browser-artist')] self._values[ListView.name] = [library_name, GLib.Variant.new_string('coverart-browser-list')] cl.switch_locale(cl.Locale.RB) print (self._values)
def __init__(self, plugin, mainbox, controllers): super(Toolbar, self).__init__() self.plugin = plugin self.mainbox = mainbox cl = CoverLocale() ui_file = rb.find_plugin_file(plugin, self.ui) # create the toolbar builder = Gtk.Builder() builder.set_translation_domain(cl.Locale.LOCALE_DOMAIN) print (ui_file) builder.add_from_file(ui_file) # assign the controllers to the buttons for button, controller in controllers.items(): if button != 'search': builder.get_object(button).controller = controller if not webkit_support(): # button = builder.get_object('flowview_button') #button.set_visible(False) separator = builder.get_object('properties_separator') if separator: separator.set_visible(False) # workaround to translate the search entry tooltips cl.switch_locale(cl.Locale.RB) search_entry = SearchEntry(has_popup=True) search_entry.show_all() cl.switch_locale(cl.Locale.LOCALE_DOMAIN) # add it to the ui align = builder.get_object('entry_search_alignment') align.add(search_entry) # assign the controller search_entry.controller = controllers['search'] Theme(self.plugin).connect('theme_changed', self._theme_changed, controllers) self.builder = builder.get_object('toolbar') # now theme the toolbar including child objects such as the button popups style_context = self.builder.get_style_context() style_context.add_class(Gtk.STYLE_CLASS_TOOLBAR) view_button = builder.get_object(ToolbarObject.VIEW) view_button.set_visible(not self.plugin.using_headerbar)
def __init__(self): super(CoverFlowView, self).__init__() self.show_policy = FlowShowingPolicy(self) if webkit_support(): from gi.repository import WebKit self.view = WebKit.WebView() else: self.view = None self._last_album = None self._has_initialised = False self._filter_changed_inprogress = False self._on_first_use = True
def __init__(self, plugin, selection_color): ''' Initializes the pane, loading it's html templates and it's ui. ''' super(CoverSearchPane, self).__init__() self.set_orientation(Gtk.Orientation.VERTICAL) self.selection_color = selection_color self.file = "" self.basepath = 'file://' + plugin.plugin_info.get_data_dir() self.load_templates(plugin) if webkit_support(): self.init_gui() # init the pane with the empty template self.clear()
def __init__(self, plugin, mainbox, controllers): super(Toolbar, self).__init__() self.plugin = plugin self.mainbox = mainbox cl = CoverLocale() ui_file = rb.find_plugin_file(plugin, self.ui) # create the toolbar builder = Gtk.Builder() builder.set_translation_domain(cl.Locale.LOCALE_DOMAIN) builder.add_from_file(ui_file) # assign the controllers to the buttons for button, controller in controllers.items(): if button != 'search': builder.get_object(button).controller = controller if not webkit_support(): button = builder.get_object('iconview_button') button.set_visible(False) button = builder.get_object('flowview_button') button.set_visible(False) separator = builder.get_object('properties_separator') if separator: separator.set_visible(False) # workaround to translate the search entry tooltips cl.switch_locale(cl.Locale.RB) search_entry = SearchEntry(has_popup=True) search_entry.show_all() cl.switch_locale(cl.Locale.LOCALE_DOMAIN) # add it to the ui align = builder.get_object('entry_search_alignment') align.add(search_entry) # assign the controller search_entry.controller = controllers['search'] Theme(self.plugin).connect('theme_changed', self._theme_changed, controllers) self.builder = builder.get_object('main_box')
def __init__(self, shell): ''' Initializes the singleton interface, assigning all the constants used to access the plugin's settings. ''' super(Views._impl, self).__init__() from coverart_covericonview import CoverIconView from coverart_coverflowview import CoverFlowView from coverart_artistview import ArtistView from coverart_listview import ListView from coverart_browser_prefs import webkit_support library_name = shell.props.library_source.props.name self._values = OrderedDict() cl = CoverLocale() cl.switch_locale(cl.Locale.LOCALE_DOMAIN) self._values[CoverIconView.name] = [ _('Tiles'), GLib.Variant.new_string('coverart-browser-tile') ] if webkit_support(): self._values[CoverFlowView.name] = [ _('Flow'), GLib.Variant.new_string('coverart-browser-coverflow') ] self._values[ArtistView.name] = [ _('Artist'), GLib.Variant.new_string('coverart-browser-artist') ] self._values[ListView.name] = [ library_name, GLib.Variant.new_string('coverart-browser-list') ] cl.switch_locale(cl.Locale.RB) print(self._values)