本文整理汇总了Python中Xlib.ext.record.FromServer方法的典型用法代码示例。如果您正苦于以下问题:Python record.FromServer方法的具体用法?Python record.FromServer怎么用?Python record.FromServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Xlib.ext.record
的用法示例。
在下文中一共展示了record.FromServer方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __processEvent
# 需要导入模块: from Xlib.ext import record [as 别名]
# 或者: from Xlib.ext.record import FromServer [as 别名]
def __processEvent(self, reply):
if reply.category != record.FromServer:
return
if reply.client_swapped:
return
if not len(reply.data) or str_or_bytes_to_bytes(reply.data)[0] < 2:
# not an event
return
data = reply.data
while len(data):
event, data = rq.EventField(None).parse_binary_value(data, self.recordDisplay.display, None, None)
if event.type == X.KeyPress:
self.handle_keypress(event.detail)
elif event.type == X.KeyRelease:
self.handle_keyrelease(event.detail)
elif event.type == X.ButtonPress:
self.handle_mouseclick(event.detail, event.root_x, event.root_y)
示例2: processevents
# 需要导入模块: from Xlib.ext import record [as 别名]
# 或者: from Xlib.ext.record import FromServer [as 别名]
def processevents(self, reply):
if reply.category != record.FromServer:
return
if reply.client_swapped:
print ("* received swapped protocol data, cowardly ignored")
return
if not len(reply.data) or reply.data[0] < 2:
# not an event
return
data = reply.data
while len(data):
event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None)
if event.type == X.KeyPress:
hookevent = self.keypressevent(event)
self.KeyDown(hookevent)
elif event.type == X.KeyRelease:
hookevent = self.keyreleaseevent(event)
self.KeyUp(hookevent)
elif event.type == X.ButtonPress:
hookevent = self.buttonpressevent(event)
self.MouseAllButtonsDown(hookevent)
elif event.type == X.ButtonRelease:
hookevent = self.buttonreleaseevent(event)
self.MouseAllButtonsUp(hookevent)
elif event.type == X.MotionNotify:
# use mouse moves to record mouse position, since press and release events
# do not give mouse position info (event.root_x and event.root_y have
# bogus info).
self.mousemoveevent(event)
#print "processing events...", event.type
示例3: processevents
# 需要导入模块: from Xlib.ext import record [as 别名]
# 或者: from Xlib.ext.record import FromServer [as 别名]
def processevents(self, reply):
if reply.category != record.FromServer:
return
if reply.client_swapped:
print "* received swapped protocol data, cowardly ignored"
return
if not len(reply.data) or ord(reply.data[0]) < 2:
# not an event
return
data = reply.data
while len(data):
event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None)
if event.type == X.KeyPress:
hookevent = self.keypressevent(event)
self.KeyDown(hookevent)
elif event.type == X.KeyRelease:
hookevent = self.keyreleaseevent(event)
self.KeyUp(hookevent)
elif event.type == X.ButtonPress:
hookevent = self.buttonpressevent(event)
self.MouseAllButtonsDown(hookevent)
elif event.type == X.ButtonRelease:
hookevent = self.buttonreleaseevent(event)
self.MouseAllButtonsUp(hookevent)
elif event.type == X.MotionNotify:
# use mouse moves to record mouse position, since press and release events
# do not give mouse position info (event.root_x and event.root_y have
# bogus info).
self.mousemoveevent(event)
# print "processing events...", event.type
示例4: processevents
# 需要导入模块: from Xlib.ext import record [as 别名]
# 或者: from Xlib.ext.record import FromServer [as 别名]
def processevents(self, reply):
if reply.category != record.FromServer:
return
if reply.client_swapped:
print "* received swapped protocol data, cowardly ignored"
return
if not len(reply.data) or ord(reply.data[0]) < 2:
# not an event
return
data = reply.data
while len(data):
event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None)
if event.type == X.KeyPress:
hookevent = self.keypressevent(event)
self.KeyDown(hookevent)
elif event.type == X.KeyRelease:
hookevent = self.keyreleaseevent(event)
self.KeyUp(hookevent)
elif event.type == X.ButtonPress:
hookevent = self.buttonpressevent(event)
self.MouseAllButtonsDown(hookevent)
elif event.type == X.ButtonRelease:
hookevent = self.buttonreleaseevent(event)
self.MouseAllButtonsUp(hookevent)
elif event.type == X.MotionNotify:
# use mouse moves to record mouse position, since press and release events
# do not give mouse position info (event.root_x and event.root_y have
# bogus info).
self.mousemoveevent(event)
#print "processing events...", event.type
示例5: processevents
# 需要导入模块: from Xlib.ext import record [as 别名]
# 或者: from Xlib.ext.record import FromServer [as 别名]
def processevents(self, reply):
if reply.category != record.FromServer:
return
if reply.client_swapped:
print("* received swapped protocol data, cowardly ignored")
return
if not len(reply.data) or ord(reply.data[0]) < 2:
# not an event
return
data = reply.data
while len(data):
event, data = rq.EventField(None).parse_binary_value(data, self.record_dpy.display, None, None)
if event.type == X.KeyPress:
hookevent = self.keypressevent(event)
self.KeyDown(hookevent)
elif event.type == X.KeyRelease:
hookevent = self.keyreleaseevent(event)
self.KeyUp(hookevent)
elif event.type == X.ButtonPress:
hookevent = self.buttonpressevent(event)
self.MouseAllButtonsDown(hookevent)
elif event.type == X.ButtonRelease:
hookevent = self.buttonreleaseevent(event)
self.MouseAllButtonsUp(hookevent)
elif event.type == X.MotionNotify:
# use mouse moves to record mouse position, since press and release events
# do not give mouse position info (event.root_x and event.root_y have
# bogus info).
hookevent = self.mousemoveevent(event)
self.MouseMovement(hookevent)
#print "processing events...", event.type
示例6: record_callback
# 需要导入模块: from Xlib.ext import record [as 别名]
# 或者: from Xlib.ext.record import FromServer [as 别名]
def record_callback(reply):
if reply.category != record.FromServer:
return
if reply.client_swapped:
print("* received swapped protocol data, cowardly ignored")
return
if not len(reply.data) or reply.data[0] < 2:
# not an event
return
data = reply.data
while len(data):
event, data = rq.EventField(None).parse_binary_value(data, record_dpy.display, None, None)
if event.type in [X.KeyPress, X.KeyRelease]:
pr = event.type == X.KeyPress and "Press" or "Release"
keysym = local_dpy.keycode_to_keysym(event.detail, 0)
if not keysym:
print("KeyCode%s" % pr, event.detail)
else:
print("KeyStr%s" % pr, lookup_keysym(keysym))
if event.type == X.KeyPress and keysym == XK.XK_Escape:
local_dpy.record_disable_context(ctx)
local_dpy.flush()
return
elif event.type == X.ButtonPress:
print("ButtonPress", event.detail)
elif event.type == X.ButtonRelease:
print("ButtonRelease", event.detail)
elif event.type == X.MotionNotify:
print("MotionNotify", event.root_x, event.root_y)
# Check if the extension is present
示例7: processevents
# 需要导入模块: from Xlib.ext import record [as 别名]
# 或者: from Xlib.ext.record import FromServer [as 别名]
def processevents(self, reply):
if reply.category != record.FromServer:
return
if reply.client_swapped:
print_err('* received swapped protocol data, cowardly ignored')
return
try:
# Python 2
intval = ord(reply.data[0])
except TypeError:
# Python 3.
intval = reply.data[0]
if (not reply.data) or (intval < 2):
# not an event
return
data = reply.data
while len(data):
event, data = rq.EventField(None).parse_binary_value(
data,
self.record_dpy.display,
None,
None
)
if event.type == X.KeyPress:
hookevent = self.keypressevent(event)
self.KeyDown(hookevent)
elif event.type == X.KeyRelease:
hookevent = self.keyreleaseevent(event)
self.KeyUp(hookevent)
elif event.type == X.ButtonPress:
hookevent = self.buttonpressevent(event)
self.MouseAllButtonsDown(hookevent)
elif event.type == X.ButtonRelease:
hookevent = self.buttonreleaseevent(event)
self.MouseAllButtonsUp(hookevent)
elif event.type == X.MotionNotify:
# use mouse moves to record mouse position, since press and
# release events
# do not give mouse position info
# (event.root_x and event.root_y have bogus info).
self.mousemoveevent(event)
# print('processing events...', event.type)
示例8: processevents
# 需要导入模块: from Xlib.ext import record [as 别名]
# 或者: from Xlib.ext.record import FromServer [as 别名]
def processevents(self, reply):
if reply.category != record.FromServer:
return
if reply.client_swapped:
print("* received swapped protocol data, cowardly ignored")
return
try:
# Get int value, python2.
intval = ord(reply.data[0])
except TypeError:
# Already bytes/ints, python3.
intval = reply.data[0]
if (not reply.data) or (intval < 2):
# not an event
return
data = reply.data
while len(data):
event, data = rq.EventField(None).parse_binary_value(
data,
self.record_dpy.display,
None,
None
)
if event.type == X.KeyPress:
hookevent = self.keypressevent(event)
self.KeyDown(hookevent)
elif event.type == X.KeyRelease:
hookevent = self.keyreleaseevent(event)
self.KeyUp(hookevent)
elif event.type == X.ButtonPress:
hookevent = self.buttonpressevent(event)
self.MouseAllButtonsDown(hookevent)
elif event.type == X.ButtonRelease:
hookevent = self.buttonreleaseevent(event)
self.MouseAllButtonsUp(hookevent)
elif event.type == X.MotionNotify:
# use mouse moves to record mouse position, since press and
# release events do not give mouse position info
# (event.root_x and event.root_y have bogus info).
hookevent = self.mousemoveevent(event)
self.MouseMovement(hookevent)
# print("processing events...", event.type)