コード例 #1
0
class CheckSits(Screen):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.next_screen = False

        instr = ScrollLabel(txt_sits, size_hint=(0.3, 1), textcolor='#FFFFFF')
        lbl1 = ScrollLabel('Сделайте 30 приседаний', textcolor='#FFFFFF')
        self.lbl_sits = Sits(30, textcolor='#FFFFFF')
        self.run = Runner(total=30,
                          steptime=1.5,
                          size_hint=(0.4, 1),
                          lcolor=(0.44, 0.44, 0.44, 1))
        self.run.bind(finished=self.run_finished)

        line = ColoredLayout(lcolor=(0, 0.5, 0.01, 1))
        vlay = BoxLayout(orientation='vertical', size_hint=(0.3, 1))
        vlay.add_widget(lbl1)
        vlay.add_widget(self.lbl_sits)
        line.add_widget(instr)
        line.add_widget(vlay)
        line.add_widget(self.run)

        self.btn = Button(text='Начать',
                          size_hint=(0.3, 0.2),
                          pos_hint={'center_x': 0.5})
        self.btn.background_color = btn_color
        self.btn.on_press = self.next

        outer = BoxLayout(orientation='vertical', padding=8, spacing=8)
        outer.add_widget(line)
        outer.add_widget(self.btn)

        self.add_widget(outer)

    def run_finished(self, instance, value):
        self.btn.set_disabled(False)
        self.btn.text = 'Продолжить'
        self.next_screen = True

    def next(self):
        if not self.next_screen:
            self.btn.set_disabled(True)
            self.run.start()
            self.run.bind(value=self.lbl_sits.next)
        else:
            self.manager.current = 'pulse2'
コード例 #2
0
ファイル: view.py プロジェクト: hmurari/pytest-gui
    def __init__(self, root):
        self._project = None
        self.executor = None

        # Root window
        self.root = root
        self.root.title('ASD Test Interface')
        self.root.geometry('1024x768')
        self.root.option_add('*tearOff', FALSE)

        # Catch the close button
        self.root.protocol("WM_DELETE_WINDOW", self.cmd_quit)
        # Catch the "quit" event.
        self.root.createcommand('exit', self.cmd_quit)

        # Setup the menu
        self._setup_menubar()

        # Set up the main content for the window.
        self._setup_button_toolbar()
        self._setup_main_content()
        self._setup_status_bar()

        # Now configure the weights for the root frame
        self.root.columnconfigure(0, weight=1)
        self.root.rowconfigure(0, weight=0)
        self.root.rowconfigure(1, weight=1)
        self.root.rowconfigure(2, weight=0)

        # Set up listeners for runner events.
        Runner.bind('test_status_update', self.on_executorStatusUpdate)
        Runner.bind('test_start', self.on_executorTestStart)
        Runner.bind('test_end', self.on_executorTestEnd)
        Runner.bind('suite_end', self.on_executorSuiteEnd)
        Runner.bind('suite_error', self.on_executorSuiteError)

        # Now that we've laid out the grid, hide the error and output text
        # until we actually have an error/output to display
        self._hide_test_output()
        self._hide_test_errors()