1. quanon
  2. kivy-catalog

Commits

Dusty Phillips  committed 43d52c7

Add listeners to the tab headers so the kv box gets the right content on tab change

  • Participants
  • Parent commits d55399e
  • Branches master

Comments (0)

Files changed (2)

File kivycatalog.kv

View file
             tab_pos: "left_top"
             default_tab_text: "Introduction"
             default_tab_content: introduction_tab
+            on_default_tab: root.show_kv(*args)
+
 
             Accordion:
                 id: introduction_tab
             TabbedPanelHeader:
                 text: 'Layouts'
                 content: layout_tab
-
+                on_state: root.show_kv(*args)
             TabbedPanelHeader:
                 text: 'UX Widgets'
                 content: basic_widgets
-
+                on_state: root.show_kv(*args)
             TabbedPanelHeader:
                 text: 'Complex'
                 content: complex_widgets
+                on_state: root.show_kv(*args)
 
             Accordion:
                 id: layout_tab

File main.py

View file
         '''Called when an accordionitem is collapsed or expanded. If it
         was expanded, we need to show the .kv language file associated with
         the newly revealed container.'''
+        if collapsed == "down":  # a tabbed panel was clicked, not an accordion
+            object = object.content.children[0]
+            collapsed = False
         if not collapsed and hasattr(object, "kv_container"):
+            print "called"
             with open(object.kv_container.kv_file) as file:
                 self.language_box.text = file.read()
                 self.kv_container = object.kv_container