This was the one that introduced the Gtk.Template class that we use. And
better to have a meaningful exit than a crash.
Fixes#197
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We used to drop all but the last 10 drawings on startup and as the comment
says so that users don't rely on tuhi for storage. That's mostly fine when
Tuhi is a separate daemon but now the primary interface is the GUI. So we can
run into this situation:
- user starts Tuhi (which in turn starts tuhi-gui and tuhi-server)
- tuhi-server downloads 20 fresh drawings from the device
- tuhi-gui crashes before it can fetch them from the tuhi-server
- restart Tuhi, the server now purges 10 out of those 20 drawings that the
user has never seen. They're gone for good.
Let's drop that code until we figure out a better solution to that (e.g. drop
drawings older than X months but that too is fraught with errors).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Previously, the YAML output was basically:
- send: [0xb9, 0x01, 0x00]
- recv: [0xba, 0x02, 0x44, 0x00]
using a context manager where replies are expeced we can now group the
replies in the yaml file:
with logger as _:
self.send_nordic_command(...)
self.wait_nordic_data(...)
And that will prodice a grouped entry in the YAML file:
- send: [0xb9, 0x01, 0x00]
recv: [0xba, 0x02, 0x44, 0x00]
Which means processing those becomes a bit easier.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Both handlers need to be set up to log at debug level, the logger itself will
filter correctly anyway where verbose isn't given. And we want them both to
log in the same format, so let's re-use the formatter.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
The session id is a UUID, postfixed by an incrementing number. The UUID stays
the same for Tuhi's livetime, the number increments with every bluetooth
connect/disconnect. Result is e.g. 4e55c30035d043ce9f6f4914fb223820-2.
This session id is printed to the log file, added to the YAML raw logs and to
the JSON file, making it easier which log part resulted in which drawing, etc.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reproduced on the Spark, first bytes in a new file recording were
- file header: 0x62, 0x38, 0x62, 0x74
- stroke point: 0xbf, 0xff, 0xff, 0x4a, 0x14, 0x29, 0x31, 0x6a
- stroke delta: 0xa8, 0x02, 0x04, 0xc3,
The initial point thus has a delta pressure value 0x6a which must be added to
*something*. And zero is the most sensible *something* that I can think of.
Fixes#111
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Deprecated, but still exists on the Slate so let's wrap the connect attempt
so we throw the right error.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
It's caused by a timeout but the underlying issue is that we never got the
reply that we wanted.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
refresh was accurate when it ended up redrawing the screen but now that
redrawing is a separate function let's rename this.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Do this when we're saving the file instead and rotate the pixbuf itself only.
For the tablet-wide orientation we regenerate the SVGs because this is
supposed to be a once-off setting so being smart here doesn't gain us
anything.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This situation will never be handled correctly b a GUI and there's no need to,
our settings aren't supposed to be edited by puny humans. So just log an error
and treat the device as unregistered.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
And since this function was the only one generating some of the exceptions,
let's remove those too.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Use --peek to download the first (oldest) drawing on the device but do not
delete it. This is primarily intended as a debugging option, so we can debug
the tablet handling without having to draw new drawings (which cause the
protocol messages to change slightly).
Since the tablet only has a "download oldest file" command this isn't very
useful to end users. If there are two or more files on the tablet, we can only
ever retrieve the oldest one.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
We only ever have one of those anyway, so let's make it a singleton. This
patch keeps the self.config assignment and config passing to keep the churn at
at a minimum. But this way we can assign runtime options to the config and
have those as globally accessible options.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
0xc3 is 'download the oldest file'
0xca is 'delete the oldest file' (usually the one we just received) from the tablet.
0xc1 is 'how many files are there'
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Some raw log files may be empty if we cancelled tuhi at the wrong time. Skip
over those while testing
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>