Пример #1
0
 def __init__(self, screen, has_border=True, reduce_cpu=False):
     super(TestFrame, self).__init__(screen,
                                     screen.height,
                                     screen.width,
                                     name="Test Form",
                                     has_border=has_border,
                                     hover_focus=True,
                                     reduce_cpu=reduce_cpu)
     layout = Layout([1, 18, 1])
     self.add_layout(layout)
     self._reset_button = Button("Reset", self._reset)
     layout.add_widget(Label("Group 1:"), 1)
     layout.add_widget(TextBox(5,
                               label="My First Box:",
                               name="TA",
                               on_change=self._on_change), 1)
     layout.add_widget(
         Text(label="Text1:", name="TB", on_change=self._on_change), 1)
     layout.add_widget(
         Text(label="Text2:",
              name="TC",
              on_change=self._on_change,
              validator="^[0-9]*$"), 1)
     layout.add_widget(
         Text(label="Text3:",
              name="TD",
              on_change=self._on_change,
              validator=lambda x: x in ("", "a")), 1)
     layout.add_widget(Divider(height=2), 1)
     layout.add_widget(Label("Group 2:"), 1)
     layout.add_widget(RadioButtons([("Option 1", 1),
                                     ("Option 2", 2),
                                     ("Option 3", 3)],
                                    label="A Longer Selection:",
                                    name="Things",
                                    on_change=self._on_change), 1)
     layout.add_widget(CheckBox("Field 1",
                                label="A very silly long name for fields:",
                                name="CA",
                                on_change=self._on_change), 1)
     layout.add_widget(
         CheckBox("Field 2", name="CB", on_change=self._on_change), 1)
     layout.add_widget(
         CheckBox("Field 3", name="CC", on_change=self._on_change), 1)
     layout.add_widget(Divider(height=3), 1)
     layout2 = Layout([1, 1, 1])
     self.add_layout(layout2)
     layout2.add_widget(self._reset_button, 0)
     layout2.add_widget(Button("View Data", self._view), 1)
     layout2.add_widget(Button("Quit", self._quit), 2)
     self.fix()
Пример #2
0
    def __init__(self, screen, model, ui: UIController):
        super().__init__(screen,
                         height=screen.height // 2,
                         width=screen.width // 2,
                         can_scroll=False,
                         title="Add Command",
                         hover_focus=True)

        self._model: ModelInterface = model
        self._ui: UIController = ui
        self._theme = None
        self.set_theme(ui.theme)

        # Initialize Widgets
        self._confirm_button = Button("Confirm", self._confirm)
        self._cancel_button = Button("Cancel", self._cancel)
        self._ip_input = Text("IPs and/or subnet(s): ",
                              name="ips",
                              disabled=True)
        self._ip_input.value = self._model.current_machine
        self._command_type = RadioButtons([("Powershell", "ps"),
                                           ("DOS", "cmd"), ("Bash", "bash")],
                                          name="cmdtype",
                                          label="Command Type: ")
        # self._or = Text("OR", disabled=True)
        # self._hostname_input = Text("Hostname(s):", name="hostnames")
        self._command_input = TextBox(Widget.FILL_FRAME,
                                      label="Command(s): \n(one per line)",
                                      name="commands",
                                      line_wrap=True)

        # Create and Generate Layouts
        layout = Layout([1], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(self._ip_input)
        layout.add_widget(self._command_type)
        # layout.add_widget(self._or)
        # layout.add_widget(self._hostname_input)
        layout.add_widget(Divider())
        layout.add_widget(self._command_input)
        layout.add_widget(Divider())

        button_layout = Layout([1, 1])
        self.add_layout(button_layout)
        button_layout.add_widget(self._confirm_button, 0)
        button_layout.add_widget(self._cancel_button, 1)

        # Save Layouts
        self.fix()
Пример #3
0
    def __init__(self, screen, model):
        super(EntityListView, self).__init__(
            screen,
            screen.height,
            screen.width,
            on_load=self._reload_list,
            hover_focus=False,
            can_scroll=False,
            title="",
        )

        self.set_theme("custom")

        self._model = model

        self._entity_list_view = MultiColumnListBox(
            Widget.FILL_FRAME,
            ["<24", "<64"],
            model.get_children(),
            name="entities",
            on_change=self._on_pick,
            on_select=self._enter_child,
        )
        self._quantities_list_view = MultiColumnListBox(
            10,
            ["<24", "<64"],
            model.get_quantities(),
            name="quantities",
            on_change=self._on_pick,
            on_select=self._enter_quantity,
        )

        entity_list_layout = Layout([100], fill_frame=True)
        self.add_layout(entity_list_layout)
        entity_list_layout.add_widget(self._entity_list_view)
        entity_list_layout.add_widget(Divider())

        details_layout = Layout([100])
        self.add_layout(details_layout)
        details_layout.add_widget(self._quantities_list_view)
        details_layout.add_widget(Divider())

        button_row_layout = Layout([1, 1, 1, 1])
        self.add_layout(button_row_layout)
        button_row_layout.add_widget(Button("Quit", self._quit), 3)

        self._refresh_status()
        self.fix()
        self._on_pick()
Пример #4
0
    def __init__(self, screen, model):
        super(ProcessOrdersView, self).__init__(screen,
                                          screen.height,
                                          screen.width,
                                          on_load=self._reload_list,
                                          hover_focus=True,
                                          can_scroll=False,
                                          title="Zauctovat objednavky",
                                          reduce_cpu=True)
        # Save off the model that accesses the contacts database.
        self._model = model

        # Create the form for displaying the list of contacts.
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        self._list_view = MultiColumnListBox(
            height=Widget.FILL_FRAME,
            options=model.orders.get_orders(), 
            columns=("25%", "25%", "25%", "25%"),
            titles=("ID", "Datum", "Stav", "Celkova cena"),
            name="actions",
            add_scroll_bar=True,
            on_change=None,
            on_select=self._on_select)
        layout.add_widget(self._list_view)
        layout.add_widget(Divider())
        layout2 = Layout([1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Zauctovat vse", self._apply_all), 0)
        layout2.add_widget(Button("Zpět", self._back), 1)

        self.fix()
Пример #5
0
    def __init__(self, screen, model):
        '''
        Constructor
        '''
        super(LoadOrdersView, self).__init__(screen,
                                          5,
                                          60,
                                          hover_focus=True,
                                          can_scroll=False,
                                          title="Importovat objednavky",
                                          reduce_cpu=True)
        # Save off the model that accesses the contacts database.
        self._model = model
        self._screen = screen

        # Create the form for displaying the list of contacts.
        layout = Layout([2], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(Text("Adresa XML:", "xmlUrl"))
        layout.add_widget(Divider())
        layout2=Layout([1,1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Nacist", self._load), 0)
        layout2.add_widget(Button("Zpet", self._back), 1)

        self.reset()
        self.fix()
Пример #6
0
    def __init__(self, screen, model):
        super(ListView, self).__init__(screen,
                                       screen.height * 2 // 3,
                                       screen.width * 2 // 3,
                                       on_load=self._reload_list,
                                       hover_focus=True,
                                       title="Contact List")
        # Save off the model that accesses the contacts database.
        self._model = model

        # Create the form for displaying the list of contacts.
        self._list_view = ListBox(Widget.FILL_FRAME,
                                  model.get_summary(),
                                  name="contacts",
                                  on_change=self._on_pick)
        self._edit_button = Button("Edit", self._edit)
        self._delete_button = Button("Delete", self._delete)
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(self._list_view)
        layout.add_widget(Divider())
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Add", self._add), 0)
        layout2.add_widget(self._edit_button, 1)
        layout2.add_widget(self._delete_button, 2)
        layout2.add_widget(Button("Quit", self._quit), 3)
        self.fix()
        self._on_pick()
Пример #7
0
    def _update_ball_devices(self, **kwargs):
        del kwargs
        # TODO: do not create widgets. just update contents
        self.ball_device_widgets = []
        self.ball_device_widgets.append(Label("BALL COUNTS"))
        self.ball_device_widgets.append(Divider())

        try:
            for pf in self.machine.playfields.values():
                widget = Label('{}: {} '.format(pf.name, pf.balls))
                if pf.balls:
                    widget.custom_colour = "pf_active"
                else:
                    widget.custom_colour = "pf_inactive"
                self.ball_device_widgets.append(widget)

        except AttributeError:
            pass

        for bd in self.ball_devices:
            widget = Label('{}: {} ({})'.format(bd.name, bd.balls, bd.state))
            if bd.balls:
                widget.custom_colour = "pf_active"
            else:
                widget.custom_colour = "pf_inactive"

            self.ball_device_widgets.append(widget)

        self.ball_device_widgets.append(Label(""))

        self._layout_change = True
        self._schedule_draw_screen()
Пример #8
0
    def __init__(self, screen, model):
        super(ListView, self).__init__(screen,
                                       screen.height * 2 // 3,
                                       screen.width * 2 // 3,
                                       on_load=self._reload_list,
                                       hover_focus=True,
                                       can_scroll=False,
                                       title="SSH LIST")
        # Save off the model that accesses the contacts database.
        self._model = model

        # Create the form for displaying the list of contacts.
        self._list_view = ListBox(Widget.FILL_FRAME,
                                  model.get_summary(),
                                  name="contacts",
                                  add_scroll_bar=True)
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(self._list_view)
        layout.add_widget(Divider())
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Connect", self._connect), 0)
        layout2.add_widget(Button("Quit", self._quit), 3)
        self.fix()
Пример #9
0
 def add_label_row(self, labels, layout=[1, 1, 1, 1], add_divider=True):
     lyt = Layout(layout)
     self.add_layout(lyt)
     for b in labels:
         lyt.add_widget(Label(b[0]), b[1])
     if add_divider:
         lyt.add_widget(Divider(draw_line=False))
Пример #10
0
    def _create_resources_layout(self):
        status_layout = Layout([1, 1], fill_frame=False)
        # ...the resources list
        self._resources_list = MultiColumnListBox(
            10,  # Height
            ["<12", ">10"],
            [],
        )
        self._resources_list.disabled = True

        # ...then the 2 special occupations
        self._special_occupation_list = MultiColumnListBox(
            2,  # Height
            ["<12", ">10"],
            [],
        )
        self._special_occupation_list.disabled = True

        # ...then the occupation list
        self._occupation_list = MultiColumnListBox(
            10,  # Height
            ["<12", ">10"],
            [],
        )
        self.add_layout(status_layout)
        status_layout.add_widget(Label("Resources"), column=0)
        status_layout.add_widget(self._resources_list, column=0)
        status_layout.add_widget(Label("Workers"), column=1)
        status_layout.add_widget(self._special_occupation_list, column=1)
        status_layout.add_widget(Divider(), column=1)
        status_layout.add_widget(self._occupation_list, column=1)
Пример #11
0
 def __init__(self, screen, init_values):
     super(TestFrame2, self).__init__(screen,
                                      screen.height,
                                      screen.width,
                                      title="Test Frame 2")
     # Create the form for displaying the list of contacts.
     self._list_view = ListBox(
         Widget.FILL_FRAME,
         init_values,
         name="contacts",
         on_change=self._on_pick)
     self._edit_button = Button("Edit", self._edit)
     self._delete_button = Button("Delete", self._delete)
     layout = Layout([100], fill_frame=True)
     self.add_layout(layout)
     layout.add_widget(self._list_view)
     layout.add_widget(Divider())
     layout2 = Layout([1, 1, 1, 1])
     self.add_layout(layout2)
     layout2.add_widget(Button("Add", self._add), 0)
     layout2.add_widget(self._edit_button, 1)
     layout2.add_widget(self._delete_button, 2)
     layout2.add_widget(Button("Quit", self._quit), 3)
     self.fix()
     self._on_pick()
Пример #12
0
    def _compose_query_common_layout(self):
        divider_layout = Layout([1])
        self.add_layout(divider_layout)
        divider_layout.add_widget(Divider())
        divider_layout.add_widget(DynamicLabel(name="proto_status"))

        self._compose_created_time_layout()

        common_layout = Layout([5, 13])
        self.add_layout(common_layout)
        common_layout.add_widget(Label("Creator account id"), 0)
        common_layout.add_widget(
            Text(
                name=".payload.meta.creator_account_id", validator=account_id_validator
            ),
            1,
        )
        common_layout.add_widget(Label("Query counter"), 0)
        common_layout.add_widget(
            Text(name=".payload.meta.query_counter", validator=uint32_validator), 1
        )

        common_layout.add_widget(Label("Query type"), 0)
        common_layout.add_widget(
            DropdownList(
                options=self._model.query_type_options,
                on_change=self._on_query_type_change,
                name="query_type",
            ),
            1,
        )

        self._compose_signature_layout()
Пример #13
0
    def __init__(self, screen, data):
        super(StartupView, self).__init__(screen, min(screen.height, 43), min(screen.width, 132),
                                          hover_focus=True,
                                          title=_("EH Forwarder Bot Setup Wizard"),
                                          reduce_cpu=True)

        self._model = data
        self.set_theme("bright")
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        label_text = _("Checking Python version... OK\n"
                       "Checking master channels... OK\n"
                       "Checking slave channels... OK\n"
                       "\n"
                       "Welcome to EH Forwarder Bot Setup Wizard.  This program "
                       "will guide you to finish up the last few steps to "
                       "get EFB ready to use.\n"
                       "\n"
                       "To use this wizard in another supported language, "
                       "please change your system language or modify the "
                       "language environment variable and restart the wizard.\n"
                       "\n"
                       "Confirm the profile name to use below and "
                       "select \"Next\" to continue.\n\n")
        h = get_height(label_text, screen.width)
        layout.add_widget(Label(label_text, height=h))

        self.profile = Text("Profile", "profile")
        self.profile.value = self._model.profile
        layout.add_widget(self.profile)
        layout.add_widget(Divider(height=4))

        layout.add_widget(Button(_("Next"), self._ok))
        self.fix()
Пример #14
0
    def __init__(self, screen):
        super(DemoFrame, self).__init__(screen, screen.height, screen.width)

        # Create the widgets for the demo.
        layout = Layout([1, 18, 1], fill_frame=True)
        self.add_layout(layout)
        self._term_out = TextBox(Widget.FILL_FRAME, line_wrap=True, parser=AnsiTerminalParser())
        layout.add_widget(self._term_out, 1)
        layout.add_widget(Divider(height=2), 1)
        layout2 = Layout([1, 15, 3, 1])
        self.add_layout(layout2)
        self._term_in = Text()
        layout2.add_widget(self._term_in, 1)
        layout2.add_widget(Button("Run", self._run), 2)
        self.fix()
        self.set_theme("monochrome")

        # Open a pseudo TTY to control the interactive session.  Make it non-blocking.
        self._master, slave = pty.openpty()
        fl = fcntl.fcntl(self._master, fcntl.F_GETFL)
        fcntl.fcntl(self._master, fcntl.F_SETFL, fl | os.O_NONBLOCK)

        # Start the shell and thread to pull data from it.
        self._shell = subprocess.Popen(["bash", "-i"], preexec_fn=os.setsid, stdin=slave, stdout=slave, stderr=slave)
        self._lock = threading.Lock()
        self._thread = threading.Thread(target=self._background)
        self._thread.daemon = True
        self._thread.start()
Пример #15
0
 def __init__(self, screen):
     super(ListView, self).__init__(screen,
                                    screen.height * 2 // 3,
                                    screen.width * 2 // 3,
                                    on_load=self._reload_list,
                                    hover_focus=True,
                                    title="Inbox")
     self._list_view = ListBox(Widget.FILL_FRAME,
                               recv.build_option(IMAP_EP, USER, PASS),
                               name="emails",
                               on_change=self._on_pick)
     self._view_button = Button("View", self._view)
     self._delete_button = Button("Delete", self._delete)
     layout = Layout([100], fill_frame=True)
     self.add_layout(layout)
     layout.add_widget(Label(recv.get_header()))
     layout.add_widget(self._list_view)
     layout.add_widget(Divider())
     layout2 = Layout([1, 1, 1, 1, 1])
     self.add_layout(layout2)
     layout2.add_widget(Button("Refresh", self._update_cb), 0)
     layout2.add_widget(self._view_button, 2)
     layout2.add_widget(self._delete_button, 3)
     layout2.add_widget(Button("Compose", self._compose), 1)
     layout2.add_widget(Button("Quit", self._quit), 4)
     self.fix()
     self._on_pick()
Пример #16
0
    def __init__(self, screen, model):
        super(ContactView, self).__init__(screen,
                                          screen.height * 75 // 100,
                                          screen.width * 75 // 100,
                                          hover_focus=True,
                                          title="Login Details",
                                          reduce_cpu=True,
                                          y=1)
        # Save off the model that accesses the contacts database.
        self._model = model

        # Create the form for displaying the list of contacts.
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)

        layout.add_widget(Text("Login:"******"login"))
        layout.add_widget(Text("Group:", "lgroup"))
        layout.add_widget(Text("Username:"******"username"))
        layout.add_widget(Text("Loginlink:", "link"))
        layout.add_widget(Text("Email address:", "email"))
        layout.add_widget(Text("Length:", "length"))
        layout.add_widget(Divider())
        layout.add_widget(
            TextBox(Widget.FILL_FRAME, "Notes:", "notes", as_string=True))
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("OK", self._ok), 0)
        layout2.add_widget(Button("Cancel", self._cancel), 3)
        self.fix()
Пример #17
0
def inject_voting_state(layout, col=0):
    layout.add_widget(Label('Voting'), col)
    layout.add_widget(Divider(line_char='-'), col)
    layout.add_widget(Text('Address:', 'voting_address'), col)
    layout.add_widget(Text('Owner:', 'voting_owner'), col)
    # TODO in the actual upcoming live implementation figure out how to dynamically set the height
    layout.add_widget(TextBox(3, label='Candidates:', name='voting_candidates'), col)
Пример #18
0
 def add_label_with_button(self, label_text, button_text, button_fn, add_divider=True, layout=[70, 30]):
     _layout = Layout(layout)
     self.add_layout(_layout)
     _layout.add_widget(Label(label_text), 0) 
     _layout.add_widget(Button(button_text, button_fn), 1) 
     if add_divider:
         _layout.add_widget(Divider(draw_line=False))
Пример #19
0
    def __init__(self, screen):
        super().__init__(screen,
                         int(screen.height),
                         int(screen.width),
                         on_load=self._reload_list,
                         hover_focus=True,
                         can_scroll=False,
                         title="PyPadberg")

        layout_discr = Layout([1, 10, 1])
        self.add_layout(layout_discr)
        layout_discr.add_widget(
            Label("\nProcessing Logs", height=3, align="^"), 1)

        layout_div_1 = Layout([100])
        self.add_layout(layout_div_1)
        layout_div_1.add_widget(Divider())
        # Create the form for displaying the list of contacts.
        self._list_view = ListBox(
            Widget.FILL_FRAME,
            PADBERG.get_summary(),
            name="processing-log",
            add_scroll_bar=True,
        )
        layout = Layout([1, 15, 1], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(self._list_view, 1)

        layout2 = Layout([1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Continue", self._continue), 1)

        self.fix()
Пример #20
0
 def add_break(self):
     """
     Simply add a layout with a horizontal line across the frame
     """
     br = Layout([100])
     self.add_layout(br)
     br.add_widget(Divider())
Пример #21
0
 def __init__(self, screen, longitude, latitude, on_ok):
     super(EnterLocation, self).__init__(
             screen, 7, 40, data={"long": str(longitude), "lat": str(latitude)}, name="loc",
             title="Enter New Location", is_modal=True)
     self._on_ok = on_ok
     layout = Layout([1, 18, 1])
     self.add_layout(layout)
     layout.add_widget(Divider(draw_line=False), 1)
     layout.add_widget(Text(label="Longitude:", name="long", validator="^[-]?\d+?\.\d+?$"), 1)
     layout.add_widget(Text(label="Latitude:", name="lat", validator="^[-]?\d+?\.\d+?$"), 1)
     layout.add_widget(Divider(draw_line=False), 1)
     layout2 = Layout([1, 1, 1])
     self.add_layout(layout2)
     layout2.add_widget(Button("OK", self._ok), 1)
     layout2.add_widget(Button("Cancel", self._cancel), 2)
     self.fix()
Пример #22
0
    def __init__(self, screen, controller):
        super(LoadStartListView, self).__init__(screen,
                                          screen.height * 2 // 3,
                                          screen.width * 2 // 3,
                                          hover_focus=True,
                                          title="Load Start List",
                                          reduce_cpu=True)

        self._file_browser = FileBrowser(
            Widget.FILL_FRAME,
            ".",
            name="fileBrowser",
            on_select=self._ok)
        self._ok_button = Button("Ok", self._ok)
        self._cancel_button = Button("Cancel", self._cancel)
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(Label("Start list should be in a UTF-8 text file with the format '[number],[competitor name],[category],[team name]"))
        layout.add_widget(Divider())
        layout.add_widget(self._file_browser)
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("OK", self._ok), 0)
        layout2.add_widget(Button("Cancel", self._cancel), 3)
        self._controller = controller
        self.fix()
Пример #23
0
 def add_label_pair(self, label0_text, label1_text, add_divider=True):
     layout = Layout([1, 1])
     self.add_layout(layout)
     layout.add_widget(Label(label0_text), 0) 
     layout.add_widget(Label(label1_text), 1) 
     if add_divider:
         layout.add_widget(Divider(draw_line=False))
Пример #24
0
    def __init__(self, screen, handler, result):
        super(MainView, self).__init__(screen,
                                       screen.height * 1,
                                       screen.width * 1,
                                       hover_focus=True,
                                       title="Testing software")

        layout2 = Layout([1, 1, 1], fill_frame=False)

        self.handler = handler
        self.result = result
        self.add_layout(layout2)
        layout2.add_widget(Label("Select an option"), 1)

        self.init_values = [("Hardware information", 0),
                            ("Functional tests", 1), ("Summary", 2)]

        self._list_view = ListBox(4, self.init_values, on_change=self._on_pick)
        layout2.add_widget(self._list_view, 1)
        layout2.add_widget(Divider())

        layout = Layout([1, 1], fill_frame=False)
        self.add_layout(layout)
        self._ok_button = Button("OK", self._ok_button)

        layout.add_widget(self._ok_button)
        layout.add_widget(Button("Quit", self._quit), 1)

        self.fix()
        self._on_pick()
Пример #25
0
 def add_button_row(self, buttons, layout=[1, 1, 1, 1], add_divider=True):
     lyt = Layout(layout)
     self.add_layout(lyt)
     for b in buttons:
         lyt.add_widget(Button(b[0], b[1]), b[2])
     if add_divider:
         lyt.add_widget(Divider(draw_line=False))
Пример #26
0
    def __init__(self, screen, model):
        '''
        Constructor
        '''
        super(StockView, self).__init__(screen,
                                          screen.height,
                                          screen.width,
                                          hover_focus=True,
                                          can_scroll=False,
                                          title="Vypis skladu",
                                          reduce_cpu=True)
        # Save off the model that accesses the contacts database.
        self._model = model

        # Create the form for displaying the list of contacts.
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        self._list_view = MultiColumnListBox(
            height=Widget.FILL_FRAME,
            options=model.stock.get_stock_summary(), 
            columns=("50%", "50%"),
            titles=("Nazev", "Sklad [ks]"),
            name="products",
            add_scroll_bar=True,
            on_change=None,
            on_select=self._on_select)
        layout.add_widget(self._list_view)
        layout.add_widget(Divider())
        layout2 = Layout([1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Zpět", self._back))

        self.fix()
        self.reset()
Пример #27
0
    def _mode_change(self, *args, **kwargs):
        # Have to call this on the next frame since the mode controller's
        # active list isn't updated yet
        del args
        del kwargs
        self.mode_widgets = []
        self.mode_widgets.append(Label("ACTIVE MODES"))
        self.mode_widgets.append(Divider())
        try:
            modes = self.machine.mode_controller.active_modes
        except AttributeError:
            modes = None

        if modes:
            for mode in modes:
                self.mode_widgets.append(
                    Label('{} ({})'.format(mode.name, mode.priority)))
        else:
            self.mode_widgets.append(Label("No active modes"))

        # empty line at the end
        self.mode_widgets.append(Label(""))

        self._layout_change = True
        self._schedule_draw_screen()
Пример #28
0
    def __init__(self, screen, model):
        super(SellHistoryView, self).__init__(screen,
                                          screen.height,
                                          screen.width,
                                          on_load=self._reload_list,
                                          hover_focus=True,
                                          can_scroll=False,
                                          title="Historie prodejů",
                                          reduce_cpu=True)
        # Save off the model that accesses the contacts database.
        self._model = model

        # Create the form for displaying the list of contacts.
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        self._list_view = MultiColumnListBox(
            height=Widget.FILL_FRAME,
            options=model.stock.get_sell_history(), 
            columns=("50%", "50%"),
            titles=("Datum", "Ks."),
            name="Sales",
            add_scroll_bar=True,
            on_change=None,
            on_select=None)
        layout.add_widget(self._list_view)
        layout.add_widget(Divider())
        layout2 = Layout([1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Zpět", self._back))

        self.fix()
Пример #29
0
    def _update_player(self, **kwargs):
        del kwargs
        self._player_widgets = []
        self._player_widgets.append(Label("CURRENT PLAYER"))
        self._player_widgets.append(Divider())

        try:
            player = self.machine.game.player
            self._player_widgets.append(
                Label('PLAYER: {}'.format(player.number)))
            self._player_widgets.append(Label('BALL: {}'.format(player.ball)))
            self._player_widgets.append(
                Label('SCORE: {:,}'.format(player.score)))
        except AttributeError:
            self._player_widgets.append(Label("NO GAME IN PROGRESS"))
            return

        player_vars = player.vars.copy()
        player_vars.pop('score', None)
        player_vars.pop('number', None)
        player_vars.pop('ball', None)

        names = self.config.get('player_vars', player_vars.keys())
        for name in names:
            self._player_widgets.append(
                Label("{}: {}".format(name, player_vars[name])))

        self._layout_change = True
        self._schedule_draw_screen()
Пример #30
0
    def __init__(self, screen, model):
        super(ProcessXMLFeedView, self).__init__(screen,
                                          screen.height,
                                          screen.width,
                                          on_load=self._reload_list,
                                          hover_focus=True,
                                          can_scroll=False,
                                          title="Aplikovat zmeny",
                                          reduce_cpu=True)
        # Save off the model that accesses the contacts database.
        self._model = model

        # Create the form for displaying the list of contacts.
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        self._list_view = MultiColumnListBox(
            height=Widget.FILL_FRAME,
            options=model.xmlFeed.get_actions(), 
            columns=("50%", "50%"),
            titles=("Produkt", "Akce"),
            name="actions",
            add_scroll_bar=True,
            on_change=None,
            on_select=self._on_select)
        layout.add_widget(self._list_view)
        layout.add_widget(Divider())
        layout2 = Layout([1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Aplikovat vse", self._apply_all), 0)
        layout2.add_widget(Button("Zpět", self._back), 1)


        self.fix()