Browse Source

kivy: recreate context menu everytime an item is selected

283
ThomasV 9 years ago
parent
commit
b5b3679404
  1. 6
      gui/kivy/uix/screens.py

6
gui/kivy/uix/screens.py

@ -75,18 +75,16 @@ class CScreen(Factory.Screen):
self.hide_menu() self.hide_menu()
def hide_menu(self): def hide_menu(self):
if self.context_menu: if self.context_menu is not None:
self.remove_widget(self.context_menu) self.remove_widget(self.context_menu)
self.context_menu = None self.context_menu = None
def show_menu(self, obj): def show_menu(self, obj):
if self.context_menu is None: self.hide_menu()
self.context_menu = ContextMenu(obj, self.menu_actions) self.context_menu = ContextMenu(obj, self.menu_actions)
self.remove_widget(self.context_menu)
self.add_widget(self.context_menu) self.add_widget(self.context_menu)
class HistoryScreen(CScreen): class HistoryScreen(CScreen):
tab = ObjectProperty(None) tab = ObjectProperty(None)

Loading…
Cancel
Save