本文整理汇总了Python中jarabe.view.pulsingicon.PulsingIcon.show方法的典型用法代码示例。如果您正苦于以下问题:Python PulsingIcon.show方法的具体用法?Python PulsingIcon.show怎么用?Python PulsingIcon.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jarabe.view.pulsingicon.PulsingIcon
的用法示例。
在下文中一共展示了PulsingIcon.show方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: NotificationIcon
# 需要导入模块: from jarabe.view.pulsingicon import PulsingIcon [as 别名]
# 或者: from jarabe.view.pulsingicon.PulsingIcon import show [as 别名]
class NotificationIcon(gtk.EventBox):
__gtype_name__ = 'SugarNotificationIcon'
__gproperties__ = {
'xo-color': (object, None, None, gobject.PARAM_READWRITE),
'icon-name': (str, None, None, None, gobject.PARAM_READWRITE),
'icon-filename': (str, None, None, None, gobject.PARAM_READWRITE),
}
_PULSE_TIMEOUT = 3
def __init__(self, **kwargs):
self._icon = PulsingIcon(pixel_size=style.STANDARD_ICON_SIZE)
gobject.GObject.__init__(self, **kwargs)
self.props.visible_window = False
self._icon.props.pulse_color = \
XoColor('%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(),
style.COLOR_TRANSPARENT.get_svg()))
self._icon.props.pulsing = True
self.add(self._icon)
self._icon.show()
gobject.timeout_add_seconds(self._PULSE_TIMEOUT,
self.__stop_pulsing_cb)
self.set_size_request(style.GRID_CELL_SIZE, style.GRID_CELL_SIZE)
def __stop_pulsing_cb(self):
self._icon.props.pulsing = False
return False
def do_set_property(self, pspec, value):
if pspec.name == 'xo-color':
if self._icon.props.base_color != value:
self._icon.props.base_color = value
elif pspec.name == 'icon-name':
if self._icon.props.icon_name != value:
self._icon.props.icon_name = value
elif pspec.name == 'icon-filename':
if self._icon.props.file != value:
self._icon.props.file = value
def do_get_property(self, pspec):
if pspec.name == 'xo-color':
return self._icon.props.base_color
elif pspec.name == 'icon-name':
return self._icon.props.icon_name
elif pspec.name == 'icon-filename':
return self._icon.props.file
def _set_palette(self, palette):
self._icon.palette = palette
def _get_palette(self):
return self._icon.palette
palette = property(_get_palette, _set_palette)
示例2: ActivityButton
# 需要导入模块: from jarabe.view.pulsingicon import PulsingIcon [as 别名]
# 或者: from jarabe.view.pulsingicon.PulsingIcon import show [as 别名]
class ActivityButton(RadioToolButton):
def __init__(self, home_activity, group):
RadioToolButton.__init__(self, group=group)
self.set_palette_invoker(FrameWidgetInvoker(self))
self.palette_invoker.cache_palette = False
self._home_activity = home_activity
self._notify_launch_hid = None
self._icon = PulsingIcon()
self._icon.props.base_color = home_activity.get_icon_color()
self._icon.props.pulse_color = \
XoColor('%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(),
style.COLOR_TOOLBAR_GREY.get_svg()))
if home_activity.get_icon_path():
self._icon.props.file = home_activity.get_icon_path()
else:
self._icon.props.icon_name = 'image-missing'
self.set_icon_widget(self._icon)
self._icon.show()
if home_activity.props.launch_status == shell.Activity.LAUNCHING:
self._icon.props.pulsing = True
self._notify_launch_hid = home_activity.connect(
'notify::launch-status', self.__notify_launch_status_cb)
elif home_activity.props.launch_status == shell.Activity.LAUNCH_FAILED:
self._on_failed_launch()
def create_palette(self):
if self._home_activity.is_journal():
palette = JournalPalette(self._home_activity)
else:
palette = CurrentActivityPalette(self._home_activity)
palette.connect('done', self.__palette_item_selected_cb)
palette.set_group_id('frame')
self.set_palette(palette)
def __palette_item_selected_cb(self, widget):
frame = jarabe.frame.get_view()
frame.hide()
def _on_failed_launch(self):
# TODO http://bugs.sugarlabs.org/ticket/2007
pass
def __notify_launch_status_cb(self, home_activity, pspec):
home_activity.disconnect(self._notify_launch_hid)
self._notify_launch_hid = None
if home_activity.props.launch_status == shell.Activity.LAUNCH_FAILED:
self._on_failed_launch()
else:
self._icon.props.pulsing = False
示例3: OlpcMeshDeviceView
# 需要导入模块: from jarabe.view.pulsingicon import PulsingIcon [as 别名]
# 或者: from jarabe.view.pulsingicon.PulsingIcon import show [as 别名]
class OlpcMeshDeviceView(ToolButton):
_ICON_NAME = 'network-mesh'
FRAME_POSITION_RELATIVE = 302
def __init__(self, device, state):
ToolButton.__init__(self)
self._bus = dbus.SystemBus()
self._device = device
self._device_props = None
self._device_state = None
self._channel = 0
self._icon = PulsingIcon(icon_name=self._ICON_NAME)
self._inactive_color = xocolor.XoColor(
'%s,%s' % (style.COLOR_BUTTON_GREY.get_svg(),
style.COLOR_TRANSPARENT.get_svg()))
self._icon.props.pulse_color = profile.get_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.props.hide_tooltip_on_click = False
self.palette_invoker.props.toggle_palette = True
self._palette = WirelessPalette(_('Mesh Network'))
self._palette.connect('deactivate-connection',
self.__deactivate_connection)
self.set_palette(self._palette)
self._palette.set_group_id('frame')
self.update_state(state)
self._device_props = dbus.Interface(self._device,
dbus.PROPERTIES_IFACE)
self._device_props.Get(
network.NM_OLPC_MESH_IFACE, 'ActiveChannel',
reply_handler=self.__get_active_channel_reply_cb,
error_handler=self.__get_active_channel_error_cb)
self._bus.add_signal_receiver(
self.__wireless_properties_changed_cb,
signal_name='PropertiesChanged',
path=device.object_path,
dbus_interface=network.NM_OLPC_MESH_IFACE)
def disconnect(self):
self._bus.remove_signal_receiver(
self.__wireless_properties_changed_cb,
signal_name='PropertiesChanged',
path=self._device.object_path,
dbus_interface=network.NM_OLPC_MESH_IFACE)
def __get_active_channel_reply_cb(self, channel):
self._channel = channel
self._update_text()
def __get_active_channel_error_cb(self, err):
logging.error('Error getting the active channel: %s', err)
def __state_changed_cb(self, new_state, old_state, reason):
self._device_state = new_state
self._update()
def __wireless_properties_changed_cb(self, properties):
if 'ActiveChannel' in properties:
self._channel = properties['ActiveChannel']
self._update_text()
def _update_text(self):
channel = str(self._channel)
self._palette.props.primary_text = _('Mesh Network %s') % (channel, )
def _update(self):
state = self._device_state
if (state >= network.NM_DEVICE_STATE_PREPARE) and \
(state <= network.NM_DEVICE_STATE_IP_CONFIG):
self._icon.props.base_color = self._inactive_color
self._icon.props.pulse_color = profile.get_color()
self._palette.set_connecting()
self._icon.props.pulsing = True
elif state == network.NM_DEVICE_STATE_ACTIVATED:
def _ip_cb(ip):
self._icon.props.pulsing = False
self._palette.set_connected_with_channel(self._channel, ip)
self._icon.props.base_color = profile.get_color()
self._icon.props.pulsing = False
_get_ip(self._bus, self._device_props, _ip_cb)
self._update_text()
def update_state(self, state):
self._device_state = state
self._update()
def __deactivate_connection(self, palette, data=None):
#.........这里部分代码省略.........
示例4: WirelessDeviceView
# 需要导入模块: from jarabe.view.pulsingicon import PulsingIcon [as 别名]
# 或者: from jarabe.view.pulsingicon.PulsingIcon import show [as 别名]
class WirelessDeviceView(ToolButton):
FRAME_POSITION_RELATIVE = 302
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.props.hide_tooltip_on_click = False
self.palette_invoker.props.toggle_palette = True
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)
def disconnect(self):
self._bus.remove_signal_receiver(
self.__state_changed_cb,
signal_name='StateChanged',
path=self._device.object_path,
dbus_interface=network.NM_DEVICE_IFACE)
def __get_device_props_reply_cb(self, properties):
if 'State' in properties:
self._device_state = properties['State']
self._update_state()
def __get_device_props_error_cb(self, err):
logging.error('Error getting the device properties: %s', err)
def __get_active_ap_reply_cb(self, active_ap_op):
if self._active_ap_op != active_ap_op:
if self._active_ap_op is not None:
self._bus.remove_signal_receiver(
self.__ap_properties_changed_cb,
signal_name='PropertiesChanged',
path=self._active_ap_op,
dbus_interface=network.NM_ACCESSPOINT_IFACE)
if active_ap_op == '/':
self._active_ap_op = None
return
self._active_ap_op = active_ap_op
active_ap = self._bus.get_object(network.NM_SERVICE, active_ap_op)
props = dbus.Interface(active_ap, dbus.PROPERTIES_IFACE)
props.GetAll(network.NM_ACCESSPOINT_IFACE, byte_arrays=True,
reply_handler=self.__get_all_ap_props_reply_cb,
error_handler=self.__get_all_ap_props_error_cb)
self._bus.add_signal_receiver(
self.__ap_properties_changed_cb,
signal_name='PropertiesChanged',
path=self._active_ap_op,
dbus_interface=network.NM_ACCESSPOINT_IFACE,
byte_arrays=True)
#.........这里部分代码省略.........
示例5: LaunchWindow
# 需要导入模块: from jarabe.view.pulsingicon import PulsingIcon [as 别名]
# 或者: from jarabe.view.pulsingicon.PulsingIcon import show [as 别名]
class LaunchWindow(gtk.Window):
def __init__(self, activity_id, icon_path, icon_color):
gobject.GObject.__init__(self)
self.props.type_hint = gtk.gdk.WINDOW_TYPE_HINT_NORMAL
self.props.decorated = False
self.modify_bg(gtk.STATE_NORMAL, style.COLOR_WHITE.get_gdk_color())
canvas = gtk.VBox()
canvas.show()
self.add(canvas)
bar_size = gtk.gdk.screen_height() / 5 * 2
header = gtk.VBox()
header.set_size_request(-1, bar_size)
header.show()
canvas.pack_start(header, expand=False)
self._activity_id = activity_id
self._activity_icon = PulsingIcon(file=icon_path,
pixel_size=style.XLARGE_ICON_SIZE)
self._activity_icon.set_base_color(icon_color)
self._activity_icon.set_zooming(style.SMALL_ICON_SIZE,
style.XLARGE_ICON_SIZE, 10)
self._activity_icon.set_pulsing(True)
self._activity_icon.show()
canvas.pack_start(self._activity_icon)
footer = gtk.VBox(spacing=style.DEFAULT_SPACING)
footer.set_size_request(-1, bar_size)
footer.show()
canvas.pack_end(footer, expand=False)
self.error_text = gtk.Label()
self.error_text.props.use_markup = True
footer.pack_start(self.error_text, expand=False)
button_box = gtk.Alignment(xalign=0.5)
button_box.show()
footer.pack_start(button_box, expand=False)
self.cancel_button = gtk.Button(stock=gtk.STOCK_STOP)
button_box.add(self.cancel_button)
self.connect('realize', self.__realize_cb)
screen = gtk.gdk.screen_get_default()
screen.connect('size-changed', self.__size_changed_cb)
self._home = shell.get_model()
self._home.connect('active-activity-changed',
self.__active_activity_changed_cb)
self.connect('destroy', self.__destroy_cb)
self._update_size()
def show(self):
self.present()
def _update_size(self):
self.resize(gtk.gdk.screen_width(), gtk.gdk.screen_height())
def __realize_cb(self, widget):
wm.set_activity_id(widget.window, str(self._activity_id))
widget.window.property_change('_SUGAR_WINDOW_TYPE', 'STRING', 8,
gtk.gdk.PROP_MODE_REPLACE, 'launcher')
def __size_changed_cb(self, screen):
self._update_size()
def __active_activity_changed_cb(self, model, activity):
if activity.get_activity_id() == self._activity_id:
self._activity_icon.props.paused = False
else:
self._activity_icon.props.paused = True
def __destroy_cb(self, box):
self._activity_icon.props.pulsing = False
self._home.disconnect_by_func(self.__active_activity_changed_cb)
示例6: LaunchWindow
# 需要导入模块: from jarabe.view.pulsingicon import PulsingIcon [as 别名]
# 或者: from jarabe.view.pulsingicon.PulsingIcon import show [as 别名]
class LaunchWindow(Gtk.Window):
def __init__(self, activity_id, icon_path, icon_color):
Gtk.Window.__init__(self)
self.set_has_resize_grip(False)
self.props.type_hint = Gdk.WindowTypeHint.SPLASHSCREEN
self.modify_bg(Gtk.StateType.NORMAL, style.COLOR_WHITE.get_gdk_color())
canvas = Gtk.VBox()
canvas.show()
self.add(canvas)
bar_size = Gdk.Screen.height() / 5 * 2
header = Gtk.VBox()
header.set_size_request(-1, bar_size)
header.show()
canvas.pack_start(header, False, True, 0)
self._activity_id = activity_id
self._activity_icon = PulsingIcon(file=icon_path,
pixel_size=style.XLARGE_ICON_SIZE)
self._activity_icon.set_base_color(icon_color)
self._activity_icon.set_zooming(style.SMALL_ICON_SIZE,
style.XLARGE_ICON_SIZE, 10)
self._activity_icon.set_pulsing(True)
self._activity_icon.show()
canvas.pack_start(self._activity_icon, True, True, 0)
footer = Gtk.VBox(spacing=style.DEFAULT_SPACING)
footer.set_size_request(-1, bar_size)
footer.show()
canvas.pack_end(footer, False, True, 0)
self.error_text = Gtk.Label()
self.error_text.props.use_markup = True
footer.pack_start(self.error_text, False, True, 0)
button_box = Gtk.Alignment.new(0.5, 0, 0, 0)
button_box.show()
footer.pack_start(button_box, False, True, 0)
self.cancel_button = Gtk.Button(stock=Gtk.STOCK_STOP)
button_box.add(self.cancel_button)
self.connect('realize', self.__realize_cb)
screen = Gdk.Screen.get_default()
screen.connect('size-changed', self.__size_changed_cb)
self._home = shell.get_model()
self._home.connect('active-activity-changed',
self.__active_activity_changed_cb)
self.connect('destroy', self.__destroy_cb)
self._update_size()
def show(self):
self.present()
def _update_size(self):
self.resize(Gdk.Screen.width(), Gdk.Screen.height())
def __realize_cb(self, widget):
SugarExt.wm_set_activity_id(widget.get_window().get_xid(),
str(self._activity_id))
def __size_changed_cb(self, screen):
self._update_size()
def __active_activity_changed_cb(self, model, activity):
if activity.get_activity_id() == self._activity_id:
self._activity_icon.props.paused = False
else:
self._activity_icon.props.paused = True
def __destroy_cb(self, box):
self._activity_icon.props.pulsing = False
self._home.disconnect_by_func(self.__active_activity_changed_cb)