Exemple #1
0
    def __init__(self, screen, interface):
        super(SendBox, self).__init__(screen, 21, 59, interface, tx_func=self._ok, cancel_func=self._cancel, name="sendbox", title="Send Crypto")

        layout = Layout([100])#, fill_frame=True)
        self.prepend_layout(layout)
        layout.add_widget(Text("To Address:", "address"))
        layout.add_widget(Divider(draw_line=False))
        self.everything_checkbox = CheckBox("Send Everything", on_change=self.checkbox_change)
        self.amount_text = Text("    Amount:", "amount", on_change=self.amount_change)
        layout.add_widget(self.amount_text)
        layout.add_widget(self.everything_checkbox)
        layout.add_widget(Divider(draw_line=False))


        balances = [{'name':'ETH', 'balance': interface.node.eth_balance}]
        balances += [x for x in interface.node.erc20_balances if x['balance'] > 0]

        currency_options = [(x['name'], x) for x in balances]

        logging.info(currency_options)
        logging.info(currency_options)

        self.estimated_gas = Decimal(21000)

        self.currency_listbox = ListBox(1, currency_options, label="  Currency:",  name="currency")
        layout.add_widget(self.currency_listbox)

        self.currency_balance_label = Label(self.currency_balance)
        layout.add_widget(self.currency_balance_label)

        layout.add_widget(Divider(draw_line=False))
        self.fix()
Exemple #2
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="Untracked files")
        self._model = model

        # Create the form for displaying the files.
        self._list_view = ListBox(Widget.FILL_FRAME,
                                  model.get_summary(),
                                  name="untracked_files",
                                  add_scroll_bar=True,
                                  on_select=self._delete_one)
        self._delete_button = Button("Delete All", 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])
        self.add_layout(layout2)
        layout2.add_widget(self._delete_button, 0)
        layout2.add_widget(Button("Quit", self._quit), 1)
        self._delete_button.disabled = True  # Not implemented
        self.fix()
Exemple #3
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="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,
            [(x["name"], i) for i, x in enumerate(self._model.contacts)],
            name="contacts",
            add_scroll_bar=True,
            on_change=self._on_pick,
            on_select=self._edit)
        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 #4
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()
Exemple #5
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 #6
0
    def __init__(self, screen, model):
        super(BranchListView, self).__init__(model,
                                             screen,
                                             screen.height * 9 // 10,
                                             screen.width * 9 // 10,
                                             on_load=self._reload_list,
                                             hover_focus=True,
                                             can_scroll=False,
                                             title="Branches")
        self._model = model

        # Create the form for displaying the list of branches.
        self._list_view = ListBox(Widget.FILL_FRAME,
                                  model.list_branches(),
                                  name="branches",
                                  add_scroll_bar=True,
                                  on_select=self.__checkout)

        self.add_navigation_header()
        self.add_divider()

        self.table_layout = Layout([100], fill_frame=True)
        self.add_layout(self.table_layout)
        self.table_layout.add_widget(self._list_view)
        self.table_layout.add_widget(Divider())

        self.add_shortcut_panel()
        self.fix()
Exemple #7
0
    def __init__(self, screen, model):
        super(CommitFilesView, self).__init__(model,
                                              screen,
                                              screen.height * 9 // 10,
                                              screen.width * 9 // 10,
                                              on_load=self._reload_list,
                                              hover_focus=True,
                                              can_scroll=False,
                                              title="Diff Files")
        self._model = model

        # Create the form for displaying the list of branches.
        self._list_view = ListBox(Widget.FILL_FRAME,
                                  model.list_files_in_current_commit(),
                                  name="diff_files",
                                  add_scroll_bar=True,
                                  on_select=self.__view_diff)

        self.add_navigation_header()
        self.add_divider()

        self.table_layout = Layout([100], fill_frame=True)
        self.add_layout(self.table_layout)
        self.table_layout.add_widget(self._list_view)

        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("Back", self._open_commits_view), 0)

        self.table_layout.add_widget(Divider())

        self.add_shortcut_panel()
        self.fix()
Exemple #8
0
    def __init__(self, screen, model: ModelController,
                 logger: LoggingController, ui: UIController):
        super(LogMenu, self).__init__(screen,
                                      height=screen.height // 4,
                                      width=screen.width,
                                      hover_focus=True,
                                      can_scroll=False,
                                      on_load=None,
                                      title="Logs",
                                      y=screen.height * 3 // 4)
        self._logger: LoggingController = logger
        self._model: ModelController = model
        self._ui: UIController = ui
        self._last_frame = 0
        self._theme = None
        self.set_theme(ui.theme)

        # Initialize Widgets
        self._log_list = ListBox(Widget.FILL_FRAME, [], add_scroll_bar=True)
        self._button = Button("Test", on_click=self._reload_frame)

        # Fix Widgets
        layout = Layout([1])
        self.add_layout(layout)
        layout.add_widget(self._log_list)
        # layout.add_widget(self._button)
        self._layout = layout

        # Fix the layouts to the Frame
        self.fix()
Exemple #9
0
    def __init__(self, screen, event_model):
        super(EventList, self).__init__(screen,
                                        screen.height // 2,
                                        screen.width // 2,
                                        on_load=self.reload,
                                        has_border=False,
                                        reduce_cpu=True)

        self.palette = palette

        self._model = event_model

        self.event_listbox = ListBox(Widget.FILL_FRAME,
                                     self._model.event_list,
                                     name="events",
                                     on_change=self._on_pick,
                                     on_select=self._select)

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

        layout0.add_widget(Label("EVENT LIST"))
        layout0.add_widget(Divider(draw_line=False))

        layout1 = Layout([50, 50])
        self.add_layout(layout1)

        stipulation = '%s%s' % ((' at %s' % self._model.venue['venue'])
                                if self._model.venue is not None else '',
                                (' featuring %s' % self._model.band['name'])
                                if self._model.band is not None else '')

        layout1.add_widget(
            Label("%i events found%s." % (self._model.count, stipulation)))
        layout1.add_widget(
            Label("%i other known bands featured (!)." %
                  self._model.count_of_other_bands))
        layout1.add_widget(
            Label("%i distinct venues featured." %
                  self._model.count_of_venues))
        layout1.add_widget(
            Label("%i venues not currently in the database (*)." %
                  self._model.count_of_new_venues))
        layout1.add_widget(Divider(draw_line=False))

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

        layout2.add_widget(self.event_listbox)
        layout2.add_widget(Divider(draw_line=False))

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

        layout3.add_widget(Button("Commit", self._commit), 1)
        layout3.add_widget(Button("Cancel", self._cancel), 2)

        self.fix()
Exemple #10
0
    def __init__(self, screen, interface):
        super(NetworkOptions, self).__init__(screen,
                                             8,
                                             26,
                                             y=2,
                                             has_shadow=True,
                                             is_modal=True,
                                             name="networkopts",
                                             title="Network Options",
                                             can_scroll=False)
        self.set_theme('shadowlands')
        self._interface = interface

        #debug(); pdb.set_trace()

        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        #layout.add_widget(Divider(draw_line=False))

        self._node = self._interface.node

        options = [
            ('Local node', 'connect_w3_local'),
            ('Custom infura', 'connect_w3_custom_infura'),
            ('Custom http', 'connect_w3_custom_http'),
            ('Custom websocket', 'connect_w3_custom_websocket'),
            ('Custom ipc', 'connect_w3_custom_ipc'),
            #('Custom Infura API Key', 'connect_w3_custom_infura'),
        ]
        listbox = ListBox(4, options, on_select=self._ok, name='netpicker')

        # Set listbox to match stored options
        for i, option in enumerate(options):
            if option[1] == self._interface._config.default_method:
                listbox._value = option[1]
                listbox._selection = i

        layout.add_widget(listbox)

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

        layout2.add_widget(Button("Cancel", self._cancel))
        #layout2.add_widget(Button("Connect", self._ok), 0)
        self.fix()
Exemple #11
0
 def _init_command_list(self):
     fields = []
     if self._model.current_machine:
         commands = self._model.get_queued_commands(
             self._model.current_machine)
         fields = [(item.command, i) for i, item in enumerate(commands)]
     return ListBox(Widget.FILL_FRAME,
                    options=fields,
                    name="commands",
                    label="Queued Commands")
Exemple #12
0
    def __init__(self, screen):
        super(GameView, self).__init__(screen,
                                       40,
                                       100,
                                       on_load=self._onload,
                                       hover_focus=True,
                                       can_scroll=False,
                                       title="Game Page")
        self.messages = []

        main_layout = Layout([7, 1, 2])
        self.add_layout(main_layout)
        self.my_label = Label("")  # my nick name
        main_layout.add_widget(self.my_label, 0)
        main_layout.add_widget(Label("messages:"), 0)
        msg_list = ListBox(30, self.messages, add_scroll_bar=True)
        # msg_list.disabled = True
        main_layout.add_widget(msg_list, 0)
        main_layout.add_widget(VerticalDivider(), 1)
        main_layout.add_widget(Label("online users:"), 2)
        main_layout.add_widget(Button("refresh", self._refresh_users), 2)
        global user_list
        self.list_users = ListBox(30, user_list,
                                  # [("老王的甜糕", 1), ("阿故的植物", 2), ("怡宝的鸭子", 3), ("凉妹子的iPad Mini", 4),
                                  #  ("当归的长发", 5),
                                  #  ],
                                  on_select=self._on_user_select)
        main_layout.add_widget(self.list_users, 2)

        div_layout = Layout([1])
        self.add_layout(div_layout)
        div_layout.add_widget(Divider())

        ctl_layout = Layout([1, 1, 1, 1])
        self.add_layout(ctl_layout)
        # TODO
        ctl_layout.add_widget(Button("战斗", self._fight), 0)
        ctl_layout.add_widget(Button("背包", self._package), 1)
        ctl_layout.add_widget(Button("信息", self._info), 2)
        ctl_layout.add_widget(Button("退出", self._quit), 3)
        # ctl_layout.add_widget(Button("test", None))
        self.fix()
Exemple #13
0
    def _create_layouts(self):
        top_layout = Layout([100], fill_frame=True)
        self.add_layout(top_layout)
        self._list_box = ListBox(self.screen.height * 2 // 3 - 4, [], name="packages")
        top_layout.add_widget(self._list_box)

        bottom_layout = Layout([20, 60, 20], fill_frame=False)
        self.add_layout(bottom_layout)
        bottom_layout.add_widget(Button("Exit", self._exit))
        bottom_layout.add_widget(Button("More", self._more), 2)
        self.fix()
Exemple #14
0
    def __init__(self, parent: "CustomFileBrowser"):
        """Create a popup with the list of options from the parent widget.

        Args:
            parent: the parent widget.
        """
        location = parent.get_location()
        if parent.frame.screen.height - location[1] < 3:
            height = min(len(parent.options) + 4, location[1] + 2)
            start_line = location[1] - height + 2
            reverse = True
        else:
            start_line = location[1] - 1
            height = min(
                len(parent.options) + 4,
                parent.frame.screen.height - location[1] + 1)
            reverse = False

        _TempPopup.__init__(
            self,
            parent.frame.screen,
            parent,
            location[0],
            start_line,
            parent.width,
            height,
        )

        layout = Layout([1], fill_frame=True)
        self.add_layout(layout)
        self._field = Text()
        self._field.disabled = True
        divider = Divider()
        divider.disabled = True
        self._list = ListBox(
            Widget.FILL_FRAME,
            parent.options,
            add_scroll_bar=len(parent.options) > height - 4,
            on_select=self.close,
            on_change=self._link,
        )
        layout.add_widget(self._list if reverse else self._field, 0)
        layout.add_widget(divider, 0)
        layout.add_widget(self._field if reverse else self._list, 0)
        self.fix()

        selected_name = parent.selection.name if parent.selection.is_file(
        ) else "."
        for p, i in self._list.options:
            if p == selected_name:
                self._list.value = i
                break
Exemple #15
0
 def _create_research_layout(self):
     research_layout = Layout([1, 1], fill_frame=False)
     # ...list of available research
     self._available_research = ListBox(
         10,
         [],
         on_change=self._on_research_selected,
     )
     self.add_layout(research_layout)
     research_layout.add_widget(Divider(), column=0)
     research_layout.add_widget(Label("Available Research"), column=0)
     research_layout.add_widget(self._available_research, column=0)
     research_layout.add_widget(Divider(), column=1)
Exemple #16
0
 def __init__(self, screen, msg: InventoryQuery):
     super().__init__(screen,
                      screen.height * 2 // 3,
                      screen.width * 2 // 3,
                      title=msg.title)
     self.msg = msg
     options = [(k, v) for k, v in msg.items]
     layout = Layout([
         1,
     ])
     self.add_layout(layout)
     self._list = ListBox(len(options), options, name="item")
     self._list.value = options[0][1]
     layout.add_widget(self._list, 0)
     self.fix()
    def __init__(self, screen, on_select=None):
        super().__init__(screen,
                         screen.height - 2,
                         max(min(screen.width // 8, 48), 16),
                         x=0,
                         reduce_cpu=True,
                         title="Feeds")

        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        self.list_box = ListBox(Widget.FILL_FRAME, [],
                                name="feeds",
                                on_select=on_select)
        layout.add_widget(self.list_box)
        self.fix()
Exemple #18
0
    def __init__(self, screen):
        super(ListView, self).__init__(screen,
                                       screen.height * 2 // 3,
                                       screen.width * 2 // 3,
                                       hover_focus=True,
                                       can_scroll=False,
                                       title="Scoreboard")
        # Save off the model that accesses the contacts database.

        # Create the form for displaying the list of contacts.
        self._list_view = ListBox(Widget.FILL_FRAME, [])
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(self._list_view)
        layout.add_widget(Divider())
        self.fix()
Exemple #19
0
    def __init__(self: ChatView, screen: Screen, model: MessageModel) -> None:
        self.stop = True

        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=True,
            title=self._("Чат"),
        )

        self._model = model

        self._send_message_button = Button(self._('Отправить сообщение'),
                                           self._send_message)
        self._back_button = Button(self._("Выйти"), self._back)

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

        self._messages_list = ListBox(
            Widget.FILL_FRAME,
            options=[],
            name="messages",
            # add_scroll_bar=True
        )
        self._input_form = Text(label="Сообщение:", name="message")

        layout.add_widget(Label(self._('Сообщения'), align='^'))
        layout.add_widget(self._messages_list)
        layout.add_widget(self._input_form)

        layout2 = Layout([1, 1])
        self.add_layout(layout2)
        layout2.add_widget(self._send_message_button, 0)
        layout2.add_widget(self._back_button, 1)
        self.fix()

        self.model_connected = False
Exemple #20
0
def demo(screen, scene):
    frame = Frame(screen,
                  screen.height // 3,
                  screen.width // 3,
                  hover_focus=True,
                  has_border=False,
                  title="Main Menu")

    frame.palette = palette

    layout3 = Layout([100])
    frame.add_layout(layout3)

    layout3.add_widget(Label("Test"), 0)
    layout3.add_widget(Divider(draw_line=False))

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

    layout1.add_widget(
        ListBox(Widget.FILL_FRAME, [("One", 1), ("Two", 3), ("Three", 2),
                                    ("Four", 4), ("Five", 5), ("Six", 6),
                                    ("Seven", 7), ("Eight", 8), ("Nine", 9),
                                    ("Ten", 10), ("Eleven", 11),
                                    ("Twelve", 12), ("Thirteen", 13),
                                    ("Fourteen", 14), ("Fifteen", 15),
                                    ("Sixteen", 16), ("Seventeen", 17),
                                    ("Eighteen", 18), ("Nineteen", 19),
                                    ("Twenty", 20), ("Loop", 1)],
                name="List Thing"))
    layout1.add_widget(Divider(draw_line=False))

    layout2 = Layout([1, 1, 1, 1])
    frame.add_layout(layout2)

    layout2.add_widget(Button("OK", leave), 1)
    layout2.add_widget(Button("Cancel", leave), 2)

    frame.fix()

    scenes = [Scene([frame], -1, name="Test")]

    screen.play(scenes, stop_on_resize=True, start_scene=scene)
Exemple #21
0
    def __init__(self, screen, model):
        super(GameFrame, self).__init__(screen,
                                        screen.height,
                                        screen.width,
                                        has_border=False)

        self._model = model
        self._statement = self._model.get_statement(1)
        self._picture = self._model.get_scene("start")

        self.palette = defaultdict(lambda: (Screen.COLOUR_WHITE, Screen.
                                            A_NORMAL, Screen.COLOUR_BLACK))
        for key in ["selected_focus_field", "label"]:
            self.palette[key] = (Screen.COLOUR_BLACK, Screen.A_BOLD,
                                 Screen.COLOUR_WHITE)
        self.palette["title"] = (Screen.COLOUR_BLACK, Screen.A_NORMAL,
                                 Screen.COLOUR_WHITE)

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

        self._answer_options = ListBox(Widget.FILL_FRAME,
                                       self._get_answers(),
                                       name="answer_options",
                                       on_select=self._on_select)

        self._picture_display = TextBox(16, as_string=True)
        self._picture_display.disabled = True

        self._remark = TextBox(2, as_string=True)
        self._remark.disabled = True

        self._statement_text = Text()
        self._statement_text.disabled = True

        layout.add_widget(self._picture_display)
        # layout.add_widget(Divider())
        layout.add_widget(self._remark)
        layout.add_widget(self._statement_text)
        layout.add_widget(self._answer_options)
        layout.add_widget(Label("Press `q` to quit."))

        self.fix()
Exemple #22
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,
                                       can_scroll=False,
                                       title="Deck")

        # Create the form for displaying the list of contacts.
        self._list_view = ListBox(
            Widget.FILL_FRAME,[("first option",1),("Second option", 2)],
            name="test",
            on_select=self._edit)
        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(self._list_view)
        self.fix()
        self._on_pick()
Exemple #23
0
    def __init__(self, screen, parsed_args):
        super(HistoryView, self).__init__(screen,
                                          screen.height,
                                          screen.width,
                                          on_load=self._update_preview,
                                          hover_focus=True,
                                          can_scroll=False,
                                          title="Respyte")

        theme = parsed_args.color_scheme
        self.set_theme(theme)
        # Create the form for displaying the list of contacts.
        history_layout = Layout([1])
        self.add_layout(history_layout)
        self.data['history'] = 0
        self.preview_box = Pager(
            screen.height // 2,
            label="Preview body",
            name="preview",
            line_wrap=True,
            as_string=True,
            tab_stop=False,
        )
        self.history_list = ListBox((screen.height // 2) - 4,
                                    self._history(),
                                    label="History",
                                    on_change=self._update_preview,
                                    on_select=self._update_preview,
                                    name="history")
        self._update_preview()
        history_layout.add_widget(self.history_list, 0)
        preview_layout = Layout([1])
        self.add_layout(preview_layout)
        preview_layout.add_widget(self.preview_box, 0)
        button_layout = Layout([1, 1, 1])
        self.add_layout(button_layout)
        button_layout.add_widget(Divider())
        button_layout.add_widget(Divider(), 1)
        button_layout.add_widget(Divider(), 2)
        button_layout.add_widget(Button("Select", self._select), 0)
        button_layout.add_widget(Button("Cancel", self._cancel), 2)

        self.fix()
    def _compose_layout(self):
        list_lay = Layout([1], fill_frame=True)
        self.add_layout(list_lay)
        list_lay.add_widget(
            ListBox(
                Widget.FILL_FRAME,
                list(self._model.screen_options.items()),
                name="list",
                add_scroll_bar=True,
                on_select=self._on_select,
            ))
        list_lay.add_widget(Divider())

        tx_buttons_lay = Layout([1, 1])
        self.add_layout(tx_buttons_lay)
        tx_buttons_lay.add_widget(Button("Proceed", on_click=self._on_select),
                                  0)
        tx_buttons_lay.add_widget(
            Button("Cancel", on_click=self._model.cancel), 1)
Exemple #25
0
    def __init__(self, screen: Screen, context: FavoritesVM):
        super().__init__(
            screen,
            screen.height,
            screen.width,
            has_border=False,
            hover_focus=True,
            can_scroll=False,
            on_load=self._on_load,
        )

        self.set_theme("user_theme")

        self._context = context
        self._context.on_property_changed.add(self._context_changed)
        self._context.on_order_changed.add(self._order_changed)

        self._list_box = ListBox(Widget.FILL_FRAME, [],
                                 on_select=self._on_select,
                                 on_change=self._on_changed)

        layout = Layout([20, 20, 20, 20, 20])
        self.add_layout(layout)
        layout.add_widget(Button("Bbsmenu", self._to_bbsmenu), 0)
        layout.add_widget(Button("Board", self._to_board), 1)
        layout.add_widget(Button("Thread", self._to_thread), 2)
        layout.add_widget(Button("Favorite", None, disabled=True), 3)
        layout.add_widget(Button("NG", self._to_ng), 4)

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

        layout = Layout([100], fill_frame=True)
        self.add_layout(layout)
        layout.add_widget(self._list_box)

        self.fix()

        self._selected_item = None
        self._list = self._context.list
        self._update_list()
    def __init__(self: ChatsListView, 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=True,
                         title=self._("Чат"),
                         on_load=self._reload_chats_list)

        self._model = model

        self._build_chat_button = Button(self._('Создать чат'),
                                         self._build_chat)
        self._enter_chat_button = Button(self._("Войти в чат"),
                                         self._enter_chat)
        self._reload_chats_button = Button(self._("Обновить список чатов"),
                                           self._reload_chats_list)
        self._back_button = Button(self._("Выйти"), self._back)

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

        self._chats_list = ListBox(Widget.FILL_FRAME,
                                   options=[],
                                   name="chats",
                                   on_select=self._enter_chat)

        layout.add_widget(Label(self._('Список чатов'), align='^'))
        layout.add_widget(self._chats_list)

        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(self._build_chat_button, 0)
        layout2.add_widget(self._enter_chat_button, 1)
        layout2.add_widget(self._reload_chats_button, 2)
        layout2.add_widget(self._back_button, 3)
        self.fix()
Exemple #27
0
    def __init__(self, screen, model):
        super(WorkingCopyView, self).__init__(model,
                                              screen,
                                              screen.height * 9 // 10,
                                              screen.width * 9 // 10,
                                              on_load=self._reload_list,
                                              hover_focus=True,
                                              can_scroll=False,
                                              title="Working copy")
        self._model = model
        screen.catch_interrupt = True

        self._list_view = ListBox(Widget.FILL_FRAME,
                                  model.changed_files_for_table(),
                                  name="working_copy",
                                  add_scroll_bar=True,
                                  on_select=self._add_to_index)

        self.add_navigation_header()
        self.add_divider()

        self.table_layout = Layout([100], fill_frame=True)
        self.add_layout(self.table_layout)
        self.table_layout.add_widget(self._list_view)
        self.table_layout.add_widget(Divider())

        self._commit_button = Button("Commit", self._commit)
        self._push_button = Button("Push", self._push)

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

        self.commit_message = Text("Commit message:", "commit_message")
        layout2.add_widget(self.commit_message, 0)
        layout2.add_widget(self._commit_button, 1)
        layout2.add_widget(self._push_button, 2)

        self.add_divider()

        self.add_shortcut_panel()
        self.fix()
Exemple #28
0
 def __init__(self,screen):
     super(MainView,self).__init__(screen,screen.height * 2 // 3, screen.width * 3 // 3, hover_focus=True,title="Main View")
     self._screen = screen
     self.main_button_layout = Layout([1])
     self.add_layout(self.main_button_layout)
     self.main_button_layout.add_widget(Label('Version:{0}'.format(get_versions()['version'])))
     self.main_button_layout.add_widget(Button("QUIT",self._quit))
     self.instrument_list_layout = Layout([1])
     height = 4
     options = cbp_instrument_options
     self.instrument_list_box = ListBox(height=height,options=options,on_select=self._instrument_select)
     self.add_layout(self.instrument_list_layout)
     self.instrument_list_layout.add_widget(self.instrument_list_box)
     self.status_layout = Layout([1,1])
     self.add_layout(self.status_layout)
     self.instument_text_dictionary = {}
     for idx, item in enumerate(cbp_instrument_list):
         instrument_text = Text("{0}".format(item),name=item,on_change=self._display_status)
         instrument_text.disabled = True
         self.instument_text_dictionary[item] = instrument_text
         self.status_layout.add_widget(instrument_text,0 if idx < 5 else 1)
     self.fix()
Exemple #29
0
    def __init__(self, screen, model):
        super(MenuListView, self).__init__(screen,
                                          screen.height * 2 // 3,
                                          screen.width * 2 // 3,
                                          hover_focus=True,
                                          title="Main Menu",
                                          reduce_cpu=True)

        self._list_view = ListBox(
            Widget.FILL_FRAME,
            self._get_items(),
            name="menu")
        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(self._list_view)
        layout2 = Layout([1, 1, 1, 1])
        self.add_layout(layout2)
        layout2.add_widget(Button("OK", self._ok), 0)

        self.fix()
Exemple #30
0
    def __init__(self, screen, controller, 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='Passwdn')
        # Save off the model that accesses the contacts database.
        self._model = model
        self._controller = controller
        self.set_theme('bright')
        self.palette['selected_focus_field'] = (Screen.COLOUR_WHITE,
                                                Screen.A_BOLD,
                                                Screen.COLOUR_GREEN)

        # Create the form for displaying the list of contacts.
        self._list_view = ListBox(
            Widget.FILL_FRAME,
            self._controller.get_list(),
            # model.get_summary(),
            name='store',
            add_scroll_bar=True,
            on_change=self._on_pick,
            on_select=self._edit)
        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()