本文整理汇总了Python中sugar.graphics.toolbutton.ToolButton.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ToolButton.__init__方法的具体用法?Python ToolButton.__init__怎么用?Python ToolButton.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sugar.graphics.toolbutton.ToolButton
的用法示例。
在下文中一共展示了ToolButton.__init__方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self, **kwargs):
ToolButton.__init__(self, **kwargs)
self.selected_button = None
if self.props.palette:
self.__palette_cb(None, None)
self.connect("notify::palette", self.__palette_cb)
示例2: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self, activity, **kwargs):
ToolButton.__init__(self, **kwargs)
icon = _create_activity_icon(activity.metadata)
self.set_icon_widget(icon)
icon.show()
self.props.tooltip = activity.metadata['title']
activity.metadata.connect('updated', self.__jobject_updated_cb)
示例3: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self, activity, abi):
ToolButton.__init__(self, "document-save")
self.props.tooltip = _("Export")
self.props.label = _("Export")
for i in self._EXPORT_FORMATS:
menu_item = MenuItem(i["title"])
menu_item.connect("activate", self.__activate_cb, activity, abi, i)
self.props.palette.menu.append(menu_item)
menu_item.show()
示例4: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self, page=None, **kwargs):
ToolButton.__init__(self, **kwargs)
self.page_widget = None
self.set_page(page)
self.connect('clicked',
lambda widget: self.set_expanded(not self.is_expanded()))
self.connect('hierarchy-changed', self.__hierarchy_changed_cb)
示例5: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self, file_transfer):
ToolButton.__init__(self)
self.file_transfer = file_transfer
file_transfer.connect('notify::state', self.__notify_state_cb)
icon = Icon()
self.props.icon_widget = icon
icon.show()
self.notif_icon = NotificationIcon()
self.notif_icon.connect('button-release-event',
self.__button_release_event_cb)
self.connect('clicked', self.__button_clicked_cb)
示例6: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self, device):
ToolButton.__init__(self)
self._bus = dbus.SystemBus()
self._device = device
self._device_props = None
self._flags = 0
self._ssid = ''
self._display_name = ''
self._mode = network.NM_802_11_MODE_UNKNOWN
self._strength = 0
self._frequency = 0
self._device_state = None
self._color = None
self._active_ap_op = None
self._icon = PulsingIcon()
self._icon.props.icon_name = get_icon_state('network-wireless', 0)
self._inactive_color = xocolor.XoColor(
'%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(),
style.COLOR_TRANSPARENT.get_svg()))
self._icon.props.pulse_color = self._inactive_color
self._icon.props.base_color = self._inactive_color
self.set_icon_widget(self._icon)
self._icon.show()
self.set_palette_invoker(FrameWidgetInvoker(self))
self._palette = WirelessPalette(self._display_name)
self._palette.connect('deactivate-connection',
self.__deactivate_connection_cb)
self.set_palette(self._palette)
self._palette.set_group_id('frame')
self._device_props = dbus.Interface(self._device,
dbus.PROPERTIES_IFACE)
self._device_props.GetAll(network.NM_DEVICE_IFACE, byte_arrays=True,
reply_handler=self.__get_device_props_reply_cb,
error_handler=self.__get_device_props_error_cb)
self._device_props.Get(network.NM_WIRELESS_IFACE, 'ActiveAccessPoint',
reply_handler=self.__get_active_ap_reply_cb,
error_handler=self.__get_active_ap_error_cb)
self._bus.add_signal_receiver(self.__state_changed_cb,
signal_name='StateChanged',
path=self._device.object_path,
dbus_interface=network.NM_DEVICE_IFACE)
示例7: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self,jobject=None):
LicenseWidget.__init__(self,"#ffffff,#ffffff")
self._jobject = jobject
if jobject:
self._color_selected = XoColor(self._jobject.metadata['icon-color'])
else:
self._color_selected = profile.get_color()
default, license = self.load_license()
icon_name = self.uri_to_icon(license)
ToolButton.__init__(self)
icon = Icon(icon_name,icon_size=self._icon_size,xo_color=XoColor("#ffffff,#ffffff"))
icon.show()
self.set_icon_widget(icon)
self.props.sensitive = True
self.set_tooltip(self._format_tooltip(license))
self.make_menu(self.get_palette(),XoColor("#ffffff,#ffffff"),self._color_selected,icon_name)
示例8: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self, icon_name, scroll_direction):
ToolButton.__init__(self)
self._viewport = None
self._scroll_direction = scroll_direction
self.set_size_request(style.GRID_CELL_SIZE, style.GRID_CELL_SIZE)
self.icon = Icon(icon_name=icon_name, icon_size=gtk.ICON_SIZE_SMALL_TOOLBAR)
# The alignment is a hack to work around gtk.ToolButton code
# that sets the icon_size when the icon_widget is a gtk.Image
alignment = gtk.Alignment(0.5, 0.5)
alignment.add(self.icon)
self.set_icon_widget(alignment)
alignment.show_all()
self.connect("clicked", self._clicked_cb)
示例9: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self):
ToolButton.__init__(self)
self._property = 'timestamp'
self._order = gtk.SORT_ASCENDING
self.props.tooltip = _('Sort view')
self.props.icon_name = 'view-lastedit'
for property_, icon, label in self._SORT_OPTIONS:
button = MenuItem(icon_name=icon, text_label=label)
button.connect('activate',
self.__sort_type_changed_cb,
property_,
icon)
button.show()
self.props.palette.menu.insert(button, -1)
示例10: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self, toolbar, name, uri):
self._name = name
self._uri = uri
self._toolbar = toolbar
self._browser = toolbar._activity._browser
# set up the button
ToolButton.__init__(self, 'bookmarklet')
self.connect('clicked', self.__clicked_cb)
toolbar.insert(self, -1)
# and its palette
palette = Palette(name, text_maxlen=50)
self.set_palette(palette)
menu_item = gtk.MenuItem(_('Remove'))
menu_item.connect('activate', self.__remove_cb)
palette.menu.append(menu_item)
menu_item.show()
self.show()
示例11: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self, **kwargs):
ToolButton.__init__(self, "back", **kwargs)
self.props.tooltip = _("Back")
self.props.accelerator = "<Alt>Left"
示例12: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self, activity, **kwargs):
ToolButton.__init__(self, "dialog-apply", **kwargs)
self.props.tooltip = _("Score Card")
self.props.accelerator = "<Ctrl>Q"
self.connect("clicked", self.__show_score_win, activity)
示例13: __init__
# 需要导入模块: from sugar.graphics.toolbutton import ToolButton [as 别名]
# 或者: from sugar.graphics.toolbutton.ToolButton import __init__ [as 别名]
def __init__(self):
ToolButton.__init__(self)