Merge branch 'master' of ssh://github.com/kivy/kivy

This commit is contained in:
Mathieu Virbel 2012-12-16 13:47:46 +01:00
commit 050016cc96
2 changed files with 11 additions and 16 deletions

View File

@ -116,6 +116,7 @@
ScrollView:
id: kr_scroll
KivyRenderTextInput:
catalog: root
id: language_box
lexer: KivyLexer()
size_hint: 1, None

View File

@ -17,8 +17,6 @@ from kivy.clock import Clock
CATALOG_ROOT = os.path.dirname(__file__)
print Config.get('graphics', 'width')
Config.set('graphics', 'width', '1024')
Config.set('graphics', 'height', '768')
@ -69,7 +67,7 @@ class KivyRenderTextInput(CodeInput):
# This allows *either* ctrl *or* cmd, but not both.
if modifiers == ['ctrl'] or (is_osx and modifiers == ['meta']):
if key == ord('s'):
self.parent.parent.parent.change_kv(True)
self.catalog.change_kv(True)
return
super(KivyRenderTextInput, self)._keyboard_on_key_down(
@ -142,20 +140,16 @@ class Catalog(BoxLayout):
Builder._apply_rule(widget, parser.root, parser.root)
kv_container.add_widget(widget)
except (SyntaxError, ParserException) as e:
self.info_label.text = str(e)
self.anim = Animation(top=190.0, opacity=1, d=2, t='in_back') +\
Animation(top=190.0, d=2) +\
Animation(top=0, opacity=0, d=2)
self.anim.start(self.info_label)
except:
import traceback
traceback.print_exc()
popup = Popup(title="Boom",
content=Label(text='Something horrible happened while parsing'
+ 'your Kivy Language', text_size=(350, None),
size_hint=(None, None), size=(400, 400)))
popup.open()
self.show_error(e)
except Exception, e:
self.show_error(e)
def show_error(self, e):
self.info_label.text = str(e)
self.anim = Animation(top=190.0, opacity=1, d=2, t='in_back') +\
Animation(top=190.0, d=3) +\
Animation(top=0, opacity=0, d=2)
self.anim.start(self.info_label)
class KivyCatalogApp(App):
'''The kivy App that runs the main root. All we do is build a catalog