Exemplo n.º 1
0
    def rr_popup(self, stdscr, error=False):
        """ Responce Chance Input """
        h, w = stdscr.getmaxyx()
        win, panel = self.make_panel(stdscr,
                                     4,
                                     20,
                                     h / 2,
                                     w / 2,
                                     "Response Chance\n",
                                     normal=False)
        curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)
        win.bkgd(' ', curses.color_pair(1))
        y, x = win.getyx()
        win.addstr(y, x, "must be 0-100:\n")

        text = CustomTextbox(win)
        curses.panel.update_panels()
        stdscr.refresh()
        result = text.edit()
        try:
            result = ''.join(x for x in result.split(':')[-1] if x.isdigit())
            r = float(result)
            if not r >= 0 or not r <= 100:
                raise ValueError('must be between 0 and 100')
            self.set_rr(r)
            self.output('set response chance to: %s' % result)
        except ValueError:
            self.rr_popup(stdscr, error=True)
Exemplo n.º 2
0
    def simspd_popup(self, stdscr, error=False):
        """ simulation speed (not working) """
        h,w = stdscr.getmaxyx()
        win, panel = self.make_panel(stdscr, 2,10, h/2,w/2, "Frequency\n", normal=False)
        curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)
        win.bkgd(' ', curses.color_pair(1))

        text = CustomTextbox(win)
        curses.panel.update_panels(); stdscr.refresh()
        result = text.edit()
        try:
            asyncfreq = float(result)
            self.output('set simspd to: %s' % asyncfreq)
        except ValueError:
            self.simspd_popup(stdscr, error=True)
Exemplo n.º 3
0
    def freq_popup(self, stdscr, error=False):
        """ Frequency Input """
        h,w = stdscr.getmaxyx()
        win, panel = self.make_panel(stdscr, 2,10, h/2,w/2, "Frequency\n", normal=False)
        curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)
        win.bkgd(' ', curses.color_pair(1))

        text = CustomTextbox(win)
        curses.panel.update_panels(); stdscr.refresh()
        result = text.edit()
        try:
            self.set_freq(float(result))
            self.output('set freq to: %s' % result)
        except ValueError:
            self.freq_popup(stdscr, error=True)
Exemplo n.º 4
0
    def rr_popup(self, stdscr, error=False):
        """ Responce Chance Input """
        h,w = stdscr.getmaxyx()
        win, panel = self.make_panel(stdscr, 4,20, h/2,w/2, "Response Chance\n", normal=False)
        curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)
        win.bkgd(' ', curses.color_pair(1))
        y,x = win.getyx()
        win.addstr(y,x, "must be 0-100:\n")

        text = CustomTextbox(win)
        curses.panel.update_panels(); stdscr.refresh()
        result = text.edit()
        try:
            result = ''.join(x for x in result.split(':')[-1] if x.isdigit())
            r = float(result)
            if not r>=0 or not r<=100:
                raise ValueError('must be between 0 and 100')
            self.set_rr(r)
            self.output('set response chance to: %s' % result)
        except ValueError:
            self.rr_popup(stdscr, error=True)
Exemplo n.º 5
0
    def simspd_popup(self, stdscr, error=False):
        """ simulation speed (not working) """
        h, w = stdscr.getmaxyx()
        win, panel = self.make_panel(stdscr,
                                     2,
                                     10,
                                     h / 2,
                                     w / 2,
                                     "Frequency\n",
                                     normal=False)
        curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)
        win.bkgd(' ', curses.color_pair(1))

        text = CustomTextbox(win)
        curses.panel.update_panels()
        stdscr.refresh()
        result = text.edit()
        try:
            asyncfreq = float(result)
            self.output('set simspd to: %s' % asyncfreq)
        except ValueError:
            self.simspd_popup(stdscr, error=True)
Exemplo n.º 6
0
    def freq_popup(self, stdscr, error=False):
        """ Frequency Input """
        h, w = stdscr.getmaxyx()
        win, panel = self.make_panel(stdscr,
                                     2,
                                     10,
                                     h / 2,
                                     w / 2,
                                     "Frequency\n",
                                     normal=False)
        curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE)
        win.bkgd(' ', curses.color_pair(1))

        text = CustomTextbox(win)
        curses.panel.update_panels()
        stdscr.refresh()
        result = text.edit()
        try:
            self.set_freq(float(result))
            self.output('set freq to: %s' % result)
        except ValueError:
            self.freq_popup(stdscr, error=True)