Sample counter Glassware written in Python.
To create a counter, a user accesses a web UI hosted on Google App Engine and sets a name and starting number. Counters appear on Glass devices as timeline items with the options to increment, decrement, reset, share, and delete.
This Glassware demonstrates how to use the timelineItem.sourceItemId field of a timeline item and JSON serialization to associate variables (custom fields) with timeline items. This technique can be used with Jinja2 to automatically generate html and display these custom fields. The file custom_item_fields provides functions to enable this capability. The main handler and notification handler demonstrate how to use these methods.
Note: This is a snapshot sample. That means that although we think you will find it useful, it is not being actively maintained. Pull requests are always apprecaited.
In the web interface, users see a list of their counters and can rename (set counter name and counter number), delete, and reset each counter.
Clicking the green New Counter button will bring up a pop-up. Users can name their counter and initialize it at any number.
A interface at /subscribe
allows users to debug their Glassware's timeline
subscription. The Glassware must be subscribed in order for Counter to work
on Glass. This feature is meant for developer testing.
On Glass, each counter is a single timeline card.
Clicking on the timeline card allows users to scroll through increment, decrement, and reset to 0 custom menu options as well as the share, pin, and delete built-in menu options.