Commit Graph

398 Commits

Author SHA1 Message Date
Peter Hutterer 293b64c1f3 Show the drawings in reverse sorted order (newest first) 2019-07-16 15:29:19 +10:00
Peter Hutterer d6a2e01acb svg: drop the non-pressure handling
No point in keeping this, let's always use the pressure and where it's not
sufficient just change the algorithm.
2019-07-16 15:29:14 +10:00
Peter Hutterer 217ec508fa Subscribe to battery changes so we can update the GUI
Previously we only ever updated on the initial device assignments. Especially
when the device is offline while started, this means we never get the right
icon.
2019-07-16 15:29:09 +10:00
Peter Hutterer 3590ee4ce3 Drop an unnecessary self
We have the device variable here and use it in the lines above. Let's do the
same for the drawings too.
2019-07-16 15:29:00 +10:00
Peter Hutterer a82b291dbb flake 8 fixes 2019-07-16 15:28:51 +10:00
Peter Hutterer 096c4e22a2 Make the main window resizable
No good reason why this needs to be a fixed size.
2019-07-16 10:23:08 +10:00
Peter Hutterer 498a867558 Revert "base: once the device is registered, we're done"
This broke device initialization in some cases (not sure why it worked until
today though). Where a device is in register mode but the ManufacturerData has
not yet updated to the 4-byte string (i.e. a device previously known
normally), the device would now always call listen(). The firmware - in
register mode - would start initializing the connection though and get
rejected, leaving us with a device that cannot be registered.

This reverts commit a061240b11.
2019-07-15 21:57:24 +10:00
Peter Hutterer b3f4e91616 Add some relative dates for the drawings 2019-07-15 21:34:56 +10:00
Peter Hutterer fcf15daa08 Switch two more icons fro better lokos in the Adwaita theme 2019-07-15 21:34:56 +10:00
Peter Hutterer de23da9a84 Change the battery icon to one in the adwaita icon theme
The previous one must've been from some leftover theme I had sitting around.
2019-07-15 21:34:56 +10:00
Peter Hutterer 5f5c49b6d0 Hook up synchronizing the state to the drawing perspective 2019-07-15 21:34:56 +10:00
Peter Hutterer 48a339c3b7 wacom: device time must be interpreted as UTC 2019-07-15 09:38:19 +02:00
Peter Hutterer a1e3e8eafb wacom: move device state debugging to the functions themselves 2019-07-15 09:38:19 +02:00
Peter Hutterer aff38c26a3 wacom: fetch both dimensions in one go
No need for the caller to call this twice everywhere, let's just do this here.
2019-07-15 09:38:19 +02:00
Peter Hutterer dbd60675a9 wacom: fetch firmware data in one go
No need for the caller to call this twice everywhere, let's just do this here.
2019-07-15 09:38:19 +02:00
Peter Hutterer bf5e53b62b wacom: simplify the battery state debug message 2019-07-15 09:38:19 +02:00
Peter Hutterer 5d53ec8005 Bubble up the width/height from the protocol to the dbus interface
Fixes #135
2019-07-15 09:38:19 +02:00
Peter Hutterer d3156110b7 wacom: disable a duplicate debugging, enable another one
Print the dimensions during register too. And the "received" message is
duplicate because we log this as the data comes in from the nordic anyway.
2019-07-15 09:38:19 +02:00
Peter Hutterer 4611692b2c wacom: minor tidyup
No functional change, it just uses a dict now to pick the protocol class which
makes it *slightly* easier to read.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15 09:38:19 +02:00
Peter Hutterer b6494efd40 wacom: move the fw logging into a custom class
Instead of just doing a single log line, let's log this to a yaml file so we
have a permanent record of the interactions with the device for bug reports.
2019-07-15 09:38:19 +02:00
Peter Hutterer bcdf730a72 base: make sure we only connect once to the bluez connect/disconnect signals
This was getting stacked - once on init and once whenever we actually made a
connecting, resulting in the signal never getting disconnected properly and
some races because we tried to sync twice.

The whole "listen()" vs "listening" vs "connected" etc. is a bit of a mess and
should be reworked for a proper fix to this. But for now this will do.

This may fix #124
2019-07-15 09:38:19 +02: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 05fd213940 wacom: fetch the battery state during register
Any decent UI will want to know this given the device is online right now.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15 09:38:19 +02:00
Peter Hutterer f488d4e130 wacom: make 0xb3 the expected opcode
Virtually all the commands we have that don't have a specific opcode expect
0xb3. Since that's the general ACK command, we can default to that and make
everything else the exception.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-15 09:38:19 +02:00
Peter Hutterer a061240b11 base: once the device is registered, we're done
This method is called whenever a bluez property changes, don't prompt the user
(in the logs) to register the device we just finished registering.
2019-07-15 09:38:19 +02:00
Peter Hutterer 517a7e6882 Make the setup parts a dialog
A more traditional interface.
2019-07-15 15:05:30 +10:00
Peter Hutterer 64dca90f54 meson: fix a URL still pointing to libratbag 2019-07-15 14:17:23 +10:00
Peter Hutterer de3386a88d base: add a helpful comment
This it's more obvious that add_device can really be called every second or so
2019-07-15 10:43:35 +10:00
Peter Hutterer 6aced355b5 wacom: minor change to a debug message 2019-07-15 10:43:35 +10:00
Peter Hutterer 72507b687a wacom: remove some superfluous ''' 2019-07-15 10:43:35 +10:00
Peter Hutterer bdb88865f0 Drop the device name from the drawing perspective
We have it in the titlebar now, no further need for it
2019-07-11 21:15:30 +10:00
Peter Hutterer 0ce60deb34 Don't start listening twice
We get a notification for listening going to True after start_listening(), but
we don't need to start it again in that case.
2019-07-11 20:18:23 +10:00
Peter Hutterer 82f62059f0 Add more logging to help with debugging 2019-07-11 20:17:38 +10:00
Peter Hutterer 035dd68115 Rework the header bar for the primary window
Previously the menu was hand-composed, let's replace it with the glade files
as possible. And move the menu itself out into the source file so glade
doesn't keep overwriting it.
2019-07-11 20:16:45 +10:00
Peter Hutterer d07835b15c Fix the battery icon name
We need to crop to the nearest 20, not just divide by it.
2019-07-11 16:11:48 +10:00
Peter Hutterer 2df9f55119 Hide the "trash" button for now until we know how to hook it up 2019-07-11 16:11:48 +10:00
Peter Hutterer 71849d926d Hook up synchronizing the drawings
And drop the rotate/sync button while we're there. The rotate button because
it's not hooked up anyway. The sync button because that is not how we work: we
just always listen while we're running, any drawing will "immediately" be
synched from the device.
2019-07-11 16:11:48 +10:00
Peter Hutterer d97c5eaaac Rename the connected property to 'online'
We're using connected for the bluez property, so let's not clash with that
2019-07-11 15:45:48 +10:00
Peter Hutterer fdade5529d tuhi: drop the live bits from our dbus bindings
Not needed here
2019-07-11 15:31:20 +10:00
Peter Hutterer f2dfec4f49 Add the flatpak files 2019-07-11 15:11:32 +10:00
Peter Hutterer d03493f7ff Add a GUI for Tuhi
This is a quickly hacked-together versions with some bits in detail, others
just sketched in. Credit goes to Piper where much of the basic structure has
been taken from, and tuhi-kete where the DBus bindings were taken from.

Current functionality allows to register a new device and save drawings from
an existing device. Missing is the bit where we can download drawings from a
newly registered device. Several buttons are present but not hooked up yet,
several UI pieces are unpolished.

This UI is designed to work with one device only right now. If you have two
devices, you'll have to manually remove them from Tuhi and add one or the
other through this tool.

The UI is minimal. If you start it and Tuhi doesn't have a device yet, it will
immediately go into search mode and start registering the device. If you have
a device, it'll just display the data.

The data Tuhi exports is downloaded immediately and converted to SVG files,
stored in $XDG_DATA_HOME/tuhigui/<timestamp>.svg. Downloading a file through
the GUI merely copies that file into the target path. No support for rotation
at this point, but could and should be added (there's a button already!)
2019-07-11 11:05:39 +10:00
Peter Hutterer 8cf85c3e5d Fix a few typos 2019-07-11 08:52:22 +10:00
Peter Hutterer caa52e0c51 base: when search is turned off, remove unregistered devices again
This is what the dbusserver module does as well, so we end up with a weird
mismatch: to the base module the device is still known and unregistered on the
next search start. So when we see the bluez properties float past, we don't
add a new devices.

To the dbusserver the device is gone though and since we don't add it again in
the base module, we never send a signal for it.

Since there's a reasonable assumption that if we don't register the device, we
don't want it anyway, let's delete it from the base device list too.

This doesn't fix the issue of a device timing out while waiting for a button
press. That device will count as known until the next search stop. But at
least now we don't have to restart tuhi.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-08 10:52:39 +02:00
Peter Hutterer 6ff9f34d08 wacom: fix type error when registering a Intuos Pro paper
gmtime() and localtime() both take seconds, not a struct time.
2019-07-08 10:52:39 +02:00
Daniel Martin a3e273c9f9
Merge pull request #133 from whot/wip/update-flatpak
Update flatpak to SDK 18.08
2019-06-08 11:37:01 +02:00
Peter Hutterer 6837c29f69 flatpak: update to pygobject 3.32
Drop pycairo by way of an environment variable, because we don't need it for
tuhi.

The way pygobject is setup it checks for setuptools during pip3 and then
complains that it's not there:

  Collecting setuptools
    Could not find a version that satisfies the requirement setuptools (from versions: )
  No matching distribution found for setuptools

It's not actually needed since it has a fallback, but clearly... anyway.

Let's use the plain setup.py invocation, but with the right --prefix.
Of course that setup.py invocation doesn't work for the other packages,
so let's leave pip3 in place for those. Because how much worse would the world
be if this would just work...

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-07 16:29:29 +10:00
Peter Hutterer d6a97337d9 flatpak: update pyparsing to latest stable version
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-07 15:39:57 +10:00
Peter Hutterer 594fad1d3c flatpak: update pycairo to the latest version
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-07 15:38:14 +10:00
Peter Hutterer a1ca70df28 flatpak: update to freedesktop.org SDK 18.08
This one now includes Python 3.7, so we don't need to do it build it
ourselves. Fix the kete path up for 3.7 as well so this works again.

And finally, fix the pip incovations, the current ones we have install into
/usr/ which is read-only. Use the pip3 command generated by the
flatpak-pip-generator as listed on http://docs.flatpak.org/en/latest/python.html

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-07 15:35:59 +10:00
Peter Hutterer 0ddc33a37b drawing: fix deprecation warning
tuhi/drawing.py:46: PyGIDeprecationWarning: GObject.property is deprecated;
use GObject.Property instead
  @GObject.property

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-07 15:35:59 +10:00