Exemplo n.º 1
0
 def show(self, render_fn=None):
     """Show the widget."""
     # Call render() method if exists
     if hasattr(self, "render"):
         self.render()
     if hasattr(self, "panel"):
         uni.show_panel(self.panel)
     uni.update_panels()
Exemplo n.º 2
0
    def display(self):
        #self.panel.top()
        uni.top_panel(self.panel)
        uni.show_panel(self.panel)
        #self.panel.show()
        uni.clear()  #self.window.clear()

        while True:
            uni.refresh()  #self.window.refresh()
            uni.doupdate()
            for index, item in enumerate(self.items):
                if index == self.position:
                    mode = uni.A_REVERSE
                else:
                    mode = uni.A_NORMAL

                msg = '%d. %s' % (index, item[0])
                uni.mvaddstr(1 + index, 1, msg, mode)

            key = uni.getch()

            if key in [uni.KEY_ENTER, ord('\n')]:
                if self.position == len(self.items) - 1:
                    break
                else:
                    self.items[self.position][1]()

            elif key == uni.KEY_UP:
                self.navigate(-1)

            elif key == uni.KEY_DOWN:
                self.navigate(1)

        uni.clear()  #self.window.clear()
        uni.hide_panel(self.panel)  #self.panel.hide()
        uni.update_panels()  #panel.update_panels()
        uni.doupdate()
Exemplo n.º 3
0
 def enable(self):
     if not self.enabled:
         self.locked_buttons = copy.copy(self.to_stay_lock)
         self.to_stay_lock = []
         show_panel(self.game_menu_interface_panel)
         self.enabled = True
Exemplo n.º 4
0
 def enable(self):
     if not self.enabled:
         self.enabled = True
         show_panel(self.game_field_panel)
Exemplo n.º 5
0
 def enable(self):
     if not self.enabled:
         self.enabled = True
         show_panel(self.game_stat_panel)
Exemplo n.º 6
0
 def enable(self):
     if not self.enabled:
         self.locked_topics = copy.copy(self.to_stay_lock)
         self.to_stay_lock = []
         show_panel(self.panel)
         self.enabled = True
Exemplo n.º 7
0
 def enable(self):
     if not self.enabled:
         self.locked_buttons = copy.copy(self.to_stay_lock)
         self.to_stay_lock = []
         show_panel(self.game_menu_interface_panel)
         self.enabled = True
Exemplo n.º 8
0
 def enable(self):
     if not self.enabled:
         self.enabled = True
         show_panel(self.game_field_panel)
Exemplo n.º 9
0
 def enable(self):
     if not self.enabled:
         self.enabled = True
         show_panel(self.game_stat_panel)
Exemplo n.º 10
0
 def enable(self):
     if not self.enabled:
         self.locked_topics = copy.copy(self.to_stay_lock)
         self.to_stay_lock = []
         show_panel(self.panel)
         self.enabled = True