Closed F6 closed 5 years ago
wow... really high efficiency :+1: I like your idea.
For further usage, I prefer to send command via CommandBuilder
, rather than raw string :)
But don't worry about that, I will edit and merge it these days.
Thanks for your PR!
@F6 hi,
You can apply your complicate actions like this:
with safe_connection(_DEVICE_ID) as d:
builder = CommandBuilder()
builder.press(0, 400, 400, 50)
builder.commit()
builder.move(0, 500, 500, 50)
builder.commit()
builder.move(0, 800, 400, 50)
builder.commit()
builder.release(0)
builder.commit()
builder.publish(d)
with safe_device(_DEVICE_ID) as d:
builder = CommandBuilder()
builder.press(0, 400, 400, 50)
builder.commit()
builder.move(0, 500, 500, 50)
builder.commit()
builder.move(0, 800, 400, 50)
builder.commit()
builder.release(0)
builder.commit()
builder.publish(d.connection)
But I don't know if it is a good way. Any suggestions?
Of course, use it without with
:
d = MNTDevice(_DEVICE_ID)
builder = CommandBuilder()
builder.press(0, 400, 400, 50)
builder.commit()
builder.move(0, 500, 500, 50)
builder.commit()
builder.move(0, 800, 400, 50)
builder.commit()
builder.release(0)
builder.commit()
builder.publish(d.connection)
# do not forget to stop it
d.stop()
got your idea, thanks. I previously thought that CommandBuilder is only intended for internal use.
I think your idea is great, a small suggestion is that we can use a consistent naming convention with minitouch, e.g. maybe "down" instead of "press", "up" instead of "release"?
https://github.com/williamfzc/pyminitouch/pull/5 based on this PR was created. Closed.
3
I have slightly modified your source code to use it in my project, see commit 15e768a