From f9430b057f4103a7e3b18a509eab539d5de71123 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Wed, 2 Nov 2011 16:39:05 +0100 Subject: [PATCH] inspector: add module documentation + some fixes for live editing --- doc/autobuild.py | 1 + kivy/modules/inspector.py | 40 +++++++++++++++++++++++++-------------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/doc/autobuild.py b/doc/autobuild.py index 0718ffc73..1a170b7ab 100644 --- a/doc/autobuild.py +++ b/doc/autobuild.py @@ -39,6 +39,7 @@ import kivy.animation import kivy.modules.keybinding import kivy.modules.monitor import kivy.modules.touchring +import kivy.modules.inspector import kivy.network.urlrequest from kivy.factory import Factory diff --git a/kivy/modules/inspector.py b/kivy/modules/inspector.py index 74cb38029..35752df9a 100644 --- a/kivy/modules/inspector.py +++ b/kivy/modules/inspector.py @@ -402,26 +402,38 @@ class Inspector(FloatLayout): self.content.add_widget(content) def save_property_numeric(self, widget, key, index, instance, value): - if index >= 0: - getattr(widget, key)[index] = float(instance.text) - else: - setattr(widget, key, float(instance.text)) + try: + if index >= 0: + getattr(widget, key)[index] = float(instance.text) + else: + setattr(widget, key, float(instance.text)) + except: + pass def save_property_text(self, widget, key, index, instance, value): - if index >= 0: - getattr(widget, key)[index] = instance.text - else: - setattr(widget, key, instance.text) + try: + if index >= 0: + getattr(widget, key)[index] = instance.text + else: + setattr(widget, key, instance.text) + except: + pass def save_property_boolean(self, widget, key, index, instance, ): - value = instance.state == 'down' - if index >= 0: - getattr(widget, key)[index] = value - else: - setattr(widget, key, value) + try: + value = instance.state == 'down' + if index >= 0: + getattr(widget, key)[index] = value + else: + setattr(widget, key, value) + except: + pass def save_property_option(self, widget, key, instance, *l): - setattr(widget, key, instance.text) + try: + setattr(widget, key, instance.text) + except: + pass def create_inspector(win, ctx, *l):