Commit Graph

519 Commits

Author SHA1 Message Date
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
Daniel Martin b52891f8fd ble: prefix all device logs with address
Use a logger child in BlueZDevice prefixing all log messages with the
device address.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
2019-06-07 08:34:07 +10:00
Daniel Martin c719ecf2e2 ble: use properties instead of variables
Replace variables (objpath, interface, uuid) with properties.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
2019-06-07 08:34:07 +10:00
Daniel Martin 7f9e58e587 ble: simplify GATT characteristic lookup
No need to get triggered by BlueZDeviceManager when it finds any GATT
characteristic. The BlueZDevice just needs its 'ServicesResolved' and
can resolve the GATT characteristics itself.

This solves a FIXME.

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
2019-06-07 08:34:07 +10:00
Daniel Martin e7f8cc2bc2 ble: make object manager return sorted object list
The object list returned by object managers get_objects() function is
not sorted. Though, we rely on objects being sorted by their object
path.

Replace the object managers get_objects() function with a variant
fixing that. Additionally, our variant makes it possible to filter
the returned object list by object path and interface.

Examples:

- get_objects():
  /
  /org/bluez
  /org/bluez/hci0
  /org/bluez/hci0/dev_00_00_00_00_00_00
  /org/bluez/hci0/dev_00_00_00_00_00_00/service0000
  /org/bluez/hci0/dev_00_00_00_00_00_00/service0000/char0000
  /org/bluez/hci0/dev_00_00_00_00_00_00/service1111
  /org/bluez/hci0/dev_00_00_00_00_00_00/service1111/char1111
  /org/bluez/hci0/dev_FF_FF_FF_FF_FF_FF
  /org/bluez/hci0/dev_FF_FF_FF_FF_FF_FF/serviceffff
  /org/bluez/hci0/dev_FF_FF_FF_FF_FF_FF/serviceffff/charffff

- get_objects(interface='org.bluez.Adapter1'):
  /org/bluez/hci0

- get_objects(interface='org.bluez.GattCharacteristic1'
              base_path='/org/bluez/hci0/dev_00_00_00_00_00_00'):
  /org/bluez/hci0/dev_00_00_00_00_00_00/service0000/char0000
  /org/bluez/hci0/dev_00_00_00_00_00_00/service1111/char1111

Signed-off-by: Daniel Martin <consume.noise@gmail.com>
2019-06-07 08:34:07 +10:00
Daniel Martin 1016fb29d0 README: remove duplicate "either on" 2019-06-07 08:34:07 +10:00
Peter Hutterer 1b9b7760fd wacom: let's assume any 0xb3 with nonzero data is an error
b3 01 00 seems to be a generic "I'm happy" and the few others we've seen
are errors. So let's encode that and reconsider if it turns out to be false.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 11:14:48 +02:00
Peter Hutterer c1283289b7 wacom: sort the error handling
and use elif for clarity (even though we have exceptions here)

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 11:14:48 +02:00
Peter Hutterer 4b02a6f51c Fix flake8-3 complaints
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 10:58:21 +02:00
Peter Hutterer 9a97f19a13 tuhi: always use verbose mode when starting from git
When starting from within the git directory, always use verbose mode. Because
you're debugging it, otherwise you wouldn't start from git.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 10:57:36 +02:00
Peter Hutterer 82b81b1c34 base: add timestamps to the logs
Fixes #127

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-06-05 10:54:44 +02:00
Christian Muehlhaeuser 6f9d3dbde4 Link to Arch Linux package tuhi-git in README 2019-06-05 09:22:40 +10:00
Ishak BELAHMAR f2263e72cf wacom/live: read Slate dimensions before starting live mode 2019-05-03 09:56:20 +02:00
Benjamin Tissoires 594297f7fb kete: fix typo
s/stoke_width/stroke_width/
2019-04-29 09:38:02 +02:00
Benjamin Tissoires 359502b134 kete: various flake8 fixes
>$ flake8 --ignore=E501,W504 tools
tools/kete.py:35:1: E302 expected 2 blank lines, found 1
tools/kete.py:553:12: E713 test for membership should be 'not in'
tools/kete.py:599:42: E226 missing whitespace around arithmetic operator
tools/kete.py:599:61: E226 missing whitespace around arithmetic operator
tools/kete.py:615:25: E226 missing whitespace around arithmetic operator
tools/kete.py:615:32: E226 missing whitespace around arithmetic operator
tools/kete.py:624:49: E225 missing whitespace around operator
tools/kete.py:871:9: F841 local variable 'e' is assigned to but never used
2019-04-29 09:36:11 +02:00
Benjamin Tissoires 146b480a84 kete: add more documentation for the default settings.ini 2019-04-29 09:36:11 +02:00
Benjamin Tissoires c21c8a4633 wacom: do not use relative data when exporting
we already are keeping a record of the x,y and p. So we are trying
to duplicate the effort by using new_rel.
The problem is that some reports have relative coordinates but absolute
pressure data. Which means we are missing the pressure change as it has
a relative value of 0.

By trusting the wacom internal state, we can have the json data that
matches it completely.
2019-04-29 09:36:11 +02:00
Benjamin Tissoires 6d74615085 tuhi: prettify the exported json
having the whole file in a single line is fine for programs, much
less for humans
2019-04-29 09:36:11 +02:00
Ishak BELAHMAR a1ed978db9 kete: Handle variable stroke pressure
This is a first implementation of variable stroke pressure. It is based
on a set of individual-width-variable strokes. The ideal implementation
should convert the variable-stroke-width path into an outlined shape.
2019-04-23 11:31:05 +02:00
Ishak BELAHMAR b10ede69c4 kete: Read tablet orientation from settings.ini 2019-04-23 11:31:05 +02:00
Ishak BELAHMAR 7cd269b092 kete: Normalize SVG dimensions (increase viewer compatibility) 2019-04-23 11:31:05 +02:00
Benjamin Tissoires 9e85b4d248 flatpak: use cached version for pygobject
There is no points relying on git master, just pick one version, this
will save us some network i/o during rebuilds of the flatpak
2018-03-06 10:31:57 +01:00
Benjamin Tissoires 83d669c059 kete-sandboxed: fix tuhi-kete import path
fixes e4e0a3b ("kete: rename the script from tuhi-kete.py to kete.py")

When renaming tuhi-kete into kete, we forgot to also update
tuhi-kete-sandboxed.py.
2018-03-06 10:02:23 +01:00
Benjamin Tissoires d86d3ce4a7 setup.py: fix pyxdg requirement
xdg is declaring itself as pyxdg.

Detected when installing through flatpak. It tries installing 'xdg'
through pip while we already manually installed it:

Processing dependencies for tuhi==0.1
Searching for xdg
Reading https://pypi.python.org/simple/xdg/
Download error on https://pypi.python.org/simple/xdg/: [Errno -3] Temporary failure in name resolution -- Some packages may not be found!
Couldn't find index page for 'xdg' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [Errno -3] Temporary failure in name resolution -- Some packages may not be found!
No local packages or working download links found for xdg
error: Could not find suitable distribution for Requirement.parse('xdg')
Error: module tuhi: Child process exited with code 1
2018-03-06 09:55:11 +01:00
Peter Hutterer e6f5baf02f setup.py: add pygobject
This appears to be the right dependency and should work with pip
https://mathieu.daitauha.fr/blog/2016/07/06/pip-install-pygobject/
2018-03-06 09:33:17 +01:00
Peter Hutterer b749cad77e setup.py: don't require 'gi'
Turns out this is not the gi.repository but a different package:
    'Command line to private gist.  Example: gi.py myFile'

It's incompatible with python3 and fails on import and seems to conflict with
gi.repository (also, the upstream seems dead).

Fixes #103
2018-03-06 09:33:17 +01:00
Peter Hutterer 7e751d45c8 base: if gi.repository fails to import, warn
We need python 3.6 but old Ubuntus only have 3.5. 3.6 can be installed (and
thus we get past the 3.6 sys.version check), but the gi.repository backports
are in various states of disarray (see #103 and #104).

And Python (and in particular gi) makes it hard for users to distinguish
between "the dependencies are a mess" and "this is a bug in tuhi".

So let's catch any error during gi.repository import and print a warning to
the user, in the hope of getting less bugs caused by Ubuntu frankenpythons.
Still won't fix issues like #104, but I'm not sure how to test for those
errors.

Related to #103
2018-03-06 09:33:17 +01:00
Peter Hutterer 0ee18353ef README: the Intuos Pro Paper works now 2018-03-06 09:54:39 +10:00
Peter Hutterer 108f1720b8 setup.py: add requires for external packages
Fixes #100
2018-02-20 11:05:31 +10:00
Peter Hutterer caf1264952 dbus: add file format version negotiation for the JSON data
Export the supported versions in a Manager property and require the client to
request a specific version in GetJSONData. Without that, the server could
never update the format and clients would have to support every single
historical version to make sure they can run against any version server.

Fixes #98
2018-02-19 11:17:18 +10:00