Commit Graph

519 Commits

Author SHA1 Message Date
Peter Hutterer 3e23e8bc31 svg: pass the orientation into the constructor
Don't let the SVG generation parse the config file, not necessary here.
2019-07-16 21:15:11 +10:00
Peter Hutterer 1743a93873 Rename Config.load() to Config.instance() for better clarity 2019-07-16 21:13:30 +10:00
Peter Hutterer 09a66642ae Move SVG generation to the Drawing
This means we can just call refresh() from the parent after the orientation
has changed.
2019-07-16 21:06:32 +10:00
Peter Hutterer 9903bd851d Handle the iteration through the flowbox children better 2019-07-16 20:54:01 +10:00
Peter Hutterer 55164043e3 README: fix spelling of Māori
Fixes #141
2019-07-16 17:03:50 +10:00
Peter Hutterer 34defb3768 Drop the text for the "synchronized" label
This would just cause extra work for translators, we never actually display
that bit anyway.
2019-07-16 15:34:02 +10:00
Peter Hutterer ceee14b1ed Reduce font size for the bottom hint to press the button 2019-07-16 15:33:57 +10:00
Peter Hutterer 7be996e43a Streamline the setup dialog
Just the minimal bits that are needed.
2019-07-16 15:33:49 +10:00
Peter Hutterer 79e3e02b66 Fix a grammar mistake 2019-07-16 15:33:45 +10:00
Peter Hutterer 951bc85139 Display the missing battery icon until we get data from Tuhi 2019-07-16 15:33:40 +10:00
Peter Hutterer e999beafd7 If we haven't synced in 10 years, it's "never"
This is the value that's displayed on startup now
2019-07-16 15:33:34 +10:00
Peter Hutterer a857b14b8a Implement 'deleting' drawings
Enable the delete button that's been hidden away so far. When clicked, we
suffix the cached json file with '.deleted'. This also causes a popup with an
undo button to appear (taken from Nautilus). When clicked, that button will
restore the drawing again.

This is really all just renaming anyway, because nothing ever gets deleted
here.

An extra filter is needed to skip Tuhi drawings that have been deleted in the
GUI - we don't want to add the drawings we just deleted again just because
Tuhi still keeps them in cache.
2019-07-16 15:33:02 +10:00
Peter Hutterer ff35e5bfc5 Cache the json files to disentangle them from Tuhi
Tuhi caches the json data but has no guarantee about storage. So we cache the
json we get from Tuhi and store it in our settings dir through our Config
backend. Then we use  those cached values to generate the SVG files.
2019-07-16 15:32:49 +10:00
Peter Hutterer b34dbcf899 Switch to using pathlib over os.join 2019-07-16 15:32:10 +10:00
Peter Hutterer 6e21db0c9a Revert "Store the SVGs in the runtime directory"
Actually, not a good idea since we can't rely on Tuhi to store the drawings
forever.

This reverts commit 5470a7afd23c44d55ee14d32ddf081a8e0eab251.
2019-07-16 15:31:46 +10:00
Peter Hutterer 651d9d87e4 Store the SVGs in the runtime directory
No need to pile these into the data directory.
2019-07-16 15:31:43 +10:00
Peter Hutterer 2f3094d3db Allow for orientation changes for the device
This is saved for posterity in the new settings file, so we need a new Config
object (singleton is enough here).

For now, whenever the orientation changes, we just wipe our UI and re-generate
all SVG files. Much easier than messing with proper SVG rotation given that a
device should only ever change between rotations once.
2019-07-16 15:31:36 +10:00
Peter Hutterer 84273a1c83 Add a Help entry in the menu (to point to the wiki) 2019-07-16 15:29:51 +10:00
Peter Hutterer 6c8d586caa Rename a the variable used to generate the icon name 2019-07-16 15:29:46 +10:00
Peter Hutterer c7fe771082 Set the battery percent as tooltip on the battery image 2019-07-16 15:29:33 +10:00
Peter Hutterer 958633e4ff Pre-fill the filename propertly
Saving a file for the first time is supposed to set the current name, not the
file name.
2019-07-16 15:29:24 +10:00
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