File: debugging.md

package info (click to toggle)
inkcut 2.1.7%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,580 kB
  • sloc: python: 4,959; makefile: 21; sh: 10
file content (28 lines) | stat: -rw-r--r-- 1,020 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Inkcut now embeds an IPython console which greatly helps debugging. You can
access the entire runtime state of the application via python's inspection
tools and the enaml [workbench](https://enaml.readthedocs.io/en/latest/dev_guides/workbenches.html)'s
plugin api.


It's often helpful to be able to manually send commands the the device.

To do this from the console use:


```python
from inkcut.core.workbench import InkcutWorkbench
# Get device handle
device = InkcutWorkbench.instance().get_plugin('inkcut.device').device
device.connect() # Or click the connect button in the Control tab
device.connection.write("D100,100")

# Some time later...
device.disconnect()

```

You can use this to run scripts if needed. See the [IPython docs](https://ipython.readthedocs.io/en/stable/index.html)
for more on IPython.

> Note: Since Inkcut does not use threads writing is all asyncronously. To wait
for a write to complete, use the returned [deferred](https://twisted.readthedocs.io/en/latest/core/howto/defer-intro.html)