本文整理汇总了Python中Xlib.X.CurrentTime方法的典型用法代码示例。如果您正苦于以下问题:Python X.CurrentTime方法的具体用法?Python X.CurrentTime怎么用?Python X.CurrentTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xlib.X
的用法示例。
在下文中一共展示了X.CurrentTime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: listen
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def listen(self):
self.grab()
while True:
evt = self.disp.next_event()
if evt.type in [X.KeyPress, X.KeyRelease]:
keycode = evt.detail
keysym = self.disp.keycode_to_keysym(keycode, 0)
char = XK.keysym_to_string(keysym)
self.disp.allow_events(X.ReplayKeyboard, X.CurrentTime)
self.mode(self, evt, char)
if evt.type == X.DestroyNotify:
if evt.window.id == self.id:
self.ungrab()
return
示例2: set_screen_config
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def set_screen_config(self, size_id, rotation, config_timestamp, rate=0, timestamp=X.CurrentTime):
"""Sets the screen to the specified size, rate, rotation and reflection.
rate can be 0 to have the server select an appropriate rate.
"""
return SetScreenConfig(
display=self.display,
opcode=self.display.get_extension_major(extname),
drawable=self,
timestamp=timestamp,
config_timestamp=config_timestamp,
size_id=size_id,
rotation=rotation,
rate=rate,
)
示例3: set_panning
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def set_panning(self, crtc, left, top, width, height, track_left, track_top, track_width, track_height, border_left, border_top, border_width, border_height, timestamp=X.CurrentTime):
return SetPanning (
display=self.display,
opcode=self.display.get_extension_major(extname),
crtc=crtc,
left=left,
top=top,
width=width,
height=height,
track_left=track_left,
track_top=track_top,
track_width=track_width,
track_height=track_height,
border_left=border_left,
border_top=border_top,
border_width=border_width,
border_height=border_height,
timestamp=timestamp,
)
示例4: __sendKeyPressEvent
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def __sendKeyPressEvent(self, keyCode, modifiers, theWindow=None):
if theWindow is None:
focus = self.localDisplay.get_input_focus().focus
else:
focus = theWindow
keyEvent = event.KeyPress(
detail=keyCode,
time=X.CurrentTime,
root=self.rootWindow,
window=focus,
child=X.NONE,
root_x=1,
root_y=1,
event_x=1,
event_y=1,
state=modifiers,
same_screen=1
)
focus.send_event(keyEvent)
示例5: __sendKeyReleaseEvent
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def __sendKeyReleaseEvent(self, keyCode, modifiers, theWindow=None):
if theWindow is None:
focus = self.localDisplay.get_input_focus().focus
else:
focus = theWindow
keyEvent = event.KeyRelease(
detail=keyCode,
time=X.CurrentTime,
root=self.rootWindow,
window=focus,
child=X.NONE,
root_x=1,
root_y=1,
event_x=1,
event_y=1,
state=modifiers,
same_screen=1
)
focus.send_event(keyEvent)
示例6: sendKey
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def sendKey(window, keycode, modifiers=0, released=True):
if released:
type = KeyRelease
event_class = KeyReleaseEvent
else:
type = KeyPress
event_class = KeyPressEvent
event = event_class(
type=type,
detail=keycode,
time=CurrentTime,
root=NONE,
window=window,
child=NONE,
root_x=0,
root_y=0,
event_x=0,
event_y=0,
state=modifiers,
same_screen=1)
window.send_event(event)
window.display.flush()
示例7: event
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def event(self, name, detail, state):
return name(
time=X.CurrentTime,
root=self.root,
window=self.inkscape,
same_screen=0, child=Xlib.X.NONE,
root_x=0, root_y=0, event_x=0, event_y=0,
state=state,
detail=detail
)
示例8: setCurrentDesktop
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def setCurrentDesktop(self, i):
"""
Set the current desktop (property _NET_CURRENT_DESKTOP).
:param i: the desired desktop number"""
self._setProperty('_NET_CURRENT_DESKTOP', [i, X.CurrentTime])
示例9: setActiveWindow
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def setActiveWindow(self, win):
"""
Set the given window active (property _NET_ACTIVE_WINDOW)
:param win: the window object"""
self._setProperty('_NET_ACTIVE_WINDOW', [1, X.CurrentTime, win.id],
win)
示例10: _getMouseEvent
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def _getMouseEvent():
screen = _display.screen()
window = screen.root
window.grab_pointer(1, X.PointerMotionMask|X.ButtonReleaseMask|X.ButtonPressMask, X.GrabModeAsync, X.GrabModeAsync, X.NONE, X.NONE, X.CurrentTime)
e = _display.next_event()
_display.ungrab_pointer(X.CurrentTime)
if e.type == X.ButtonPress:
e = MOUSE_EVENT[e.detail] + '_down'
elif e.type == X.ButtonRelease:
e = MOUSE_EVENT[e.detail] + '_up'
else:
e = 'moving'
return e
示例11: _1_0set_screen_config
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def _1_0set_screen_config(self, size_id, rotation, config_timestamp, timestamp=X.CurrentTime):
"""Sets the screen to the specified size and rotation.
"""
return _1_0SetScreenConfig(
display=self.display,
opcode=self.display.get_extension_major(extname),
drawable=self,
timestamp=timestamp,
config_timestamp=config_timestamp,
size_id=size_id,
rotation=rotation,
)
示例12: set_crtc_config
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def set_crtc_config(self, crtc, config_timestamp, x, y, mode, rotation, outputs, timestamp=X.CurrentTime):
return SetCrtcConfig (
display=self.display,
opcode=self.display.get_extension_major(extname),
crtc=crtc,
config_timestamp=config_timestamp,
x=x,
y=y,
mode=mode,
rotation=rotation,
outputs=outputs,
timestamp=timestamp,
)
示例13: fake_input
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def fake_input(self, event_type, detail = 0, time = X.CurrentTime,
root = X.NONE, x = 0, y = 0):
FakeInput(display = self.display,
opcode = self.display.get_extension_major(extname),
event_type = event_type,
detail = detail,
time = time,
root = root,
x = x,
y = y)
示例14: __grab_keyboard
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def __grab_keyboard(self):
focus = self.localDisplay.get_input_focus().focus
focus.grab_keyboard(True, X.GrabModeAsync, X.GrabModeAsync, X.CurrentTime)
self.localDisplay.flush()
示例15: __ungrabKeyboard
# 需要导入模块: from Xlib import X [as 别名]
# 或者: from Xlib.X import CurrentTime [as 别名]
def __ungrabKeyboard(self):
self.localDisplay.ungrab_keyboard(X.CurrentTime)
self.localDisplay.flush()