本文整理汇总了Python中miro.frontends.widgets.widgetutil.pad函数的典型用法代码示例。如果您正苦于以下问题:Python pad函数的具体用法?Python pad怎么用?Python pad使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pad函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
self.in_progress = False
widgetset.Background.__init__(self)
hbox = widgetset.HBox()
# left side: labels on first line, progress on second
vbox = widgetset.VBox()
line = widgetset.HBox()
self.size_label = widgetset.Label(u"")
self.size_label.set_bold(True)
self.sync_label = widgetset.Label(u"")
self.sync_label.set_alignment(widgetconst.TEXT_JUSTIFY_RIGHT)
self.sync_label.set_bold(True)
line.pack_start(self.size_label)
line.pack_end(self.sync_label)
vbox.pack_start(widgetutil.pad(line, bottom=10))
self.progress = SizeProgressBar()
self.progress.set_size_request(-1, 14)
vbox.pack_start(self.progress)
hbox.pack_start(vbox, expand=True)
# right size: sync button
self.sync_button = widgetutil.ThreeImageButton(
'device-sync', _("Up to date"))
self.sync_button.set_text_size(1.07) # 14pt
self.sync_button.disable()
self.sync_button.set_size_request(150, 23)
hbox.pack_end(widgetutil.pad(self.sync_button, left=50))
self.add(widgetutil.align(hbox, 0.5, 1, 1, 0, top_pad=10,
bottom_pad=10, left_pad=50, right_pad=50))
示例2: __init__
def __init__(self):
self.in_progress = False
widgetset.Background.__init__(self)
vbox = widgetset.VBox()
# first line: size remaining on the left, sync status on the right
line = widgetset.HBox()
self.size_label = widgetset.Label(u"")
self.size_label.set_bold(True)
self.sync_label = widgetset.Label(u"")
line.pack_start(self.size_label)
line.pack_end(self.sync_label)
vbox.pack_start(widgetutil.pad(line, bottom=10))
# second line: bigger; size status on left, sync button on right
line = widgetset.HBox()
self.progress = SizeProgressBar()
self.progress.set_size_request(425, 36)
self.sync_button = widgetutil.ThreeImageButton(
'device-sync', _("Sync Now"))
self.sync_button.set_size_request(100, 39)
line.pack_start(self.progress)
line.pack_end(widgetutil.pad(self.sync_button, left=50))
vbox.pack_start(line)
self.add(widgetutil.align(vbox, 0.5, 1, 0, 0, top_pad=15,
bottom_pad=15, right_pad=20))
示例3: _pack_extra_buttons
def _pack_extra_buttons(self, vbox):
self.sync_unwatched = widgetset.Checkbox(_("Only sync unplayed items"))
self.sync_unwatched.connect('toggled', self.unwatched_toggled)
self.expire_podcasts = widgetset.Checkbox(
_("Delete expired podcasts from my device"))
self.expire_podcasts.connect('toggled', self.expire_podcasts_toggled)
vbox.pack_start(widgetutil.pad(self.sync_unwatched, left=20))
vbox.pack_start(widgetutil.pad(self.expire_podcasts, left=20))
示例4: _pack_bottom
def _pack_bottom(self):
"""Pack the bottom row into the VBox."""
bottom = [PathField("video_path", self.items, _("Path"), readonly=True)]
self.vbox.pack_start(widgetutil.pad(widgetset.HLine(), top=25, bottom=10, left=15, right=15))
for field in bottom:
self.vbox.pack_start(field.get_box())
self.vbox.pack_start(widgetutil.pad(widgetset.HLine(), top=10, left=15, right=15))
self.fields.extend(bottom)
示例5: _build_sync_section
def _build_sync_section(self, bottom):
hbox = widgetset.HBox()
vbox = widgetset.VBox()
label_line = widgetset.HBox()
label = self.build_header(_("Sync a Phone, Tablet, or Digital Camera"))
label_line.pack_start(widgetutil.align_left(label, left_pad=20,
bottom_pad=10))
help_button = HelpButton()
help_button.connect('clicked', self.help_button_clicked)
label_line.pack_start(widgetutil.align_top(help_button))
bottom.pack_start(label_line)
label = widgetset.Label(
_("Connect the USB cable to sync your Android device with "
"%(shortappname)s. Be sure to set your device to 'USB Mass "
"Storage' mode in your device settings. Attach your digital "
"camera, and convert your video files to be instantly "
"web-ready.", self.trans_data))
label.set_size(self.TEXT_SIZE)
label.set_color(self.TEXT_COLOR)
label.set_size_request(400, -1)
label.set_wrap(True)
vbox.pack_start(widgetutil.align_left(label, left_pad=20,
bottom_pad=20))
show_all_vbox = widgetset.VBox()
self.show_unknown = widgetset.Checkbox(
_("Show all attached devices and drives"))
self.show_unknown.set_checked(
app.config.get(prefs.SHOW_UNKNOWN_DEVICES))
self.show_unknown.connect('toggled', self.show_all_devices_toggled)
show_all_vbox.pack_start(self.show_unknown)
padding = self.show_unknown.get_text_padding()
label = widgetset.Label(
_("Use this if your phone doesn't appear in %(shortappname)s when "
"you connect it to the computer, or if you want to sync with an "
"external drive.", self.trans_data))
label.set_size(self.TEXT_SIZE)
label.set_color(self.TEXT_COLOR)
label.set_size_request(370 - padding, -1)
label.set_wrap(True)
show_all_vbox.pack_start(widgetutil.pad(label, top=10, left=padding))
bg = widgetutil.RoundedSolidBackground(
widgetutil.css_to_color('#e4e4e4'))
bg.set_size_request(400, -1)
bg.add(widgetutil.pad(show_all_vbox, 20, 20, 20, 20))
vbox.pack_start(widgetutil.pad(bg, left=20, right=10, bottom=50))
hbox.pack_start(vbox)
hbox.pack_start(widgetutil.align_top(widgetset.ImageDisplay(
imagepool.get(resources.path('images/connect-android.png')))))
bottom.pack_start(hbox)
示例6: __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))
示例7: set_device
def set_device(self, device):
for child in self.device_choices.children:
self.device_choices.remove(child)
self.device = device
possible_devices = sorted(device.info.devices)
rbg = widgetset.RadioButtonGroup()
buttons_to_device_name = {}
for device_name in possible_devices:
button = widgetset.RadioButton(device_name, rbg)
self.device_choices.pack_start(button)
buttons_to_device_name[button] = device_name
def _clicked(*args):
selected_button = rbg.get_selected()
if selected_button is None:
return # user didn't actually select a device
messages.SetDeviceType(
self.device,
buttons_to_device_name[selected_button]).send_to_backend()
select = widgetset.Button(_('This is my device'))
select.connect('clicked', _clicked)
self.device_choices.pack_start(widgetutil.pad(select, top=20))
示例8: __init__
def __init__(self, items):
DialogPanel.__init__(self, items)
self.fields = [
TextField('show', self.items, _("Show")),
TextField('episode_id', self.items, _("Episode ID")),
MultifieldRow(
NumberField('season_number', self.items, _("Season Number"),
width=15),
NumberField('episode_number', self.items, _("Episode Number"),
width=15),
),
OptionsField('kind', self.items, _("Video Kind"), [
# FIXME: changes here need also be applied in messages
(None, u""),
(u'movie', _("Movie")),
(u'show', _("Show")),
(u'clip', _("Clip")),
(u'podcast', _("Podcast")),
]),
]
content = widgetset.VBox()
for field in self.fields:
field.set_label_width(120)
content.pack_start(field.get_box(), padding=5)
# XXX - hack: OS X is cutting off the right side of the box in single
# selection mode; this seems like a bug in layout. padding the right
# side causes only padding to be cut off.
# XXX - this padding fixes 17065. 17065 is the same layout issue?
self.vbox = widgetutil.pad(content, right=15)
示例9: __init__
def __init__(self, field, items, label, formatter, multiple=None):
Field.__init__(self, field, items, label, readonly=True, multiple=multiple)
value = self.common_value
if self.mixed_values:
value = _("(mixed)")
else:
value = formatter(value)
label = widgetset.Label(value)
self.widget = widgetutil.pad(label, top=6)
示例10: build_widget
def build_widget(self):
image_path = resources.path("images/icon-conversions_large.png")
icon = imagepool.get(image_path)
titlebar = ConversionsTitleBar(_("Conversions"), icon)
self.widget.pack_start(titlebar)
sep = separator.HSeparator((0.85, 0.85, 0.85), (0.95, 0.95, 0.95))
self.widget.pack_start(sep)
self.stop_all_button = widgetset.Button(_('Stop All Conversions'), style='smooth')
self.stop_all_button.set_size(widgetconst.SIZE_SMALL)
self.stop_all_button.set_color(widgetset.TOOLBAR_GRAY)
self.stop_all_button.disable()
self.stop_all_button.connect('clicked', self.on_cancel_all)
reveal_button = widgetset.Button(_('Show Conversion Folder'), style='smooth')
reveal_button.set_size(widgetconst.SIZE_SMALL)
reveal_button.set_color(widgetset.TOOLBAR_GRAY)
reveal_button.connect('clicked', self.on_reveal_conversions_folder)
self.clear_finished_button = widgetset.Button(
_('Clear Finished Conversions'), style='smooth')
self.clear_finished_button.set_size(widgetconst.SIZE_SMALL)
self.clear_finished_button.set_color(widgetset.TOOLBAR_GRAY)
self.clear_finished_button.connect('clicked', self.on_clear_finished)
toolbar = itemlistwidgets.DisplayToolbar()
hbox = widgetset.HBox()
hbox.pack_start(widgetutil.pad(self.stop_all_button, top=8, bottom=8, left=8))
hbox.pack_end(widgetutil.pad(reveal_button, top=8, bottom=8, right=8))
hbox.pack_end(widgetutil.pad(self.clear_finished_button, top=8, bottom=8, right=8))
toolbar.add(hbox)
self.widget.pack_start(toolbar)
self.iter_map = dict()
self.model = widgetset.TableModel('object')
self.table = ConversionTableView(self.model)
self.table.connect_weak('hotspot-clicked', self.on_hotspot_clicked)
scroller = widgetset.Scroller(False, True)
scroller.add(self.table)
self.widget.pack_start(scroller, expand=True)
conversion_manager.fetch_tasks_list()
示例11: _build_titlebar_extra
def _build_titlebar_extra(self):
self.create_signal('save-search')
button = widgetset.Button(_('Save Search'))
button.connect('clicked', self._on_save_search)
self.save_button = widgetutil.HideableWidget(
widgetutil.pad(button, right=10))
return [
widgetutil.align_middle(self.save_button),
ItemListTitlebar._build_titlebar_extra(self),
]
示例12: _make_label
def _make_label(self, header_text):
hbox = widgetset.HBox()
self.header_label = widgetset.Label(header_text)
self.header_label.set_size(0.85)
self.header_label.set_bold(True)
self.header_label.set_color((0.27, 0.27, 0.27))
hbox.pack_start(self.header_label)
self.info_label = widgetset.Label("")
self.info_label.set_size(0.85)
self.info_label.set_color((0.72, 0.72, 0.72))
hbox.pack_start(widgetutil.pad(self.info_label, left=7))
self.expander.set_label(hbox)
示例13: __init__
def __init__(self):
self.device = None
widgetset.HBox.__init__(self)
first_column = widgetset.VBox()
self.sync_library = widgetset.Checkbox(self.title)
self.sync_library.connect('toggled', self.sync_library_toggled)
first_column.pack_start(self.sync_library)
self.sync_group = widgetset.RadioButtonGroup()
if self.file_type != 'playlists':
# don't actually need to create buttons for playlists, since we
# always sync all items
all_button = widgetset.RadioButton(self.all_label, self.sync_group)
all_button.connect('clicked', self.all_button_clicked)
widgetset.RadioButton(self.unwatched_label,
self.sync_group)
for button in self.sync_group.get_buttons():
button.disable()
first_column.pack_start(button)
self.pack_start(widgetutil.pad(first_column, 20, 0, 20, 20))
second_column = widgetset.VBox()
second_column.pack_start(widgetset.Label(self.list_label))
self.feed_list = widgetset.VBox()
self.info_map = {}
feeds = self.get_feeds()
if feeds:
for info in feeds:
checkbox = widgetset.Checkbox(info.name)
checkbox.connect('toggled', self.feed_toggled, info)
self.feed_list.pack_start(checkbox)
self.info_map[self.info_key(info)] = checkbox
else:
self.sync_library.disable()
scroller = widgetset.Scroller(False, True)
scroller.set_child(self.feed_list)
second_column.pack_start(scroller, expand=True)
self.feed_list.disable()
self.pack_start(widgetutil.pad(second_column, 20, 20, 20, 20),
expand=True)
示例14: __init__
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)
示例15: _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)