예제 #1
0
    def build_results_page(self):
        # FIXME - this is built just like the search_page.  it'd be
        # better to just change the buttons on the bottom of the
        # search page.
        vbox = widgetset.VBox(spacing=5)

        progress_bar = widgetset.ProgressBar()
        progress_bar.set_size_request(400, -1)
        vbox.pack_start(widgetutil.align_center(progress_bar,
                                                top_pad=50))

        progress_bar.stop_pulsing()
        progress_bar.set_progress(1.0)

        self.results_label = widgetset.Label("")
        vbox.pack_start(
            widgetutil.align_top(
                widgetutil.align_center(self.results_label),
                top_pad=10))

        vbox.pack_start(self._force_space_label(), expand=True)

        cancel_button = widgetset.Button(BUTTON_CANCEL.text)
        cancel_button.connect('clicked', self.on_cancel)

        import_button = widgetset.Button(BUTTON_IMPORT_FILES.text)
        import_button.connect('clicked', lambda x: self.destroy_dialog())

        vbox.pack_start(widgetutil.align_right(
                widgetutil.build_hbox((cancel_button, import_button))))

        return vbox
예제 #2
0
    def __init__(self):
        widgetset.VBox.__init__(self)
        label = widgetset.Label()
        label.set_text(
            _("Your device isn't telling us its exact model number."))
        self.pack_start(widgetutil.align_center(label, left_pad=20, top_pad=50,
                                              bottom_pad=20))
        label = widgetset.Label()
        label.set_text(
            _('For optimal video conversion, select the device model.'))
        label.set_bold(True)
        self.pack_start(widgetutil.align_center(label, left_pad=20,
                                                bottom_pad=20)),

        self.device_choices = widgetset.VBox()
        self.pack_start(widgetutil.align_center(self.device_choices,
                                                left_pad=20, top_pad=20,
                                                bottom_pad=20))

        image = widgetset.ImageDisplay(
            imagepool.get(resources.path('images/sync-unknown.png')))
        self.pack_start(widgetutil.align_center(image, left_pad=20,
                                                bottom_pad=20))

        label = widgetset.Label()
        label.set_text(_("If you don't know the model or it doesn't appear "
                         "in the list, it's fine to choose the 'Generic' "
                         "device option."))
        label.set_bold(True)
        self.pack_start(widgetutil.align_center(label, left_pad=20,
                                                bottom_pad=20))
예제 #3
0
파일: displays.py 프로젝트: nxmirrors/miro
 def __init__(self, tab_type, selected_tabs):
     Display.__init__(self)
     self.type = tab_type
     self.child_count = self.folder_count = self.folder_child_count = 0
     if tab_type == 'feed':
         tab_list = app.tab_list_manager.feed_list
     elif tab_type == 'audio-feed':
         tab_list = app.tab_list_manager.audio_feed_list
     elif tab_type == 'site':
         tab_list = app.tab_list_manager.site_list
     else:
         tab_list = app.tab_list_manager.playlist_list
     for tab in selected_tabs:
         if hasattr(tab, "is_folder") and tab.is_folder:
             self.folder_count += 1
             self.folder_child_count += tab_list.get_child_count(tab.id)
         else:
             self.child_count += 1
     vbox = widgetset.VBox(spacing=20)
     label = self._make_label(tab_type, selected_tabs)
     label.set_size(2)
     label.set_color((0.3, 0.3, 0.3))
     vbox.pack_start(widgetutil.align_center(label))
     vbox.pack_start(widgetutil.align_center(
         self._make_buttons(tab_type)))
     self.widget = widgetutil.align_middle(vbox)
예제 #4
0
    def __init__(self):
        widgetset.VBox.__init__(self)

        if not app.sharing_manager.mdns_present:
            sharing_broken = SharingBroken()
            sharing_broken.connect('install-clicked',
                                   self.daap_install_clicked)
            self.pack_start(widgetutil.align_center(sharing_broken))

        title = widgetset.HBox()
        logo = widgetset.ImageDisplay(imagepool.get(
            resources.path('images/icon-connect_large.png')))
        title.pack_start(widgetutil.align_middle(logo))
        label = widgetset.Label(_("Connect"))
        label.set_size(widgetutil.font_scale_from_osx_points(30))
        label.set_bold(True)
        title.pack_start(widgetutil.align_middle(label, left_pad=5))
        self.pack_start(widgetutil.align_center(title, top_pad=30,
                                                bottom_pad=20))

        bottom = widgetset.VBox()

        self._build_daap_section(bottom)
        self._build_sync_section(bottom)
        self._build_app_store_section(bottom)
        self._build_android_section(bottom)

        self.pack_start(widgetutil.align_center(bottom))
예제 #5
0
파일: tabcontroller.py 프로젝트: kmshi/miro
    def __init__(self):
        widgetset.VBox.__init__(self)

        if not app.sharing_manager.mdns_present:
            sharing_broken = SharingBroken()
            sharing_broken.connect('install-clicked',
                                   self.daap_install_clicked)
            self.pack_start(widgetutil.align_center(sharing_broken))

        title = widgetset.HBox()
        logo = widgetset.ImageDisplay(
            imagepool.get(resources.path('images/icon-connect_large.png')))
        title.pack_start(widgetutil.align_middle(logo))
        label = widgetset.Label(_("Connect"))
        label.set_size(widgetutil.font_scale_from_osx_points(30))
        label.set_bold(True)
        title.pack_start(widgetutil.align_middle(label, left_pad=5))
        self.pack_start(
            widgetutil.align_center(title, top_pad=30, bottom_pad=20))

        bottom = widgetset.VBox()

        self._build_daap_section(bottom)
        self._build_sync_section(bottom)
        self._build_app_store_section(bottom)
        self._build_android_section(bottom)

        self.pack_start(widgetutil.align_center(bottom))

        self.callback_handle = app.backend_config_watcher.connect_weak(
            'changed', self.on_config_changed)
예제 #6
0
    def __init__(self):
        widgetset.SolidBackground.__init__(self, itemlistwidgets.StandardView.BACKGROUND_COLOR)
        bg = widgetutil.RoundedSolidBackground(widgetutil.WHITE)
        vbox = widgetset.VBox()
        title = widgetset.HBox()
        logo = imagepool.get_image_display(resources.path("images/icon-search_large.png"))
        title.pack_start(widgetutil.align_middle(logo))
        label = widgetset.Label(self.TITLE)
        label.set_bold(True)
        label.set_size(widgetutil.font_scale_from_osx_points(30))
        title.pack_start(widgetutil.align_middle(label, left_pad=5))
        vbox.pack_start(widgetutil.align_center(title, bottom_pad=20))
        desc = widgetset.Label(self.DESC)
        vbox.pack_start(widgetutil.align_center(desc, bottom_pad=40))

        engine_width = int((desc.get_width() - 30) / 2)

        engine_widgets = self.build_engine_widgets()
        for widgets in engine_widgets[:-1]:  # widgets with borders
            hbox = widgetset.HBox(spacing=30)
            for widget in widgets:
                widget.set_size_request(engine_width, 45)
                hbox.pack_start(widget, expand=True)
            vbox.pack_start(hbox)

        hbox = widgetset.HBox(spacing=30)
        for widget in engine_widgets[-1]:  # has no border
            widget.set_has_border(False)
            widget.set_size_request(engine_width, 45)
            hbox.pack_start(widget, expand=True)

        vbox.pack_start(hbox)

        bg.add(widgetutil.pad(vbox, 45, 45, 45, 45))
        self.add(widgetutil.align(bg, xalign=0.5, top_pad=50))
예제 #7
0
 def __init__(self):
     widgetset.VBox.__init__(self)
     label = widgetset.Label()
     label.set_text(_('This phone is not yet mounted.'))
     label.set_bold(True)
     label.set_size(1.5)
     self.pack_start(widgetutil.align_center(label, left_pad=20, top_pad=50,
                                           bottom_pad=20))
     self.device_text = widgetset.Label()
     self.device_text.set_size(1.5)
     self.device_text.set_wrap(True)
     self.pack_start(widgetutil.align_center(self.device_text, left_pad=20))
예제 #8
0
    def __init__(self):
        widgetset.VBox.__init__(self)
        label = widgetset.Label()
        label.set_text(_("We're not exactly sure what kind of phone this is."))
        label.set_bold(True)
        label.set_size(1.5)
        self.pack_start(widgetutil.align_center(label, left_pad=20, top_pad=50,
                                              bottom_pad=20))

        self.device_choices = widgetset.VBox()
        self.pack_start(widgetutil.align_center(self.device_choices,
                                                left_pad=20, top_pad=50,
                                                bottom_pad=20))
예제 #9
0
    def __init__(self, done_firsttime_callback):
        widgetset.Window.__init__(
            self, _("%(name)s First Time Setup",
                    {'name': app.config.get(prefs.SHORT_APP_NAME)}),
            widgetset.Rect(100, 100, 475, 500))

        # the directory panel 3 searches for files in
        self.search_directory = None

        self.finder = None

        self.cancelled = False

        self.gathered_media_files = None

        self._done_firsttime_callback = done_firsttime_callback

        self._page_box = widgetset.VBox()
        self._pages = self.build_pages()
        self._page_index = -1

        self.set_content_widget(widgetutil.align_center(self._page_box,
                top_pad=20, bottom_pad=20, left_pad=20, right_pad=20))

        self.on_close_handler = self.connect('will-close', self.on_close)
예제 #10
0
 def __init__(self):
     RoundedVBox.__init__(self)
     self._background = widgetset.Background()
     self.pack_start(
         widgetutil.align_center(self._background, 20, 20, 20, 20))
     self.boxes = {}
     self.device = None
예제 #11
0
파일: displays.py 프로젝트: nxmirrors/miro
 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)
예제 #12
0
 def __init__(self):
     RoundedVBox.__init__(self)
     self._background = widgetset.Background()
     self.pack_start(widgetutil.align_center(self._background,
                                             20, 20, 20, 20))
     self.boxes = {}
     self.device = None
예제 #13
0
파일: update.py 프로젝트: kmshi/miro
 def __init__(self, url):
     dialogs.MainDialog.__init__(self, _("Update Available"))
     self.browser = UpdateAvailableBrowser(url)
     label = widgetset.Label()
     label.set_text(
         _('A new version of %(appname)s is available for download.',
           {"appname": app.config.get(prefs.SHORT_APP_NAME)}))
     label2 = widgetset.Label()
     label2.set_text(_('Do you want to download it now?'))
     self.vbox = widgetset.VBox(spacing=6)
     self.vbox.pack_end(widgetutil.align_center(label2))
     self.vbox.pack_end(self.browser, expand=True)
     self.vbox.pack_end(widgetutil.align_center(label))
     self.set_extra_widget(self.vbox)
     self.add_button(dialogs.BUTTON_YES.text)
     self.add_button(dialogs.BUTTON_NO.text)
예제 #14
0
파일: update.py 프로젝트: cool-RR/Miro
 def __init__(self, url):
     dialogs.MainDialog.__init__(self, _("Update Available"))
     self.browser = UpdateAvailableBrowser(url)
     label = widgetset.Label()
     label.set_text(
         _('A new version of %(appname)s is available for download.',
           {"appname": app.config.get(prefs.SHORT_APP_NAME)}))
     label2 = widgetset.Label()
     label2.set_text(
         _('Do you want to download it now?'))
     self.vbox = widgetset.VBox(spacing=6)
     self.vbox.pack_end(widgetutil.align_center(label2))
     self.vbox.pack_end(self.browser, expand=True)
     self.vbox.pack_end(widgetutil.align_center(label))
     self.set_extra_widget(self.vbox)
     self.add_button(dialogs.BUTTON_YES.text)
     self.add_button(dialogs.BUTTON_NO.text)
예제 #15
0
파일: dialogs.py 프로젝트: codito/miro
 def __init__(self, title):
     MainDialog.__init__(self, title, description='')
     self.progress_bar = widgetset.ProgressBar()
     self.label = widgetset.Label()
     self.label.set_size(1.2)
     self.vbox = widgetset.VBox(spacing=6)
     self.vbox.pack_end(widgetutil.align_center(self.label))
     self.vbox.pack_end(self.progress_bar)
     self.set_extra_widget(self.vbox)
예제 #16
0
 def __init__(self, title):
     MainDialog.__init__(self, title, description='')
     self.progress_bar = widgetset.ProgressBar()
     self.label = widgetset.Label()
     self.label.set_size(1.2)
     self.vbox = widgetset.VBox(spacing=6)
     self.vbox.pack_end(widgetutil.align_center(self.label))
     self.vbox.pack_end(self.progress_bar)
     self.set_extra_widget(self.vbox)
예제 #17
0
    def __init__(self):
        widgetset.VBox.__init__(self)
        label = widgetset.Label()
        label.set_text(_('This device is not yet mounted.'))
        label.set_bold(True)
        label.set_size(1.5)
        self.pack_start(widgetutil.align_center(label, left_pad=20, top_pad=50,
                                              bottom_pad=20))
        self.device_text = widgetset.Label()
        self.device_text.set_size(1.5)
        self.device_text.set_wrap(True)
        self.pack_start(widgetutil.align_center(self.device_text, left_pad=20,
                                                bottom_pad=40))

        image = widgetset.ImageDisplay(
            imagepool.get(resources.path('images/sync-unmounted.png')))
        self.pack_start(widgetutil.align_center(image, left_pad=20,
                                                bottom_pad=20))
예제 #18
0
    def __init__(self):
        widgetset.VBox.__init__(self)

        title = widgetset.HBox()
        logo = widgetset.ImageDisplay(imagepool.get(
                resources.path('images/icon-playlist_large.png')))
        title.pack_start(widgetutil.align_middle(logo))
        label = widgetset.Label(_("Playlists"))
        label.set_size(widgetutil.font_scale_from_osx_points(30))
        label.set_bold(True)
        title.pack_start(widgetutil.align_middle(label, left_pad=5))
        self.pack_start(widgetutil.align_center(
                title, top_pad=30, bottom_pad=20))

        bottom = widgetset.VBox()

        self._build_add_playlist_section(bottom)

        self.pack_start(widgetutil.align_center(bottom))
예제 #19
0
파일: dialogs.py 프로젝트: cool-RR/Miro
 def __init__(self, title):
     MainDialog.__init__(self, title)
     self.progress_bar = widgetset.ProgressBar()
     self.label = widgetset.Label()
     self.label.set_size(1.2)
     self.vbox = widgetset.VBox(spacing=6)
     self.vbox.pack_end(widgetutil.align_center(self.label))
     self.vbox.pack_end(self.progress_bar)
     height = self.vbox.get_size_request()[1] + 24
     self.set_extra_widget(self.vbox)
예제 #20
0
파일: displays.py 프로젝트: zjmmjzzjm/miro
 def __init__(self, tab_type, selected_tabs):
     Display.__init__(self)
     self.type = tab_type
     self.child_count = self.folder_count = self.folder_child_count = 0
     tab_list = app.tabs[tab_type]
     for tab in selected_tabs:
         if hasattr(tab, "is_folder") and tab.is_folder:
             self.folder_count += 1
             self.folder_child_count += tab_list.get_child_count(tab.id)
         else:
             self.child_count += 1
     vbox = widgetset.VBox(spacing=20)
     label = self._make_label(tab_type, selected_tabs)
     label.set_size(widgetutil.font_scale_from_osx_points(30))
     label.set_bold(True)
     label.set_color((0.3, 0.3, 0.3))
     vbox.pack_start(widgetutil.align_center(label))
     vbox.pack_start(widgetutil.align_center(self._make_buttons(tab_type)))
     self.widget = widgetutil.align_middle(vbox)
예제 #21
0
파일: tabcontroller.py 프로젝트: kmshi/miro
    def __init__(self):
        widgetset.VBox.__init__(self)

        title = widgetset.HBox()
        logo = widgetset.ImageDisplay(
            imagepool.get(resources.path('images/icon-playlist_large.png')))
        title.pack_start(widgetutil.align_middle(logo))
        label = widgetset.Label(_("Playlists"))
        label.set_size(widgetutil.font_scale_from_osx_points(30))
        label.set_bold(True)
        title.pack_start(widgetutil.align_middle(label, left_pad=5))
        self.pack_start(
            widgetutil.align_center(title, top_pad=30, bottom_pad=20))

        bottom = widgetset.VBox()

        self._build_add_playlist_section(bottom)

        self.pack_start(widgetutil.align_center(bottom))
예제 #22
0
파일: displays.py 프로젝트: bluezone/miro
 def __init__(self, tab_type, selected_tabs):
     Display.__init__(self)
     self.type = tab_type
     self.child_count = self.folder_count = self.folder_child_count = 0
     tab_list = app.tabs[tab_type]
     for tab in selected_tabs:
         if hasattr(tab, "is_folder") and tab.is_folder:
             self.folder_count += 1
             self.folder_child_count += tab_list.get_child_count(tab.id)
         else:
             self.child_count += 1
     vbox = widgetset.VBox(spacing=20)
     label = self._make_label(tab_type, selected_tabs)
     label.set_size(widgetutil.font_scale_from_osx_points(30))
     label.set_bold(True)
     label.set_color((0.3, 0.3, 0.3))
     vbox.pack_start(widgetutil.align_center(label))
     vbox.pack_start(widgetutil.align_center(
         self._make_buttons(tab_type)))
     self.widget = widgetutil.align_middle(vbox)
예제 #23
0
파일: itemedit.py 프로젝트: nerdymcgee/miro
    def _pack_top(self):
        """Pack the top row into the VBox; these components are visible in all
        panels.
        """
        self.vbox.pack_start(widgetutil.align_center(self.toggler, top_pad=10))
        items = len(self.items)
        if items > 1:
            # text1 is included because ngettext requires text1 to have all the
            # same placeholders as text2; it won't be used
            text = ngettext("%(items)d", "%(items)d items selected to edit", items, {"items": items})
            label = widgetset.Label(text)
            label.set_bold(True)
            self.vbox.pack_start(widgetutil.align_center(label, top_pad=10, bottom_pad=3))

            text = _(
                "To change a field for all the selected items, check the "
                "checkbox next to the field you'd like to change."
            )
            label = widgetset.Label(text)
            label.set_size(widgetconst.SIZE_SMALL)
            self.vbox.pack_start(widgetutil.align_center(label, bottom_pad=20))
예제 #24
0
    def _pack_top(self):
        """Pack the top row into the VBox; these components are visible in all
        panels.
        """
        self.vbox.pack_start(widgetutil.align_center(self.toggler, top_pad=10))
        items = len(self.items)
        if items > 1:
            # text1 is included because ngettext requires text1 to have all the
            # same placeholders as text2; it won't be used
            text = ngettext("%(items)d", "%(items)d items selected to edit",
                            items, {'items': items})
            label = widgetset.Label(text)
            label.set_bold(True)
            self.vbox.pack_start(
                widgetutil.align_center(label, top_pad=10, bottom_pad=3))

            text = _("To change a field for all the selected items, check the "
                     "checkbox next to the field you'd like to change.")
            label = widgetset.Label(text)
            label.set_size(widgetconst.SIZE_SMALL)
            self.vbox.pack_start(widgetutil.align_center(label, bottom_pad=20))
예제 #25
0
    def build_search_page(self):
        vbox = widgetset.VBox(spacing=5)

        self.progress_bar = widgetset.ProgressBar()
        self.progress_bar.set_size_request(400, -1)
        vbox.pack_start(widgetutil.align_center(
                self.progress_bar, top_pad=50))

        self.progress_label = widgetset.Label("")
        vbox.pack_start(
            widgetutil.align_top(
                widgetutil.align_center(self.progress_label),
                top_pad=10))

        self.cancel_search_button = widgetset.Button(_("Cancel Search"))
        self.cancel_search_button.connect(
            'clicked', self.handle_search_cancel_clicked)

        vbox.pack_start(widgetutil.align_right(self.cancel_search_button, right_pad=5))

        vbox.pack_start(self._force_space_label(), expand=True)

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

        self.search_next_button = widgetset.Button(_("Finish"))
        self.search_next_button.connect('clicked',
                                        lambda x: self.destroy())

        vbox.pack_start(
            widgetutil.align_bottom(widgetutil.align_right(
                    widgetutil.build_hbox((self.search_prev_button,
                                           self.search_next_button)))),
            expand=True)

        vbox = widgetutil.pad(vbox)
        vbox.run_me_on_switch = self.start_search

        return vbox
예제 #26
0
    def __init__(self):
        self.device = None
        widgetset.VBox.__init__(self)

        self.button_row = segmented.SegmentedButtonsRow()
        for name in ('Main', 'Video', 'Audio', 'Playlists', 'Settings'):
            button = DeviceTabButtonSegment(name.lower(), name,
                                            self._tab_clicked)
            self.button_row.add_button(name.lower(), button)

        self.button_row.set_active('main')
        self.pack_start(widgetutil.align_center(
                        self.button_row.make_widget()))

        self.tabs = {}
        self.tab_container = widgetset.SolidBackground((1, 1, 1))
        self.pack_start(self.tab_container, expand=True)

        vbox = widgetset.VBox()
        label = widgetset.Label(_("To copy media onto the device, drag it "
                                  "onto the sidebar."))
        label.set_size(1.5)
        vbox.pack_start(widgetutil.align_center(label, top_pad=50))

        self.sync_container = widgetset.Background()
        sync_vbox = widgetset.VBox()
        self.sync_button = widgetset.Button('Sync Now')
        self.sync_button.set_size(1.5)
        self.sync_button.connect('clicked', self.sync_clicked)
        sync_vbox.pack_start(self.sync_button)
        self.sync_state = widgetset.Label()
        sync_vbox.pack_start(self.sync_state)
        self.sync_container.set_child(widgetutil.align_center(sync_vbox))
        vbox.pack_start(widgetutil.align_center(self.sync_container,
                                                top_pad=50))

        self.device_size = SizeWidget()
        alignment = widgetset.Alignment(0.5, 1, 0, 0, bottom_pad=15,
                                        right_pad=20)
        alignment.add(self.device_size)
        vbox.pack_end(alignment)

        self.add_tab('main', vbox)
        self.add_tab('video', widgetutil.align_center(VideoFeedSyncWidget()))
        self.add_tab('audio', widgetutil.align_center(AudioFeedSyncWidget()))
        self.add_tab('playlists',
                     widgetutil.align_center(PlaylistSyncWidget()))
        self.add_tab('settings',
                     widgetutil.align_center(DeviceSettingsWidget()))
예제 #27
0
파일: dialogs.py 프로젝트: codito/miro
 def __init__(self, title, text):
     MainDialog.__init__(self, title)
     self.progress_bar = widgetset.ProgressBar()
     self.top_label = widgetset.Label()
     self.top_label.set_text(text)
     self.top_label.set_wrap(True)
     self.top_label.set_size_request(350, -1)
     self.label = widgetset.Label()
     self.vbox = widgetset.VBox(spacing=6)
     self.vbox.pack_end(widgetutil.align_center(self.label))
     self.vbox.pack_end(self.progress_bar)
     self.vbox.pack_end(widgetutil.pad(self.top_label, bottom=6))
     self.set_extra_widget(self.vbox)
예제 #28
0
    def build_search_page(self):
        vbox = widgetset.VBox(spacing=5)

        self.progress_bar = widgetset.ProgressBar()
        self.progress_bar.set_size_request(400, -1)
        vbox.pack_start(widgetutil.align_center(self.progress_bar,
                                                top_pad=50))

        self.progress_label = widgetset.Label("")
        vbox.pack_start(
            widgetutil.align_top(
                widgetutil.align_center(self.progress_label),
                top_pad=10))

        vbox.pack_start(self._force_space_label(), expand=True)

        cancel_button = widgetset.Button(_("Cancel Search"))
        cancel_button.connect('clicked', self.on_cancel)

        vbox.pack_start(widgetutil.align_right(cancel_button))

        return vbox
예제 #29
0
 def build_extra_widget(self, window):
     table = widgetset.Table(2, 2)
     table.set_column_spacing(12)
     table.pack(widgetset.Label(_("Username:"******"Password:")), 0, 1)
     self.password_entry = widgetset.SecureTextEntry(
             self.dialog.prefill_password)
     self.password_entry.set_activates_default(True)
     table.pack(self.password_entry, 1, 1)
     window.set_extra_widget(widgetutil.align_center(table))
예제 #30
0
 def __init__(self, title, text):
     MainDialog.__init__(self, title)
     self.progress_bar = widgetset.ProgressBar()
     self.top_label = widgetset.Label()
     self.top_label.set_text(text)
     self.top_label.set_wrap(True)
     self.top_label.set_size_request(350, -1)
     self.label = widgetset.Label()
     self.vbox = widgetset.VBox(spacing=6)
     self.vbox.pack_end(widgetutil.align_center(self.label))
     self.vbox.pack_end(self.progress_bar)
     self.vbox.pack_end(widgetutil.pad(self.top_label, bottom=6))
     self.set_extra_widget(self.vbox)
예제 #31
0
 def build_extra_widget(self, window):
     table = widgetset.Table(2, 2)
     table.set_column_spacing(12)
     table.pack(widgetset.Label(_("Username:"******"Password:")), 0, 1)
     self.password_entry = widgetset.SecureTextEntry(
         self.dialog.prefill_password)
     self.password_entry.set_activates_default(True)
     table.pack(self.password_entry, 1, 1)
     window.set_extra_widget(widgetutil.align_center(table))
예제 #32
0
    def __init__(self):
        widgetset.VBox.__init__(self)
        label = widgetset.Label()
        label.set_text(_('This device is not yet mounted.'))
        label.set_bold(True)
        label.set_size(1.5)
        self.pack_start(
            widgetutil.align_center(label,
                                    left_pad=20,
                                    top_pad=50,
                                    bottom_pad=20))
        self.device_text = widgetset.Label()
        self.device_text.set_size(1.5)
        self.device_text.set_wrap(True)
        self.pack_start(
            widgetutil.align_center(self.device_text,
                                    left_pad=20,
                                    bottom_pad=40))

        image = widgetset.ImageDisplay(
            imagepool.get(resources.path('images/sync-unmounted.png')))
        self.pack_start(
            widgetutil.align_center(image, left_pad=20, bottom_pad=20))
예제 #33
0
    def __init__(self):
        widgetset.SolidBackground.__init__(
            self, itemlistwidgets.StandardView.BACKGROUND_COLOR)
        bg = widgetutil.RoundedSolidBackground(widgetutil.WHITE)
        vbox = widgetset.VBox()
        title = widgetset.HBox()
        logo = imagepool.get_image_display(
            resources.path('images/icon-search_large.png'))
        title.pack_start(widgetutil.align_middle(logo))
        label = widgetset.Label(self.TITLE)
        label.set_bold(True)
        label.set_size(widgetutil.font_scale_from_osx_points(30))
        title.pack_start(widgetutil.align_middle(label, left_pad=5))
        vbox.pack_start(widgetutil.align_center(title, bottom_pad=20))
        desc = widgetset.Label(self.DESC)
        vbox.pack_start(widgetutil.align_center(desc, bottom_pad=40))

        engine_width = int((desc.get_width() - 30) / 2)

        engine_widgets = self.build_engine_widgets()
        for widgets in engine_widgets[:-1]:  # widgets with borders
            hbox = widgetset.HBox(spacing=30)
            for widget in widgets:
                widget.set_size_request(engine_width, 45)
                hbox.pack_start(widget, expand=True)
            vbox.pack_start(hbox)

        hbox = widgetset.HBox(spacing=30)
        for widget in engine_widgets[-1]:  # has no border
            widget.set_has_border(False)
            widget.set_size_request(engine_width, 45)
            hbox.pack_start(widget, expand=True)

        vbox.pack_start(hbox)

        bg.add(widgetutil.pad(vbox, 45, 45, 45, 45))
        self.add(widgetutil.align(bg, xalign=0.5, top_pad=50))
예제 #34
0
    def build_search_page(self):
        vbox = widgetset.VBox(spacing=5)

        self.progress_bar = widgetset.ProgressBar()
        self.progress_bar.set_size_request(400, -1)
        vbox.pack_start(widgetutil.align_center(self.progress_bar, top_pad=50))

        self.progress_label = widgetset.Label("")
        vbox.pack_start(
            widgetutil.align_top(widgetutil.align_center(self.progress_label),
                                 top_pad=10))

        self.cancel_search_button = widgetset.Button(_("Cancel Search"))
        self.cancel_search_button.connect('clicked',
                                          self.handle_search_cancel_clicked)

        vbox.pack_start(
            widgetutil.align_right(self.cancel_search_button, right_pad=5))

        vbox.pack_start(self._force_space_label(), expand=True)

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

        self.search_next_button = widgetset.Button(_("Finish"))
        self.search_next_button.connect('clicked', lambda x: self.destroy())

        vbox.pack_start(widgetutil.align_bottom(
            widgetutil.align_right(
                widgetutil.build_hbox(
                    (self.search_prev_button, self.search_next_button)))),
                        expand=True)

        vbox = widgetutil.pad(vbox)
        vbox.run_me_on_switch = self.start_search

        return vbox
예제 #35
0
    def __init__(self):
        widgetset.VBox.__init__(self)
        label = widgetset.Label()
        label.set_text(
            _("Your device isn't telling us its exact model number."))
        self.pack_start(
            widgetutil.align_center(label,
                                    left_pad=20,
                                    top_pad=50,
                                    bottom_pad=20))
        label = widgetset.Label()
        label.set_text(
            _('For optimal video conversion, select the device model.'))
        label.set_bold(True)
        self.pack_start(
            widgetutil.align_center(label, left_pad=20, bottom_pad=20)),

        self.device_choices = widgetset.VBox()
        self.pack_start(
            widgetutil.align_center(self.device_choices,
                                    left_pad=20,
                                    top_pad=20,
                                    bottom_pad=20))

        image = widgetset.ImageDisplay(
            imagepool.get(resources.path('images/sync-unknown.png')))
        self.pack_start(
            widgetutil.align_center(image, left_pad=20, bottom_pad=20))

        label = widgetset.Label()
        label.set_text(
            _("If you don't know the model or it doesn't appear "
              "in the list, it's fine to choose the 'Generic' "
              "device option."))
        label.set_bold(True)
        self.pack_start(
            widgetutil.align_center(label, left_pad=20, bottom_pad=20))
예제 #36
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')
        self.pack_start(widgetutil.align_center(
                        self.button_row.make_widget(), top_pad=50))

        self.tabs = {}
        self.tab_container = widgetset.Background()
        self.pack_start(self.tab_container, expand=True)


        label_size = widgetutil.font_scale_from_osx_points(16)
        vbox = widgetset.VBox()
        label = widgetset.Label(_("Drag individual video and audio files "
                                  "onto the device in the sidebar to copy "
                                  "them."))
        label.set_size(label_size)
        vbox.pack_start(widgetutil.align_center(label, top_pad=50))
        label = widgetset.Label(_("Use these options and the tabs above for "
                                  "automatic syncing."))
        label.set_size(label_size)
        vbox.pack_start(widgetutil.align_center(label, top_pad=10))

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

        self.sync_container = widgetset.Background()
        self.pack_end(widgetutil.align_center(self.sync_container))

        self.add_tab('main', vbox)
        self.add_tab('podcasts', widgetutil.align_center(PodcastSyncWidget()))
        self.add_tab('playlists',
                     widgetutil.align_center(PlaylistSyncWidget()))
        self.add_tab('settings',
                     widgetutil.align_center(DeviceSettingsWidget()))
예제 #37
0
파일: dialogs.py 프로젝트: cool-RR/Miro
 def __init__(self, title):
     MainDialog.__init__(self, title)
     self.progress_bar = widgetset.ProgressBar()
     self.top_label = widgetset.Label()
     self.top_label.set_text(_("Miro is upgrading your database of feeds "
         "and files.  This one-time process can take a long time if you "
         "have a large number of items in Miro (it can even take more "
         "than 30 minutes)."))
     self.top_label.set_wrap(True)
     self.top_label.set_size_request(200, -1)
     self.label = widgetset.Label()
     self.vbox = widgetset.VBox(spacing=6)
     self.vbox.pack_end(widgetutil.align_center(self.label))
     self.vbox.pack_end(self.progress_bar)
     self.vbox.pack_end(widgetutil.pad(self.top_label, bottom=6))
     height = self.vbox.get_size_request()[1] + 24
     self.set_extra_widget(self.vbox)
예제 #38
0
파일: browser.py 프로젝트: kmshi/miro
 def redraw(self):
     if self._width is None:
         # Haven't seen a size-allocated signal yet.  Wait until we get one
         # to draw ourselves
         return
     self.clear()
     available = self._width
     right_padding = 0
     if self.download_shown:
         self.pack_start(self.download)
         available -= self.DOWNLOAD_WIDTH
         right_padding = self.DOWNLOAD_WIDTH
     if (self.throbber_shown and available >=
         (self.THROBBER_WIDTH + right_padding)):
         self.pack_start(widgetutil.align_center(self.get_throbber(),
                                                 right_pad=right_padding),
                         expand=True)
예제 #39
0
파일: browser.py 프로젝트: codito/miro
 def redraw(self):
     if self._width is None:
         # Haven't seen a size-allocated signal yet.  Wait until we get one
         # to draw ourselves
         return
     self.clear()
     available = self._width
     right_padding = 0
     if self.download_shown:
         self.pack_start(self.download)
         available -= self.DOWNLOAD_WIDTH
         right_padding = self.DOWNLOAD_WIDTH
     if (self.throbber_shown and
         available >= (self.THROBBER_WIDTH + right_padding)):
         self.pack_start(widgetutil.align_center(self.get_throbber(),
                                                 right_pad=right_padding),
                         expand=True)
예제 #40
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')
        self.pack_start(
            widgetutil.align_center(self.button_row.make_widget(), top_pad=50))

        self.tabs = {}
        self.tab_container = widgetset.Background()
        self.pack_start(self.tab_container, expand=True)

        label_size = widgetutil.font_scale_from_osx_points(16)
        vbox = widgetset.VBox()
        label = widgetset.Label(
            _("Drag individual video and audio files "
              "onto the device in the sidebar to copy "
              "them."))
        label.set_size(label_size)
        vbox.pack_start(widgetutil.align_center(label, top_pad=50))
        label = widgetset.Label(
            _("Use these options and the tabs above for "
              "automatic syncing."))
        label.set_size(label_size)
        vbox.pack_start(widgetutil.align_center(label, top_pad=10))

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

        self.sync_container = widgetset.Background()
        self.pack_end(widgetutil.align_center(self.sync_container))

        self.add_tab('main', vbox)
        self.add_tab('podcasts', widgetutil.align_center(PodcastSyncWidget()))
        self.add_tab('playlists',
                     widgetutil.align_center(PlaylistSyncWidget()))
        self.add_tab('settings',
                     widgetutil.align_center(DeviceSettingsWidget()))
예제 #41
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)
예제 #42
0
파일: donate.py 프로젝트: ktan2020/miro
    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
예제 #43
0
    def build_language_page(self):
        vbox = widgetset.VBox(spacing=5)

        vbox.pack_start(
            _build_paragraph_text(
                _(
                    "Welcome to %(name)s!  We have a couple of questions "
                    "to help you get started.",
                    {'name': app.config.get(prefs.SHORT_APP_NAME)})))

        vbox.pack_start(
            _build_title_question(
                _("What language would you like %(name)s to be in?",
                  {'name': app.config.get(prefs.SHORT_APP_NAME)})))

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

        def update_language(widget, index):
            os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE
            app.config.set(prefs.LANGUAGE, str(lang_options[index][0]))
            gtcache.init()

            # FIXME - this is totally awful and may break at some
            # point.  what happens is that widgetconst translates at
            # import time, so if someone changes the language, then
            # the translations have already happened.  we reload the
            # module to force them to happen again.  bug 17515
            if "miro.frontends.widgets.widgetconst" in sys.modules:
                reload(sys.modules["miro.frontends.widgets.widgetconst"])
            self.this_page(rebuild=True)

        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)

        lang_option_menu.connect('changed', update_language)

        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)

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

        vbox.pack_start(widgetutil.align_center(hbox))

        vbox.pack_start(self._force_space_label())

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

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

        vbox = widgetutil.pad(vbox)

        return vbox
예제 #44
0
    def build_language_page(self):
        vbox = widgetset.VBox(spacing=5)

        vbox.pack_start(_build_paragraph_text(_(
                    "Welcome to %(name)s!  We have a couple of questions "
                    "to help you get started.",
                    {'name': app.config.get(prefs.SHORT_APP_NAME)})))

        vbox.pack_start(_build_title_question(_(
                    "What language would you like %(name)s to be in?",
                    {'name': app.config.get(prefs.SHORT_APP_NAME)})))

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

        def update_language(widget, index):
            os.environ["LANGUAGE"] = _SYSTEM_LANGUAGE
            app.config.set(prefs.LANGUAGE,
                       str(lang_options[index][0]))
            gtcache.init()

            # FIXME - this is totally awful and may break at some
            # point.  what happens is that widgetconst translates at
            # import time, so if someone changes the language, then
            # the translations have already happened.  we reload the
            # module to force them to happen again.  bug 17515
            if "miro.frontends.widgets.widgetconst" in sys.modules:
                reload(sys.modules["miro.frontends.widgets.widgetconst"])
            self.this_page(rebuild=True)

        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)

        lang_option_menu.connect('changed', update_language)

        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)

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

        vbox.pack_start(widgetutil.align_center(hbox))

        vbox.pack_start(self._force_space_label())

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

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

        vbox = widgetutil.pad(vbox)

        return vbox
예제 #45
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))
예제 #46
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))
예제 #47
0
파일: donate.py 프로젝트: zjmmjzzjm/miro
    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
예제 #48
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))
예제 #49
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))