From cb1c6602f0c1c7e765d9fb35fdf59fbc17d22577 Mon Sep 17 00:00:00 2001 From: Thomas Sarlandie Date: Thu, 29 Aug 2013 20:49:24 -0700 Subject: [PATCH 1/4] Make sure sh version is the same as tintin-sdk requirements --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 726a0d6..cfc2780 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ twisted autobahn websocket-client -sh==1.04 +sh==1.08 pyserial>=2.6 # Only if using bluetooth connection to Pebble: # git+http://github.com/pebble/lightblue-0.4.git#egg=lightblue-0.4 From 9bf48987f1e37ea607fddf33cabb8f63b4c24eae Mon Sep 17 00:00:00 2001 From: Brad Murray Date: Wed, 4 Sep 2013 23:39:49 -0400 Subject: [PATCH 2/4] Add a usage of APP_LOG to the template app. Also clean up some window initialization/deinitialization --- pebble/PblProjectCreator.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pebble/PblProjectCreator.py b/pebble/PblProjectCreator.py index 60b26df..6931e97 100644 --- a/pebble/PblProjectCreator.py +++ b/pebble/PblProjectCreator.py @@ -139,9 +139,8 @@ def build(ctx): void handle_init(void) { window = window_create(); - window_stack_push(window, true /* Animated */); - window_set_click_config_provider(window, (ClickConfigProvider) config_provider); + window_stack_push(window, true /* Animated */); text_layer = text_layer_create(GRect(/* x: */ 0, /* y: */ 74, /* width: */ 144, /* height: */ 20)); @@ -151,12 +150,17 @@ def build(ctx): } void handle_deinit(void) { - text_layer_destroy(text_layer); + window_stack_remove(window, false /* Animated */); window_destroy(window); + + text_layer_destroy(text_layer); } int main(void) { handle_init(); + + APP_LOG(APP_LOG_LEVEL_DEBUG, "Done initializing, pushed window: %p", window); + app_event_loop(); handle_deinit(); } From 9199b78977ed8bbcf66779e1f995a42396312c89 Mon Sep 17 00:00:00 2001 From: Martijn The Date: Thu, 5 Sep 2013 18:11:39 -0700 Subject: [PATCH 3/4] Fixes: "pb-sdk list" fails if there are no installed apps. get_appbank_status() returns a dictionary with "apps" and "banks" keys. It can potentially throw an exception. The "No apps" message wasn't working before, because the call returns a dictionary even if there are no apps installed. --- pebble/LibPebblesCommand.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/pebble/LibPebblesCommand.py b/pebble/LibPebblesCommand.py index 97ceaf9..7072faa 100644 --- a/pebble/LibPebblesCommand.py +++ b/pebble/LibPebblesCommand.py @@ -73,13 +73,16 @@ def configure_subparser(self, parser): def run(self, args): LibPebbleCommand.run(self, args) - apps = self.pebble.get_appbank_status() - if apps is not False: - for app in apps['apps']: + try: + response = self.pebble.get_appbank_status() + apps = response['apps'] + if len(apps) == 0: + logging.info("No apps installed.") + return + for app in apps: logging.info('[{}] {}'.format(app['index'], app['name'])) - else: - logging.info("No apps.") - + except: + logging.error("Error getting apps list.") class PblRemoveCommand(LibPebbleCommand): name = 'rm' From a1c6f3456ee0327a9e550437f5bf88512c013edb Mon Sep 17 00:00:00 2001 From: Brad Murray Date: Fri, 6 Sep 2013 09:54:47 -0400 Subject: [PATCH 4/4] Revert deinit order in the example app --- pebble/PblProjectCreator.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pebble/PblProjectCreator.py b/pebble/PblProjectCreator.py index 6931e97..2baba99 100644 --- a/pebble/PblProjectCreator.py +++ b/pebble/PblProjectCreator.py @@ -150,10 +150,8 @@ def build(ctx): } void handle_deinit(void) { - window_stack_remove(window, false /* Animated */); - window_destroy(window); - text_layer_destroy(text_layer); + window_destroy(window); } int main(void) {