1
0
Fork 0
Commit graph

36 commits

Author SHA1 Message Date
Daniel Thompson
ae0d59dbe3 widgets: Further compact some of the internal representations
Many widgets adopted the _im(mutable) idiom to allow us to reduce the
RAM overhead of each widget. Where the immutable data considers entirely
of integers smaller than 256 then we can push this just a little further
by switching from a tuple to a bytes.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20 17:08:39 +01:00
Daniel Thompson
9099c2398e widgets: Refactor the stopwatch as a widget
This is purely a refactoring for the purposes of code reuse. No change
of behaviour is expected.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-06-20 17:03:05 +01:00
Daniel Thompson
6e269d5cd7 widgets: Add a button with a graphical icon
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-18 21:52:55 +00:00
Daniel Thompson
05310a82f8 widgets: Clarity whether spinner max is inclusive or exclusive
Currently the spinner uses exclusive max when wrapping from low to high
and inclusive max when wrapping from high to low. Fix this by adopting
*inclusive* max everywhere. The call sites are similarly confused.

Fix this!

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-12 20:22:44 +00:00
Miguel Rochefort
8a07edb4d8 widgets: ConfirmationView: Restore default font
The title will render with the last font used, and this isn't always
right for the ConfirmationView. Setting the font explicitly solves that
issue.

Signed-off-by: Miguel Rochefort <miguelrochefort@gmail.com>
2021-01-10 18:13:31 +00:00
Daniel Thompson
ed242b84a6 widgets: ConfirmationView: Adopt the button widget
Replace the pixelated Yes/No buttons with text based alternatives.
This also required changes to the pager to change the way the
redraw after changing view is implemented (improved muting and a reset
of the colours).

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 10:34:37 +00:00
Daniel Thompson
b6b30238c6 widgets: button: Add a simple Button widget
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-10 10:30:27 +00:00
Daniel Thompson
ed6b126e2e widgets: checkbox: Add a label property
The checkbox uses the _im(mutable) idiom to minimize the RAM overhead
of its immutable properties (position and label). However it can be useful
to retrieve the label to provide a property accessor.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-03 14:50:04 +00:00
Daniel Thompson
75a1a15f45 widgets: Use theme colours for text labels
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2021-01-03 14:48:19 +00:00
Daniel Thompson
ad9714b0dc manager: Recategorize the theme labels for apps
By default bright and mid are white/grey tones, the ui widgets are
blue and the spot colours are different variants of orange.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-31 19:22:54 +00:00
Daniel Thompson
b8ba1a9eba widgets: ConfirmationView: Fix hit box problems
The ConfirmationView became broken when we converted it's images over to
2-bit RLE. That happened because the confirmation view relied on the
the 1-bit RLE to dynamically generate hit boxes.

Currently the code pre-calculates the hit box which is a waste of RAM.
Let's rip out the existing hit box logic and replace it with much larger
("fat finger") hit targets.

We make the touch() method more closely adopt the idioms of other UI
components (e.g. don't return the dialog status... just whether or
not we handled the touch).

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-30 10:29:02 +00:00
Daniel Thompson
2641616ff6 widgets: Spinner: Add a simple spinner widget
We are able to add this to the self tests without having to create a
special page. Instead we can modify the existing notifications test
to utilize the spinner.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 20:07:50 +00:00
Daniel Thompson
632ec713a4 widgets: Checkbox: Add a simple checkbox widget
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 12:32:38 +00:00
Daniel Thompson
3ddb7fc13d widgets: ConfirmationView: minor docstring tweak
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 12:32:04 +00:00
Daniel Thompson
f8231bc0ac widgets: Slider: Adopt draw565.lighten for palette management
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-29 12:31:38 +00:00
Daniel Thompson
8abb6f3f4d widgets: Reduce the size of the battery icon
Currently the battery icon is overlarge compared to other status bar
icons such as the BT and notification icons (both of which are 32px
high). Fix this by redrawing the battery artwork and updating
the widgets in the status bar.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-28 11:12:16 +00:00
Daniel Thompson
4468285c34 widgets: BatteryMeter: Fix theme handling
Add the battery frame to the theme so it matches the frame used for
charging and rename accordingly.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-12-13 16:51:07 +00:00
kozova1
2624a6e998 Added basic theming engine.
This theming engine uses a bytestring (but supports anything indexable,
as long as the index results are a byte long),
stored as `wasp.system._theme`.
It has a default value, which should not change anything about the way this looks currently.

The theme can be set via `wasp.system.set_theme`,
but this should *ONLY* be used in `main.py`.
`wasp.system.set_theme` will return True if it was successful,
or False if the theme is of an old format.
Using an old format theme will *not* crash the watch,
but will use the default theme instead.

To theme this, one has to use tools/themer.py (use flag -h for complete explanation)
to generate a bytestring that's added in main.py (see diff).

The bytestring is then loaded into 'wasp.system._theme'.
Theme values can be looked up by apps by using `wasp.system.theme("theme-key")`.
Theme keys appear in the function body of `wasp.system.theme()`.

I've took the liberty of converting existing apps to use this method,
and it seems to work well.

A test theme is provided in `tools/test_theme.py`

Signed-off-by: kozova1 <mug66kk@gmail.com>
2020-12-13 16:51:07 +00:00
Daniel Thompson
167173e9ba widgets: ConfirmationView: Allow the widget to manage its own visibility
When the buttons are pressed then the widget should be dismissed. There
is no reason to make the caller handle that.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-29 09:12:14 +00:00
Aidan Houlihan
393dfefc86 apps: pager: notifications: Added remove all notifications dialog
Signed-off-by: Aidan Houlihan <aidandhoulihan@gmail.com>
[daniel@redfelineninja.org.uk: Minor changes to .gitignore]
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-29 09:12:03 +00:00
Daniel Thompson
bfa715b488 widgets: clock: Improve the redraw logic
Currently if we wake the watch exactly N hours (where N is integer)
after it goes to sleep then the time will not be updated. Fix this the
obvious way.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-11-22 09:27:14 +00:00
Daniel Thompson
398ce598fc widgets: status: Add a status bar combo widget
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-21 21:28:09 +01:00
Daniel Thompson
9f3c75d512 widgets: battery: Fix a redraw bug
Currently if the real battery level is <5% then a redraw from scratch will
not draw the outline of the battery. Fix this by adding a special case for
negative previous states (-1 charging, -2 redraw).

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-21 21:10:16 +01:00
Daniel Thompson
6cd1e86295 widgets: clock: Add a simple clock widget
This is intended to be reused by any app that shows the clock as part
of the status bar at the top of the display.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-21 21:10:16 +01:00
Daniel Thompson
fc502cdcaa widgets: Rename StatusBar to NotificaitonBar
This is not (yet) a useful change but we'll be creating a new StatusBar
soon.

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-20 18:56:08 +01:00
Daniel Thompson
89d91f7e5b widgets: Fix a broken docstring
Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-10-10 21:42:51 +01:00
Daniel Thompson
326e06bc6b StatusBar: Rename and add BLE connection status icon
Notifier was a dumb name so make it better. Now that we have a decent
name it should be obvious how to handle the BLE connection status icon!

Signed-off-by: Daniel Thompson <daniel@redfelineninja.org.uk>
2020-07-24 17:04:46 +01:00
Daniel Thompson
a01fb7df57 Introduction basic notification support
This requires a modified version of Gadgetbridge and currently works by
implementing the BangleJS protocol.

In Gadgetbridge ensure "Sync time" is *not* set and choose "Don't pair"
when adding the PineTime device.
2020-07-19 20:50:33 +01:00
Daniel Thompson
d62e6a22c7 Fix symbol lookup error (knob2) 2020-06-04 22:57:50 +01:00
Daniel Thompson
de647b324c widgets: Introduce a slider widget
Currently the slider doesn't actually slide (because we process touch
events rather than swipe events) but we've called is a slider anyway.
2020-05-24 14:20:02 +01:00
Daniel Thompson
b8efcd3053 wasp: Even more docstrings 2020-05-14 22:29:35 +01:00
Daniel Thompson
2b5ebcef72 wasp: widgets: Add a scrolling indicator
As we enrich the navigation options we will increasinly need to visualize
between apps where up/down will switch us between rings and there
up/down is needed to scroll through content.
2020-04-06 22:04:21 +01:00
Daniel Thompson
b9fe31241c Add licensing information for all wasp-os files. 2020-03-22 15:40:18 +00:00
Daniel Thompson
031d139b7c wasp: draw565: Refactor to allow apps to focus on the drawable. 2020-03-09 00:00:13 +00:00
Daniel Thompson
1d8b900d40 waps: widgets: Improve the battery meter athtetics
Add some extra internal padding and draw the battery in red when
power is critically low.
2020-02-04 08:43:49 +00:00
Daniel Thompson
1f2c25a7bd wasp: clock: Add a simple battery meter 2020-02-03 22:35:16 +00:00