当前位置: 首页>>代码示例>>Python>>正文


Python X.AnyPropertyType方法代码示例

本文整理汇总了Python中Xlib.X.AnyPropertyType方法的典型用法代码示例。如果您正苦于以下问题:Python X.AnyPropertyType方法的具体用法?Python X.AnyPropertyType怎么用?Python X.AnyPropertyType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Xlib.X的用法示例。


在下文中一共展示了X.AnyPropertyType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: formatWindow

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import AnyPropertyType [as 别名]
def formatWindow(window):
    name = window.get_wm_name()
    info = []
    if name:
        info.append(name)

    geometry = window.get_geometry()
    info.append('%sx%sx%s at (%s,%s)' % (
        geometry.width, geometry.height, geometry.depth,
        geometry.x, geometry.y))

    atom = InternAtom(display=window.display, name="_NET_WM_PID", only_if_exists=1)
    pid = window.get_property(atom.atom, AnyPropertyType, 0, 10)
    if pid:
        pid = int(pid.value.tolist()[0])
        info.append('PID=%r' % pid)

    info.append("ID=0x%08x" % window.id)
    return '; '.join(info) 
开发者ID:tuwid,项目名称:darkc0de-old-stuff,代码行数:21,代码来源:x11.py

示例2: _getProperty

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import AnyPropertyType [as 别名]
def _getProperty(self, _type, win=None):
        if not win:
            win = self.root
        atom = win.get_full_property(self.display.get_atom(_type),
                                     X.AnyPropertyType)
        if atom:
            return atom.value 
开发者ID:parkouss,项目名称:pyewmh,代码行数:9,代码来源:ewmh.py

示例3: _get_current_window_id

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import AnyPropertyType [as 别名]
def _get_current_window_id() -> Optional[int]:
    atom = display.get_atom("_NET_ACTIVE_WINDOW")
    window_prop = screen.root.get_full_property(atom, X.AnyPropertyType)

    if window_prop is None:
        logger.warning("window_prop was None")
        return None

    # window_prop may contain more than one value, but it seems that it's always the first we want.
    # The second has in my attempts always been 0 or rubbish.
    window_id = window_prop.value[0]
    return window_id if window_id != 0 else None 
开发者ID:ActivityWatch,项目名称:aw-watcher-window,代码行数:14,代码来源:xlib.py

示例4: get_window_pid

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import AnyPropertyType [as 别名]
def get_window_pid(window: Window) -> str:
    atom = display.get_atom("_NET_WM_PID")
    pid_property = window.get_full_property(atom, X.AnyPropertyType)
    if pid_property:
        pid = pid_property.value[-1]
        return pid
    else:
        # TODO: Needed?
        raise Exception("pid_property was None") 
开发者ID:ActivityWatch,项目名称:aw-watcher-window,代码行数:11,代码来源:xlib.py

示例5: handle_incr

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import AnyPropertyType [as 别名]
def handle_incr(d, w, data_atom, target_name):
    # This works by us removing the data property, the selection owner
    # getting a notification of that, and then setting the property
    # again with more data.  To notice that, we must listen for
    # PropertyNotify events.
    w.change_attributes(event_mask = X.PropertyChangeMask)

    while True:
        # Delete data property to tell owner to give us more data
        w.delete_property(data_atom)

        # Wait for notification that we got data
        while True:
            e = d.next_event()
            if (e.type == X.PropertyNotify
                and e.state == X.PropertyNewValue
                and e.window == w
                and e.atom == data_atom):
                break

        r = w.get_full_property(data_atom, X.AnyPropertyType,
                                sizehint = 10000)

        # End of data
        if len(r.value) == 0:
            return

        output_data(d, r, target_name)
        # loop around 
开发者ID:python-xlib,项目名称:python-xlib,代码行数:31,代码来源:get_selection.py

示例6: get_full_text_property

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import AnyPropertyType [as 别名]
def get_full_text_property(self, property, property_type=X.AnyPropertyType, sizehint = 10):
        prop = self.get_full_property(property, property_type,
                                      sizehint=sizehint)
        if prop is None or prop.format != 8:
            return None
        if prop.property_type == Xatom.STRING:
            prop.value = prop.value.decode(self._STRING_ENCODING)
        elif prop.property_type == self.display.get_atom('UTF8_STRING'):
            prop.value = prop.value.decode(self._UTF8_STRING_ENCODING)
        # FIXME: at least basic support for compound text would be nice.
        # elif prop.property_type == self.display.get_atom('COMPOUND_TEXT'):
        return prop.value 
开发者ID:python-xlib,项目名称:python-xlib,代码行数:14,代码来源:drawable.py

示例7: _getProperty

# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import AnyPropertyType [as 别名]
def _getProperty(self, _type, win=None):
		if not win: win = self.root
		atom = win.get_full_property(self.display.get_atom(_type), X.AnyPropertyType)
		if atom: return atom.value 
开发者ID:linuxdeepin,项目名称:deepin-remote-assistance,代码行数:6,代码来源:ewmh.py


注:本文中的Xlib.X.AnyPropertyType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。