本文整理汇总了Python中sugar3.graphics.radiotoolbutton.RadioToolButton.value方法的典型用法代码示例。如果您正苦于以下问题:Python RadioToolButton.value方法的具体用法?Python RadioToolButton.value怎么用?Python RadioToolButton.value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.radiotoolbutton.RadioToolButton
的用法示例。
在下文中一共展示了RadioToolButton.value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sugar3.graphics.radiotoolbutton import RadioToolButton [as 别名]
# 或者: from sugar3.graphics.radiotoolbutton.RadioToolButton import value [as 别名]
def __init__(self, model, alerts=None):
SectionView.__init__(self)
self._model = model
self._images_loaded = False
self._append_to_store_sid = None
self.connect('realize', self.__realize_cb)
self.connect('unrealize', self.__unrealize_cb)
self.set_border_width(style.DEFAULT_SPACING * 2)
self.set_spacing(style.DEFAULT_SPACING)
label_box = Gtk.Box()
label_bg = Gtk.Label(label=_('Select a background:'))
label_bg.modify_fg(Gtk.StateType.NORMAL,
style.COLOR_SELECTION_GREY.get_gdk_color())
label_bg.show()
label_box.pack_start(label_bg, False, True, 0)
label_box.show()
self.pack_start(label_box, False, True, 1)
clear_button = Gtk.Button()
clear_button.set_label(_('Clear background'))
clear_button.connect('clicked', self._clear_clicked_cb)
clear_button.show()
self.pack_end(clear_button, False, True, 0)
scrolled_window = Gtk.ScrolledWindow()
scrolled_window.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
Gtk.PolicyType.AUTOMATIC)
self.pack_start(scrolled_window, True, True, 0)
scrolled_window.show()
self._store = Gtk.ListStore(GdkPixbuf.Pixbuf, str)
self._icon_view = Gtk.IconView.new_with_model(self._store)
self._icon_view.set_selection_mode(Gtk.SelectionMode.SINGLE)
self._icon_view.connect('selection-changed', self._background_selected)
self._icon_view.set_pixbuf_column(0)
self._icon_view.grab_focus()
scrolled_window.add(self._icon_view)
self._icon_view.show()
alpha = self._model.get_background_alpha_level()
alpha_box = Gtk.HBox()
alpha_buttons = []
alpha_icons = [
[1.0, 'network-wireless-000'],
[0.8, 'network-wireless-020'],
[0.6, 'network-wireless-040'],
[0.4, 'network-wireless-060'],
[0.2, 'network-wireless-080']]
for value, icon_name in alpha_icons:
if len(alpha_buttons) > 0:
button = RadioToolButton(group=alpha_buttons[0])
else:
button = RadioToolButton(group=None)
button.set_icon_name(icon_name)
button.value = value
button.props.active = value == alpha
button.show()
alpha_box.pack_start(button, False, True, 0)
alpha_buttons.append(button)
for button in alpha_buttons:
button.connect('toggled', self._set_alpha_cb)
alpha_alignment = Gtk.Alignment()
alpha_alignment.set(0.5, 0, 0, 0)
alpha_alignment.add(alpha_box)
alpha_box.show()
self.pack_start(alpha_alignment, False, False, 0)
alpha_alignment.show()
self._paths_list = []
file_paths = []
for directory in self._model.BACKGROUNDS_DIRS:
if directory is not None and os.path.exists(directory):
for root, dirs, files in os.walk(directory):
for file_ in files:
file_paths.append(os.path.join(root, file_))
self._append_to_store(file_paths)
self.setup()