本文整理汇总了Python中gi.repository.SugarExt.wm_get_bundle_id方法的典型用法代码示例。如果您正苦于以下问题:Python SugarExt.wm_get_bundle_id方法的具体用法?Python SugarExt.wm_get_bundle_id怎么用?Python SugarExt.wm_get_bundle_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.SugarExt
的用法示例。
在下文中一共展示了SugarExt.wm_get_bundle_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _window_opened_cb
# 需要导入模块: from gi.repository import SugarExt [as 别名]
# 或者: from gi.repository.SugarExt import wm_get_bundle_id [as 别名]
def _window_opened_cb(self, screen, window):
"""Handle the callback for the 'window opened' event.
Most activities will register 2 windows during
their lifetime: the launcher window, and the 'main'
app window.
When the main window appears, we send a signal to
the launcher window to close.
Some activities (notably non-native apps) open several
windows during their lifetime, switching from one to
the next as the 'main' window. We use a stack to track
them.
"""
if window.get_window_type() == Wnck.WindowType.NORMAL or \
window.get_window_type() == Wnck.WindowType.SPLASHSCREEN:
home_activity = None
xid = window.get_xid()
activity_id = SugarExt.wm_get_activity_id(xid)
service_name = SugarExt.wm_get_bundle_id(xid)
if service_name:
registry = get_registry()
activity_info = registry.get_bundle(service_name)
else:
activity_info = None
if activity_id:
home_activity = self.get_activity_by_id(activity_id)
display = Gdk.Display.get_default()
gdk_window = GdkX11.X11Window.foreign_new_for_display(display,
xid)
gdk_window.set_decorations(0)
window.maximize()
if not home_activity:
logging.debug('first window registered for %s', activity_id)
color = self._shared_activities.get(activity_id, None)
home_activity = Activity(activity_info, activity_id,
color, window)
self._add_activity(home_activity)
else:
logging.debug('window registered for %s', activity_id)
home_activity.add_window(window)
if window.get_window_type() != Wnck.WindowType.SPLASHSCREEN \
and \
home_activity.get_launch_status() == Activity.LAUNCHING:
self.emit('launch-completed', home_activity)
startup_time = time.time() - home_activity.get_launch_time()
logging.debug('%s launched in %f seconds.',
activity_id, startup_time)
if self._active_activity is None:
self._set_active_activity(home_activity)
示例2: get_type
# 需要导入模块: from gi.repository import SugarExt [as 别名]
# 或者: from gi.repository.SugarExt import wm_get_bundle_id [as 别名]
def get_type(self):
"""Retrieve the activity bundle id for future reference"""
if not self._windows:
return None
else:
return SugarExt.wm_get_bundle_id(self._windows[0].get_xid())