Esempio n. 1
0
def run_dialog(channel):
    """Displays the feed settings panel dialog."""
    pref_window = MainDialog(_("Podcast Settings"))
    try:
        try:
            v = widgetset.VBox(spacing=10)
            v.pack_start(
                widgetutil.align_left(_build_header(channel),
                                      left_pad=20,
                                      right_pad=20))

            v.pack_start(separator.HThinSeparator((0.6, 0.6, 0.6)), padding=18)

            grid = dialogwidgets.ControlGrid()
            _build_auto_download(channel, grid)
            grid.end_line(spacing=20)
            _build_video_expires(channel, grid)
            grid.end_line(spacing=20)
            _build_remember_items(channel, grid)
            v.pack_start(
                widgetutil.align_left(grid.make_table(),
                                      left_pad=20,
                                      right_pad=20))

            v.pack_end(separator.HThinSeparator((0.6, 0.6, 0.6)), padding=6)

            pref_window.set_extra_widget(v)
            pref_window.add_button(BUTTON_DONE.text)

            pref_window.run()
        except StandardError:
            logging.exception("feed settings panel threw exception.")
    finally:
        pref_window.destroy()
Esempio n. 2
0
def _playback_panel():
    extras = []

    lab = widgetset.Label(_("Renderer options:"))
    lab.set_bold(True)
    extras.append(align_left(lab))

    grid = dialogwidgets.ControlGrid()

    note = dialogwidgets.note(
        _("You must restart %(appname)s for renderer "
          "changes to take effect.",
          {"appname": app.config.get(prefs.SHORT_APP_NAME)}))
    grid.pack(align_left(note, bottom_pad=12), grid.ALIGN_LEFT, span=2)

    grid.end_line(spacing=12)

    rbg = widgetset.RadioButtonGroup()
    radio_map = {}
    for mem in renderers.get_renderer_list():
        radio_map[mem] = widgetset.RadioButton(mem, rbg)

    buttons = [(v, k) for k, v in radio_map.items()]
    attach_radio(buttons, options.USE_RENDERER)

    grid.pack_label(_("Video renderer:"), grid.ALIGN_RIGHT)
    grid.pack(dialogwidgets.radio_button_list(*radio_map.values()))

    grid.end_line(spacing=12)

    extras.append(align_left(grid.make_table()))

    return extras
Esempio n. 3
0
def _conversions_panel():
    extras = []

    lab = widgetset.Label(_("Binaries to use:"))
    lab.set_bold(True)
    extras.append(align_left(lab))

    grid = dialogwidgets.ControlGrid()

    grid.pack_label(_("ffmpeg binary path:"), grid.ALIGN_RIGHT)
    ffmpeg_binary = widgetset.TextEntry()
    attach_text(ffmpeg_binary, options.FFMPEG_BINARY)
    grid.pack(ffmpeg_binary)

    grid.end_line(spacing=4)

    grid.pack_label(_("ffmpeg2theora binary path:"), grid.ALIGN_RIGHT)
    ffmpeg2theora_binary = widgetset.TextEntry()
    attach_text(ffmpeg2theora_binary, options.FFMPEG2THEORA_BINARY)
    grid.pack(ffmpeg2theora_binary)

    grid.end_line(spacing=4)

    extras.append(align_left(grid.make_table()))

    return extras
Esempio n. 4
0
    def build_widgets(self):
        self.vlayout = widgetset.VBox(spacing=5)
        grid = dialogwidgets.ControlGrid()

        donate_nothanks_textentry = widgetset.TextEntry()
        donate_nothanks_textentry.set_width(5)
        prefpanel.attach_integer(donate_nothanks_textentry,
                                 prefs.DONATE_NOTHANKS,
                                 prefpanel.build_error_image(),
                                 prefpanel.create_value_checker(min_=0))

        last_donate_time_textentry = widgetset.TextEntry()
        last_donate_time_textentry.set_width(16)
        prefpanel.attach_integer(last_donate_time_textentry,
                                 prefs.LAST_DONATE_TIME,
                                 prefpanel.build_error_image(),
                                 prefpanel.create_value_checker(min_=0))

        donate_counter_textentry = widgetset.TextEntry()
        donate_counter_textentry.set_width(5)
        prefpanel.attach_integer(donate_counter_textentry,
                                 prefs.DONATE_COUNTER,
                                 prefpanel.build_error_image(),
                                 prefpanel.create_value_checker(min_=0))

        set_ratelimit_button = widgetset.Button('Force ratelimit')
        set_ratelimit_button.connect('clicked', self.on_set_ratelimit_clicked)

        reset_ratelimit_button = widgetset.Button('Force no ratelimit')
        reset_ratelimit_button.connect('clicked',
                                       self.on_reset_ratelimit_clicked)

        reset_button = widgetset.Button('Reset counters to factory defaults')
        reset_button.connect('clicked', self.on_reset_clicked)

        reset_donate_url_button = widgetset.Button('Reset')
        reset_donate_url_button.connect('clicked',
                                        self.on_reset_donate_url_clicked)

        reset_payment_url_button = widgetset.Button('Reset')
        reset_payment_url_button.connect('clicked',
                                         self.on_reset_payment_url_clicked)

        self.donate_url_textentry = widgetset.TextEntry()
        self.donate_url_textentry.set_width(16)

        self.payment_url_textentry = widgetset.TextEntry()
        self.payment_url_textentry.set_width(16)

        run_button = widgetset.Button('Run dialog')
        run_button.connect('clicked', self.on_run_clicked)

        grid.pack_label('Set DONATE_NOTHANKS', grid.ALIGN_RIGHT)
        grid.pack(donate_nothanks_textentry, span=2)
        grid.end_line(spacing=4)

        grid.pack_label('Set LAST_DONATE_TIME', grid.ALIGN_RIGHT)
        grid.pack(last_donate_time_textentry, span=2)
        grid.end_line(spacing=4)

        grid.pack_label('Set DONATE_COUNTER', grid.ALIGN_RIGHT)
        grid.pack(donate_counter_textentry, span=2)
        grid.end_line(spacing=4)

        grid.pack(reset_button, grid.FILL, span=3)
        grid.end_line(spacing=4)

        hbox = widgetset.HBox()
        hbox.pack_start(set_ratelimit_button)
        hbox.pack_start(reset_ratelimit_button)

        grid.pack(widgetutil.align_center(hbox), grid.FILL, span=3)
        grid.end_line(spacing=4)
        grid.pack_label('Use donate url', grid.ALIGN_RIGHT)
        grid.pack(self.donate_url_textentry)
        grid.pack(reset_donate_url_button, grid.FILL)
        grid.end_line(spacing=4)

        grid.pack_label('Use payment donate url', grid.ALIGN_RIGHT)
        grid.pack(self.payment_url_textentry)
        grid.pack(reset_payment_url_button, grid.FILL)
        grid.end_line(spacing=4)

        grid.pack(run_button, grid.FILL, span=3)
        grid.end_line(spacing=12)

        alignment = widgetset.Alignment(xalign=0.5, yalign=0.5)
        alignment.set_padding(20, 20, 20, 20)
        alignment.add(grid.make_table())

        return alignment