Exemple #1
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
    def __init__(self):
        widgetset.Background.__init__(self)
        self.create_signal('install-clicked')

        vbox = widgetset.VBox()
        label = widgetset.Label(_("Sharing Disabled").upper())
        label.set_bold(True)
        label.set_color((1, 1, 1))
        vbox.pack_start(widgetutil.align_left(label, top_pad=10))
        # Note: "Miro iPad app" is the name of a specific piece of
        # software and thus should not be %(appname)s iPad app.
        label = widgetset.Label(
            _("You need to install the Bonjour libraries to be able to "
              "share files from %(appname)s-to-%(appname)s or to the "
              "Miro iPad app.\n\n"
              "Once you install the Bonjour libraries, you will have "
              "to restart %(appname)s.",
              {'appname': app.config.get(prefs.SHORT_APP_NAME)}))

        label.set_wrap(True)
        label.set_size_request(550, -1)
        label.set_color((1, 1, 1))
        vbox.pack_start(widgetutil.align_left(label, top_pad=20))
        button = widgetset.Button(_("Click here to install"))
        button.connect('clicked', self.on_clicked)
        vbox.pack_start(widgetutil.align_left(button, top_pad=20,
                                              bottom_pad=20))

        self.add(widgetutil.align(vbox, xscale=1, left_pad=20))
Exemple #3
0
    def __init__(self):
        widgetset.Background.__init__(self)
        self.create_signal('install-clicked')

        vbox = widgetset.VBox()
        label = widgetset.Label(_("Sharing Disabled").upper())
        label.set_bold(True)
        label.set_color((1, 1, 1))
        vbox.pack_start(widgetutil.align_left(label, top_pad=10))
        # Note: "Miro iPad app" is the name of a specific piece of
        # software and thus should not be %(appname)s iPad app.
        label = widgetset.Label(
            _(
                "You need to install the Bonjour libraries to be able to "
                "share files from %(appname)s-to-%(appname)s or to the "
                "Miro iPad app.\n\n"
                "Once you install the Bonjour libraries, you will have "
                "to restart %(appname)s.",
                {'appname': app.config.get(prefs.SHORT_APP_NAME)}))

        label.set_wrap(True)
        label.set_size_request(550, -1)
        label.set_color((1, 1, 1))
        vbox.pack_start(widgetutil.align_left(label, top_pad=20))
        button = widgetset.Button(_("Click here to install"))
        button.connect('clicked', self.on_clicked)
        vbox.pack_start(
            widgetutil.align_left(button, top_pad=20, bottom_pad=20))

        self.add(widgetutil.align(vbox, xscale=1, left_pad=20))
Exemple #4
0
 def _build_app_store_section(self, bottom):
     # iPad link
     hbox = widgetset.HBox()
     vbox = widgetset.VBox()
     label = self.build_header(_("Miro on your iPad"))
     vbox.pack_start(
         widgetutil.align_left(label, left_pad=20, bottom_pad=10))
     label = widgetset.Label(
         _(
             "The gorgeous Miro iPad app lets you wirelessly stream music "
             "and videos from %(shortappname)s on your desktop to your iPad. "
             "You can also download songs and videos to your iPad and take "
             "them with you.", self.trans_data))
     label.set_size(self.TEXT_SIZE)
     label.set_color(self.TEXT_COLOR)
     label.set_wrap(True)
     label.set_size_request(400, -1)
     vbox.pack_start(
         widgetutil.align_left(label,
                               left_pad=20,
                               right_pad=10,
                               bottom_pad=50))
     hbox.pack_start(vbox)
     app_store_button = AppStoreButton()
     app_store_button.connect('clicked', self.app_store_button_clicked)
     hbox.pack_start(app_store_button)
     bottom.pack_start(hbox)
Exemple #5
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
Exemple #6
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
Exemple #7
0
    def build_widget(self):
        v = widgetset.VBox(8)

        run_at_startup_cbx = widgetset.Checkbox(_(
            "Automatically run %(appname)s when I log in.",
            {'appname': app.config.get(prefs.SHORT_APP_NAME)}))
        attach_boolean(run_at_startup_cbx, prefs.RUN_AT_STARTUP)
        v.pack_start(run_at_startup_cbx)

        warn_if_downloading_cbx = widgetset.Checkbox(_("Warn me if I attempt to quit with downloads in progress."))
        attach_boolean(warn_if_downloading_cbx, prefs.WARN_IF_DOWNLOADING_ON_QUIT)
        v.pack_start(warn_if_downloading_cbx)

        warn_if_converting_cbx = widgetset.Checkbox(_("Warn me if I attempt to quit with conversions in progress."))
        attach_boolean(warn_if_converting_cbx, prefs.WARN_IF_CONVERTING_ON_QUIT)
        v.pack_start(warn_if_converting_cbx)

        # FIXME - need to automatically generate list of available languages
        # in correct language
        lang_options = gtcache.get_languages()
        lang_options.insert(0, ("system", _("System default")))

        lang_option_menu = widgetset.OptionMenu([op[1] for op in lang_options])
        attach_combo(lang_option_menu, prefs.LANGUAGE,
                     [op[0] for op in lang_options])
        v.pack_start(widgetutil.align_left(
            widgetutil.build_control_line((widgetset.Label(_("Language:")), lang_option_menu))))

        v.pack_start(widgetutil.align_left(
            dialogwidgets.note(_("(Changing the language requires you to restart Miro.)"))))
        
        pack_extras(v, "general")

        return v
Exemple #8
0
def run_dialog(channel):
    """Displays the feed settings panel dialog."""
    pref_window = MainDialog(_("Feed 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()
Exemple #9
0
 def __init__(self):
     widgetset.SolidBackground.__init__(self, (0, 0, 0))
     vbox = widgetset.VBox()
     label = widgetset.Label(_(
         "%(appname)s can't play this file.  You may "
         "be able to open it with a different program",
         {"appname": app.config.get(prefs.SHORT_APP_NAME)}
         ))
     label.set_color((1, 1, 1))
     vbox.pack_start(label)
     table = widgetset.Table(2, 2)
     table.set_column_spacing(6)
     self.filename_label = self._make_label('')
     self.filetype_label  = self._make_label('')
     table.pack(widgetutil.align_left(self._make_heading(_('Filename:'))),
             0, 0)
     table.pack(widgetutil.align_left(self.filename_label), 1, 0)
     table.pack(widgetutil.align_left(self._make_heading(_('File type:'))),
             0, 1)
     table.pack(widgetutil.align_left(self.filetype_label), 1, 1)
     vbox.pack_start(widgetutil.align_left(table, top_pad=12))
     hbox = widgetset.HBox(spacing=12)
     reveal_button = widgetset.Button(_('Reveal File'))
     self.play_externally_button = widgetset.Button(_('Play Externally'))
     self.play_externally_button.connect('clicked', self._on_play_externally)
     skip_button = widgetset.Button(_('Skip'))
     reveal_button.connect('clicked', self._on_reveal)
     skip_button.connect('clicked', self._on_skip)
     hbox.pack_start(reveal_button)
     hbox.pack_start(self.play_externally_button)
     hbox.pack_start(skip_button)
     vbox.pack_start(widgetutil.align_center(hbox, top_pad=24))
     alignment = widgetset.Alignment(xalign=0.5, yalign=0.5)
     alignment.add(vbox)
     self.add(alignment)
Exemple #10
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()
Exemple #11
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
Exemple #12
0
    def _build_sync_section(self, bottom):
        hbox = widgetset.HBox()
        vbox = widgetset.VBox()
        label_line = widgetset.HBox()
        label = self.build_header(_("Sync a Phone, Tablet, or Digital Camera"))
        label_line.pack_start(
            widgetutil.align_left(label, left_pad=20, bottom_pad=10))
        help_button = HelpButton()
        help_button.connect('clicked', self.help_button_clicked)
        label_line.pack_start(widgetutil.align_top(help_button))
        bottom.pack_start(label_line)

        label = widgetset.Label(
            _(
                "Connect the USB cable to sync your Android device with "
                "%(shortappname)s.  Be sure to set your device to 'USB Mass "
                "Storage' mode in your device settings.  Attach your digital "
                "camera, and convert your video files to be instantly "
                "web-ready.", self.trans_data))
        label.set_size(self.TEXT_SIZE)
        label.set_color(self.TEXT_COLOR)
        label.set_size_request(400, -1)
        label.set_wrap(True)
        vbox.pack_start(
            widgetutil.align_left(label, left_pad=20, bottom_pad=20))

        show_all_vbox = widgetset.VBox()
        self.show_unknown = widgetset.Checkbox(
            _("Show all attached devices and drives"))
        self.show_unknown.set_checked(
            app.config.get(prefs.SHOW_UNKNOWN_DEVICES))
        self.show_unknown.connect('toggled', self.show_all_devices_toggled)
        show_all_vbox.pack_start(self.show_unknown)
        padding = self.show_unknown.get_text_padding()
        label = widgetset.Label(
            _(
                "Use this if your phone doesn't appear in %(shortappname)s when "
                "you connect it to the computer, or if you want to sync with an "
                "external drive.", self.trans_data))
        label.set_size(self.TEXT_SIZE)
        label.set_color(self.TEXT_COLOR)
        label.set_size_request(370 - padding, -1)
        label.set_wrap(True)
        show_all_vbox.pack_start(widgetutil.pad(label, top=10, left=padding))
        bg = widgetutil.RoundedSolidBackground(
            widgetutil.css_to_color('#e4e4e4'))
        bg.set_size_request(400, -1)
        bg.add(widgetutil.pad(show_all_vbox, 20, 20, 20, 20))
        vbox.pack_start(widgetutil.pad(bg, left=20, right=10, bottom=50))
        hbox.pack_start(vbox)
        hbox.pack_start(
            widgetutil.align_top(
                widgetset.ImageDisplay(
                    imagepool.get(
                        resources.path('images/connect-android.png')))))
        bottom.pack_start(hbox)
Exemple #13
0
    def _build_sync_section(self, bottom):
        hbox = widgetset.HBox()
        vbox = widgetset.VBox()
        label_line = widgetset.HBox()
        label = self.build_header(_("Sync a Phone, Tablet, or Digital Camera"))
        label_line.pack_start(widgetutil.align_left(label, left_pad=20,
                                              bottom_pad=10))
        help_button = HelpButton()
        help_button.connect('clicked', self.help_button_clicked)
        label_line.pack_start(widgetutil.align_top(help_button))
        bottom.pack_start(label_line)

        label = widgetset.Label(
            _("Connect the USB cable to sync your Android device with "
              "%(shortappname)s.  Be sure to set your device to 'USB Mass "
              "Storage' mode in your device settings.  Attach your digital "
              "camera, and convert your video files to be instantly "
              "web-ready.", self.trans_data))
        label.set_size(self.TEXT_SIZE)
        label.set_color(self.TEXT_COLOR)
        label.set_size_request(400, -1)
        label.set_wrap(True)
        vbox.pack_start(widgetutil.align_left(label, left_pad=20,
                                              bottom_pad=20))

        show_all_vbox = widgetset.VBox()
        self.show_unknown = widgetset.Checkbox(
            _("Show all attached devices and drives"))
        self.show_unknown.set_checked(
            app.config.get(prefs.SHOW_UNKNOWN_DEVICES))
        self.show_unknown.connect('toggled', self.show_all_devices_toggled)
        show_all_vbox.pack_start(self.show_unknown)
        padding = self.show_unknown.get_text_padding()
        label = widgetset.Label(
            _("Use this if your phone doesn't appear in %(shortappname)s when "
              "you connect it to the computer, or if you want to sync with an "
              "external drive.", self.trans_data))
        label.set_size(self.TEXT_SIZE)
        label.set_color(self.TEXT_COLOR)
        label.set_size_request(370 - padding, -1)
        label.set_wrap(True)
        show_all_vbox.pack_start(widgetutil.pad(label, top=10, left=padding))
        bg = widgetutil.RoundedSolidBackground(
            widgetutil.css_to_color('#e4e4e4'))
        bg.set_size_request(400, -1)
        bg.add(widgetutil.pad(show_all_vbox, 20, 20, 20, 20))
        vbox.pack_start(widgetutil.pad(bg, left=20, right=10, bottom=50))
        hbox.pack_start(vbox)
        hbox.pack_start(widgetutil.align_top(widgetset.ImageDisplay(
            imagepool.get(resources.path('images/connect-android.png')))))
        bottom.pack_start(hbox)
Exemple #14
0
    def build_media_player_import_page(self):
        vbox = widgetset.VBox(spacing=5)

        vbox.pack_start(
            _build_title_question(
                _(
                    "Would you like to display your %(player)s music and "
                    "video in %(appname)s?", {
                        "player": self.mp_name,
                        "appname": app.config.get(prefs.SHORT_APP_NAME)
                    })))

        rbg = widgetset.RadioButtonGroup()
        yes_rb = widgetset.RadioButton(_("Yes"), rbg)
        no_rb = widgetset.RadioButton(_("No"), rbg)
        yes_rb.set_selected()

        vbox.pack_start(widgetutil.align_left(yes_rb))
        vbox.pack_start(widgetutil.align_left(no_rb))

        lab = widgetset.Label(
            _(
                "Note: %(appname)s won't move or copy any files on your "
                "disk.  It will just add them to your %(appname)s library.",
                {"appname": app.config.get(prefs.SHORT_APP_NAME)}))
        lab.set_size_request(WIDTH - 40, -1)
        lab.set_wrap(True)
        vbox.pack_start(widgetutil.align_left(lab))

        def handle_next(widget):
            if rbg.get_selected() == yes_rb:
                self.import_media_player_stuff = True
            else:
                self.import_media_player_stuff = False
            self.next_page()

        prev_button = widgetset.Button(_("< Previous"))
        prev_button.connect('clicked', lambda x: self.prev_page())

        next_button = widgetset.Button(_("Next >"))
        next_button.connect('clicked', handle_next)

        vbox.pack_start(widgetutil.align_bottom(
            widgetutil.align_right(
                widgetutil.build_hbox((prev_button, next_button)))),
                        expand=True)

        vbox = widgetutil.pad(vbox)

        return vbox
Exemple #15
0
def _build_header(channel):
    v = widgetset.VBox(6)
    
    lab = widgetset.Label(clamp_text(channel.name, 60))
    lab.set_bold(True)
    lab.set_size(1.2)
    v.pack_start(widgetutil.align_left(lab))

    lab = widgetset.Label(clamp_text(channel.url, 80))
    lab.set_selectable(True)
    lab.set_size(widgetconst.SIZE_SMALL)
    lab.set_color(widgetconst.DIALOG_NOTE_COLOR)
    v.pack_start(widgetutil.align_left(lab))

    return v
Exemple #16
0
def _build_header(channel):
    v = widgetset.VBox(6)

    lab = widgetset.Label(clamp_text(channel.name, 60))
    lab.set_bold(True)
    lab.set_size(1.2)
    v.pack_start(widgetutil.align_left(lab))

    lab = widgetset.Label(clamp_text(channel.url, 80))
    lab.set_selectable(True)
    lab.set_size(widgetconst.SIZE_SMALL)
    lab.set_color(widgetconst.DIALOG_NOTE_COLOR)
    v.pack_start(widgetutil.align_left(lab))

    return v
Exemple #17
0
    def build_widget(self):
        vbox = widgetset.VBox()

        grid = dialogwidgets.ControlGrid()
        
        count = get_logical_cpu_count()
        max_concurrent = []
        for i in range(0, count):
            max_concurrent.append((i+1, str(i+1)))
        max_concurrent_menu = widgetset.OptionMenu([op[1] for op in max_concurrent])
        attach_combo(max_concurrent_menu, prefs.MAX_CONCURRENT_CONVERSIONS, 
            [op[0] for op in max_concurrent])

        if count == 1:
            max_concurrent_menu.disable()

        grid.pack(dialogwidgets.label_with_note(
            _("Allow this many concurrent conversions:"),
            _("(changing this will not apply to currently running conversions)")),
            dialogwidgets.ControlGrid.ALIGN_RIGHT)
        grid.pack(max_concurrent_menu)
        grid.end_line(spacing=4)
        vbox.pack_start(widgetutil.align_left(grid.make_table()))

        pack_extras(vbox, "conversions")

        return vbox
 def _build_android_section(self, bottom):
     hbox = widgetset.HBox()
     vbox = widgetset.VBox()
     label = self.build_header(_("Miro on Android"))
     vbox.pack_start(widgetutil.align_left(label, left_pad=20,
                                           bottom_pad=10))
     label = self.build_text(
         _("We don't yet have a Miro app for Android, but you can stream "
           "to your device using other DAAP apps."))
     label.set_wrap(True)
     label.set_size_request(550, -1)
     vbox.pack_start(widgetutil.align_left(label, left_pad=20,
                                           right_pad=10,
                                           bottom_pad=20))
     hbox.pack_start(vbox)
     bottom.pack_start(hbox)
Exemple #19
0
    def build_widget(self):
        SimpleItemListController.build_widget(self)

        button = widgetset.Button(_('Back to feed'))
        button.connect('clicked', self._on_clicked)
        self.widget.titlebar_vbox.pack_start(widgetutil.align_left(button,
            left_pad=10, top_pad=6, bottom_pad=4))
Exemple #20
0
    def build_media_player_import_page(self):
        vbox = widgetset.VBox(spacing=5)

        vbox.pack_start(_build_title_question(_(
                "Would you like to display your %(player)s music and "
                "video in %(appname)s?",
                {"player": self.mp_name,
                 "appname": app.config.get(prefs.SHORT_APP_NAME)})))

        rbg = widgetset.RadioButtonGroup()
        yes_rb = widgetset.RadioButton(_("Yes"), rbg)
        no_rb = widgetset.RadioButton(_("No"), rbg)
        yes_rb.set_selected()

        vbox.pack_start(widgetutil.align_left(yes_rb))
        vbox.pack_start(widgetutil.align_left(no_rb))

        lab = widgetset.Label(_(
                "Note: %(appname)s won't move or copy any files on your "
                "disk.  It will just add them to your %(appname)s library.",
                {"appname": app.config.get(prefs.SHORT_APP_NAME)}))
        lab.set_size_request(WIDTH - 40, -1)
        lab.set_wrap(True)
        vbox.pack_start(widgetutil.align_left(lab))

        def handle_next(widget):
            if rbg.get_selected() == yes_rb:
                self.import_media_player_stuff = True
            else:
                self.import_media_player_stuff = False
            self.next_page()

        prev_button = widgetset.Button(_("< Previous"))
        prev_button.connect('clicked', lambda x: self.prev_page())

        next_button = widgetset.Button(_("Next >"))
        next_button.connect('clicked', handle_next)

        vbox.pack_start(
            widgetutil.align_bottom(widgetutil.align_right(
                    widgetutil.build_hbox((prev_button, next_button)))),
            expand=True)

        vbox = widgetutil.pad(vbox)

        return vbox
Exemple #21
0
def _general_panel():
    extras = []
    show_cbx = widgetset.Checkbox(_("Enable tray icon"))
    attach_boolean(show_cbx, options.SHOW_TRAYICON)
    extras.append(show_cbx)

    lab = widgetset.Label(_("When I click the red close button:"))
    extras.append(widgetutil.align_left(lab))
    rbg = widgetset.RadioButtonGroup()
    rad_close = widgetset.RadioButton(_("Close to tray so that downloads can continue."), rbg)
    rad_quit = widgetset.RadioButton(_("Quit %(appname)s completely.",
        {'appname': app.config.get(prefs.SHORT_APP_NAME)}), rbg)

    attach_radio([(rad_close, True), (rad_quit, False)], prefs.MINIMIZE_TO_TRAY)
    extras.append(widgetutil.align_left(rad_close, left_pad=20))
    extras.append(widgetutil.align_left(rad_quit, left_pad=20))
    return extras
Exemple #22
0
def _build_title(text):
    """Builds and returns a title widget for the panes in the
    First Time Startup dialog.
    """
    lab = widgetset.Label(text)
    lab.set_bold(True)
    lab.set_wrap(True)
    return widgetutil.align_left(lab, bottom_pad=10)
Exemple #23
0
    def build_first_page(self):
        vbox = widgetset.VBox(spacing=5)

        vbox.pack_start(_build_title(_("Choose Language")))

        lab = widgetset.Label(_(
            "Welcome to the %(name)s first time setup!\n"
            "\n"
            "The next few screens will help you set up %(name)s so that "
            "it works best for you.\n"
            "\n"
            "What language would you like Miro to be in?",
            {'name': app.config.get(prefs.SHORT_APP_NAME)}))
        lab.set_wrap(True)
        lab.set_size_request(400, -1)
        vbox.pack_start(widgetutil.align_left(lab))

        lang_options = gtcache.get_languages()
        lang_options.insert(0, ("system", _("System default")))

        lang_option_menu = widgetset.OptionMenu([op[1] for op in lang_options])
        lang = app.config.get(prefs.LANGUAGE)
        try:
            lang_option_menu.set_selected([op[0] for op in lang_options].index(lang))
        except ValueError:
            lang_option_menu.set_selected(1)

        def update_clicked(widget):
            os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE
            app.config.set(prefs.LANGUAGE,
                       str(lang_options[lang_option_menu.get_selected()][0]))
            gtcache.init()
            self.this_page(rebuild=True)

        def next_clicked(widget):
            os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE
            app.config.set(prefs.LANGUAGE,
                       str(lang_options[lang_option_menu.get_selected()][0]))
            gtcache.init()
            self.next_page(rebuild=True)

        update_button = widgetset.Button(_("Update"))
        update_button.connect('clicked', update_clicked)

        hbox = widgetset.HBox()
        hbox.pack_start(widgetset.Label(_("Language:")), padding=0)
        hbox.pack_start(lang_option_menu, padding=5)
        hbox.pack_start(update_button, padding=5)

        vbox.pack_start(hbox)

        vbox.pack_start(widgetset.Label(" "), expand=True)
        
        next_button = widgetset.Button(_("Next >"))
        next_button.connect('clicked', next_clicked)

        vbox.pack_start(widgetutil.align_right(next_button))
        return vbox
Exemple #24
0
def _build_title_question(text):
    """Builds and returns a title widget for the panes in the
    First Time Startup dialog.
    """
    lab = widgetset.Label(text)
    lab.set_bold(True)
    lab.set_wrap(True)
    lab.set_size_request(WIDTH - 40, -1)
    return widgetutil.align_left(lab, bottom_pad=15)
Exemple #25
0
def _build_title_question(text):
    """Builds and returns a title widget for the panes in the
    First Time Startup dialog.
    """
    lab = widgetset.Label(text)
    lab.set_bold(True)
    lab.set_wrap(True)
    lab.set_size_request(WIDTH - 40, -1)
    return widgetutil.align_left(lab, bottom_pad=15)
Exemple #26
0
 def _build_android_section(self, bottom):
     hbox = widgetset.HBox()
     vbox = widgetset.VBox()
     label = self.build_header(_("Miro on Android"))
     vbox.pack_start(
         widgetutil.align_left(label, left_pad=20, bottom_pad=10))
     label = self.build_text(
         _("We don't yet have a Miro app for Android, but you can stream "
           "to your device using other DAAP apps."))
     label.set_wrap(True)
     label.set_size_request(550, -1)
     vbox.pack_start(
         widgetutil.align_left(label,
                               left_pad=20,
                               right_pad=10,
                               bottom_pad=20))
     hbox.pack_start(vbox)
     bottom.pack_start(hbox)
Exemple #27
0
def run_dialog(report):
    window = MainDialog(_("Internal Error"))
    try:
        try:
            vbox = widgetset.VBox(spacing=5)

            lab = widgetset.Label(_(
                "%(appname)s has encountered an internal error.  You can "
                "help us track down this problem and fix it by submitting "
                "an error report.",
                {"appname": app.config.get(prefs.SHORT_APP_NAME)}
                ))

            lab.set_wrap(True)
            lab.set_size_request(600, -1)

            vbox.pack_start(widgetutil.align_left(lab))

            cbx = widgetset.Checkbox(_(
                "Include entire program database including all video and "
                "feed metadata with crash report"
            ))
            vbox.pack_start(widgetutil.align_left(cbx))

            lab2 = widgetset.Label(_("Describe what you were doing when you got this error:"))
            vbox.pack_start(widgetutil.align_left(lab2))

            text = widgetset.MultilineTextEntry()
            text.set_size_request(600, 100)
            vbox.pack_start(widgetutil.align_left(text))

            window.set_extra_widget(vbox)
            window.add_button(BUTTON_SUBMIT_REPORT.text)
            window.add_button(BUTTON_IGNORE.text)

            ret = window.run()
            if ret == 0:
                messages.ReportCrash(report, text.get_text(), cbx.get_checked()).send_to_backend()
            else:
                return IGNORE_ERRORS
        except StandardError:
            logging.exception("crashdialog threw exception.")
    finally:
        window.destroy()
Exemple #28
0
    def build_header(self, text):
        label = widgetset.Label(text)
        label.set_bold(True)
        label.set_size(0.85)
        label.set_color(style.TAB_LIST_HEADER_COLOR)

        vbox = widgetset.VBox()
        vbox.pack_start(widgetutil.align_left(label, top_pad=5, bottom_pad=5, left_pad=self.header_left_pad))

        return vbox
Exemple #29
0
    def build_second_page(self):
        vbox = widgetset.VBox(spacing=5)

        vbox.pack_start(_build_title(
            _("%(name)s Startup",
              {'name': app.config.get(prefs.SHORT_APP_NAME)})))

        lab = widgetset.Label(_(
            "We recommend that you have %(name)s launch when your computer "
            "starts up.  This way, downloads in progress can finish "
            "downloading and new media files can be downloaded in the "
            "background, ready when you want to watch.",
            {'name': app.config.get(prefs.SHORT_APP_NAME)}))
        lab.set_wrap(True)
        lab.set_size_request(400, -1)
        vbox.pack_start(widgetutil.align_left(lab))

        lab = widgetset.Label(_("Would you like to run %(name)s on startup?",
                              {'name': app.config.get(prefs.SHORT_APP_NAME)}))
        lab.set_bold(True)
        vbox.pack_start(widgetutil.align_left(lab))

        rbg = widgetset.RadioButtonGroup()
        yes_rb = widgetset.RadioButton(_("Yes"), rbg)
        no_rb = widgetset.RadioButton(_("No"), rbg)

        prefpanel.attach_radio([(yes_rb, True), (no_rb, False)],
                               prefs.RUN_AT_STARTUP)
        vbox.pack_start(widgetutil.align_left(yes_rb))
        vbox.pack_start(widgetutil.align_left(no_rb))

        vbox.pack_start(widgetset.Label(" "), expand=True)

        prev_button = widgetset.Button(_("< Previous"))
        prev_button.connect('clicked', lambda x: self.prev_page())

        next_button = widgetset.Button(_("Next >"))
        next_button.connect('clicked', lambda x: self.next_page())

        hbox = widgetutil.build_hbox((prev_button, next_button))
        vbox.pack_start(widgetutil.align_right(hbox))

        return vbox
Exemple #30
0
 def __init__(self, engine):
     widgetset.Background.__init__(self)
     hbox = widgetset.HBox(spacing=15)
     self.pack(hbox, imagepool.get_image_display(searchengines.icon_path_for_engine(engine)))
     label = widgetset.Label(engine.title)
     label.set_size(widgetutil.font_scale_from_osx_points(14))
     label.set_bold(True)
     self.pack(hbox, widgetutil.align_left(label), expand=True)
     self.add(hbox)
     self.has_border = True
    def _build_note_section(self, bottom):
        label = widgetset.Label(_(
                "Sources are any websites that offer audio, video, or "
                "torrents for download that you would like to use "
                "within %(shortappname)s.",
                {'shortappname': app.config.get(prefs.SHORT_APP_NAME)}))
        label.set_size(widgetconst.SIZE_SMALL)
        label.set_wrap(True)
        label.set_size_request(550, -1)

        bottom.pack_start(widgetutil.align_left(label, bottom_pad=30))
Exemple #32
0
 def __init__(self, engine):
     widgetset.Background.__init__(self)
     hbox = widgetset.HBox(spacing=15)
     self.pack(hbox, imagepool.get_image_display(
             searchengines.icon_path_for_engine(engine)))
     label = widgetset.Label(engine.title)
     label.set_size(widgetutil.font_scale_from_osx_points(14))
     label.set_bold(True)
     self.pack(hbox, widgetutil.align_left(label), expand=True)
     self.add(hbox)
     self.has_border = True
Exemple #33
0
    def build_startup_page(self):
        vbox = widgetset.VBox(spacing=5)

        vbox.pack_start(
            _build_paragraph_text(
                _(
                    "%(name)s can automatically run when you start your "
                    "computer so that it can resume your downloads "
                    "and update your podcasts.",
                    {'name': app.config.get(prefs.SHORT_APP_NAME)})))

        vbox.pack_start(
            _build_title_question(
                _("Would you like to run %(name)s on startup?",
                  {'name': app.config.get(prefs.SHORT_APP_NAME)})))

        rbg = widgetset.RadioButtonGroup()
        yes_rb = widgetset.RadioButton(_("Yes"), rbg)
        no_rb = widgetset.RadioButton(_("No"), rbg)

        prefpanel.attach_radio([(yes_rb, True), (no_rb, False)],
                               prefs.RUN_AT_STARTUP)
        vbox.pack_start(widgetutil.align_left(yes_rb, left_pad=10))
        vbox.pack_start(widgetutil.align_left(no_rb, left_pad=10))

        prev_button = widgetset.Button(_("< Previous"))
        prev_button.connect('clicked', lambda x: self.prev_page())

        next_button = widgetset.Button(_("Next >"))
        next_button.connect('clicked', lambda x: self.next_page())

        vbox.pack_start(self._force_space_label())

        vbox.pack_start(widgetutil.align_bottom(
            widgetutil.align_right(
                widgetutil.build_hbox((prev_button, next_button)))),
                        expand=True)

        vbox = widgetutil.pad(vbox)

        return vbox
Exemple #34
0
    def __init__(self):
        widgetset.SolidBackground.__init__(self, (0, 0, 0))
        vbox = widgetset.VBox()
        label = widgetset.Label(_(
            "%(appname)s can't play this file.  You may "
            "be able to open it with a different program",
            {"appname": app.config.get(prefs.SHORT_APP_NAME)}
            ))
        label.set_color((1, 1, 1))
        vbox.pack_start(label)
        table = widgetset.Table(2, 2)
        table.set_column_spacing(6)
        self.filename_label = self._make_label('')
        self.filetype_label  = self._make_label('')
        table.pack(widgetutil.align_left(self._make_heading(_('Filename:'))),
                0, 0)
        table.pack(widgetutil.align_left(self.filename_label), 1, 0)
        table.pack(widgetutil.align_left(self._make_heading(_('File type:'))),
                0, 1)
        table.pack(widgetutil.align_left(self.filetype_label), 1, 1)
        vbox.pack_start(widgetutil.align_left(table, top_pad=12))
        hbox = widgetset.HBox(spacing=12)
        reveal_button = widgetset.Button(_('Reveal File'))
        self.play_externally_button = widgetset.Button(_('Play Externally'))
        self.play_externally_button.connect('clicked',
                                            self._on_play_externally)
        skip_button = widgetset.Button(_('Skip'))
        reveal_button.connect('clicked', self._on_reveal)
        skip_button.connect('clicked', self._on_skip)

        self.reveal_button_holder = widgetutil.HideableWidget(reveal_button)
        self.play_externally_button_holder = widgetutil.HideableWidget(
                                          self.play_externally_button)

        hbox.pack_start(self.reveal_button_holder)
        hbox.pack_start(self.play_externally_button_holder)
        hbox.pack_start(skip_button)
        vbox.pack_start(widgetutil.align_center(hbox, top_pad=24))
        alignment = widgetset.Alignment(xalign=0.5, yalign=0.5)
        alignment.add(vbox)
        self.add(alignment)
Exemple #35
0
 def __init__(self):
     DisplayToolbar.__init__(self)
     hbox = widgetset.HBox()
     self.add(hbox)
     save_button = widgetset.Button(_('Save as a Feed'), style='smooth')
     save_button.set_size(widgetconst.SIZE_SMALL)
     save_button.connect('clicked', self._on_save_clicked)
     aligned = widgetutil.align_left(save_button, top_pad=5, left_pad=5,
                                     bottom_pad=5)
     self.hideable = widgetutil.HideableWidget(aligned)
     hbox.pack_start(self.hideable)
     self.create_signal('save-search')
Exemple #36
0
    def _build_note_section(self, bottom):
        label = widgetset.Label(
            _(
                "Sources are any websites that offer audio, video, or "
                "torrents for download that you would like to use "
                "within %(shortappname)s.",
                {'shortappname': app.config.get(prefs.SHORT_APP_NAME)}))
        label.set_size(widgetconst.SIZE_SMALL)
        label.set_wrap(True)
        label.set_size_request(550, -1)

        bottom.pack_start(widgetutil.align_left(label, bottom_pad=30))
Exemple #37
0
    def build_widget(self):
        v = widgetset.VBox()

        miro_cbx = widgetset.Checkbox(_('Play media in Miro.'))
        separate_cbx = widgetset.Checkbox(_('Always play videos in a separate window.'))
        resume_cbx = widgetset.Checkbox(_('Resume playing a video or audio item from the point it was last stopped.'))

        subtitles_cbx = widgetset.Checkbox(_('Automatically enable movie subtitles when available.'))

        rbg = widgetset.RadioButtonGroup()
        play_rb = widgetset.RadioButton(_("Play video and audio items one after another"), rbg)
        stop_rb = widgetset.RadioButton(_("Stop after each video or audio item"), rbg)

        attach_boolean(miro_cbx, prefs.PLAY_IN_MIRO, (separate_cbx, resume_cbx,
                                                      subtitles_cbx, play_rb,
                                                      stop_rb))
        v.pack_start(widgetutil.align_left(miro_cbx, bottom_pad=6))

        attach_boolean(separate_cbx, prefs.PLAY_DETACHED)
        v.pack_start(widgetutil.align_left(separate_cbx, bottom_pad=6))

        attach_boolean(resume_cbx, prefs.RESUME_VIDEOS_MODE)
        v.pack_start(widgetutil.align_left(resume_cbx, bottom_pad=6))

        attach_boolean(subtitles_cbx, prefs.ENABLE_SUBTITLES)
        v.pack_start(widgetutil.align_left(subtitles_cbx, bottom_pad=6))

        attach_radio([(stop_rb, True), (play_rb, False)], prefs.SINGLE_VIDEO_PLAYBACK_MODE)
        v.pack_start(widgetutil.align_left(play_rb), padding=2)
        v.pack_start(widgetutil.align_left(stop_rb))

        pack_extras(v, "playback")

        return v
    def _build_note_section(self, bottom):
        label = widgetset.Label(_(
                "Select the music and video stores you'd like to have "
                "appear in %(shortappname)s.  Note: some other store "
                "websites may work well with %(shortappname)s if you "
                "add them as Sources, but these are Stores that we've "
                "integrated and tested.",
                {'shortappname': app.config.get(prefs.SHORT_APP_NAME)}))
        label.set_size(widgetconst.SIZE_SMALL)
        label.set_wrap(True)
        label.set_size_request(550, -1)

        bottom.pack_start(widgetutil.align_left(label, bottom_pad=30))
 def _build_app_store_section(self, bottom):
     # iPad link
     hbox = widgetset.HBox()
     vbox = widgetset.VBox()
     label = self.build_header(_("Miro on your iPad"))
     vbox.pack_start(widgetutil.align_left(label, left_pad=20,
                                           bottom_pad=10))
     label = self.build_text(
         _("The gorgeous Miro iPad app lets you wirelessly stream music "
           "and videos from %(shortappname)s on your desktop to your iPad. "
           "You can also download songs and videos to your iPad and take "
           "them with you.", self.trans_data))
     label.set_wrap(True)
     label.set_size_request(400, -1)
     vbox.pack_start(widgetutil.align_left(label, left_pad=20,
                                           right_pad=10,
                                           bottom_pad=50))
     hbox.pack_start(vbox)
     app_store_button = AppStoreButton()
     app_store_button.connect('clicked', self.app_store_button_clicked)
     hbox.pack_start(app_store_button)
     bottom.pack_start(hbox)
Exemple #40
0
    def build_startup_page(self):
        vbox = widgetset.VBox(spacing=5)

        vbox.pack_start(_build_paragraph_text(_(
                    "%(name)s can automatically run when you start your "
                    "computer so that it can resume your downloads "
                    "and update your podcasts.",
                    {'name': app.config.get(prefs.SHORT_APP_NAME)})))

        vbox.pack_start(_build_title_question(_(
                    "Would you like to run %(name)s on startup?",
                    {'name': app.config.get(prefs.SHORT_APP_NAME)})))

        rbg = widgetset.RadioButtonGroup()
        yes_rb = widgetset.RadioButton(_("Yes"), rbg)
        no_rb = widgetset.RadioButton(_("No"), rbg)

        prefpanel.attach_radio([(yes_rb, True), (no_rb, False)],
                               prefs.RUN_AT_STARTUP)
        vbox.pack_start(widgetutil.align_left(yes_rb, left_pad=10))
        vbox.pack_start(widgetutil.align_left(no_rb, left_pad=10))

        prev_button = widgetset.Button(_("< Previous"))
        prev_button.connect('clicked', lambda x: self.prev_page())

        next_button = widgetset.Button(_("Next >"))
        next_button.connect('clicked', lambda x: self.next_page())

        vbox.pack_start(self._force_space_label())

        vbox.pack_start(
            widgetutil.align_bottom(widgetutil.align_right(
                    widgetutil.build_hbox((prev_button, next_button)))),
            expand=True)

        vbox = widgetutil.pad(vbox)

        return vbox
Exemple #41
0
    def _build_note_section(self, bottom):
        label = widgetset.Label(
            _(
                "Select the music and video stores you'd like to have "
                "appear in %(shortappname)s.  Note: some other store "
                "websites may work well with %(shortappname)s if you "
                "add them as Sources, but these are Stores that we've "
                "integrated and tested.",
                {'shortappname': app.config.get(prefs.SHORT_APP_NAME)}))
        label.set_size(widgetconst.SIZE_SMALL)
        label.set_wrap(True)
        label.set_size_request(550, -1)

        bottom.pack_start(widgetutil.align_left(label, bottom_pad=30))
Exemple #42
0
    def __init__(self, title):
        widgetset.VBox.__init__(self)
        self.current_limit = self.ITEM_LIMIT
        hbox = widgetset.HBox()
        label = widgetset.Label(title.upper())
        label.set_size(0.7)
        label.set_color((0.5, 0.5, 0.5))
        hbox.pack_start(widgetutil.align_left(label), expand=True)
        self.pack_start(widgetutil.pad(hbox, top=20, bottom=10))

        self.item_box = widgetset.VBox(spacing=8) # we want 17px of padding, so
                                                  # 17/2 is close to 8
        self.pack_start(self.item_box)

        self.item_list = []
Exemple #43
0
    def __init__(self, title):
        widgetset.VBox.__init__(self)
        self.current_limit = self.ITEM_LIMIT
        hbox = widgetset.HBox()
        label = widgetset.Label(title.upper())
        label.set_size(0.7)
        label.set_color((0.5, 0.5, 0.5))
        hbox.pack_start(widgetutil.align_left(label), expand=True)
        self.pack_start(widgetutil.pad(hbox, top=20, bottom=10))

        self.item_box = widgetset.VBox(
            spacing=8)  # we want 17px of padding, so
        # 17/2 is close to 8
        self.pack_start(self.item_box)

        self.item_list = []
Exemple #44
0
    def _make_item_views(self):
        self.downloading_view = itemlistwidgets.ItemView(
                itemlist.DownloadingItemList(), self.is_folder)
        self.downloaded_view = itemlistwidgets.ItemView(
                itemlist.DownloadedItemList(), self.is_folder)
        self.full_view = itemlistwidgets.ItemView(itemlist.ItemList(), self.is_folder)
        self.downloading_section = itemlistwidgets.HideableSection(
                "", self.downloading_view)
        self.downloaded_section = itemlistwidgets.HideableSection(
                _("Downloaded"), self.downloaded_view)

        self.show_more_button = widgetset.Button('')
        self.show_more_button.connect('clicked', self._on_show_more)
        self.show_more_container = widgetutil.HideableWidget(
                widgetutil.align_left(self.show_more_button, 2, 2, 10, 0))
        full_section_vbox = widgetset.VBox(spacing=2)
        full_section_vbox.pack_start(self.full_view, expand=True)
        full_section_vbox.pack_start(self.show_more_container)
        self.full_section = itemlistwidgets.HideableSection(
                _("Full Feed"), full_section_vbox)
Exemple #45
0
    def __init__(self):
        widgetset.Background.__init__(self)

        vbox = widgetset.VBox()
        # first line: sync progess and cancel button
        line = widgetset.HBox()
        self.sync_progress = SyncProgressBar()
        self.sync_progress.set_size_request(400, 10)
        self.cancel_button = imagebutton.ImageButton('sync-cancel')
        line.pack_start(widgetutil.pad(self.sync_progress, 10, 10, 5, 5))
        line.pack_end(widgetutil.pad(self.cancel_button, 5, 5, 5, 5))
        vbox.pack_start(line)

        # second line: time remaining, all the way to the right
        line = widgetset.HBox()
        self.sync_files = widgetset.Label(u"")
        self.sync_remaining = widgetset.Label(u"")
        self.sync_remaining.set_bold(True)
        line.pack_start(widgetutil.align_left(self.sync_files, 5, 5, 5, 5))
        line.pack_end(widgetutil.align_right(self.sync_remaining, 5, 5, 5, 5))
        vbox.pack_start(line)

        self.add(widgetutil.pad(vbox, 10, 10, 10, 10))
Exemple #46
0
    def __init__(self):
        widgetset.Background.__init__(self)

        vbox = widgetset.VBox()
        # first line: sync progess and cancel button
        line = widgetset.HBox()
        self.sync_progress = SyncProgressBar()
        self.sync_progress.set_size_request(400, 10)
        self.cancel_button = imagebutton.ImageButton('sync-cancel')
        line.pack_start(widgetutil.pad(self.sync_progress, 10, 10, 5, 5))
        line.pack_end(widgetutil.pad(self.cancel_button, 5, 5, 5, 5))
        vbox.pack_start(line)

        # second line: time remaining, all the way to the right
        line = widgetset.HBox()
        self.sync_files = widgetset.Label(u"")
        self.sync_remaining = widgetset.Label(u"")
        self.sync_remaining.set_bold(True)
        line.pack_start(widgetutil.align_left(self.sync_files, 5, 5, 5, 5))
        line.pack_end(widgetutil.align_right(self.sync_remaining, 5, 5, 5, 5))
        vbox.pack_start(line)

        self.add(widgetutil.pad(vbox, 10, 10, 10, 10))
Exemple #47
0
def run_dialog():
    """Displays a diagnostics windows that tells a user how Miro is set
    up on their machine.
    """
    window = MainDialog(_("Diagnostics"))
    try:
        items = [{
            "label":
            _("Movies location:"),
            "data":
            app.config.get(prefs.MOVIES_DIRECTORY),
            "button_face":
            SHOW,
            "button_fun":
            open_helper(app.config.get(prefs.MOVIES_DIRECTORY))
        }, {
            "label":
            _("Icon cache location:"),
            "data":
            app.config.get(prefs.ICON_CACHE_DIRECTORY),
            "button_face":
            SHOW,
            "button_fun":
            open_helper(app.config.get(prefs.ICON_CACHE_DIRECTORY))
        }, {
            "label": _("Log file location:"),
            "data": app.config.get(prefs.LOG_PATHNAME),
            "button_face": SHOW,
            "button_fun": open_helper(app.config.get(prefs.LOG_PATHNAME))
        }, {
            "label":
            _("Downloader log file location:"),
            "data":
            app.config.get(prefs.DOWNLOADER_LOG_PATHNAME),
            "button_face":
            SHOW,
            "button_fun":
            open_helper(app.config.get(prefs.DOWNLOADER_LOG_PATHNAME))
        }, {
            "label":
            _("Database file location:"),
            "data":
            app.config.get(prefs.SQLITE_PATHNAME),
            "button_face":
            SHOW,
            "button_fun":
            open_helper(app.config.get(prefs.SQLITE_PATHNAME))
        }, {
            "label":
            _("Crash reports location:"),
            "data":
            app.config.get(prefs.CRASH_PATHNAME),
            "button_face":
            SHOW,
            "button_fun":
            open_helper(app.config.get(prefs.CRASH_PATHNAME))
        }, SEPARATOR, {
            "label":
            _("Space free on disk:"),
            "data":
            lambda: util.format_size_for_user(get_available_bytes_for_movies(),
                                              "0B", False)
        }, {
            "label":
            _("Database size:"),
            "data":
            lambda: util.format_size_for_user(get_database_size(), "0B", False)
        }, {
            "label": _("Total db objects in memory:"),
            "data": lambda: "%d" % get_database_object_count()
        }, SEPARATOR, {
            "label":
            _("Total db backups:"),
            "data":
            "",
            "button_face":
            _("%(databasecount)s: Delete",
              {"databasecount": len(app.db.get_backup_databases())}),
            "button_fun":
            delete_backups
        }]

        t = widgetset.Table(3, len(items))
        t.set_column_spacing(10)
        for row_num, item in enumerate(items):
            if item is SEPARATOR:
                t.pack(widgetset.Label(""), 0, row_num)
                continue

            label = item.get("label")
            lab = widgetset.Label(label)
            lab.set_bold(True)
            t.pack(widgetutil.align_left(lab), 0, row_num)

            data = item.get("data")
            if callable(data):
                data = data()
            if not isinstance(data, basestring):
                data = repr(data)
            datalab = widgetset.Label(data)
            t.pack(widgetutil.align_left(datalab), 1, row_num)

            if item.get("button_face"):
                b = widgetset.Button(item["button_face"])
                b.set_size(widgetconst.SIZE_SMALL)
                b.connect('clicked', item["button_fun"])
                t.pack(widgetutil.align_left(b), 2, row_num)

        window.set_extra_widget(t)
        window.add_button(BUTTON_OK.text)
        window.run()
    finally:
        window.destroy()
Exemple #48
0
def _build_paragraph_text(text):
    lab = widgetset.Label(text)
    lab.set_wrap(True)
    lab.set_size_request(WIDTH - 40, -1)
    return widgetutil.align_left(lab, bottom_pad=15)
Exemple #49
0
    def build_find_files_page(self):
        vbox = widgetset.VBox(spacing=5)

        vbox.pack_start(
            _build_paragraph_text(
                _(
                    "%(name)s can find music and video on your computer "
                    "and show them in your %(name)s library.  No files "
                    "will be copied or duplicated.",
                    {"name": app.config.get(prefs.SHORT_APP_NAME)})))

        vbox.pack_start(
            _build_title_question(
                _(
                    "Would you like %(name)s to search your computer "
                    "for media files?",
                    {"name": app.config.get(prefs.SHORT_APP_NAME)})))

        rbg = widgetset.RadioButtonGroup()
        no_rb = widgetset.RadioButton(_("No"), rbg)
        yes_rb = widgetset.RadioButton(_("Yes"), rbg)
        no_rb.set_selected()
        vbox.pack_start(widgetutil.align_left(no_rb, left_pad=10))
        vbox.pack_start(
            widgetutil.align_left(yes_rb, left_pad=10, bottom_pad=5))

        group_box = widgetset.VBox(spacing=5)

        rbg2 = widgetset.RadioButtonGroup()
        restrict_rb = widgetset.RadioButton(_("Search everywhere."), rbg2)
        search_rb = widgetset.RadioButton(_("Just search in this folder:"),
                                          rbg2)
        restrict_rb.set_selected()
        group_box.pack_start(widgetutil.align_left(restrict_rb, left_pad=30))
        group_box.pack_start(widgetutil.align_left(search_rb, left_pad=30))

        search_entry = widgetset.TextEntry(
            filename_to_unicode(get_default_search_dir()))
        search_entry.set_width(20)
        change_button = widgetset.Button(_("Choose..."))
        hbox = widgetutil.build_hbox((widgetutil.align_middle(search_entry),
                                      widgetutil.align_middle(change_button)))
        group_box.pack_start(widgetutil.align_left(hbox, left_pad=30))

        def handle_change_clicked(widget):
            dir_ = dialogs.ask_for_directory(
                _("Choose directory to search for media files"),
                initial_directory=get_default_search_dir(),
                transient_for=self)
            if dir_:
                search_entry.set_text(filename_to_unicode(dir_))
                self.search_directory = dir_
            else:
                self.search_directory = get_default_search_dir()
            # reset the search results if they change the directory
            self.gathered_media_files = None

        change_button.connect('clicked', handle_change_clicked)

        vbox.pack_start(group_box)

        prev_button = widgetset.Button(_("< Previous"))
        prev_button.connect('clicked', lambda x: self.prev_page())

        def handle_search_finish_clicked(widget):
            if widget.mode == "search":
                if rbg2.get_selected() == restrict_rb:
                    self.search_directory = get_default_search_dir()

                self.next_page()
            else:
                self.destroy()

        search_button = widgetset.Button(_("Search"))
        search_button.connect('clicked', handle_search_finish_clicked)
        # FIXME - this is goofy naming
        search_button.text_faces = {"search": _("Next >"), "next": _("Finish")}

        search_button.mode = "search"

        def switch_mode(mode):
            search_button.set_text(search_button.text_faces[mode])
            search_button.mode = mode

        vbox.pack_start(self._force_space_label())

        vbox.pack_start(widgetutil.align_bottom(
            widgetutil.align_right(
                widgetutil.build_hbox((prev_button, search_button)))),
                        expand=True)

        def handle_radio_button_clicked(widget):
            # Uggh  this is a bit messy.
            if widget is no_rb:
                group_box.disable()
                search_entry.disable()
                change_button.disable()
                switch_mode("next")
                self.gathered_media_files = None

            elif widget is yes_rb:
                group_box.enable()
                if rbg2.get_selected() is restrict_rb:
                    search_entry.disable()
                    change_button.disable()
                else:
                    search_entry.enable()
                    change_button.enable()

                switch_mode("search")

            elif widget is restrict_rb:
                search_entry.disable()
                change_button.disable()
                self.gathered_media_files = None

            elif widget is search_rb:
                search_entry.enable()
                change_button.enable()
                self.gathered_media_files = None

            if widget is restrict_rb or widget is search_rb:
                switch_mode("search")

        no_rb.connect('clicked', handle_radio_button_clicked)
        yes_rb.connect('clicked', handle_radio_button_clicked)
        restrict_rb.connect('clicked', handle_radio_button_clicked)
        search_rb.connect('clicked', handle_radio_button_clicked)

        handle_radio_button_clicked(restrict_rb)
        handle_radio_button_clicked(no_rb)

        vbox = widgetutil.pad(vbox)

        return vbox
Exemple #50
0
def run_dialog(channel_infos, downloaded_items, downloading_items,
               has_watched_feeds):
    """Displays the remove feeds dialog.
    """
    title = ngettext('Remove Podcast', 'Remove Podcasts', len(channel_infos))

    rc_window = MainDialog(title)
    try:
        try:
            v = widgetset.VBox(spacing=5)

            lab = widgetset.Label(
                ngettext("Are you sure you want to remove this podcast:",
                         "Are you sure you want to remove these podcasts:",
                         len(channel_infos)))
            lab.set_wrap(True)
            v.pack_start(widgetutil.align_left(lab))

            v2 = widgetset.VBox()
            lab_height = None
            for mem in channel_infos:
                lab_mem = widgetset.Label(util.clamp_text(mem.name, 40))
                if lab_height is None:
                    dummy, lab_height = lab_mem.get_size_request()
                v2.pack_start(widgetutil.align_left(lab_mem, left_pad=15))

            if len(channel_infos) > 5:
                scroller = widgetset.Scroller(False, True)
                scroller.set_has_borders(True)
                scroller.add(v2)
                scroller_width, scroller_height = scroller.get_size_request()
                if scroller_height == 0:
                    scroller.set_size_request(scroller_width,
                                              5 * (lab_height + 1))
                v2 = scroller
            v.pack_start(v2, padding=10)

            cbx_downloaded = None
            if downloaded_items:
                cbx_downloaded = widgetset.Checkbox(
                    _("Keep items that have been downloaded in my library."))
                v.pack_start(
                    widgetutil.align_left(cbx_downloaded, bottom_pad=5))

            if has_watched_feeds:
                lab = widgetset.Label(
                    _(
                        "Watched folders will be removed from the sidebar but "
                        "their contents will still appear in your library.  "
                        "You can stop watching watched folders completely "
                        "in the %(appname)s preference panel.",
                        {"appname": app.config.get(prefs.SHORT_APP_NAME)}))
                lab.set_wrap(True)
                lab.set_size_request(390, -1)
                v.pack_start(widgetutil.align_left(lab, bottom_pad=5))

            if downloading_items:
                lab_downloading = widgetset.Label(
                    ngettext(
                        "Are you sure you want to remove this podcast?  "
                        "The downloads currently in progress will be canceled.",
                        "Are you sure you want to remove these podcasts?  "
                        "The downloads currently in progress will be canceled.",
                        len(channel_infos)))
                lab_downloading.set_wrap(True)
                lab_downloading.set_size_request(390, -1)
                v.pack_start(widgetutil.align_left(lab_downloading))

            rc_window.set_extra_widget(v)
            rc_window.add_button(BUTTON_REMOVE.text)
            rc_window.add_button(BUTTON_CANCEL.text)
            ret = rc_window.run()
            if ret == 0:
                # this is silly, but it sets us up for adding additional
                # bits later.
                ret = {KEEP_ITEMS: False}
                if downloaded_items:
                    ret[KEEP_ITEMS] = cbx_downloaded.get_checked()
                return ret
        except StandardError:
            logging.exception("removefeeds threw exception.")
    finally:
        rc_window.destroy()
Exemple #51
0
    def create_table(self):
        self._background.remove()

        def _get_conversion_name(id_):
            if id_ == 'copy':
                return _('Copy')
            else:
                return conversion_manager.lookup_converter(id_).name

        conversion_details = {
            'audio': _get_conversion_name(self.device.info.audio_conversion),
            'video': _get_conversion_name(self.device.info.video_conversion)
        }
        audio_conversion_names = [
            _('Device Default (%(audio)s)', conversion_details),
            _('Copy')
        ]
        self.audio_conversion_values = [None, 'copy']
        video_conversion_names = [
            _('Device Default (%(video)s)', conversion_details),
            _('Copy')
        ]
        self.video_conversion_values = [None, 'copy']
        for section_name, converters in conversion_manager.get_converters():
            for converter in converters:
                if converter.mediatype == 'video':
                    video_conversion_names.append(converter.name)
                    self.video_conversion_values.append(converter.identifier)
                elif converter.mediatype == 'audio':
                    audio_conversion_names.append(converter.name)
                    self.audio_conversion_values.append(converter.identifier)
        widgets = []
        for text, setting, type_ in (
            (_("Name of Device"), u'name', 'text'),
            (_("Video Conversion"), u'video_conversion', 'video_conversion'),
            (_("Audio Conversion"), u'audio_conversion', 'audio_conversion'),
            (_("Store video in this directory"), u'video_path',
             'text'), (_("Store audio in this directory"), u'audio_path',
                       'text'), (_("Always show this device, even if "
                                   "'show all devices' is turned off"),
                                 u'always_show', 'bool'),
            (_("Always convert videos before copying to this device, even "
               "if the video can play without conversion\n(may reduce video "
               "file sizes, but makes syncing much slower)"),
             u"always_sync_videos", 'bool')):
            if type_ == 'text':
                widget = widgetset.TextEntry()
                widget.set_size_request(260, -1)
            elif type_.endswith('conversion'):
                if type_ == 'video_conversion':
                    options = video_conversion_names
                elif type_ == 'audio_conversion':
                    options = audio_conversion_names
                widget = widgetset.OptionMenu(options)
                widget.set_size_request(260, -1)
            elif type_ == 'bool':
                widget = widgetset.Checkbox(text)
                widget.set_size_request(400, -1)
            else:
                raise RuntimeError('unknown settings widget: %r' % type_)
            self.boxes[setting] = widget
            if type_ != 'bool':  # has a label already
                widgets.append((widgetset.Label(text), widget))
                if type_ == 'text':
                    widget.connect('focus-out', self.setting_changed, setting)
                else:
                    widget.connect('changed', self.setting_changed, setting)
            else:
                widgets.append((widget, ))
                widget.connect('toggled', self.setting_changed, setting)
        table = widgetset.Table(2, len(widgets))
        for row, widget in enumerate(widgets):
            if len(widget) == 1:  # checkbox
                table.pack(widget[0], 0, row, column_span=2)
            else:
                table.pack(widgetutil.align_right(widget[0]), 0, row)
                table.pack(widgetutil.align_left(widget[1]), 1, row)
        table.set_column_spacing(20)
        table.set_row_spacing(20)
        self._background.set_child(
            widgetutil.align_center(table, 20, 20, 20, 20))
Exemple #52
0
    def __init__(self):
        self.device = None
        widgetset.VBox.__init__(self)

        self.button_row = segmented.SegmentedButtonsRow()

        for key, name in (('main', _('Main')), ('podcasts', _('Podcasts')),
                          ('playlists', _('Playlists')), ('settings',
                                                          _('Settings'))):
            button = DeviceTabButtonSegment(key, name, self._tab_clicked)
            self.button_row.add_button(name.lower(), button)

        self.button_row.set_active('main')
        tbc = TabButtonContainer()
        tbc.add(
            widgetutil.align_center(self.button_row.make_widget(), top_pad=9))
        width = tbc.child.get_size_request()[0]
        tbc.child.set_size_request(-1, 24)
        self.pack_start(tbc)

        self.tabs = {}
        self.tab_container = widgetset.Background()
        scroller = widgetset.Scroller(False, True)
        scroller.add(self.tab_container)
        self.pack_start(scroller, expand=True)

        vbox = widgetset.VBox()
        vbox.pack_start(
            widgetutil.align_left(tabcontroller.ConnectTab.build_header(
                _("Individual Files")),
                                  top_pad=10))
        label = tabcontroller.ConnectTab.build_text(
            _("Drag individual video and audio files onto "
              "the device in the sidebar to copy them."))
        label.set_size_request(width, -1)
        label.set_wrap(True)
        vbox.pack_start(widgetutil.align_left(label, top_pad=10))

        vbox.pack_start(
            widgetutil.align_left(tabcontroller.ConnectTab.build_header(
                _("Syncing")),
                                  top_pad=30))
        label = tabcontroller.ConnectTab.build_text(
            _("Use the tabs above and these options for "
              "automatic syncing."))
        label.set_size_request(width, -1)
        label.set_wrap(True)
        vbox.pack_start(widgetutil.align_left(label, top_pad=10))

        self.auto_sync = widgetset.Checkbox(
            _("Sync automatically when this "
              "device is connected"))
        self.auto_sync.connect('toggled', self._auto_sync_changed)
        vbox.pack_start(widgetutil.align_left(self.auto_sync, top_pad=10))
        max_fill_label = _(
            "Don't fill more than %(count)i percent of the "
            "free space when syncing", {'count': id(self)})
        checkbox_label, text_label = max_fill_label.split(unicode(id(self)), 1)
        self.max_fill_enabled = widgetset.Checkbox(checkbox_label)
        self.max_fill_enabled.connect('toggled',
                                      self._max_fill_enabled_changed)
        self.max_fill_percent = widgetset.TextEntry()
        self.max_fill_percent.set_size_request(50, -1)
        self.max_fill_percent.connect('focus-out',
                                      self._max_fill_percent_changed)
        label = widgetset.Label(text_label)
        vbox.pack_start(
            widgetutil.align_left(widgetutil.build_hbox(
                [self.max_fill_enabled, self.max_fill_percent, label], 0),
                                  top_pad=10))

        rounded_vbox = RoundedVBox()
        vbox.pack_start(
            widgetutil.align_left(tabcontroller.ConnectTab.build_header(
                _("Auto Fill")),
                                  top_pad=30,
                                  bottom_pad=10))
        self.auto_fill = widgetset.Checkbox(
            _("After syncing my selections in the tabs above, "
              "fill remaining space with:"))
        self.auto_fill.connect('toggled', self._auto_fill_changed)
        rounded_vbox.pack_start(
            widgetutil.align_left(self.auto_fill, 20, 20, 20, 20))
        names = [(_('Newest Music'), u'recent_music'),
                 (_('Random Music'), u'random_music'),
                 (_('Most Played Songs'), u'most_played_music'),
                 (_('New Playlists'), u'new_playlists'),
                 (_('Most Recent Podcasts'), u'recent_podcasts')]
        longest = max(names, key=lambda x: len(x[0]))[0]
        width = widgetset.Label(longest).get_width()
        less_label = widgetset.Label(_('Less').upper())
        less_label.set_size(tabcontroller.ConnectTab.TEXT_SIZE / 2)
        more_label = widgetset.Label(_('More').upper())
        more_label.set_size(tabcontroller.ConnectTab.TEXT_SIZE / 2)
        label_hbox = widgetutil.build_hbox([
            less_label,
            widgetutil.pad(
                more_label,
                left=(200 - less_label.get_width() - more_label.get_width()))
        ],
                                           padding=0)
        label_hbox.set_size_request(200, -1)
        scrollers = [widgetutil.align_right(label_hbox, right_pad=20)]
        self.auto_fill_sliders = {}
        for name, setting in names:
            label = widgetutil.align_right(widgetset.Label(name))
            label.set_size_request(width, -1)
            dragger = AutoFillSlider()
            dragger.connect('released', self._auto_fill_slider_changed,
                            setting)
            self.auto_fill_sliders[setting] = dragger
            hbox = widgetutil.build_hbox([label, dragger], 20)
            scrollers.append(hbox)
        rounded_vbox.pack_start(
            widgetutil.align_left(widgetutil.build_vbox(scrollers, 10), 20, 20,
                                  20, 20))

        vbox.pack_start(widgetutil.align_left(rounded_vbox))

        self.device_size = SizeWidget()
        self.device_size.sync_button.connect('clicked', self.sync_clicked)
        self.pack_end(self.device_size)

        self.add_tab('main', widgetutil.align_center(vbox, 20, 20, 20, 20))
        self.add_tab(
            'podcasts',
            widgetutil.align_center(PodcastSyncWidget(), 20, 20, 20, 20))
        self.add_tab(
            'playlists',
            widgetutil.align_center(PlaylistSyncWidget(), 20, 20, 20, 20))
        self.add_tab(
            'settings',
            widgetutil.align_center(DeviceSettingsWidget(), 20, 20, 20, 20))
Exemple #53
0
    def _build_daap_section(self, bottom):
        label = self.build_header(
            _("%(shortappname)s Sharing", self.trans_data))
        bottom.pack_start(
            widgetutil.align_left(label, left_pad=20, bottom_pad=10))
        # Note: "Miro iPad app" is the name of a piece of software--
        # don't substitute Miro for %(appname)s here.
        label = widgetset.Label(
            _(
                "%(shortappname)s can stream and download files to and from "
                "other %(shortappname)ss on your local network and to the "
                "Miro iPad app.  It's awesome!", self.trans_data))
        label.set_size(self.TEXT_SIZE)
        label.set_color(self.TEXT_COLOR)
        label.set_wrap(True)
        label.set_size_request(550, -1)
        bottom.pack_start(
            widgetutil.align_left(label, left_pad=20, bottom_pad=20))

        if not app.sharing_manager.mdns_present:
            label = widgetset.Label(_("Disabled: Needs Bonjour"))
            label.set_bold(True)
            bottom.pack_start(
                widgetutil.align_left(label,
                                      left_pad=20,
                                      bottom_pad=20,
                                      top_pad=10))
            return

        container = widgetset.HBox()
        self.share_button = PrettyToggleButton()
        self.share_button.connect('clicked', self.daap_changed)
        self.share_button.connect('dragged-left', self.daap_changed)
        self.share_button.connect('dragged-right', self.daap_changed)
        self.share_button.set_value(app.config.get(prefs.SHARE_MEDIA))
        container.pack_start(widgetutil.pad(self.share_button, right=20))

        vbox = widgetset.VBox()
        hbox = widgetset.HBox(spacing=30)
        self.share_audio_cbx = widgetset.Checkbox(_("Share Music"), bold=True)
        self.share_video_cbx = widgetset.Checkbox(_("Share Videos"), bold=True)
        self.share_warnonquit_cbx = widgetset.Checkbox(
            _('Warn on quit when others are connected to my media library.'))
        hbox.pack_start(widgetutil.align_top(self.share_video_cbx))
        hbox.pack_start(widgetutil.align_top(self.share_audio_cbx))
        prefpanel.attach_boolean(self.share_audio_cbx, prefs.SHARE_AUDIO)
        prefpanel.attach_boolean(self.share_video_cbx, prefs.SHARE_VIDEO)
        vbox.pack_start(hbox)

        label = widgetset.Label(
            _("My %(shortappname)s Share Name", self.trans_data))
        label.set_bold(True)
        vbox.pack_start(widgetutil.align_left(label, top_pad=15, bottom_pad=5))

        hbox = widgetset.HBox()
        self.share_entry = widgetset.TextEntry()
        self.share_entry.set_size_request(230, -1)
        share_error = prefpanel.build_error_image()
        prefpanel.attach_text(self.share_entry,
                              prefs.SHARE_NAME,
                              share_error,
                              check_function=prefpanel.text_is_not_blank)

        if not self.share_button.get_value():
            self.share_entry.disable()
            self.share_video_cbx.disable()
            self.share_audio_cbx.disable()
            self.share_warnonquit_cbx.disable()

        hbox.pack_start(self.share_entry)
        hbox.pack_start(share_error)
        vbox.pack_start(hbox)
        vbox.pack_start(widgetutil.pad(self.share_warnonquit_cbx, top=15))

        container.pack_start(vbox)

        bg = widgetutil.RoundedSolidBackground(
            widgetutil.css_to_color('#e4e4e4'))
        bg.add(widgetutil.pad(container, 20, 20, 20, 20))
        bottom.pack_start(widgetutil.align_left(bg, left_pad=20,
                                                bottom_pad=50))
Exemple #54
0
    def run_dialog(self, report):
        self.report = report
        try:
            vbox = widgetset.VBox(spacing=8)

            lab = widgetset.Label(
                _("You can help us fix this problem by submitting an "
                  "error report."))
            lab.set_wrap(True)
            lab.set_size_request(600, -1)
            vbox.pack_start(widgetutil.align_left(lab))

            warning = widgetset.Label(
                _("Note: This error report will not be posted publicly, "
                  "but may include uniquely identifable information "
                  "including file names, website URLs, podcast URLs, "
                  "and disk paths."))
            warning.set_wrap(True)
            warning.set_size_request(600, -1)
            vbox.pack_start(widgetutil.align_left(warning))

            self.see_crash_button = widgetset.Button(_("See crash report"))
            self.see_crash_button.set_size(widgetconst.SIZE_SMALL)
            self.see_crash_button.connect('clicked', self.on_see_crash_report)
            vbox.pack_start(widgetutil.align_right(self.see_crash_button))

            cbx = widgetset.Checkbox(
                _("Include entire program database including all "
                  "filenames, websites, and podcasts with the "
                  "error report."))
            vbox.pack_start(widgetutil.align_left(cbx))

            lab2 = widgetset.Label(
                _("What were you doing when you got this message?  "
                  "(Helpful, but not required.)"))
            lab2.set_wrap(True)
            lab2.set_size_request(600, -1)
            vbox.pack_start(widgetutil.align_left(lab2))

            text = widgetset.MultilineTextEntry()
            scroller = widgetset.Scroller(True, True)
            scroller.add(text)
            scroller.set_size_request(600, 100)
            vbox.pack_start(widgetutil.align_left(scroller))

            hidden_vbox = widgetset.VBox(spacing=5)
            lab = widgetset.Label(_("Crash Report:"))
            hidden_vbox.pack_start(widgetutil.align_left(lab))

            report_text = widgetset.MultilineTextEntry(self.report)
            report_text.set_editable(False)

            scroller = widgetset.Scroller(True, True)
            scroller.add(report_text)
            scroller.set_size_request(600, 100)
            hidden_vbox.pack_start(widgetutil.align_left(scroller))

            self.hidden_vbox = widgetutil.HideableWidget(hidden_vbox)
            self.hidden_vbox.hide()
            vbox.pack_start(self.hidden_vbox)

            self.set_extra_widget(vbox)
            self.add_button(BUTTON_SUBMIT_REPORT.text)
            self.add_button(BUTTON_IGNORE.text)

            self.vbox = vbox
            ret = self.run()
            if ret == 0:
                messages.ReportCrash(report, text.get_text(),
                                     cbx.get_checked()).send_to_backend()
            else:
                return IGNORE_ERRORS
        except StandardError:
            logging.exception("crashdialog threw exception.")
Exemple #55
0
    def build_widget(self):
        vbox = widgetset.VBox()

        grid = dialogwidgets.ControlGrid()

        grid.pack_label(_('Maximum number of manual downloads at a time:'))
        max_manual = widgetset.TextEntry()
        max_manual.set_width(5)
        attach_integer(max_manual, prefs.MAX_MANUAL_DOWNLOADS, create_integer_checker(min=0))
        grid.pack(max_manual)
        grid.end_line(spacing=6)

        grid.pack_label(_('Maximum number of auto-downloads at a time:'))
        max_auto = widgetset.TextEntry()
        max_auto.set_width(5)
        attach_integer(max_auto, prefs.DOWNLOADS_TARGET, create_integer_checker(min=0))
        grid.pack(max_auto)
        grid.end_line(spacing=12)
        
        vbox.pack_start(grid.make_table())

        grid = dialogwidgets.ControlGrid()
        grid.pack(dialogwidgets.heading(_("Bittorrent:")), grid.ALIGN_LEFT, span=3)
        grid.end_line(spacing=12)

        cbx = widgetset.Checkbox( _('Limit upstream bandwidth to:'))
                    #avoid internet slowdowns'))
        limit = widgetset.TextEntry()
        limit.set_width(5)
        attach_boolean(cbx, prefs.LIMIT_UPSTREAM, (limit,))
        max_kbs = sys.maxint / (2**10) # highest value accepted: sys.maxint
                                       # bits per second in kb/s
        attach_integer(limit, prefs.UPSTREAM_LIMIT_IN_KBS, create_integer_checker(min=0, max=max_kbs))

        grid.pack(cbx)
        grid.pack(limit)
        grid.pack_label(_("KB/s"))
        grid.end_line(spacing=6)

        cbx = widgetset.Checkbox(_('Limit downstream bandwidth to:'))
        limit = widgetset.TextEntry()
        limit.set_width(5)
        attach_boolean(cbx, prefs.LIMIT_DOWNSTREAM_BT, (limit,))
        attach_integer(limit, prefs.DOWNSTREAM_BT_LIMIT_IN_KBS, create_integer_checker(min=0, max=max_kbs))

        grid.pack(cbx)
        grid.pack(limit)
        grid.pack_label(_("KB/s"))
        grid.end_line(spacing=6)

        cbx = widgetset.Checkbox(_('Limit torrent connections to:'))
        limit = widgetset.TextEntry()
        limit.set_width(5)
        attach_boolean(cbx, prefs.LIMIT_CONNECTIONS_BT, (limit,))
        attach_integer(limit, prefs.CONNECTION_LIMIT_BT_NUM, create_integer_checker(min=0, max=65536))

        grid.pack(cbx)
        grid.pack(limit)
        grid.end_line(spacing=6)

        min_port = widgetset.TextEntry()
        min_port.set_width(5)
        max_port = widgetset.TextEntry()
        max_port.set_width(5)
        attach_integer(min_port, prefs.BT_MIN_PORT, create_integer_checker(min=0, max=65535))
        attach_integer(max_port, prefs.BT_MAX_PORT, create_integer_checker(min=0, max=65535))

        grid.pack_label(_("Starting port:"), dialogwidgets.ControlGrid.ALIGN_RIGHT)
        grid.pack(min_port)
        grid.end_line(spacing=6)

        grid.pack_label(_("Ending port:"), dialogwidgets.ControlGrid.ALIGN_RIGHT)
        grid.pack(max_port)
        grid.end_line(spacing=12)
        vbox.pack_start(widgetutil.align_left(grid.make_table()))

        grid = dialogwidgets.ControlGrid()
        cbx = widgetset.Checkbox(_('Automatically forward ports.  (UPNP)'))
        attach_boolean(cbx, prefs.USE_UPNP)
        vbox.pack_start(cbx, padding=4)

        cbx = widgetset.Checkbox(_('Ignore unencrypted connections.'))
        attach_boolean(cbx, prefs.BT_ENC_REQ)
        vbox.pack_start(cbx)

        cbx = widgetset.Checkbox(_('Stop torrent uploads when this ratio is reached:'))
        limit = widgetset.TextEntry()
        attach_boolean(cbx, prefs.LIMIT_UPLOAD_RATIO, (limit,))
        attach_float(limit, prefs.UPLOAD_RATIO, create_float_checker(0.0, 1.0))
        grid.pack(cbx)
        grid.pack(limit)
        grid.end_line(spacing=6)
        vbox.pack_start(widgetutil.align_left(grid.make_table()))

        return vbox