• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python widgetutil.align_middle函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中miro.frontends.widgets.widgetutil.align_middle函数的典型用法代码示例。如果您正苦于以下问题:Python align_middle函数的具体用法?Python align_middle怎么用?Python align_middle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了align_middle函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(self):
        style.LowerBox.__init__(self)
        self.controls = PlaybackControls()
        self.timeline = ProgressTimeline()
        app.playback_manager.connect('will-start', self.on_playback_started)
        app.playback_manager.connect('did-stop', self.on_playback_stopped)
        app.playback_manager.connect('selecting-file', self.on_file_selected)
        self.timeline.info.connect('clicked', self.on_title_clicked)
        self.playback_mode = PlaybackModeControls()
        self.volume_muter = imagebutton.ImageButton('volume')
        self.volume_muter.set_can_focus(False)
        self.volume_slider = VolumeSlider()
        self.time_slider = self.timeline.slider

        hbox = widgetset.HBox(spacing=20)
        hbox.pack_start(self.controls, expand=False)
        hbox.pack_start(widgetutil.align_middle(self.timeline),
                        expand=True)
        volume_hbox = widgetset.HBox(spacing=4)
        volume_hbox.pack_start(widgetutil.align_middle(self.volume_muter))
        volume_hbox.pack_start(widgetutil.align_middle(self.volume_slider))
        hbox.pack_start(volume_hbox)
        hbox.pack_start(self.playback_mode)

        vbox = widgetset.VBox()
        hline = separator.HSeparator(widgetutil.BLACK)
        vbox.pack_start(hline)
        vbox.pack_start(widgetutil.align_middle(hbox, 0, 0, 25, 25),
                        expand=True)

        self.add(vbox)

        self.selected_tab_list = self.selected_tabs = None
        self.selected_file = None
开发者ID:foxi,项目名称:miro,代码行数:34,代码来源:videobox.py


示例2: __init__

    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))
开发者ID:CodeforEvolution,项目名称:miro,代码行数:28,代码来源:tabcontroller.py


示例3: __init__

    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))
开发者ID:kmshi,项目名称:miro,代码行数:35,代码来源:searchcontroller.py


示例4: _build_titlebar_extra

    def _build_titlebar_extra(self):
        hbox = widgetset.HBox()

        self.searchbox = widgetset.VideoSearchTextEntry()
        w, h = self.searchbox.get_size_request()
        self.searchbox.set_size_request(w * 2, h)
        self.searchbox.connect('validate', self._on_search_activate)
        hbox.pack_start(widgetutil.align_middle(self.searchbox, 0, 0, 16, 16))

        return widgetutil.align_middle(hbox, right_pad=20)
开发者ID:nxmirrors,项目名称:miro,代码行数:10,代码来源:itemlistwidgets.py


示例5: run_dialog

    def run_dialog(self):
        """
        Returns (directory, show-in-sidebar) or None
        """
        try:
            extra = widgetset.VBox(spacing=10)
            if self.previous_error:
                extra.pack_start(widgetset.Label(self.previous_error))

            self.folder_entry = widgetset.TextEntry()
            self.folder_entry.set_activates_default(True)
            self.folder_entry.set_text(filename_to_unicode(self.path))
            self.folder_entry.set_size_request(300, -1)

            choose_button = widgetset.Button(_("Choose..."))
            choose_button.connect('clicked', self.handle_choose)

            h = widgetset.HBox(spacing=5)
            h.pack_start(widgetutil.align_middle(
                widgetset.Label(_("Directory:"))))
            h.pack_start(widgetutil.align_middle(self.folder_entry))
            h.pack_start(widgetutil.align_middle(choose_button))

            extra.pack_start(h)

            self.visible_checkbox = widgetset.Checkbox(
                _("Show in my sidebar as a podcast"))
            self.visible_checkbox.set_checked(True)
            extra.pack_start(self.visible_checkbox)

            self.vbox = extra

            self.set_extra_widget(extra)
            self.add_button(BUTTON_ADD_FOLDER.text)
            self.add_button(BUTTON_CANCEL.text)

            ret = self.run()
            if ret == 0:
                # 17407 band-aid - don't init with PlatformFilenameType since
                # str use ascii codec
                dir = self.folder_entry.get_text()
                if PlatformFilenameType == str:
                    dir = dir.encode('utf-8')
                return (dir, self.visible_checkbox.get_checked())

            return None

        except StandardError:
            logging.exception("newwatchedfolder threw exception.")
开发者ID:CodeforEvolution,项目名称:miro,代码行数:49,代码来源:newwatchedfolder.py


示例6: __init__

    def __init__(self):
        DisplayToolbar.__init__(self)        
        vbox = widgetset.VBox()

        sep = separator.HSeparator((0.85, 0.85, 0.85), (0.95, 0.95, 0.95))
        vbox.pack_start(sep)

        h = widgetset.HBox(spacing=5)

        self.create_signal('pause-all')
        self.create_signal('resume-all')
        self.create_signal('cancel-all')
        self.create_signal('settings')

        pause_button = widgetset.Button(_('Pause All'), style='smooth')
        pause_button.set_size(widgetconst.SIZE_SMALL)
        pause_button.set_color(widgetset.TOOLBAR_GRAY)
        pause_button.connect('clicked', self._on_pause_button_clicked)
        h.pack_start(widgetutil.align_right(pause_button, top_pad=5,
            bottom_pad=5), expand=True)

        resume_button = widgetset.Button(_('Resume All'), style='smooth')
        resume_button.set_size(widgetconst.SIZE_SMALL)
        resume_button.set_color(widgetset.TOOLBAR_GRAY)
        resume_button.connect('clicked', self._on_resume_button_clicked)
        h.pack_start(widgetutil.align_middle(resume_button, top_pad=5,
            bottom_pad=5))

        cancel_button = widgetset.Button(_('Cancel All'), style='smooth')
        cancel_button.set_size(widgetconst.SIZE_SMALL)
        cancel_button.set_color(widgetset.TOOLBAR_GRAY)
        cancel_button.connect('clicked', self._on_cancel_button_clicked)
        h.pack_start(widgetutil.align_middle(cancel_button, top_pad=5,
            bottom_pad=5))

        settings_button = widgetset.Button(_('Download Settings'),
                                           style='smooth')
        settings_button.set_size(widgetconst.SIZE_SMALL)
        settings_button.set_color(widgetset.TOOLBAR_GRAY)
        settings_button.connect('clicked', self._on_settings_button_clicked)
        h.pack_start(widgetutil.align_middle(settings_button, top_pad=5,
            bottom_pad=5, right_pad=16))

        vbox.pack_start(h)

        h = widgetset.HBox(spacing=10)

        vbox.pack_start(h)
        self.add(vbox)
开发者ID:nxmirrors,项目名称:miro,代码行数:49,代码来源:itemlistwidgets.py


示例7: __init__

    def __init__(self):
        widgetset.HBox.__init__(self)

        self.set_size_request(-1, 25)
        self.create_signal('browser-reload')
        self.create_signal('browser-back')
        self.create_signal('browser-forward')
        self.create_signal('browser-stop')
        self.create_signal('browser-home')
        self.create_signal('address-entered')
        self.create_signal('browser-download')
        self.create_signal('browser-open')

        self.back_button = imagebutton.ImageButton('navback')
        self.back_button.set_squish_width(True)
        self.back_button.connect('clicked', self._on_back_button_clicked)
        self.back_button.disable()
        self.pack_start(widgetutil.align_middle(self.back_button, left_pad=4))
        
        self.forward_button = imagebutton.ImageButton('navforward')
        self.forward_button.set_squish_width(True)
        self.forward_button.connect('clicked', self._on_forward_button_clicked)
        self.forward_button.disable()
        self.pack_start(widgetutil.align_middle(self.forward_button))

        self.reload_button = imagebutton.ImageButton('navreload')
        self.reload_button.connect('clicked', self._on_reload_button_clicked)
        self.pack_start(widgetutil.align_middle(self.reload_button, left_pad=4))

        self.stop_button = imagebutton.ImageButton('navstop')
        self.stop_button.connect('clicked', self._on_stop_button_clicked)
        self.pack_start(widgetutil.align_middle(self.stop_button, left_pad=4))

        self.home_button = imagebutton.ImageButton('navhome')
        self.home_button.connect('clicked', self._on_home_button_clicked)
        self.pack_start(widgetutil.align_middle(self.home_button, left_pad=4))

        self.browser_open_button = widgetset.Button(
            _('Open in browser'), style='smooth')
        self.browser_open_button.set_size(widgetconst.SIZE_SMALL)
        self.browser_open_button.connect(
            'clicked', self._on_browser_open_activate)
        self.pack_end(widgetutil.align_middle(self.browser_open_button,
                                              right_pad=4))

        self.download_button = widgetset.Button(_("Download this video"),
                                                style="smooth")
        self.download_button.set_size(widgetconst.SIZE_SMALL)
        self.download_button.connect('clicked',
                                     self._on_download_button_clicked)
        self.download_button = widgetutil.HideableWidget(self.download_button)
        self.pack_end(widgetutil.align_middle(self.download_button,
                                              right_pad=4))

        self.loading_icon = widgetutil.HideableWidget(
                widgetset.AnimatedImageDisplay(
                    resources.path('images/load-indicator.gif')))
        self.pack_end(widgetutil.align_middle(self.loading_icon, right_pad=6))
开发者ID:nxmirrors,项目名称:miro,代码行数:58,代码来源:browser.py


示例8: __init__

 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)
开发者ID:nxmirrors,项目名称:miro,代码行数:26,代码来源:displays.py


示例9: __init__

 def __init__(self):
     widgetset.HBox.__init__(self, spacing=2)
     self.previous = self.make_button("skip_previous", True)
     self.stop = self.make_button("stop", False)
     self.play = self.make_button("play", False)
     self.forward = self.make_button("skip_forward", True)
     self.fullscreen = self.make_button("play_fullscreen", True)
     self.pack_start(widgetutil.align_middle(self.previous))
     self.pack_start(widgetutil.align_middle(self.stop))
     self.pack_start(widgetutil.align_middle(self.play))
     self.pack_start(widgetutil.align_middle(self.fullscreen))
     self.pack_start(widgetutil.align_middle(self.forward))
     app.playback_manager.connect("selecting-file", self.handle_selecting)
     app.playback_manager.connect("will-play", self.handle_play)
     app.playback_manager.connect("will-pause", self.handle_pause)
     app.playback_manager.connect("will-stop", self.handle_stop)
开发者ID:nxmirrors,项目名称:miro,代码行数:16,代码来源:videobox.py


示例10: __init__

 def __init__(self):
     style.LowerBox.__init__(self)
     self.search_field = widgetset.VideoSearchTextEntry()
     self.search_field.select_engine(app.search_manager.engine)
     self.search_field.connect('validate', self.on_search)
     self.add(widgetutil.align_middle(self.search_field, 0, 0, 16, 0))
     app.playback_manager.connect('will-play-attached', self.on_start_attached_playback)
     app.playback_manager.connect('will-play-detached', self.on_start_detached_playback)
     app.playback_manager.connect('did-stop', self.on_stop_playback)
开发者ID:CodeforEvolution,项目名称:miro,代码行数:9,代码来源:searchbox.py


示例11: _build_add_playlist_section

    def _build_add_playlist_section(self, bottom):
        hbox = widgetset.HBox()
        label = widgetset.Label(_("Name"))
        hbox.pack_start(widgetutil.align_middle(label))

        self.name_entry = widgetset.TextEntry()
        self.name_entry.set_size_request(400, -1)
        self.name_entry.connect('activate', self._on_add_playlist)
        hbox.pack_start(widgetutil.align_middle(
                self.name_entry, left_pad=15))

        self.add_playlist_button = widgetutil.TitlebarButton(_("Add Playlist"))
        self.add_playlist_button.connect('clicked', self._on_add_playlist)
        hbox.pack_start(widgetutil.align_middle(
                self.add_playlist_button, left_pad=15))

        bg = widgetutil.RoundedSolidBackground(
            widgetutil.css_to_color('#e4e4e4'))
        bg.add(widgetutil.pad(hbox, 10, 10, 10, 10))

        bottom.pack_start(bg)
开发者ID:CodeforEvolution,项目名称:miro,代码行数:21,代码来源:tabcontroller.py


示例12: __init__

    def __init__(self):
        widgetset.DonateWindow.__init__(self, _("Donate"))
        self.create_signal("donate-clicked")
        self.vbox = widgetset.VBox(spacing=5)
        self.hbox = widgetset.HBox(spacing=5)
        self.button_yes = widgetset.Button(_("Yes, I can donate now"))
        self.button_no = widgetset.Button(_("Ask me later"))
        self.button_yes.connect("clicked", self._on_button_clicked)
        self.button_no.connect("clicked", self._on_button_clicked)
        self.browser = widgetset.Browser()
        self.browser.set_size_request(640, 440)
        self.browser.connect("net-stop", self._on_browser_stop)
        self.browser.connect("net-error", self._on_browser_error)
        self.hbox.pack_end(widgetutil.align_middle(self.button_no, right_pad=10))
        self.hbox.pack_end(widgetutil.align_middle(self.button_yes))
        self.vbox.pack_start(self.browser, padding=10, expand=True)
        self.vbox.pack_start(self.hbox, padding=5)
        self.set_content_widget(self.vbox)
        self.was_shown_invoked = False

        self.callback_object = None
开发者ID:ktan2020,项目名称:miro,代码行数:21,代码来源:donate.py


示例13: __init__

    def __init__(self):
        style.LowerBox.__init__(self)
        self.controls = PlaybackControls()
        self.timeline = ProgressTimeline()
        if hasattr(widgetset, 'VolumeMuter'):
            self.volume_muter = widgetset.VolumeMuter()
        else:
            self.volume_muter = imagebutton.ImageButton('volume')
        if hasattr(widgetset, 'VolumeSlider'):
            self.volume_slider = widgetset.VolumeSlider()
        else:
            self.volume_slider = VolumeSlider()
        self.time_slider = self.timeline.slider

        hbox = widgetset.HBox(spacing=20)
        hbox.pack_start(self.controls, expand=False)
        hbox.pack_start(widgetutil.align_middle(self.timeline), expand=True)
        volume_hbox = widgetset.HBox(spacing=4)
        volume_hbox.pack_start(widgetutil.align_middle(self.volume_muter))
        volume_hbox.pack_start(widgetutil.align_middle(self.volume_slider))
        hbox.pack_start(volume_hbox)
        self.add(widgetutil.align_middle(hbox, 0, 0, 25, 25))
开发者ID:cool-RR,项目名称:Miro,代码行数:22,代码来源:videobox.py


示例14: _build_stores_section

    def _build_stores_section(self, bottom):
        vbox = widgetset.VBox()
        from miro.frontends.widgets import prefpanel
        self.store_helper = prefpanel.StoreHelper(height=200)
        self.store_helper.store_list.set_size_request(550, -1)
        vbox.pack_start(widgetutil.align_middle(
                self.store_helper.store_list, top_pad=20, bottom_pad=15,
                left_pad=15, right_pad=15))

        bg = widgetutil.RoundedSolidBackground(
            widgetutil.css_to_color('#e4e4e4'))
        bg.add(widgetutil.pad(vbox, 00, 10, 10, 10))

        bottom.pack_start(bg)
开发者ID:CodeforEvolution,项目名称:miro,代码行数:14,代码来源:tabcontroller.py


示例15: pack_hbox_extra

 def pack_hbox_extra(self):
     self.filter_switch = segmented.SegmentedButtonsRow(behavior='custom')
     # this "All" is different than other "All"s in the codebase, so it
     # needs to be clarified
     self.filter_switch.add_text_button('view-all',
                                        declarify(_('View|All')),
                                        self._on_view_all_clicked)
     self.filter_switch.add_text_button('view-unwatched',
                                        self.unwatched_label,
                                        self._on_toggle_unwatched_clicked)
     self.filter_switch.add_text_button('view-non-feed',
                                        _('Non Feed'),
                                        self._on_toggle_non_feed_clicked)
     self.filter_switch.set_active('view-all')
     self._hbox.pack_start(widgetutil.align_middle(
         self.filter_switch.make_widget(), left_pad=12))
开发者ID:nxmirrors,项目名称:miro,代码行数:16,代码来源:itemlistwidgets.py


示例16: __init__

 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)
开发者ID:bluezone,项目名称:miro,代码行数:20,代码来源:displays.py


示例17: make_widget

 def make_widget(self):
     hbox = widgetset.HBox()
     if self.label is not None:
         label = widgetset.Label(self.label)
         label.set_size(-2)
         label.set_color((0.9, 0.9, 0.9))
         hbox.pack_start(widgetutil.align_middle(label))
     count = len(self.buttons_list)
     for index in range(count):
         if index == 0:
             if count == 1:
                 segment_type = 'unique'
             else:
                 segment_type = 'left'
         elif index == count-1:
             segment_type =  'right'
         else:
             segment_type =  'middle'            
         button = self.buttons_list[index]
         button.set_segment_type(segment_type)
         hbox.pack_start(button)
     return hbox
开发者ID:CodeforEvolution,项目名称:miro,代码行数:22,代码来源:segmented.py


示例18: __init__

    def __init__(self):
        itemlistwidgets.Titlebar.__init__(self)

        hbox = widgetset.HBox()
        self.add(hbox)

        self.create_signal('browser-reload')
        self.create_signal('browser-back')
        self.create_signal('browser-forward')
        self.create_signal('browser-stop')
        self.create_signal('browser-home')
        self.create_signal('address-entered')
        self.create_signal('browser-download')
        self.create_signal('browser-open')

        self.back_button = imagebutton.ImageButton('navback')
        self.back_button.set_squish_width(True)
        self.back_button.connect('clicked', self._on_back_button_clicked)
        self.back_button.disable()
        hbox.pack_start(widgetutil.align_middle(self.back_button, left_pad=10))

        nav_separator = widgetset.ImageDisplay(imagepool.get(
            resources.path('images/navseparator.png')))
        hbox.pack_start(widgetutil.align_middle(nav_separator))

        self.forward_button = imagebutton.ImageButton('navforward')
        self.forward_button.set_squish_width(True)
        self.forward_button.connect('clicked', self._on_forward_button_clicked)
        self.forward_button.disable()
        hbox.pack_start(widgetutil.align_middle(self.forward_button))

        self.reload_button = imagebutton.ImageButton('navreload')
        self.reload_button.connect('clicked', self._on_reload_button_clicked)
        hbox.pack_start(widgetutil.align_middle(self.reload_button,
                                                left_pad=4))

        self.stop_button = imagebutton.ImageButton('navstop')
        self.stop_button.connect('clicked', self._on_stop_button_clicked)
        hbox.pack_start(widgetutil.align_middle(self.stop_button, left_pad=4))

        self.home_button = imagebutton.ImageButton('navhome')
        self.home_button.connect('clicked', self._on_home_button_clicked)
        hbox.pack_start(widgetutil.align_middle(self.home_button, left_pad=4))

        self.browser_open_button = widgetutil.TitlebarButton(
            _('Open in browser'), 'navopen')
        self.browser_open_button.connect(
            'clicked', self._on_browser_open_activate)
        hbox.pack_end(widgetutil.align_middle(self.browser_open_button,
                                              right_pad=10))

        self.download_button = widgetutil.TitlebarButton(
            _("Download this video"), 'navdownload')
        self.download_button.connect('clicked',
                                     self._on_download_button_clicked)
        self.download_button = widgetutil.HideableWidget(self.download_button)
        hbox.pack_end(widgetutil.align_middle(self.download_button,
                                              right_pad=4))

        self.loading_icon = BrowserLoadingImage()
        hbox.pack_start(widgetutil.align_middle(self.loading_icon),
                        expand=True)
开发者ID:codito,项目名称:miro,代码行数:62,代码来源:browser.py


示例19: build_find_files_page

    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:
#.........这里部分代码省略.........
开发者ID:codito,项目名称:miro,代码行数:101,代码来源:firsttimedialog.py


示例20: pack

 def pack(self, hbox, widget, expand=False):
     hbox.pack_start(widgetutil.align_middle(widget), expand=expand)
开发者ID:CodeforEvolution,项目名称:miro,代码行数:2,代码来源:searchcontroller.py



注:本文中的miro.frontends.widgets.widgetutil.align_middle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python widgetutil.get_feed_info函数代码示例发布时间:2022-05-27
下一篇:
Python widgetutil.align_left函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap