Commit Graph

534 Commits

Author SHA1 Message Date
Peter Hutterer 96df9fc416 wacom: make sure we only return the data packet size we want
If we have more data than our packet [1], let's not return the whole data
array. Slice it to size instead.

[1] this never happens with the current code, we don't work asynchronously

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer eacc03b6ea wacom: rename a function to make it more obvious
We're not checking for data here, we're taking the next message.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02: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 6e27d70517 wacom: de-duplicate an opcode check
we don't need the same-ish check twice, we can just pop our non-list into a
list an go from there.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer c84f3f8c63 wacom: error code 0x05 is an unrecognized command
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer d3726420cf wacom: add a comment describing where to we store stuff
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer b009ea3c96 wacom: rename the mysterious bits to sysevent
These bits are used for system notifications

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer cda4300388 wacom: visually align the UUIDs
And add # NOQA to shut up flake8

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-02 09:30:36 +02:00
Peter Hutterer 92a9628adf base: drop the separate function for bluez updates
A lambda does the job here without increasing the class profile
2019-07-30 14:06:49 +10:00
Peter Hutterer 08e3ec532e base: drop the extra function for checking if the device is in register mode
Now that it's just a one-liner, we don't need an extra function
2019-07-30 14:06:49 +10:00
Peter Hutterer 37b9b2eefa base: simplify check for in register mode
With a "or []" we can force this to be at least a 0-length list, obsoleting
the None check.
2019-07-30 14:06:49 +10:00
Peter Hutterer e1a3675439 base: ignore anything not from the known vendor IDs
We don't want to accidentally start talking to a device and brick it.
2019-07-30 14:06:49 +10:00
Peter Hutterer deb2c3ad2f base: rename the hotplugged argument
This one is a bit confusing, because most of the time it's not a hotplug
event, it's just the RSSI property updating.
2019-07-30 14:06:49 +10:00
Peter Hutterer 5b73c8ea2d Add a few more comments to the codebase 2019-07-30 14:06:49 +10: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 a63355a03e gui: we don't really do selection in the flowbox, so let's make it white 2019-07-23 12:58:08 +10:00
Peter Hutterer 4e886fca2b gui: only show the toolbox on enter
This is using opacity of 0% to hide them - this way the space stays allocated
and showing it doesn't rearrange things. Using visiblity here causes
everything to shift around on reveal.
2019-07-19 18:09:13 +10:00
Peter Hutterer 0b9d4c2602 gui: round off the borders for the paper itself
Because we don't want to hurt ourselves on those sharp edges, do we?
2019-07-19 16:43:54 +10:00
Peter Hutterer d06b92e9af gui: hook up a zoom slider
The default size of the drawings is a bit small now, good for an overview but
not for identifying which drawing to use now. Add a zoom slider for that.
2019-07-19 16:41:17 +10:00
Peter Hutterer 097f66f33c gui: add a GTK separator under the month/year label 2019-07-19 14:37:51 +10:00
Peter Hutterer 357f25deb4 gui: pack the toolbox at the start so it doesn't expand
If one drawing in the line gets rotated, the buttons all scaled to filll the
space - which is ugly.
2019-07-19 14:37:51 +10:00
Peter Hutterer 6b623132e5 gui: handle the now-normalized pressure range
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-19 14:37:51 +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 8a76d4eae3 gui: some more styling of the drawings 2019-07-19 14:37:51 +10:00
Peter Hutterer e38c6a0d55 gui: drop the timestamp label for each drawing
Now that we group by month anyway, this isn't that useful anymore
2019-07-19 14:37:51 +10:00
Peter Hutterer c00580655e gui: use a GdkPixbuf to scale into the desired size 2019-07-19 14:37:51 +10:00
Peter Hutterer 66130b9b8b gui: give the toolbox a name 2019-07-19 14:37:51 +10:00
Peter Hutterer 68e533ec5f gui: maximize the window on startup
We need screen estate to show the drawings, let's make use of it
2019-07-19 14:37:51 +10:00
Peter Hutterer 5dddefe9d4 gui: make the drawings slightly off-white
Some randome color off the google colour picker that's supposed to look more
like a real paper color. This also means we set the general background white
now to give it a better contrast.
2019-07-19 14:37:51 +10:00
Peter Hutterer b7bf68326f gui: group the list of drawings up by month 2019-07-19 10:59:20 +10:00
Peter Hutterer 2547f6b26d gui: space out the drawings a bit 2019-07-19 10:38:40 +10:00
Peter Hutterer c29da10918 gui: fix a grammar mistake 2019-07-18 20:26:28 +10:00
Peter Hutterer bad0bc87ab Add a 'missing tablet' icon to be displayed instead of the spinner
On startup and before we connected to a tablet, let's display a missing tablet
icon. Taken from the tablet icon, combined with the X from one of the network
icons in the Adwaita theme.

Once we get a sync notification, we just hide that one and done.
2019-07-18 19:43:16 +10:00
Peter Hutterer 6add140a1f gitignore: don't ignore SVG files
We need to provide a few in for tuhigui, so let's not ignore them.
2019-07-18 19:39:55 +10:00
Peter Hutterer 3e246b0aa1 gui: add a separator between the close button and the other buttons
To avoid accidentally clicking the close button when trying to save
2019-07-18 18:33:40 +10:00
Peter Hutterer 78fc886375 gui: fix the global orientation changes
This broke at some point, let's fix it again by moving to the drawing and
calling refresh() from there - no need for the DrawingPerspective to call into
the drawing here.
2019-07-18 18:32:11 +10:00
Peter Hutterer b7079e2343 gui: restyle the drawing entries 2019-07-18 18:26:31 +10:00
Peter Hutterer 1224711328 gui: move the battery and sync spinner to the titlebar
We have the real estate there anyway, might as well make use of it
2019-07-18 17:30:41 +10:00
Peter Hutterer 900d0302cd gui: remove duplicate active stack assignment 2019-07-18 17:21:45 +10:00
Peter Hutterer 06b28274a7 Remove tuhigui's gitignore file, it's covered by the top-level one anyway 2019-07-18 13:41:48 +10:00
Peter Hutterer ef830c2560 README: make a note that flatpak doesn't use the same directories
XDG_DATA_DIR in flatpak is $HOME/.var/app/org.freedesktop.Tuhi/data/tuhi
vs $HOOME/.local/share/tuhi for normal runs.

Which means switching between flatpak and normal means we lose the UUID and
the stored drawings.
2019-07-18 13:17:47 +10:00
Peter Hutterer 23281976da tuhigui: share the config path with tuhi
The tuhigui.ini settings file where we store the orientation of the device is
now the same config directory tuhi dumps its data in.

The svgs are in an svg subdirectory, just to make them easier to find.
2019-07-18 13:04:25 +10:00
Peter Hutterer cce5099709 Fix the flatpak for tuhi to point to the GUI now
This means we can drop the normal one. Since Tuhi wasn't a GUI application
anyway it wasn't technically flatpak-compatible.
2019-07-18 12:54:30 +10:00
Peter Hutterer d2bfbc49b4 Add the tuhi.in startup script
As a <builddir>/tuhi and <builddir>/tuhi.devel version. The latter runs
in-tree, the former is the one to be installed.

This is this type of script for a number of reasons. The quickest integration would
be to just use multiprocessing and call into the python module instead of
running other generated scripts. But that doesn't work, GLib doesn't like that
much (the GTK UI crashes). See
https://jameswestby.net/weblog/tech/14-caution-python-multiprocessing-and-glib-dont-mix.html

Another option would be to have a single thread because with GObjects we don't
need to care, right? Except that we do because the DBus bindings use sync
calls and that hangs when we have the server in the same process in a single
thread. Fixing the bindings is a bit more involved.

So meanwhile, let's just go for a script that executes the right targets as
separate processes and let the kernel take care of 'threading', that's what
it's there for after all.
2019-07-18 12:54:14 +10:00
Peter Hutterer ea162610fd meson.build: install the server with meson as well 2019-07-18 12:19:29 +10:00
Peter Hutterer a708978fad meson.build: drop two unneeded replacements 2019-07-18 12:19:29 +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 a724495502 Rename tuhi.py to tuhi-server.py 2019-07-18 12:19:29 +10:00
Peter Hutterer 0791dba90a tuhigui: namespace the loggers 2019-07-18 12:19:29 +10:00
Peter Hutterer 4b3914d49c tuhi: take the mainloop out of Tuhi
If we want to integrate this with TuhiGui, we can't have multiple mainloops.
And there's nothing with Tuhi that needs it anyway, it's all about how it is
being called. Which means we can just move this to the main method.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-18 12:19:29 +10:00