Example #1
0
    def new(self):
        self.parallel = TriState('unknown', 'yes', 'no')
        self.batteries = 'unknown'
        self.serial = TriState('unknown', 'odd', 'even')
        self.vowels = TriState('unknown', 'yes', 'no')
        self.car = TriState('unknown', 'yes', 'no')
        self.frk = TriState('unknown', 'yes', 'no')

        self.notify_list = []
Example #2
0
File: main.py Project: Ikke/ktane
    def new(self):
        self.parallel = TriState('unknown', 'yes', 'no')
        self.batteries = 'unknown'
        self.serial = TriState('unknown', 'odd', 'even')
        self.vowels = TriState('unknown', 'yes', 'no')
        self.car = TriState('unknown', 'yes', 'no')
        self.frk = TriState('unknown', 'yes', 'no')

        self.notify_list = []
Example #3
0
class Bomb(Window):
    def new(self):
        self.parallel = TriState('unknown', 'yes', 'no')
        self.batteries = 'unknown'
        self.serial = TriState('unknown', 'odd', 'even')
        self.vowels = TriState('unknown', 'yes', 'no')
        self.car = TriState('unknown', 'yes', 'no')
        self.frk = TriState('unknown', 'yes', 'no')

        self.notify_list = []

    def notify_on_finish(self, cb):
        self.notify_list.append(cb)

    def __str__(self):
        return "<BombData()>"

    def event(self, ev, c):
        if ascii.isdigit(ev):
            self.batteries = c
        elif c == 'p':
            self.parallel.toggle()
        elif c == 'v':
            self.vowels.toggle()
        elif c == 's':
            self.serial.toggle()
        elif c == 'f':
            self.frk.toggle()
        elif c == 'c':
            self.car.toggle()
        elif ev in [curses.KEY_ENTER, 10]:
            for cb in self.notify_list:
                cb(self)

    def update(self, win):
        win.erase()
        win.move(1, 0)
        win.clrtoeol()

        win.addstr("Provide basic bomb information:\n\n")
        win.addstr("Batteries: {}\n".format(self.batteries))
        win.addstr("Parralel:  {}\n".format(self.parallel))
        win.addstr("Serial:    {}\n".format(self.serial))
        win.addstr("Vowels:    {}\n".format(self.vowels))
        win.addstr("FRK:       {}\n".format(self.frk))
        win.addstr("CAR:       {}\n".format(self.car))
        win.addstr("\nPress enter to continue")
Example #4
0
File: main.py Project: Ikke/ktane
class Bomb(Window):
    def new(self):
        self.parallel = TriState('unknown', 'yes', 'no')
        self.batteries = 'unknown'
        self.serial = TriState('unknown', 'odd', 'even')
        self.vowels = TriState('unknown', 'yes', 'no')
        self.car = TriState('unknown', 'yes', 'no')
        self.frk = TriState('unknown', 'yes', 'no')

        self.notify_list = []

    def notify_on_finish(self, cb):
        self.notify_list.append(cb)

    def __str__(self):
        return "<BombData()>"

    def event(self, ev, c):
        if ascii.isdigit(ev):
            self.batteries = c
        elif c == 'p':
            self.parallel.toggle()
        elif c == 'v':
            self.vowels.toggle()
        elif c == 's':
            self.serial.toggle()
        elif c == 'f':
            self.frk.toggle()
        elif c == 'c':
            self.car.toggle()
        elif ev in [curses.KEY_ENTER, 10]:
            for cb in self.notify_list:
                cb(self)

    def update(self, win):
        win.erase()
        win.move(1,0)
        win.clrtoeol()

        win.addstr("Provide basic bomb information:\n\n")
        win.addstr("Batteries: {}\n".format(self.batteries))
        win.addstr("Parralel:  {}\n".format(self.parallel))
        win.addstr("Serial:    {}\n".format(self.serial))
        win.addstr("Vowels:    {}\n".format(self.vowels))
        win.addstr("FRK:       {}\n".format(self.frk))
        win.addstr("CAR:       {}\n".format(self.car))
        win.addstr("\nPress enter to continue")