Skip to content

AVert/mirror-counter-sample-python

 
 

Repository files navigation

Counter for Glass

Sample counter Glassware written in Python.

Link to Online Demo

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.

Screenshots

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.

The list of counters in the web interface.

Clicking the green New Counter button will bring up a pop-up. Users can name their counter and initialize it at any number.

The pop-up that appears when users make a new counter.

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.

The subscription debugging page.

On Glass, each counter is a single timeline card.

A counter timeline card on glass.

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.

Increment menu option. Decrement menu option. Reset menu option.

About

A Mirror API sample project that illustrates the creation of a counter Glassware

Resources

License

Stars

Watchers

Forks

Packages

No packages published