Example #1
0
    def on_prefs_real(self):
        """Display the preferences dialog"""

        self.builder = ui.builder('preferences')
        self.provider = ui.css_provider('preferences')
        self.prefswindow = self.builder.get_object('preferences_dialog')
        self.prefswindow.set_transient_for(self.window)
        self.prefsnotebook = self.builder.get_object('preferences_notebook')

        tabs = ('mpd', 'display', 'behavior', 'format', 'extras', 'plugins')

        for name in tabs:
            func = getattr(self, '%s_tab' % name)
            cbs = globals().get('%s_cbs' % name.capitalize())
            func(cbs)

        close_button = self.builder.get_object('preferences_closebutton')
        self.prefswindow.show_all()
        self.prefsnotebook.set_current_page(self.last_tab)
        close_button.grab_focus()
        self.prefswindow.connect('response', self._window_response)
        # Save previous connection properties to determine if we should try to
        # connect to MPD after prefs are closed:
        self.prev_host = self.config.host[self.config.profile_num]
        self.prev_port = self.config.port[self.config.profile_num]
        self.prev_password = self.config.password[self.config.profile_num]
Example #2
0
    def on_prefs_real(self):
        """Display the preferences dialog"""

        self.builder = ui.builder('preferences')
        self.provider = ui.css_provider('preferences')
        self.prefswindow = self.builder.get_object('preferences_dialog')
        self.prefswindow.set_transient_for(self.window)
        self.prefsnotebook = self.builder.get_object('preferences_notebook')

        tabs = ('mpd', 'display', 'behavior', 'format', 'extras', 'plugins')

        for name in tabs:
            func = getattr(self, '%s_tab' % name)
            cbs = globals().get('%s_cbs' % name.capitalize())
            func(cbs)

        close_button = self.builder.get_object('preferences_closebutton')
        self.prefswindow.show_all()
        self.prefsnotebook.set_current_page(self.last_tab)
        close_button.grab_focus()
        self.prefswindow.connect('response', self._window_response)
        # Save previous connection properties to determine if we should try to
        # connect to MPD after prefs are closed:
        self.prev_host = self.config.host[self.config.profile_num]
        self.prev_port = self.config.port[self.config.profile_num]
        self.prev_password = self.config.password[self.config.profile_num]
Example #3
0
    def __init__(self, config, linkcolor, on_link_click_cb,
                 get_playing_song, TAB_INFO, on_image_activate,
                 on_image_motion_cb, on_image_drop_cb,
                 album_return_artist_and_tracks, add_tab):
        self.logger = logging.getLogger(__name__)
        self.config = config
        self.linkcolor = linkcolor
        self.on_link_click_cb = on_link_click_cb
        self.get_playing_song = get_playing_song
        self.album_return_artist_and_tracks = album_return_artist_and_tracks

        self.last_bitrate = None

        self.info_boxes_in_more = None
        self._editlabel = None
        self.info_left_label = None
        self.info_lyrics = None
        self._morelabel = None
        self._searchlabel = None

        self.lyrics_text = None
        self.album_text = None

        self.active = False

        # Info tab
        self.builder = ui.builder('info')
        self.css_provider = ui.css_provider('info')
        self.info_area = self.builder.get_object('info_page_scrolledwindow')
        self.tab_label_widget = self.builder.get_object('info_tab_eventbox')
        tab_label = self.builder.get_object('info_tab_label')
        tab_label.set_text(TAB_INFO)
        self.tab = add_tab(self.info_area, self.tab_label_widget,
                           TAB_INFO, self.info_area)

        self._imagebox = self.builder.get_object('info_page_song_eventbox')
        self.image = self.builder.get_object('info_page_song_image')
        self.image.set_from_icon_set(ui.icon('sonata-cd-large'), -1)

        self._imagebox.drag_dest_set(Gtk.DestDefaults.HIGHLIGHT |
                                     Gtk.DestDefaults.DROP,
                                     [Gtk.TargetEntry.new("text/uri-list", 0, 80),
                                      Gtk.TargetEntry.new("text/plain", 0, 80)],
                                      Gdk.DragAction.DEFAULT)
        self._imagebox.connect('button_press_event', on_image_activate)
        self._imagebox.connect('drag_motion', on_image_motion_cb)
        self._imagebox.connect('drag_data_received', on_image_drop_cb)

        self._widgets_initialize()
Example #4
0
    def __init__(self, config, linkcolor, on_link_click_cb, get_playing_song,
                 TAB_INFO, on_image_activate, on_image_motion_cb,
                 on_image_drop_cb, album_return_artist_and_tracks, add_tab):
        self.logger = logging.getLogger(__name__)
        self.config = config
        self.linkcolor = linkcolor
        self.on_link_click_cb = on_link_click_cb
        self.get_playing_song = get_playing_song
        self.album_return_artist_and_tracks = album_return_artist_and_tracks

        self.last_bitrate = None

        self.info_boxes_in_more = None
        self._editlabel = None
        self.info_left_label = None
        self.info_lyrics = None
        self._morelabel = None
        self._searchlabel = None

        self.lyrics_text = None
        self.album_text = None

        self.active = False

        # Info tab
        self.builder = ui.builder('info')
        self.css_provider = ui.css_provider('info')
        self.info_area = self.builder.get_object('info_page_scrolledwindow')
        self.tab_label_widget = self.builder.get_object('info_tab_eventbox')
        tab_label = self.builder.get_object('info_tab_label')
        tab_label.set_text(TAB_INFO)
        self.tab = add_tab(self.info_area, self.tab_label_widget, TAB_INFO,
                           self.info_area)

        self._imagebox = self.builder.get_object('info_page_song_eventbox')
        self.image = self.builder.get_object('info_page_song_image')
        self.image.set_from_icon_set(ui.icon('sonata-cd-large'), -1)

        self._imagebox.drag_dest_set(
            Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP, [
                Gtk.TargetEntry.new("text/uri-list", 0, 80),
                Gtk.TargetEntry.new("text/plain", 0, 80)
            ], Gdk.DragAction.DEFAULT)
        self._imagebox.connect('button_press_event', on_image_activate)
        self._imagebox.connect('drag_motion', on_image_motion_cb)
        self._imagebox.connect('drag_data_received', on_image_drop_cb)

        self._widgets_initialize()
Example #5
0
    def __init__(self, window, tags_mpd_update, tags_set_use_mpdpath):
        self.window = window
        self.tags_mpd_update = tags_mpd_update
        self.tags_set_use_mpdpath = tags_set_use_mpdpath

        self.file_label = None
        self.curr_mpdpath = None
        self.tagnum = None
        self.use_mpdpaths = None

        self.edit_window = None
        self.entries = None
        self.tags = None

        self.builder = ui.builder('tagedit')
        self.css_provider = ui.css_provider('tagedit')
Example #6
0
    def __init__(self, window, tags_mpd_update, tags_set_use_mpdpath):
        self.window = window
        self.tags_mpd_update = tags_mpd_update
        self.tags_set_use_mpdpath = tags_set_use_mpdpath

        self.file_label = None
        self.curr_mpdpath = None
        self.tagnum = None
        self.use_mpdpaths = None

        self.edit_window = None
        self.entries = None
        self.tags = None

        self.builder = ui.builder('tagedit')
        self.css_provider = ui.css_provider('tagedit')
Example #7
0
 def about_load(self, stats):
     self.builder = ui.builder('about')
     self.provider = ui.css_provider('about')
     self.about_dialog = self.builder.get_object('about_dialog')
     try:
         self.about_dialog.set_transient_for(self.parent_window)
     except:
         pass
     self.about_dialog.set_version(self.version)
     if stats:
         self.about_dialog.set_copyright(self.statstext(stats))
     context = self.about_dialog.get_style_context()
     logo_icon = Gtk.IconFactory.lookup_default('sonata-large')
     logo_pb = logo_icon.render_icon_pixbuf(context, -1)
     self.about_dialog.set_logo(logo_pb)
     # Add button to show keybindings:
     children = self.about_dialog.action_area.get_children()[-1]
     self.about_dialog.action_area.reorder_child(children, -2)
     # Connect to callbacks
     self.about_dialog.connect('response', self.about_close)
     self.about_dialog.connect('delete_event', self.about_close)
     shortcut_button = self.builder.get_object('shortcut_button')
     shortcut_button.connect('clicked', self.about_shortcuts)
     self.about_dialog.show_all()
Example #8
0
 def about_load(self, stats):
     self.builder = ui.builder('about')
     self.provider = ui.css_provider('about')
     self.about_dialog = self.builder.get_object('about_dialog')
     try:
         self.about_dialog.set_transient_for(self.parent_window)
     except:
         pass
     self.about_dialog.set_version(self.version)
     if stats:
         self.about_dialog.set_copyright(self.statstext(stats))
     context = self.about_dialog.get_style_context()
     logo_icon = Gtk.IconFactory.lookup_default('sonata-large')
     logo_pb = logo_icon.render_icon_pixbuf(context, -1)
     self.about_dialog.set_logo(logo_pb)
     # Add button to show keybindings:
     children = self.about_dialog.action_area.get_children()[-1]
     self.about_dialog.action_area.reorder_child(children, -2)
     # Connect to callbacks
     self.about_dialog.connect('response', self.about_close)
     self.about_dialog.connect('delete_event', self.about_close)
     shortcut_button = self.builder.get_object('shortcut_button')
     shortcut_button.connect('clicked', self.about_shortcuts)
     self.about_dialog.show_all()