Esempio n. 1
0
 def __init__(self, cmdline):
     ListBox.__init__(self)
     self.title = "clipboard"
     self.cmdline = cmdline
     self.textbox = TextBox()
     self.textbox.prompt = " Clipboard: "
     self.textbox.edithook = self.start
Esempio n. 2
0
 def __init__(self, name=None):
     Widget.__init__(self, name)
     self.message = ""
     self.options = []
     self.cursor = 0
     self.result = None
     self.listbox = ListBox()
     self.listbox.lb = -1
Esempio n. 3
0
 def __init__(self, cmdline):
     ListBox.__init__(self)
     self.title = "output"
     self.cmdline = cmdline
Esempio n. 4
0
 def __init__(self, cmdline):
     ListBox.__init__(self)
     self.title = "history"
     self.cmdline = cmdline
     self.source_string = self.cmdline.text
     self.lb = -1
Esempio n. 5
0
 def __init__(self):
     ListBox.__init__(self, "Help")
     self.indent = " " * 4
Esempio n. 6
0
 def __init__(self):
     ListBox.__init__(self, "ActionBox")
     self.selected = None
Esempio n. 7
0
 def __init__(self, cmdline):
     ListBox.__init__(self)
     self.cmdline = cmdline
     self.parser = None
     self.loadprograms()
     import_completion_functions()
Esempio n. 8
0
 def __init__(self, directory):
     ListBox.__init__(self)
     self.dir = directory
Esempio n. 9
0
 def __init__(self):
     ListBox.__init__(self)
     self.lb = -1
Esempio n. 10
0
 def __init__(self):
     ListBox.__init__(self, "Menu")
     self.title = ""
     self.current = None
Esempio n. 11
0
class Dialog(Widget):
    keymap = None

    def __init__(self, name=None):
        Widget.__init__(self, name)
        self.message = ""
        self.options = []
        self.cursor = 0
        self.result = None
        self.listbox = ListBox()
        self.listbox.lb = -1

    def refresh(self):
        pass

    def draw(self):
        pass

    def input(self, key):
        if key in self.keymap:
            self.keymap[key]()

    def show_listbox(self, entries):
        _entries = []
        for entry in entries:
            if isinstance(entry, Entry):
                _entries.append(entry)
            else:
                _entries.append(Entry(entry))
        self.listbox.show(_entries)

    def show(self, message, options, entries=None):
        if entries:
            self.show_listbox(entries)
        self.message = message
        self.options = options
        self.panel.show()

    def hide(self):
        self.listbox.hide()
        self.panel.hide()

    def get_result(self):
        self.result = self.cursor_entry()
        self.hide()

    def settop(self):
        self.cursor = 0

    def setbottom(self):
        self.cursor = len(self.options) - 1

    def mvcursor(self, amount):
        self.cursor += amount

    def setcursor(self, dist):
        self.cursor = dist

    def cursor_entry(self):
        return self.options[self.cursor]

    def fix_position(self):
        if self.cursor < 0:
            self.cursor = 0
        elif self.cursor >= len(self.options):
            self.cursor = len(self.options) - 1