# -*- coding: utf-8 -*- from pylibpointing import PointingDevice, DisplayDevice, TransferFunction import sys try: pdev=PointingDevice.create(sys.argv[1]) except: pdev=PointingDevice.create("any:?debugLevel=1") ddev=DisplayDevice.create("any:") tfct=TransferFunction.create("system:", pdev, ddev) print("========= Testing DisplayDevice =========") print("getURI: "+str(ddev.getURI())) print("getURI (w/ property): "+str(ddev.uri)) print("getBounds (in pixels): "+str(ddev.getBounds())) print("getBounds (w/ property):"+str(ddev.bounds)) print("getSize (in mm): "+str(ddev.getSize())) print("getSize (w/ property): "+str(ddev.size)) print("getResolution (in ppi): "+str(ddev.getResolution())) print("getResolution (w/ property): "+str(ddev.resolution)) print("getRefreshRate (in Hz): "+str(ddev.getRefreshRate())) print("getRefreshRate (w/ property): "+str(ddev.refreshrate)) print("========= Testing PointingDevice =========") class ObjectCB(object): def __init__(self, name): self.name_=name self.done_=False
# -*- coding: utf-8 -*- from pylibpointing import PointingDevice, DisplayDevice, TransferFunction import sys try: pdev = PointingDevice.create(sys.argv[1]) except: pdev = PointingDevice.create("any:?debugLevel=1") ddev = DisplayDevice.create("any:") tfct = TransferFunction.create("system:", pdev, ddev) print("========= Testing DisplayDevice =========") print("getURI: " + str(ddev.getURI())) print("getURI (w/ property): " + str(ddev.uri)) print("getBounds (in pixels): " + str(ddev.getBounds())) print("getBounds (w/ property):" + str(ddev.bounds)) print("getSize (in mm): " + str(ddev.getSize())) print("getSize (w/ property): " + str(ddev.size)) print("getResolution (in ppi): " + str(ddev.getResolution())) print("getResolution (w/ property): " + str(ddev.resolution)) print("getRefreshRate (in Hz): " + str(ddev.getRefreshRate())) print("getRefreshRate (w/ property): " + str(ddev.refreshrate)) print("========= Testing PointingDevice =========") class ObjectCB(object): def __init__(self, name):
pm = PointingDeviceManager() PointingDevice.idle(100) pm.addDeviceUpdateCallback(cb_man) for desc in pm: print(desc) """ for desc in pm: print desc.devURI print desc.vendor, desc.product pdev = PointingDevice(desc.uri) """ pdev = PointingDevice.create("any:") ddev = DisplayDevice.create("any:") tfct = TransferFunction.create("system:", pdev, ddev) def cb_fct(timestamp, dx, dy, button): rx, ry = tfct.applyd(dx, dy, timestamp) print("%s: %d %d %d -> %.2f %.2f" % (str(timestamp), dx, dy, button, rx, ry)) sys.stdout.flush() pdev.setCallback(cb_fct) print("Move the mouse of Press CTRL+C to exit") for i in range(0, 10000): PointingDevice.idle(1)