Ejemplo n.º 1
0
    def __init__(self):
        gtk.Dialog.__init__(self)

        self.website_url = None
        self.bugtracker_url = None
        self.donate_url = None

        self.set_title(_('About'))

        self.image_icon = gtk.Image()
        self.label_app_name = gtk.Label()
        self.label_version = gtk.Label()
        self.label_description = gtk.Label()
        self.label_copyright = gtk.Label()
        self.table_layout = gtk.Table(3, 3, False)

        hildon.hildon_helper_set_logical_font(self.label_app_name,
                                              'X-LargeSystemFont')
        hildon.hildon_helper_set_logical_font(self.label_version,
                                              'LargeSystemFont')
        hildon.hildon_helper_set_logical_font(self.label_copyright,
                                              'SmallSystemFont')
        hildon.hildon_helper_set_logical_color(self.label_copyright, gtk.RC_FG,
                                               gtk.STATE_NORMAL,
                                               'SecondaryTextColor')

        self.label_app_name.set_alignment(0, 1)
        self.label_version.set_alignment(0, 1)
        self.label_description.set_alignment(0, 0)
        self.label_copyright.set_alignment(0, 1)
        self.label_copyright.set_line_wrap(True)
        self.label_version.set_padding(10, 0)
        self.label_copyright.set_padding(0, 5)
        self.image_icon.set_padding(5, 5)

        #content_area = self.get_content_area() # Starting with PyGTK 2.14
        content_area = self.vbox

        self.table_layout.attach(self.image_icon, 0, 1, 0, 2, 0, gtk.EXPAND, 0,
                                 0)
        self.table_layout.attach(self.label_app_name, 1, 2, 0, 1, 0,
                                 gtk.EXPAND | gtk.FILL, 0, 0)
        self.table_layout.attach(self.label_version, 2, 3, 0, 1,
                                 gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL,
                                 0, 0)
        self.table_layout.attach(self.label_description, 1, 3, 1, 2,
                                 gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL,
                                 0, 0)
        self.table_layout.attach(self.label_copyright, 0, 3, 2, 3,
                                 gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL,
                                 0, 0)
        content_area.add(self.table_layout)
        self.connect('response', self._on_response)
        self.show_all()
Ejemplo n.º 2
0
    def __init__(self):
        gtk.Dialog.__init__(self)

        self.website_url = None
        self.bugtracker_url = None
        self.donate_url = None

        self.set_title(_('About'))

        self.image_icon = gtk.Image()
        self.label_app_name = gtk.Label()
        self.label_version = gtk.Label()
        self.label_description = gtk.Label()
        self.label_copyright = gtk.Label()
        self.table_layout = gtk.Table(3, 3, False)

        hildon.hildon_helper_set_logical_font(self.label_app_name, 'X-LargeSystemFont')
        hildon.hildon_helper_set_logical_font(self.label_version, 'LargeSystemFont')
        hildon.hildon_helper_set_logical_font(self.label_copyright, 'SmallSystemFont')
        hildon.hildon_helper_set_logical_color(self.label_copyright, gtk.RC_FG, gtk.STATE_NORMAL, 'SecondaryTextColor')

        self.label_app_name.set_alignment(0, 1)
        self.label_version.set_alignment(0, 1)
        self.label_description.set_alignment(0, 0)
        self.label_copyright.set_alignment(0, 1)
        self.label_version.set_padding(10, 0)
        self.label_copyright.set_padding(0, 5)
        self.image_icon.set_padding(5, 5)

        #content_area = self.get_content_area() # Starting with PyGTK 2.14
        content_area = self.vbox

        self.table_layout.attach(self.image_icon, 0, 1, 0, 2, 0, gtk.EXPAND, 0, 0)
        self.table_layout.attach(self.label_app_name, 1, 2, 0, 1, 0, gtk.EXPAND | gtk.FILL, 0, 0)
        self.table_layout.attach(self.label_version, 2, 3, 0, 1, gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 0, 0)
        self.table_layout.attach(self.label_description, 1, 3, 1, 2, gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 0, 0)
        self.table_layout.attach(self.label_copyright, 0, 3, 2, 3, gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 0, 0)
        content_area.add(self.table_layout)
        self.connect('response', self._on_response)
        self.show_all()
Ejemplo n.º 3
0
    def new(self):
        self.channel = None

        # Styling for the label that appears when the list is empty
        hildon.hildon_helper_set_logical_font(self.empty_label, \
                'LargeSystemFont')
        hildon.hildon_helper_set_logical_color(self.empty_label, \
                gtk.RC_FG, gtk.STATE_NORMAL, 'SecondaryTextColor')

        self.episode_actions = gPodderEpisodeActions(self.main_window, \
                episode_list_status_changed=self.episode_list_status_changed, \
                episode_is_downloading=self.episode_is_downloading, \
                show_episode_shownotes=self.show_episode_shownotes, \
                playback_episodes=self.playback_episodes, \
                download_episode_list=self.download_episode_list, \
                show_episode_in_download_manager=self.show_episode_in_download_manager, \
                add_download_task_monitor=self.add_download_task_monitor, \
                remove_download_task_monitor=self.remove_download_task_monitor, \
                for_each_episode_set_task_status=self.for_each_episode_set_task_status, \
                delete_episode_list=self.delete_episode_list)

        # Tap-and-hold (aka "long press") context menu
        self.touched_episode = None
        self.context_menu = gtk.Menu()
        # "Emulate" hildon_gtk_menu_new
        self.context_menu.set_name('hildon-context-sensitive-menu')
        self.context_menu.append(self.action_shownotes.create_menu_item())
        self.context_menu.append(self.action_download.create_menu_item())
        self.context_menu.append(self.action_delete.create_menu_item())
        self.context_menu.append(gtk.SeparatorMenuItem())
        self.context_menu.append(self.action_keep.create_menu_item())
        self.context_menu.append(self.action_mark_as_old.create_menu_item())
        self.context_menu.show_all()
        self.treeview.tap_and_hold_setup(self.context_menu)

        # Workaround for Maemo bug XXX
        self.button_search_episodes_clear.set_name('HildonButton-thumb')
        appmenu = hildon.AppMenu()
        for action in (self.action_update, \
                       self.action_rename, \
                       self.action_login, \
                       self.action_website, \
                       self.action_unsubscribe, \
                       self.action_check_for_new_episodes, \
                       self.action_delete_episodes):
            button = gtk.Button()
            action.connect_proxy(button)
            appmenu.append(button)

        self.pause_sub_button = hildon.CheckButton(
            gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.pause_sub_button.set_label(_('Pause subscription'))
        self.pause_sub_button.connect(
            'toggled', self.on_pause_subscription_button_toggled)
        appmenu.append(self.pause_sub_button)

        self.keep_episodes_button = hildon.CheckButton(
            gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.keep_episodes_button.set_label(_('Keep episodes'))
        self.keep_episodes_button.connect('toggled',
                                          self.on_keep_episodes_button_toggled)
        appmenu.append(self.keep_episodes_button)

        for filter in (self.item_view_episodes_all, \
                       self.item_view_episodes_undeleted, \
                       self.item_view_episodes_downloaded):
            button = gtk.ToggleButton()
            filter.connect_proxy(button)
            appmenu.add_filter(button)
        appmenu.show_all()
        self.main_window.set_app_menu(appmenu)
Ejemplo n.º 4
0
    def make_player_tab(self):
        main_vbox = gtk.VBox()
        main_vbox.set_spacing(6)
        # add a vbox to self
        self.pack_start(main_vbox, True, True)

        # a hbox to hold the cover art and metadata vbox
        metadata_hbox = gtk.HBox()
        metadata_hbox.set_spacing(6)
        main_vbox.pack_start(metadata_hbox, True, False)

        event_box = gtk.EventBox()
        self.cover_art = gtk.Image()
        event_box.add(self.cover_art)
        metadata_hbox.pack_start(event_box, False, False)
        event_box.connect('button-press-event', self.cover_art_callback)

        # vbox to hold metadata
        metadata_vbox = gtk.VBox()
        metadata_vbox.pack_start(gtk.Image(), True, True)
        self.artist_label = gtk.Label('')
        self.artist_label.set_ellipsize(pango.ELLIPSIZE_END)
        metadata_vbox.pack_start(self.artist_label, False, False)
        separator = gtk.Label("")
        separator.set_size_request(-1, 10)
        metadata_vbox.pack_start(separator, False, False)
        self.album_label = gtk.Label('')
        if platform.FREMANTLE:
            hildon.hildon_helper_set_logical_font(self.album_label, 'SmallSystemFont')
            hildon.hildon_helper_set_logical_color(self.album_label, gtk.RC_FG, gtk.STATE_NORMAL, 'SecondaryTextColor')
        else:
            self.album_label.modify_font(pango.FontDescription('normal 8'))
        self.album_label.set_ellipsize(pango.ELLIPSIZE_END)
        metadata_vbox.pack_start(self.album_label, False, False)
        separator = gtk.Label("")
        separator.set_size_request(-1, 10)
        metadata_vbox.pack_start(separator, False, False)
        self.title_label = widgets.ScrollingLabel('',
                                                  self.config.get("options", "scrolling_color"),
                                                  update_interval=100,
                                                  pixel_jump=1,
                                                  delay_btwn_scrolls=5000,
                                                  delay_halfway=3000)
        self.title_label.scrolling = self.config.getboolean("options", "scrolling_labels")
        metadata_vbox.pack_start(self.title_label, False, False)
        metadata_vbox.pack_start(gtk.Image(), True, True)
        metadata_hbox.pack_start( metadata_vbox, True, True )

        progress_eventbox = gtk.EventBox()
        progress_eventbox.set_events(gtk.gdk.BUTTON_PRESS_MASK)
        progress_eventbox.connect(
            'button-press-event', self.on_progressbar_changed )
        self.progress = gtk.ProgressBar()
        self.progress.set_size_request(-1, self.config.getint("options", "progress_height"))
        progress_eventbox.add(self.progress)
        main_vbox.pack_start( progress_eventbox, False, False )

        # make the button box
        buttonbox = gtk.HBox()

        # A wrapper to help create DualActionButtons with the right settings
        def create_da(widget, action, widget2=None, action2=None):
            if platform.FREMANTLE:
                widget2 = None
                action2 = None

            return widgets.DualActionButton(widget, action, self.config, widget2, action2)

        self.rrewind_button = create_da(
                gtkutil.generate_image('media-skip-backward.png'),
                lambda: self.do_seek(-1*self.config.getint('options', 'seek_long')),
                gtkutil.generate_image("gtk-goto-first-ltr.png"),
                self.playlist.prev)
        buttonbox.add(self.rrewind_button)

        self.rewind_button = create_da(
                gtkutil.generate_image('media-seek-backward.png'),
                lambda: self.do_seek(-1*self.config.getint('options', 'seek_short')))
        buttonbox.add(self.rewind_button)

        self.play_pause_button = gtk.Button('')
        gtkutil.image(self.play_pause_button, 'media-playback-start.png')
        self.play_pause_button.connect( 'clicked',
                                        self.on_btn_play_pause_clicked )
        buttonbox.add(self.play_pause_button)

        self.forward_button = create_da(
                gtkutil.generate_image('media-seek-forward.png'),
                lambda: self.do_seek(self.config.getint('options', 'seek_short')))
        buttonbox.add(self.forward_button)

        self.fforward_button = create_da(
                gtkutil.generate_image('media-skip-forward.png'),
                lambda: self.do_seek(self.config.getint('options', 'seek_long')),
                gtkutil.generate_image("gtk-goto-last-ltr.png"),
                self.playlist.next)
        buttonbox.add(self.fforward_button)

        self.bookmarks_button = create_da(
                gtkutil.generate_image('bookmark-new.png'),
                self.playlist.add_bookmark_at_current_position,
                gtkutil.generate_image(gtk.STOCK_JUMP_TO, True),
                lambda *args: self.notify('select-current-item-request'))
        buttonbox.add(self.bookmarks_button)
        self.set_controls_sensitivity(False)

        if platform.FREMANTLE:
            for child in buttonbox.get_children():
                if isinstance(child, gtk.Button):
                    child.set_name('HildonButton-thumb')

        buttonbox.set_size_request(-1, self.config.getint("options", "button_height"))
        main_vbox.pack_start(buttonbox, False, False)

        if platform.MAEMO:
            self.__gui_root.main_window.connect( 'key-press-event',
                                                 self.on_key_press )

            # Disable focus for all widgets, so we can use the cursor
            # keys + enter to directly control our media player, which
            # is handled by "key-press-event"
            for w in (
                    self.rrewind_button, self.rewind_button,
                    self.play_pause_button, self.forward_button,
                    self.fforward_button, self.progress,
                    self.bookmarks_button, ):
                w.unset_flags(gtk.CAN_FOCUS)
Ejemplo n.º 5
0
    def new(self):
        self.channel = None

        # Styling for the label that appears when the list is empty
        hildon.hildon_helper_set_logical_font(self.empty_label, \
                'LargeSystemFont')
        hildon.hildon_helper_set_logical_color(self.empty_label, \
                gtk.RC_FG, gtk.STATE_NORMAL, 'SecondaryTextColor')

        self.episode_actions = gPodderEpisodeActions(self.main_window, \
                episode_list_status_changed=self.episode_list_status_changed, \
                episode_is_downloading=self.episode_is_downloading, \
                show_episode_shownotes=self.show_episode_shownotes, \
                playback_episodes=self.playback_episodes, \
                download_episode_list=self.download_episode_list, \
                show_episode_in_download_manager=self.show_episode_in_download_manager, \
                add_download_task_monitor=self.add_download_task_monitor, \
                remove_download_task_monitor=self.remove_download_task_monitor, \
                for_each_episode_set_task_status=self.for_each_episode_set_task_status, \
                delete_episode_list=self.delete_episode_list)

        # Tap-and-hold (aka "long press") context menu
        self.touched_episode = None
        self.context_menu = gtk.Menu()
        # "Emulate" hildon_gtk_menu_new
        self.context_menu.set_name('hildon-context-sensitive-menu')
        self.context_menu.append(self.action_shownotes.create_menu_item())
        self.context_menu.append(self.action_download.create_menu_item())
        self.context_menu.append(self.action_delete.create_menu_item())
        self.context_menu.append(gtk.SeparatorMenuItem())
        self.context_menu.append(self.action_keep.create_menu_item())
        self.context_menu.append(self.action_mark_as_old.create_menu_item())
        self.context_menu.show_all()
        self.treeview.tap_and_hold_setup(self.context_menu)

        # Workaround for Maemo bug XXX
        self.button_search_episodes_clear.set_name('HildonButton-thumb')
        appmenu = hildon.AppMenu()
        for action in (self.action_update, \
                       self.action_rename, \
                       self.action_login, \
                       self.action_website, \
                       self.action_unsubscribe, \
                       self.action_check_for_new_episodes, \
                       self.action_delete_episodes):
            button = gtk.Button()
            action.connect_proxy(button)
            appmenu.append(button)

        self.pause_sub_button = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.pause_sub_button.set_label(_('Pause subscription'))
        self.pause_sub_button.connect('toggled', self.on_pause_subscription_button_toggled)
        appmenu.append(self.pause_sub_button)

        self.keep_episodes_button = hildon.CheckButton(gtk.HILDON_SIZE_FINGER_HEIGHT)
        self.keep_episodes_button.set_label(_('Keep episodes'))
        self.keep_episodes_button.connect('toggled', self.on_keep_episodes_button_toggled)
        appmenu.append(self.keep_episodes_button)

        for filter in (self.item_view_episodes_all, \
                       self.item_view_episodes_undeleted, \
                       self.item_view_episodes_downloaded):
            button = gtk.ToggleButton()
            filter.connect_proxy(button)
            appmenu.add_filter(button)
        appmenu.show_all()
        self.main_window.set_app_menu(appmenu)
Ejemplo n.º 6
0
    def make_player_tab(self):
        main_vbox = gtk.VBox()
        main_vbox.set_spacing(6)
        # add a vbox to self
        self.pack_start(main_vbox, True, True)

        # a hbox to hold the cover art and metadata vbox
        metadata_hbox = gtk.HBox()
        metadata_hbox.set_spacing(6)
        main_vbox.pack_start(metadata_hbox, True, False)

        self.cover_art = gtk.Image()
        metadata_hbox.pack_start(self.cover_art, False, False)

        # vbox to hold metadata
        metadata_vbox = gtk.VBox()
        metadata_vbox.pack_start(gtk.Image(), True, True)
        self.artist_label = gtk.Label('')
        self.artist_label.set_ellipsize(pango.ELLIPSIZE_END)
        metadata_vbox.pack_start(self.artist_label, False, False)
        separator = gtk.Label("")
        separator.set_size_request(-1, 10)
        metadata_vbox.pack_start(separator, False, False)
        self.album_label = gtk.Label('')
        if platform.FREMANTLE:
            hildon.hildon_helper_set_logical_font(self.album_label,
                                                  'SmallSystemFont')
            hildon.hildon_helper_set_logical_color(self.album_label, gtk.RC_FG,
                                                   gtk.STATE_NORMAL,
                                                   'SecondaryTextColor')
        else:
            self.album_label.modify_font(pango.FontDescription('normal 8'))
        self.album_label.set_ellipsize(pango.ELLIPSIZE_END)
        metadata_vbox.pack_start(self.album_label, False, False)
        separator = gtk.Label("")
        separator.set_size_request(-1, 10)
        metadata_vbox.pack_start(separator, False, False)
        self.title_label = widgets.ScrollingLabel('',
                                                  self.config.get(
                                                      "options",
                                                      "scrolling_color"),
                                                  update_interval=100,
                                                  pixel_jump=1,
                                                  delay_btwn_scrolls=5000,
                                                  delay_halfway=3000)
        self.title_label.scrolling = self.config.getboolean(
            "options", "scrolling_labels")
        metadata_vbox.pack_start(self.title_label, False, False)
        metadata_vbox.pack_start(gtk.Image(), True, True)
        metadata_hbox.pack_start(metadata_vbox, True, True)

        progress_eventbox = gtk.EventBox()
        progress_eventbox.set_events(gtk.gdk.BUTTON_PRESS_MASK)
        progress_eventbox.connect('button-press-event',
                                  self.on_progressbar_changed)
        self.progress = gtk.ProgressBar()
        self.progress.set_size_request(
            -1, self.config.getint("options", "progress_height"))
        progress_eventbox.add(self.progress)
        main_vbox.pack_start(progress_eventbox, False, False)

        # make the button box
        buttonbox = gtk.HBox()

        # A wrapper to help create DualActionButtons with the right settings
        def create_da(widget, action, widget2=None, action2=None):
            if platform.FREMANTLE:
                widget2 = None
                action2 = None

            return widgets.DualActionButton(widget, action, self.config,
                                            widget2, action2)

        self.rrewind_button = create_da(
            gtkutil.generate_image('media-skip-backward.png'),
            lambda: self.do_seek(-1 * self.config.getint(
                'options', 'seek_long')),
            gtkutil.generate_image(gtk.STOCK_GOTO_FIRST,
                                   True), self.playlist.prev)
        buttonbox.add(self.rrewind_button)

        self.rewind_button = create_da(
            gtkutil.generate_image('media-seek-backward.png'),
            lambda: self.do_seek(-1 * self.config.getint(
                'options', 'seek_short')))
        buttonbox.add(self.rewind_button)

        self.play_pause_button = gtk.Button('')
        gtkutil.image(self.play_pause_button, 'media-playback-start.png')
        self.play_pause_button.connect('clicked',
                                       self.on_btn_play_pause_clicked)
        self.play_pause_button.set_sensitive(False)
        buttonbox.add(self.play_pause_button)

        self.forward_button = create_da(
            gtkutil.generate_image('media-seek-forward.png'),
            lambda: self.do_seek(self.config.getint('options', 'seek_short')))
        buttonbox.add(self.forward_button)

        self.fforward_button = create_da(
            gtkutil.generate_image('media-skip-forward.png'),
            lambda: self.do_seek(self.config.getint('options', 'seek_long')),
            gtkutil.generate_image(gtk.STOCK_GOTO_LAST,
                                   True), self.playlist.next)
        buttonbox.add(self.fforward_button)

        self.bookmarks_button = create_da(
            gtkutil.generate_image('bookmark-new.png'),
            self.playlist.player.add_bookmark_at_current_position,
            gtkutil.generate_image(gtk.STOCK_JUMP_TO, True),
            lambda *args: self.notify('select-current-item-request'))
        buttonbox.add(self.bookmarks_button)
        self.set_controls_sensitivity(False)

        if platform.FREMANTLE:
            for child in buttonbox.get_children():
                if isinstance(child, gtk.Button):
                    child.set_name('HildonButton-thumb')

        buttonbox.set_size_request(
            -1, self.config.getint("options", "button_height"))
        main_vbox.pack_start(buttonbox, False, False)

        if platform.MAEMO:
            self.__gui_root.main_window.connect('key-press-event',
                                                self.on_key_press)

            # Disable focus for all widgets, so we can use the cursor
            # keys + enter to directly control our media player, which
            # is handled by "key-press-event"
            for w in (
                    self.rrewind_button,
                    self.rewind_button,
                    self.play_pause_button,
                    self.forward_button,
                    self.fforward_button,
                    self.progress,
                    self.bookmarks_button,
            ):
                w.unset_flags(gtk.CAN_FOCUS)