本文整理汇总了Python中sugar3.graphics.palette.Palette.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Palette.__init__方法的具体用法?Python Palette.__init__怎么用?Python Palette.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar3.graphics.palette.Palette
的用法示例。
在下文中一共展示了Palette.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, cb_object):
Palette.__init__(self, text_maxlen=100)
self._cb_object = cb_object
self.set_group_id('frame')
cb_service = clipboard.get_instance()
cb_service.connect('object-state-changed',
self._object_state_changed_cb)
self._remove_item = MenuItem(pgettext('Clipboard', 'Remove'),
'list-remove')
self._remove_item.connect('activate', self._remove_item_activate_cb)
self.menu.append(self._remove_item)
self._remove_item.show()
self._open_item = MenuItem(_('Open'), 'zoom-activity')
self._open_item.connect('activate', self._open_item_activate_cb)
self.menu.append(self._open_item)
self._open_item.show()
self._journal_item = MenuItem(_('Keep'))
client = GConf.Client.get_default()
color = XoColor(client.get_string('/desktop/sugar/user/color'))
icon = Icon(icon_name='document-save', icon_size=Gtk.IconSize.MENU,
xo_color=color)
self._journal_item.set_image(icon)
self._journal_item.connect('activate', self._journal_item_activate_cb)
self.menu.append(self._journal_item)
self._journal_item.show()
self._update()
示例2: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, primary_text):
Palette.__init__(self, primary_text)
self._level = 0
self._time = 0
self._status = _STATUS_NOT_PRESENT
self._warning_capacity = _settings_get('warning-capacity')
self._progress_widget = PaletteMenuBox()
self.set_content(self._progress_widget)
self._progress_widget.show()
inner_box = Gtk.VBox()
inner_box.set_spacing(style.DEFAULT_PADDING)
self._progress_widget.append_item(inner_box, vertical_padding=0)
inner_box.show()
self._progress_bar = Gtk.ProgressBar()
self._progress_bar.set_size_request(
style.zoom(style.GRID_CELL_SIZE * 4), -1)
inner_box.pack_start(self._progress_bar, True, True, 0)
self._progress_bar.show()
self._status_label = Gtk.Label()
inner_box.pack_start(self._status_label, True, True, 0)
self._status_label.show()
示例3: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, title, url, owner_document):
Palette.__init__(self)
self._title = title
self._url = url
self._owner_document = owner_document
self.props.primary_text = title
self.props.secondary_text = url
menu_item = MenuItem(_('Keep image'))
icon = Icon(icon_name='document-save', xo_color=profile.get_color(),
icon_size=Gtk.IconSize.MENU)
menu_item.set_image(icon)
menu_item.connect('activate', self.__download_activate_cb)
self.menu.append(menu_item)
menu_item.show()
menu_item = MenuItem(_('Copy image'))
icon = Icon(icon_name='edit-copy', xo_color=profile.get_color(),
icon_size=Gtk.IconSize.MENU)
menu_item.set_image(icon)
menu_item.connect('activate', self.__copy_activate_cb)
self.menu.append(menu_item)
menu_item.show()
示例4: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, cb_object):
Palette.__init__(self, text_maxlen=100)
self._cb_object = cb_object
self.set_group_id('frame')
cb_service = clipboard.get_instance()
cb_service.connect('object-state-changed',
self._object_state_changed_cb)
self._remove_item = MenuItem(pgettext('Clipboard', 'Remove'),
'list-remove')
self._remove_item.connect('activate', self._remove_item_activate_cb)
self.menu.append(self._remove_item)
self._remove_item.show()
self._open_item = MenuItem(_('Open'), 'zoom-activity')
self._open_item.connect('activate', self._open_item_activate_cb)
self.menu.append(self._open_item)
self._open_item.show()
self._journal_item = MenuItem(_('Keep'))
color = profile.get_color()
icon = Icon(icon_name='document-save',
pixel_size=style.SMALL_ICON_SIZE,
xo_color=color)
self._journal_item.set_image(icon)
self._journal_item.connect('activate', self._journal_item_activate_cb)
self.menu.append(self._journal_item)
self._journal_item.show()
self._update()
示例5: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, invite):
Palette.__init__(self, '')
self._invite = invite
menu_item = MenuItem(_('Join'), icon_name='dialog-ok')
menu_item.connect('activate', self.__join_activate_cb)
self.menu.append(menu_item)
menu_item.show()
menu_item = MenuItem(_('Decline'), icon_name='dialog-cancel')
menu_item.connect('activate', self.__decline_activate_cb)
self.menu.append(menu_item)
menu_item.show()
bundle_id = invite.get_bundle_id()
registry = bundleregistry.get_registry()
self._bundle = registry.get_bundle(bundle_id)
if self._bundle:
name = self._bundle.get_name()
else:
name = bundle_id
self.set_primary_text(name)
示例6: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, buddy):
self._buddy = buddy
nick, colors = buddy
buddy_icon = Icon(icon_name="computer-xo", icon_size=style.STANDARD_ICON_SIZE, xo_color=XoColor(colors))
Palette.__init__(self, primary_text=GLib.markup_escape_text(nick), icon=buddy_icon)
示例7: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, primary_text, view):
Palette.__init__(self, label=primary_text)
self._recognizer = view._recognizer
self._view = view
self._ok_icon = Icon(icon_name='dialog-ok',
icon_size=Gtk.IconSize.MENU)
self._cancel_icon = Icon(icon_name='dialog-cancel',
icon_size=Gtk.IconSize.MENU)
label = Gtk.Label()
label.set_label(_('Mute'))
align = Gtk.Alignment(xalign=0.0, yalign=0.5, xscale=0.0, yscale=0.0)
align.add(label)
button = Gtk.Button()
button.set_image(self._cancel_icon)
button.connect('clicked', self.__button_clicked_cb)
self._asr_label = label
self._asr_button = button
hbox = Gtk.HBox()
hbox.pack_start(align, expand=True, fill=True,
padding=style.DEFAULT_PADDING)
hbox.pack_start(button, expand=False, fill=False,
padding=style.DEFAULT_PADDING)
vbox = Gtk.VBox()
vbox.pack_start(hbox, True, True, style.DEFAULT_PADDING)
self.set_content(vbox)
vbox.show_all()
示例8: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, primary_text, output_text, input_text, output_model,
input_model):
Palette.__init__(self, label=primary_text)
self._capture_manager = AudioManagerWidget(input_text,
'media-audio-input',
input_model)
self._capture_manager.show()
separator = PaletteMenuItemSeparator()
separator.show()
self._speaker_manager = AudioManagerWidget(output_text,
'speaker-100',
output_model)
self._speaker_manager.show()
self._box = PaletteMenuBox()
self._box.append_item(self._capture_manager, 0, 0)
self._box.append_item(separator, 0, 0)
self._box.append_item(self._speaker_manager, 0, 0)
self._box.show()
self.set_content(self._box)
self.connect('popup', self.__popup_cb)
示例9: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, invite):
Palette.__init__(self, "")
self._invite = invite
menu_item = MenuItem(_("Join"), icon_name="dialog-ok")
menu_item.connect("activate", self.__join_activate_cb)
self.menu.append(menu_item)
menu_item.show()
menu_item = MenuItem(_("Decline"), icon_name="dialog-cancel")
menu_item.connect("activate", self.__decline_activate_cb)
self.menu.append(menu_item)
menu_item.show()
bundle_id = invite.get_bundle_id()
registry = bundleregistry.get_registry()
self._bundle = registry.get_bundle(bundle_id)
if self._bundle:
name = self._bundle.get_name()
else:
name = bundle_id
self.set_primary_text(GLib.markup_escape_text(name))
示例10: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self):
Palette.__init__(self, primary_text=_('Wired Network'))
self._speed_label = Gtk.Label()
self._speed_label.props.xalign = 0.0
self._speed_label.show()
self._ip_address_label = Gtk.Label()
self._info = Gtk.VBox()
def _padded(child, xalign=0, yalign=0.5):
padder = Gtk.Alignment.new(xalign=xalign, yalign=yalign,
xscale=1, yscale=0.33)
padder.set_padding(style.DEFAULT_SPACING,
style.DEFAULT_SPACING,
style.DEFAULT_SPACING,
style.DEFAULT_SPACING)
padder.add(child)
return padder
self._info.pack_start(_padded(self._speed_label), True, True, 0)
self._info.pack_start(_padded(self._ip_address_label), True, True, 0)
self._info.show_all()
self.set_content(self._info)
self.props.secondary_text = _('Connected')
示例11: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, invite):
Palette.__init__(self, '')
self._invite = invite
self.menu_box = PaletteMenuBox()
self.set_content(self.menu_box)
self.menu_box.show()
menu_item = PaletteMenuItem(_('Join'), icon_name='dialog-ok')
menu_item.connect('activate', self.__join_activate_cb)
self.menu_box.append_item(menu_item)
menu_item.show()
menu_item = PaletteMenuItem(_('Decline'), icon_name='dialog-cancel')
menu_item.connect('activate', self.__decline_activate_cb)
self.menu_box.append_item(menu_item)
menu_item.show()
bundle_id = invite.get_bundle_id()
registry = bundleregistry.get_registry()
self._bundle = registry.get_bundle(bundle_id)
if self._bundle:
activity_name = self._bundle.get_name()
else:
activity_name = bundle_id
self.set_primary_text(activity_name)
title = self._invite.get_activity_title()
if title is not None:
self.set_secondary_text(title)
示例12: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, **kwargs):
self._color = Gdk.Color(0, 0, 0)
self._previous_color = self._color.copy()
self._scales = None
Palette.__init__(self, **kwargs)
self.connect('popup', self.__popup_cb)
self.connect('popdown', self.__popdown_cb)
self._picker_hbox = Gtk.HBox()
self.set_content(self._picker_hbox)
self._swatch_tray = Gtk.Table()
self._picker_hbox.pack_start(self._swatch_tray, True, True, 0)
self._picker_hbox.pack_start(Gtk.VSeparator(), True, True,
padding=style.DEFAULT_SPACING)
self._chooser_table = Gtk.Table(3, 2)
self._chooser_table.set_col_spacing(0, style.DEFAULT_PADDING)
self._scales = []
self._scales.append(
self._create_color_scale(_('Red'), self._RED, 0))
self._scales.append(
self._create_color_scale(_('Green'), self._GREEN, 1))
self._scales.append(
self._create_color_scale(_('Blue'), self._BLUE, 2))
self._picker_hbox.add(self._chooser_table)
self._picker_hbox.show_all()
self._build_swatches()
示例13: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, buddy):
self._buddy = buddy
nick, colors = buddy
buddy_icon = Icon(icon_name='computer-xo',
pixel_size=style.STANDARD_ICON_SIZE,
xo_color=XoColor(colors))
Palette.__init__(self, primary_text=nick, icon=buddy_icon)
示例14: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self):
label = GLib.markup_escape_text(_('Wireless modem'))
Palette.__init__(self, primary_text=label)
self._current_state = None
self._failed_connection = False
self.info_box = Gtk.VBox()
self._toggle_state_item = PaletteMenuItem('')
self._toggle_state_item.connect('activate', self.__toggle_state_cb)
self.info_box.pack_start(self._toggle_state_item, True, True, 0)
self._toggle_state_item.show()
self.error_title_label = Gtk.Label(label="")
self.error_title_label.set_alignment(0, 0.5)
self.error_title_label.set_line_wrap(True)
self.info_box.pack_start(self.error_title_label, True, True, 0)
self.error_description_label = Gtk.Label(label="")
self.error_description_label.set_alignment(0, 0.5)
self.error_description_label.set_line_wrap(True)
self.info_box.pack_start(self.error_description_label, True, True, 0)
self.connection_info_box = Gtk.HBox()
icon = Icon(icon_name='data-upload',
pixel_size=style.SMALL_ICON_SIZE)
self.connection_info_box.pack_start(icon, True, True, 0)
icon.show()
self._data_label_up = Gtk.Label()
self._data_label_up.props.xalign = 0.0
label_alignment = self._add_widget_with_padding(self._data_label_up)
self.connection_info_box.pack_start(label_alignment, True, True, 0)
self._data_label_up.show()
label_alignment.show()
icon = Icon(icon_name='data-download',
pixel_size=style.SMALL_ICON_SIZE)
self.connection_info_box.pack_start(icon, True, True, 0)
icon.show()
self._data_label_down = Gtk.Label()
self._data_label_down.props.xalign = 0.0
label_alignment = self._add_widget_with_padding(self._data_label_down)
self.connection_info_box.pack_start(label_alignment, True, True, 0)
self._data_label_down.show()
label_alignment.show()
self.info_box.pack_start(self.connection_info_box, True, True, 0)
self.info_box.show()
self.set_content(self.info_box)
self.update_state(_GSM_STATE_NOT_READY)
示例15: __init__
# 需要导入模块: from sugar3.graphics.palette import Palette [as 别名]
# 或者: from sugar3.graphics.palette.Palette import __init__ [as 别名]
def __init__(self, home_activity):
Palette.__init__(self)
self._notify_launch_hid = None
if home_activity.props.launch_status == shell.Activity.LAUNCHING:
self._notify_launch_hid = home_activity.connect("notify::launch-status", self.__notify_launch_status_cb)
self.set_primary_text(GLib.markup_escape_text(_("Starting...")))
elif home_activity.props.launch_status == shell.Activity.LAUNCH_FAILED:
self._on_failed_launch()
else:
self.setup_palette()