Exemple #1
0
 def __init__(self, screen):
     super(ContactView, self).__init__(screen,
                                       screen.height * 2 // 3,
                                       screen.width * 2 // 3,
                                       hover_focus=True,
                                       title="Compose",
                                       reduce_cpu=True)
     layout = Layout([100], fill_frame=True)
     self.add_layout(layout)
     self._pow_txt = Text("Proof:", "pow")
     self._pow_txt.value = ''
     layout.add_widget(Text("To:", "recip", on_blur=self._api))
     layout.add_widget(Text("Subject:", "subject"))
     layout.add_widget(self._pow_txt)
     layout.add_widget(
         TextBox(Widget.FILL_FRAME,
                 "Body:",
                 "body",
                 as_string=True,
                 line_wrap=True))
     layout2 = Layout([1, 1, 1, 1])
     self.add_layout(layout2)
     layout2.add_widget(Button("Send", self._send), 0)
     layout2.add_widget(Button("Cancel", self._cancel), 3)
     self.fix()
    def __init__(self, screen, model):
        super(ContactView, self).__init__(screen,
                                          screen.height * 2 // 3,
                                          screen.width * 2 // 3,
                                          hover_focus=True,
                                          title="Contact Details",
                                          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)
        layout.add_widget(Text("Name:", "name"))
        layout.add_widget(Text("Address:", "address"))
        layout.add_widget(Text("Phone number:", "phone"))
        layout.add_widget(Text("Email address:", "email"))
        layout.add_widget(
            TextBox(Widget.FILL_FRAME,
                    "Notes:",
                    "notes",
                    as_string=True,
                    line_wrap=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()
    def __init__(self, screen, x, y, interface, tx_func=None, cancel_func=None, **kwargs):
        super(TransactionFrame, self).__init__(screen, x, y, can_scroll=False, has_shadow=True, is_modal=True, **kwargs)
        self.set_theme('shadowlands')
        self._interface = interface
        self._screen = screen
        self._gas_price_wei = None
        self._tx_func = tx_func

        # subclass sets this to Decimal(something)
        self.estimated_gas = None

        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        self.nonce_text = Text("     Nonce:", "nonce", default_value=str(self._interface.node.next_nonce()))
        layout.add_widget(self.nonce_text)
        layout.add_widget(Divider(draw_line=False))
        layout.add_widget(GasPricePicker(on_change=self._on_option_change, interface=interface))
        custgas = Text("   CustGas:", "custgas", on_change=self._on_text_change)
        custgas._is_disabled = True
        layout.add_widget(Divider(draw_line=False))
        layout.add_widget(custgas)
        layout.add_widget(Divider(draw_line=False))

        layout.add_widget(Label("", name='gas_est_label'))
        layout.add_widget(Divider(draw_line=False))

        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Sign Tx", self.validate), 0)
        layout2.add_widget(Button("Cancel", cancel_func), 3)

        self._on_option_change()
Exemple #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()
Exemple #5
0
    def __init__(self, screen, events):
        super(EventList, self).__init__(screen,
                                        screen.height // 3,
                                        screen.width // 3,
                                        has_border=False)

        self._events = events

        self.palette = palette

        layout1 = Layout([100])
        self.add_layout(layout1)

        layout1.add_widget(Label("Event List"))
        layout1.add_widget(Divider(draw_line=False))
        layout1.add_widget(Label("%i events found." % len(self._events)))

        layout2 = Layout([100], fill_frame=True)
        self.add_layout(layout1)

        layout2.add_widget(
            ListBox(Widget.FILL_FRAME,
                    [(event.event['name'], i)
                     for event, i in enumerate(self._events)]))
        layout2.add_widget(Divider(draw_line=False))

        layout3 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)

        layout3.add_widget(Button("OK", leave), 1)
        layout3.add_widget(Button("Cancel", leave), 2)
Exemple #6
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()
Exemple #7
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()
    def __init__(self: StartChatView, screen: Screen,
                 model: MessageModel) -> None:
        with open("client/config.json", "r") as file:
            data = json.loads(file.read())
            self._: Localizate = Localizate(data['lang'])

        super().__init__(screen,
                         screen.height * 2 // 3,
                         screen.width * 2 // 3,
                         hover_focus=True,
                         can_scroll=False,
                         title=self._("Вход"))

        self._model = model

        layout = Layout([100], fill_frame=False)
        self.add_layout(layout)

        layout.add_widget(Text(self._('Имя пользователя:'), 'username'))

        layout2 = Layout([1, 1])
        self.add_layout(layout2)
        self._start_chat_button = Button(self._('Начать чат'),
                                         self._start_chat)
        self._back_button = Button(self._('Назад'), self._back)
        layout2.add_widget(self._start_chat_button, 0)
        layout2.add_widget(self._back_button, 1)

        self.fix()
Exemple #9
0
    def __init__(self, screen, controller, model):
        super(DetailView, self).__init__(screen,
                                         screen.height * 2 // 5,
                                         screen.width * 2 // 5,
                                         hover_focus=True,
                                         can_scroll=False,
                                         reduce_cpu=True)
        # Save off the model that accesses the contacts database.
        self._model = model
        self._controller = controller
        self.set_theme('bright')

        # Create the form for displaying the list of contacts.
        layout = Layout([1, 10, 1], fill_frame=True)
        self.add_layout(layout)
        # TODO сделать регулярки для валидации
        layout.add_widget(Text('Name:', 'name'), 1)
        layout.add_widget(Text('Address:', 'address'), 1)
        layout.add_widget(Text('Nick name:', 'nickname'), 1)
        layout.add_widget(Text('Email address:', 'email'), 1)
        layout.add_widget(
            Text('Phone number:', 'telnumber', validator='^[+]?[0-9]*$'), 1)
        layout.add_widget(Text('Secret question:', 'secretquest'), 1)
        layout.add_widget(Text('Password:'******'password'), 1)
        # layout.add_widget(Button('gen', self._gen_pass), 2)
        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()
Exemple #10
0
    def __init__(
        self: RegistrationView, screen: Screen, model: MessageModel
    ) -> None:
        with open("client/config.json", "r") as file:
            data = json.loads(file.read())
            self._: Localizate = Localizate(data['lang'])

        super().__init__(
            screen,
            screen.height * 2 // 3,
            screen.width * 2 // 3,
            hover_focus=True,
            can_scroll=False,
            title=self._("Регистрация")
        )

        self._model = model

        layout = Layout([100], fill_frame=False)
        self.add_layout(layout)

        layout.add_widget(Text(self._('Имя пользователя:'), 'username'))
        layout.add_widget(Text(self._('Пароль:'), 'password'))

        layout2 = Layout([1, 1])
        self.add_layout(layout2)
        self._login_button = Button(self._('Регистрация'), self._registration)
        self._back_button = Button(self._('Назад'), self._back)
        layout2.add_widget(self._login_button, 0)
        layout2.add_widget(self._back_button, 1)

        self.fix()
Exemple #11
0
 def __init__(self, screen, model):
     super(EmailView, self).__init__(screen,
                                     screen.height,
                                     screen.width,
                                     has_shadow=True,
                                     name='Main View')
     self.data = {
         'subject': '',
         'from': '',
         'to': '',
         'body': '',
         'date': ''
     }
     self.model = model
     self.uid = None
     layout = Layout([10, 80, 80])
     self.add_layout(layout)
     layout.add_widget(Button('Back', self.back_click), column=0)
     layout.add_widget(Button('Reply', self.reply_click), column=2)
     layout = Layout([100])
     self.add_layout(layout)
     layout.add_widget(self._text('Subject', 'subject'))
     layout.add_widget(self._text('To', 'to'))
     layout.add_widget(self._text('From', 'from'))
     layout.add_widget(self._text('Date', 'date'))
     textbox = TextBox(screen.height - 4,
                       label='Body',
                       name='body',
                       as_string=True)
     layout.add_widget(textbox)
     self.fix()
Exemple #12
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=r"^[-]?\d+?\.\d+?$"), 1)
     layout.add_widget(
         Text(label="Latitude:", name="lat", validator=r"^[-]?\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()
Exemple #13
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="Session List")

        # Create the form for displaying the list of sessions.
        self._session_list = ListBox(
            Widget.FILL_FRAME,
            list_sessions(),
            name="Sessions",
            on_select=self._attach,
        )

        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(Divider())
        self._new_button = Button("[N]ew Session", self._new)
        layout.add_widget(self._new_button, 0)
        layout.add_widget(Divider())
        layout.add_widget(self._session_list)
        layout.add_widget(Divider())

        layout2 = Layout([1, 1, 1])
        self.add_layout(layout2)
        self._attach_button = Button("[A]ttach", self._attach)
        self._delete_button = Button("[D]elete", self._delete)
        self._quit_button = Button("[Q]uit", self._quit)
        layout2.add_widget(self._attach_button, 0)
        layout2.add_widget(self._delete_button, 1)
        layout2.add_widget(self._quit_button, 2)

        self.fix()
    def __init__(self, screen, model):
        super(ContactView, self).__init__(screen,
                                          screen.height * 2 // 3,
                                          screen.width * 2 // 3,
                                          hover_focus=False,
                                          title="Item details",
                                          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)
        layout.add_widget(Text("Name:", "name"))
        layout.add_widget(Text("Weight:", "weight"))
        layout.add_widget(Text("Modifiers:", "modifiers"))
        layout.add_widget(Text("Range:", "range"))
        layout.add_widget(Text("Damage:", "damage"))
        layout.add_widget(Text("Damage Type:", "damageType"))
        layout.add_widget(Text("Price:", "price"))
        layout.add_widget(Text("Rarity:", "rarity"))
        layout.add_widget(Text("Properties:", "properties"))
        layout.add_widget(
            TextBox(Widget.FILL_FRAME,
                    "Description:",
                    "description",
                    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()
Exemple #15
0
 def __init__(self,screen):
     super(BirgerView, self).__init__(screen,height=screen.height * 2 // 3, width=screen.width * 3 // 3, hover_focus=True,title="Birger View")
     self._screen = screen
     self.layout = Layout([1])
     self.add_layout(self.layout)
     self.layout.add_widget(Button("QUIT", self._quit))
     self.layout.add_widget(Button("GO BACK", self._go_back))
     self.layout2 = Layout([1,1])
     self.add_layout(self.layout2)
     self.focus_text = Text("Focus",on_change=self._display_focus)
     self.focus_text.disabled = True
     self.aperture_text = Text("Aperture",on_change=self._display_aperture)
     self.aperture_text.disabled = True
     self.set_focus_text = Text("Set Focus")
     self.set_aperture_text = Text("Set Birger")
     self.layout2.add_widget(self.focus_text,0)
     self.layout2.add_widget(Label(""),0)
     self.layout2.add_widget(Label(""),0)
     self.layout2.add_widget(self.aperture_text,0)
     self.layout2.add_widget(self.set_focus_text,1)
     self.layout2.add_widget(Button("SET FOCUS",self._focus_up),1)
     self.layout2.add_widget(Label(""),1)
     self.layout2.add_widget(self.set_aperture_text,1)
     self.layout2.add_widget(Button("SET APERTURE",self._aperture_up),1)
     self.fix()
Exemple #16
0
    def __init__(self, screen, controller, model):
        super(LoginView, self).__init__(
            screen,
            # screen.height * 2 // 6,
            15,
            # screen.width * 2 // 7,
            50,
            hover_focus=True,
            can_scroll=False,
            title='Sign in')
        # Save off the model that accesses the contacts database.
        self._model = model
        self._controller = controller
        self.set_theme('bright')

        layout = Layout([1, 3, 1], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(Text('Login:'******'login'), 1)
        # layout.add_widget(Divider(height=3), 1)
        layout.add_widget(Text('Password', name='password', hide_char='*'), 1)
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button('OK', self._ok), 0)
        layout2.add_widget(Button('Quit', self._quit), 3)
        self.fix()
Exemple #17
0
 def __init__(self,screen):
     super(FilterWheelView, self).__init__(screen,screen.height * 2 // 3, screen.width * 3 // 3, hover_focus=True,title="Filter Wheel View")
     self._screen = screen
     self.filters_dictionary = {None:"None",0:"568 nm inteference",1:"700 nm (10 nm)",2:"671 nm (10 nm)",3:"DECam (2.2 deg)",4:"680 nm (10 nm)"}
     self.masks_dictionary = {None:"None",0:"200 micron slit",1:"20 micron pinhole",2:"ronchi grating",3:"20 micron pinhole decam",4:"USAF target"}
     self.filter_options = [("568 nm inteference",0),("700 nm (10 nm)",1),("671 nm (10 nm)",2),("DECam (2.2 deg)",3),("680 nm (10 nm)",4)]
     self.mask_options = [("200 micron slit",0),("20 micron pinhole",1),("ronchi grating",2),("20 micron pinhole decam",3),("USAF target",4)]
     self.layout = Layout([1])
     self.add_layout(self.layout)
     self.layout.add_widget(Button("QUIT", self._quit))
     self.layout.add_widget(Button("GO BACK", self._go_back))
     self.layout2 = Layout([1,1])
     self.add_layout(self.layout2)
     self.mask_text = Text("Mask",on_change=self._display_mask)
     self.mask_text.disabled = True
     self.filter_text = Text("Filter", on_change=self._display_filter)
     self.filter_text.disabled = True
     self.filter_options_list_box = ListBox(label="Filter Options",height=len(self.filter_options),options=self.filter_options,on_select=self._select_filter)
     self.mask_options_list_box = ListBox(label="Mask Options",height=len(self.mask_options),options=self.mask_options,on_select=self._select_mask)
     self.set_mask_text = Text("Set Mask")
     self.set_mask_text.disabled = True
     self.set_filter_text = Text("Set Filter")
     self.set_filter_text.disabled = True
     self.set_filter = None
     self.set_mask = None
     self.layout2.add_widget(self.mask_text)
     self.layout2.add_widget(self.filter_text)
     self.layout2.add_widget(Label(""))
     self.layout2.add_widget(self.set_mask_text)
     self.layout2.add_widget(self.set_filter_text)
     self.layout2.add_widget(self.mask_options_list_box,1)
     self.layout2.add_widget(Label(""),1)
     self.layout2.add_widget(self.filter_options_list_box,1)
     self.layout2.add_widget(Button("SET FILTER AND MASK",self._set_filter_and_mask),1)
     self.fix()
Exemple #18
0
    def __init__(self, screen, model):
        super(TypeView, self).__init__(
            screen,
            screen.height,
            screen.width,
            hover_focus=True,
            title="Type Effectiveness Editor",
            # title=model.get_cur_type_name(),
            reduce_cpu=True,
        )
        # Save off the model that accesses the type database.
        self._model = model

        # Create the form for displaying the type effectivenesses.
        head = Layout([25, 50, 25])
        self.add_layout(head)
        head.add_widget(Text("Name:", "name"), 1)
        layout = Layout([4, 1, 4, 1], fill_frame=True)
        self.add_layout(layout)
        # layout.add_widget()
        layout.add_widget(Text("Address:", "address"))
        layout.add_widget(Text("Phone number:", "phone"))
        layout.add_widget(Text("Email address:", "email"))
        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()
Exemple #19
0
    def __init__(self, screen, model):
        '''
        Constructor
        '''
        super(MainMenuView, self).__init__(screen,
                                          screen.height,
                                          screen.width,
                                          hover_focus=True,
                                          can_scroll=False,
                                          title="Stock Manager",
                                          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([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(Button("Výpis skladu         ", self._listItems))
        layout.add_widget(Button("Import dat z e-shopu ", self._importFromShop))
        layout.add_widget(Button("Započíst objednávku  ", self._acountOrder))
        layout.add_widget(Button("Nastaveni            ", self._settings))
        layout.add_widget(Button("Konec                ", self._exit))
        """self._screen.add_effect(Clock(screen, 10, 10, 5))"""

        self.fix()
Exemple #20
0
    def __init__(self, screen):
        super(mainView, self).__init__(screen,
                                       screen.height * 2 // 3,
                                       screen.width * 2 // 3,
                                       hover_focus=True,
                                       title="music finder")

        self.fileslist = os.listdir()
        self.dirlist = [("up..", 0)]
        i = 1
        for l in self.fileslist:
            if os.path.isdir(l):
                self.dirlist.append((l, i))
                i += 1

        for l in self.fileslist:
            if l.endswith("mp3"):
                self.dirlist.append((l, i))
                i += 1

        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        lable1 = Label(self.curdir.format(os.getcwd()))
        layout.add_widget(Divider())
        flbr = ListBox(10, self.dirlist, on_select=self._enter, name="flb")
        button1 = Button("quit", self._quit)
        button2 = Button("Enter", self._enter)
        layout.add_widget(lable1)
        layout.add_widget(flbr)
        layout.add_widget(Divider())
        layout2 = Layout([1, 1])
        self.add_layout(layout2)
        layout2.add_widget(button1, 1)
        layout2.add_widget(button2, 0)
        self.fix()
Exemple #21
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()
Exemple #22
0
    def __init__(self, screen, channelModel, messageModel):
        super(View, self).__init__(screen,
                screen.height, screen.width,
                on_load=self._retrieve,
                title="Channel List")
        self._channelModel = channelModel
        self._messageModel = messageModel
        self._initialized = False

        self._list_view = ListBox(
            Widget.FILL_FRAME,
            channelModel.get_summary(),
            name="channels",
            add_scroll_bar=True,
            on_change=self._on_channel_pick)

        self._messageListView = ListBox(
            Widget.FILL_FRAME,
            messageModel.get_summary(),
            name="messages",
            add_scroll_bar=True,
            on_select=self._on_message_select,
            on_change=self._on_pick)

        layout = Layout([1, 8, 1])
        self.add_layout(layout)
        layout.add_widget(self._list_view, 0)
        layout.add_widget(self._messageListView, 1)
        layout.add_widget(Button("Refresh", self._retrieve), 2)
        layout.add_widget(Button("Export to CSV", self._quit), 2)
        layout.add_widget(Button("Quit", self._quit), 2)
        self.fix()
Exemple #23
0
    def __init__(self, screen, bf):
        super(BFView, self).__init__(screen,
                                     screen.height * 2 // 3,
                                     screen.width * 2 // 3,
                                     on_load=self.reload_program,
                                     hover_focus=True,
                                     can_scroll=False,
                                     title="Brainfuck")

        self.bf = bf

        print('initting...')
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        self.program_widget = ProgramWidget(self.bf.program, self.bf.counter)
        layout.add_widget(self.program_widget)
        layout.add_widget(Divider())
        self.tape_widget = TapeWidget(bf.tape, bf.head)
        layout.add_widget(self.tape_widget)
        layout.add_widget(Divider())
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        self.delay_field = Text(on_change=self.delay_changed)
        self.delay_field.value = '0.1'
        layout2.add_widget(self.delay_field, 0)
        self.auto_box = CheckBox('Auto', on_change=self.auto_changed)
        self.auto_box.value = False
        layout2.add_widget(self.auto_box, 1)
        next_button = Button("Next", self.next)
        layout2.add_widget(next_button, 2)
        quit_button = Button("Exit", self.quit)
        layout2.add_widget(quit_button, 3)
        self.fix()
Exemple #24
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()
Exemple #25
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()
Exemple #26
0
 def __init__(self, screen, contest):
     super(DemoFrame, self).__init__(screen,
                                     int(screen.height),
                                     int(screen.width),
                                     data=form_data,
                                     name="My Form")
     layout = Layout([4, 18, 1], fill_frame=True)
     self.problem_body = TextArea(Widget.FILL_FRAME, name="TA")
     self.problem_body.register_frame(self)
     self.problem_body.custom_colour = "title"
     self.contest = contest
     self.add_layout(layout)
     self._list_view = ListBox(
         10,
         name="problem_code",
         options=[(val, idx)
                  for idx, val in enumerate(contest.problem_codes)],
         on_change=self._list_change,
         on_select=self._list_change)
     layout.add_widget(self._list_view, 0)
     layout.add_widget(self.problem_body, 1)
     layout2 = Layout([1, 1, 1])
     self.add_layout(layout2)
     layout2.add_widget(Button("Quit", self._quit), 2)
     layout2.add_widget(Button("Submit", self._submit), 1)
     self.fix()
     self.palette = palette
     self._list_change()
    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()
Exemple #28
0
    def __init__(self: StartMenuView, screen: Screen) -> None:
        with open("client/config.json", "r") as file:
            data = json.loads(file.read())
            self._: Localizate = Localizate(data['lang'])

        super().__init__(screen,
                         screen.height * 2 // 3,
                         screen.width * 2 // 3,
                         hover_focus=True,
                         can_scroll=False,
                         title=self._("Чат"))

        self._reg_button = Button(self._('Зарегистрироваться'),
                                  self._registration)
        self._log_button = Button(self._('Войти'), self._login)
        self._quit_button = Button(self._('Закрыть'), self._quit)
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(
            Label(self._('Пожалуйста, войдите или зарегистрируйтесь'),
                  align='^',
                  height=screen.height * 2 // 3 // 2))

        layout2 = Layout([1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(self._reg_button, 0)
        layout2.add_widget(self._log_button, 1)
        layout2.add_widget(self._quit_button, 2)
        self.fix()
Exemple #29
0
    def __init__(self, screen):
        super(Action_choice, self).__init__(screen,
                                          screen.height * 1 // 8,
                                          screen.width * 1 // 2,
                                          hover_focus=True,
                                          on_load=self._setValue,
                                          title="Confirm action",
                                          reduce_cpu=True)

        # Create the form for displaying the list of contacts.
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        self.label = CLabel("Choose action on module {} {}")
        layout.add_widget(self.label)
        layout2 = Layout([1,1,1,1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Cancel", self._cancel), 0)
        self._ShowPasteBtn = Button("Show current paste", self._showpaste)
        layout2.add_widget(self._ShowPasteBtn, 1)
        self._killBtn = Button("KILL", self._kill)
        layout2.add_widget(self._killBtn, 2)
        layout2.add_widget(Button("START", self._start), 3)
        layout3 = Layout([1,1,1,1])
        self.add_layout(layout3)
        self.textEdit = Text("Amount", "amount")
        layout3.add_widget(self.textEdit, 3)

        self.fix()
Exemple #30
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()