Commit Graph

32 Commits

Author SHA1 Message Date
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 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 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 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