Commit Graph

118 Commits (master)

Author SHA1 Message Date
Peter Hutterer 1362b89394 tools: add a basic SVG/PNG exporter tool
A commandline tool to convert the JSON files the GUI stores in
$XDG/tuhi/*.json. Makes testing SVG changes a bit easier.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2022-01-31 12:30:14 +10:00
Peter Hutterer b54ac6e99e Fix flake8 errors - module import not at top of the file
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-22 17:09:27 +10:00
Peter Hutterer 27164aba52 Fix flake8 errors - f-string without placeholders
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2021-01-22 17:09:27 +10:00
Robert Schütz 72d9dee37a live: keep $PATH and $DISPLAY 2020-04-06 15:38:17 +02:00
Ishak BELAHMAR ddd896b1f6 tools: Add choices to fetch.format argument 2019-09-30 09:50:03 +02:00
Ishak BELAHMAR bbff179a4d Add png export feature 2019-09-30 09:50:03 +02:00
Peter Hutterer a6a33ce6b4 live: add flatpak compatibility mode argument
Duplicated from tuhi.in because it's easier this way.

Fixes #217

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-12 11:18:56 +10:00
Peter Hutterer 2cc9fc778f live: pass our arguments through to the tuhi server
Any args that we don't handle in live mode directly (none right now) should be
passed through to the tuhi server.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-12 11:18:56 +10:00
Peter Hutterer fde36b1271 tools: tuhi-live's tuhi server needs to ignore SIGINT
Handling SIGINT in the freshly-started server leads to a race condition:
on Ctrl+C, Tuhi is killed before tuhi-live can call StopLive, leaving the
device in live mode. On the next start of tuhi-live nothing works because the
device will complain about invalid state.

Simplest solution here is to ignore SIGINT in the Tuhi instance and instead
rely on python's multiprocessing module to take us down when the main process
exits.

Fixes #206

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-03 16:22:18 +10:00
Peter Hutterer 9eedbe108a tools: remove write-only variable from tuhi-live
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-03 16:22:18 +10:00
Peter Hutterer b40dee5900 tools: stop live before starting it
If for some reason the device is still in live mode from an earlier
invocation, stop live mode first before we attempt to start a new one.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-03 16:22:18 +10:00
Peter Hutterer 2d95848cee tools: make tuhi-live --verbose actually work
The argparser in tuhi.base.main() drops argv[0], so we have to add a fake
argument here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-09-03 16:22:18 +10:00
Peter Hutterer 90ac2c7150 tools: call directly into Tuhi's main from tuhi-live
This sets up the config dir, loggers, etc. for us. Fixes regressions
introduced a while ago when Tuhi.run() was removed and then more obvious
breakage now that we require the Config path to be set up.

Fixes #206

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-29 10:42:10 +10:00
Peter Hutterer 658fe44d76 tools: remove noop statement from tuhi-live
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-28 15:17:38 +02:00
Peter Hutterer 08afa02690 tools: use the dbus client bindings from tuhi-live too
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-28 15:17:38 +02:00
Peter Hutterer cd84de4f32 tools: use the shared dbus client bindings for kete
Since most of the signals are propagated by the bindings we largely just need
to hook up simple methods to log what is happening.

One nasty hack: we import some of the bits into the kete namespace so
tuhi-live continues to work. This can be fixed up in a follow-up commit.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-28 15:17:38 +02:00
Peter Hutterer 9a21c2318a wacom: store the default point size for each tablet
It'll be overwritten by the messages anyway but for the converter tool this is
handy.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 11:31:30 +02:00
Peter Hutterer 723b4fec35 tools: add a format toggle for switching between json and svg
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:17:17 +10:00
Peter Hutterer ff7bdffc70 tools: rename the test-svg tool to something more descriptive
And add a long description and a flake8 fix while we're there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 10:17:17 +10:00
Peter Hutterer 6c0507abe6 tools: use the json file timestamp where the strokes have none
Cause for the issue in #179

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 08:48:19 +10:00
Peter Hutterer 06aa5b05b1 tools: handle empty files in the test-svg tool
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-23 08:48:19 +10:00
Peter Hutterer a24c54a570 tools: add an svg generation tool
This takes the raw log YAML file tuhi saves for each interaction, extracts the
pen data and then creates an SVG from that. Good for testing whether the
stroke parsing is sane.

Where --all is given, it will search through the directory that tuhi uses to
store the raw logs.

Two fixmes: the pointsize is hardcoded to 5 (intuos pro) because there's no
easy way here to get the point size. Same for the pressure range.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-21 09:31:52 +02:00
Peter Hutterer 64fcf04e32 svg: use our Json SVG converter from kete
A few minor changes like passing in a filename and fixing the different
spellings of the orientations.

In order to use it from kete though we have to mess with the PYTHONPATH. But
since it's a in-tree tool only anyway... meh.

This loses the ability to disable pressure on tablets. I think that's just a
leftover from before we knew how to handle pressure in SVG exports. We should
just fix that properly instead of having a config option here.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-20 12:02:30 +10:00
Peter Hutterer 92fcfd12cc wacom: update the dimensions with the point size
Make sure our dimensions are in actual µm.

Note that this will mess with any cached JSON files since they are now on a
different scale.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-20 12:02:30 +10:00
Peter Hutterer a7836abfe6 tools: fix syntax error in kete
Introduced in cc7ba1b365 for slightly
overzealous flake8 handling.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-20 11:56:38 +10:00
Peter Hutterer cc7ba1b365 kete: move the ini file template out of the code
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 14:11:36 +10:00
Peter Hutterer be6d57562a Switch to pathlib everywhere
gresources and svgwrite don't (yet?) take a Path though, so we have to use
os.fspath() to convert those.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-19 14:11:36 +10:00
Peter Hutterer ee5640b783 Merge branch 'master' into wip/tuhigui 2019-08-09 15:22:07 +10:00
Peter Hutterer 0c333aa64b gui: fix flake8 warnings
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-08 14:44:18 +10:00
Peter Hutterer 075fae13f9 flake 8 fixes
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer 764ad45ca2 wacom: normalize the pressure to the advertised [0, 0xffff] range
This requires adjusting the svg conversion in kete as well, afaict the 1000
range there was chosen because it's (almost) the midpoint of the Bamboo series
with 2048 pressure grades. So let's use half of 0x10000 instead, which is
approximately 0x8000 as the crow flies.

Fixes #142
2019-07-30 14:05:01 +10:00
Peter Hutterer 3c3163261f wacom: normalize the pressure to the advertised [0, 0xffff] range
This requires adjusting the svg conversion in kete as well, afaict the 1000
range there was chosen because it's (almost) the midpoint of the Bamboo series
with 2048 pressure grades. So let's use half of 0x10000 instead, which is
approximately 0x8000 as the crow flies.

Fixes #142
2019-07-19 14:37:51 +10:00
Peter Hutterer fec00a2190 Rename the tuhigui script to tuhi-gui
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-18 12:19:29 +10:00
Peter Hutterer bc7c55f281 Merge the two directories closer together
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-17 21:03:15 +10:00
Peter Hutterer b16a16abde Add a SyncState signal to the DBus interface
Propagated whenever we start talking to the device (and then again when we
stop). The purpose of this signal is merely that a UI can show e.g. a progress
bar while we're talking to the device to ensure the user something is
happening.

Fixes #138
2019-07-15 09:38:19 +02:00
Peter Hutterer 8cf85c3e5d Fix a few typos 2019-07-11 08:52:22 +10:00
Benjamin Tissoires 594297f7fb kete: fix typo
s/stoke_width/stroke_width/
2019-04-29 09:38:02 +02:00
Benjamin Tissoires 359502b134 kete: various flake8 fixes
>$ flake8 --ignore=E501,W504 tools
tools/kete.py:35:1: E302 expected 2 blank lines, found 1
tools/kete.py:553:12: E713 test for membership should be 'not in'
tools/kete.py:599:42: E226 missing whitespace around arithmetic operator
tools/kete.py:599:61: E226 missing whitespace around arithmetic operator
tools/kete.py:615:25: E226 missing whitespace around arithmetic operator
tools/kete.py:615:32: E226 missing whitespace around arithmetic operator
tools/kete.py:624:49: E225 missing whitespace around operator
tools/kete.py:871:9: F841 local variable 'e' is assigned to but never used
2019-04-29 09:36:11 +02:00
Benjamin Tissoires 146b480a84 kete: add more documentation for the default settings.ini 2019-04-29 09:36:11 +02:00
Ishak BELAHMAR a1ed978db9 kete: Handle variable stroke pressure
This is a first implementation of variable stroke pressure. It is based
on a set of individual-width-variable strokes. The ideal implementation
should convert the variable-stroke-width path into an outlined shape.
2019-04-23 11:31:05 +02:00
Ishak BELAHMAR b10ede69c4 kete: Read tablet orientation from settings.ini 2019-04-23 11:31:05 +02:00
Ishak BELAHMAR 7cd269b092 kete: Normalize SVG dimensions (increase viewer compatibility) 2019-04-23 11:31:05 +02:00
Benjamin Tissoires 83d669c059 kete-sandboxed: fix tuhi-kete import path
fixes e4e0a3b ("kete: rename the script from tuhi-kete.py to kete.py")

When renaming tuhi-kete into kete, we forgot to also update
tuhi-kete-sandboxed.py.
2018-03-06 10:02:23 +01:00
Peter Hutterer caf1264952 dbus: add file format version negotiation for the JSON data
Export the supported versions in a Manager property and require the client to
request a specific version in GetJSONData. Without that, the server could
never update the format and clients would have to support every single
historical version to make sure they can run against any version server.

Fixes #98
2018-02-19 11:17:18 +10:00
Peter Hutterer d4ea6e3938 dbus: change the JSON timestamp argument to 64 bit
Because we're totally going to ship tuhi in embedded devices that are going to
be in use until after 2038 when time resets to zero, the world goes big bang
and the only survivers will be 64-bit species. Or something like that. Either
way, the API documentation already said so anyway and the DrawingsAvailable
property is already 64 bit too.

Semi-confusingly: the dbus 64 bit unsigned type is 't', it doesn't stand for
'timestamp'.
2018-02-19 11:16:27 +10:00
Peter Hutterer e0949a2a5e kete: rename indices/index to timestamp
That's what it is, it hasn't been an index for a while now.
2018-02-19 10:50:41 +10:00
Peter Hutterer d0001e18ed tools: chmod +x on tuhi-live 2018-02-14 16:25:56 +10:00
Benjamin Tissoires 99a2f7bdc5 kete: parse incoming uhid data 2018-02-14 06:23:25 +10:00
Benjamin Tissoires d4dd672b2f live-mode: properly pack the fds over DBus
Keeping this one as a separate commit, so we can use it as a future
reference.
2018-02-14 06:23:25 +10:00
Benjamin Tissoires fec265cb68 live: add a script to run as root that enable live mode
we want to be able to open uhid, so we need root access.
Root access is bad, so we fork the process, and then immediately drop
the privileges to talk to the dbus dameon (or to create one).
2018-02-14 06:23:25 +10:00