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_created_time_layout(self): time_layout = Layout([5, 9, 4]) self.add_layout(time_layout) time_layout.add_widget(Label("Created time"), 0) time_layout.add_widget( Text(name=".payload.meta.created_time", validator=uint64_validator), 1 ) time_layout.add_widget( Button("Use Now", on_click=lambda: 0), 2 # TODO: implement )
def inject_footer(self): """ Every detail has at least the <Dashboard> control in it. The other 4 slots are open for use... """ self.add_break() # create a row of controls controls = Layout([1, 1, 1, 1, 1]) self.add_layout(controls) controls.add_widget(Button('Dashboard', self.dashboard), 4)
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)
def add_navigation_header(self): self.nav_header = Layout([1, 1, 1, 1]) self.add_layout(self.nav_header) self.nav_header.add_widget(Button("Branches", self._open_branch_view), 0) self.nav_header.add_widget(Button("History", self._open_commits_view), 1) self.nav_header.add_widget( Button("Commit", self._open_working_copy_view), 2) self.nav_header.add_widget(Button("Quit", self._quit), 3)
def __init__(self, screen): super(ListView, self).__init__(screen, int(screen.height * 0.95), int(screen.width * 0.95), hover_focus=True, can_scroll=False, title="Contact List") self._edit_button = Button("Edit", self._quit) self._delete_button = Button("Delete", self._quit) layout = Layout([100], fill_frame=True) self.add_layout(layout) 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._delete_button, 2) layout2.add_widget(Button("Quit", self._quit), 3) self.fix()
def _create_help_layout(self): help_layout = Layout([1], fill_frame=True) self.add_layout(help_layout) help_layout.add_widget(Divider()) # ...the help widget itself self._help = TextBox(height=3, label="Help: ", as_string=True) self._help.value = "TEST" self._help.disabled = True help_layout.add_widget(self._help) help_layout.add_widget(Divider())
def add_radiobuttons(self, options, default_value=None, layout=[100], layout_index=0, add_divider=True, **kwargs): _layout = Layout(layout) self.add_layout(_layout) radiobuttons_widget = RadioButtons(options, **kwargs) _layout.add_widget(radiobuttons_widget, layout_index) if add_divider: _layout.add_widget(Divider(draw_line=False)) if default_value is not None: radiobuttons_widget._value = default_value return lambda: radiobuttons_widget.value
def _compose_layout(self): nav_lay = Layout([1, 1, 1]) self.add_layout(nav_lay) nav_lay.add_widget(Label("Go to:")) nav_lay.add_widget(Button("Main menu", self._model.go_back), 1) nav_lay.add_widget( Button("Queries manager", self._model.go_to_query_manager), 2) layout = Layout([1], fill_frame=True) self.add_layout(layout) layout.add_widget(Divider()) layout.add_widget(self._transactions_list) layout.add_widget(Divider()) buttons = Layout([1] * 8) self.add_layout(buttons) self._send_button = Button("Send", self._send_txs) self._status_button = Button("Status", self._get_tx_statuses) self._remove_button = Button("Remove!", self._remove_txs) self._batch_button = Button("Batch", self._batch_txs) self._sign_button = Button("Sign", self._sign_txs) self._gen_block_button = Button("GenBlock", self._save_genesis_block) buttons.add_widget(Button("Create", self._create_tx), 0) buttons.add_widget(self._send_button, 1) buttons.add_widget(self._status_button, 2) buttons.add_widget(self._remove_button, 3) buttons.add_widget(Button("Sav/Ld", self.dummy, disabled=True), 4) buttons.add_widget(self._batch_button, 5) buttons.add_widget(self._sign_button, 6) buttons.add_widget(self._gen_block_button, 7) help_messages = Layout([1]) self.add_layout(help_messages) label1 = Label( "[Return] to edit, [Space] to pick several, [Esc] to go to main menu", align="^", ) label2 = Label( "Q - quorum, B - batch size, " "C - commands quantity, S - signatures quantity", align="^", ) help_messages.add_widget(Divider()) help_messages.add_widget(label2) help_messages.add_widget(label1)
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)
def add_textbox(self, label_text, default_value=None, add_divider=True, **kwargs): layout = Layout([100]) self.add_layout(layout) text_widget = Text(label_text, **kwargs) if default_value is not None: text_widget._value = default_value layout.add_widget(text_widget) if add_divider: layout.add_widget(Divider(draw_line=False)) return lambda: text_widget._value
def add_listbox(self, height, options, default_value=None, on_select=None, layout=[100], layout_index=0, add_divider=True, **kwargs): _layout = Layout(layout) self.add_layout(_layout) list_widget = ListBox(height, options, on_select=on_select, **kwargs) _layout.add_widget(list_widget, layout_index) if add_divider: _layout.add_widget(Divider(draw_line=False)) if default_value is not None: list_widget._value = default_value return lambda: list_widget.value
def __init__(self, screen, interface): super(ValueOptions, self).__init__(screen, 15, 24, y=2, has_shadow=True, is_modal=True, name="valueopts", title="Value display", can_scroll=False) self.set_theme('shadowlands') self._interface = interface layout = Layout([100], fill_frame=True) self.add_layout(layout) layout.add_widget(Divider(draw_line=False)) self._node = self._interface.node options = [] currencies = self._interface.price_poller.eth_prices for k in currencies.keys(): options.append((k, k)) #debug(); pdb.set_trace() radiobuttons = RadioButtons(options, name='valuepicker') # Set radiobox to match stored options for i, option in enumerate(options): if option[1] == self._interface._config.displayed_currency: radiobuttons._value = option[1] radiobuttons._selection = i layout.add_widget(radiobuttons) layout2 = Layout([1, 1]) self.add_layout(layout2) layout2.add_widget(Button("Cancel", self._cancel), 1) layout2.add_widget(Button("Select", self._ok), 0) self.fix()
def __init__(self, screen, model): super(FilterView, self).__init__(screen, screen.height * 2 // 3, screen.width * 2 // 3, hover_focus=True, title="Filters", reduce_cpu=True) self._model = model self.data["filter_finished"] = 0 self.data["filter_due"] = 0 self.data["filter_category"] = -2 self._finished_rbutton = RadioButtons([("All", 0), ("Finished", 1), ("Unfinished", 2)], label="Finished:", name="filter_finished") self._due_rbutton = RadioButtons([("None", 0), ("Closest", 1), ("Farthest", 2)], label="Due Sort:", name="filter_due") self._category_ddlist = DropdownList([("ALL", -2), ("", -1)], label="Category:", name="filter_category") self._apply_button = Button("Apply", self._apply) self._back_button = Button("Back", self._back) layout = Layout([100], fill_frame=True) self.add_layout(layout) layout.add_widget(self._finished_rbutton) layout.add_widget(Divider()) layout.add_widget(self._due_rbutton) layout.add_widget(Divider()) layout.add_widget(self._category_ddlist) layout.add_widget(Divider()) layout2 = Layout([1, 1, 1, 1]) self.add_layout(layout2) layout2.add_widget(self._apply_button, 0) layout2.add_widget(self._back_button, 3) self.fix()
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()
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()
def __init__(self, screen): super(SettingsView, self).__init__(screen, screen.height, screen.width, hover_focus=True, title="Keys setup", reduce_cpu=True) self.data = data.settings layout = Layout([100], fill_frame=True) self.add_layout(layout) layout.add_widget(Text("token:", "token")) layout.add_widget(Text("token_secret:", "token_secret")) layout.add_widget(Text("consumer_key:", "consumer_key")) layout.add_widget(Text("consumer_secret", "consumer_secret")) layout2 = Layout([1, 1]) self.add_layout(layout2) layout2.add_widget(Button("Quit", self._quit), 0) layout2.add_widget(Button("Next", self._next), 1) self.fix()
def __init__(self, screen, model): super(ExceptionView, self).__init__(model, screen, screen.height * 9 // 10, screen.width * 9 // 10, hover_focus=True, can_scroll=False, title="Error", reduce_cpu=True) self._model = model layout = Layout([100], fill_frame=True) self.add_layout(layout) self._header = TextBox(20, as_string=True) self._header.disabled = True self._header.custom_colour = "label" layout.add_widget(self._header) layout2 = Layout([1, 1, 1, 1]) self.add_layout(layout2) layout2.add_widget(Button("OK", self._ok), 0) self.fix()
def _compose_help_layout(self): help_layout = Layout([1]) self.add_layout(help_layout) help_layout.add_widget(Label( "[Return] to edit, [Space] to pick several, [Esc] to go to main menu", align="^", )) help_layout.add_widget(Label( "S - signature status (+ if valid, - if invalid, <blank> if not present)", align="^", ))
def inject_header(self): """ detail-wide gas price setter and a cpl open slots... """ header = Layout([33, 34, 33]) self.add_layout(header) header.add_widget( Text(label='Gas Price:', name='gas_price', on_change=self.on_changed), 1) self.add_break()
def __init__(self,screen): super(KeithleyView, self).__init__(screen,screen.height * 2 // 3, screen.width * 3 // 3, hover_focus=True,title="Keithley 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.keithley_text = Text("Keithley 1: ",on_change=self._display_keithley_1) self.keithley_text.disabled = True self.duration_text = Text("Duration") self.timeseries_text = Text("Timeseries Last Value:") self.timeseries_text.disabled = True self.layout2.add_widget(self.keithley_text) self.layout2.add_widget(Button("GET READING",self._get_photodiode_reading)) self.layout2.add_widget(self.duration_text,1) self.layout2.add_widget(self.timeseries_text,1) self.layout2.add_widget(Button("Get Timeseries",self._get_timeseries),1) self.fix()
def __init__(self, screen, recipe): name = recipe['title'] image_url = recipe['image'] self.missed_ingredients = recipe['missedIngredients'] self.recipie_id = recipe['id'] used_ingredients = recipe['usedIngredients'] super(Recipie, self).__init__(screen, int(screen.height) - 10, int(screen.width // 2), x=(int(screen.width // 2) - 5), has_shadow=True) layout = Layout([1]) self.add_layout(layout) layout.add_widget(Label(name, align='^', height=2), 0) layout.add_widget(Divider(height=1), 0) layout2 = Layout([1, 1]) self.add_layout(layout2) layout2.add_widget(Label("Used Ingrediants", height=2), 0) for used_ingredient in used_ingredients: layout2.add_widget(Label(f" - {used_ingredient['name']}"), 0) layout2.add_widget(Label("", height=1), 0) layout2.add_widget( Label("Ingrediants Required From the Groccery Store", height=2), 0) for missed_ingredient in self.missed_ingredients: layout2.add_widget(Label(f" - {missed_ingredient['name']}"), 0) layout2.add_widget(Label("", height=1), 0) self.image_name = self._download_image(image_url) image = Print(screen, ColourImageFile(screen, self.image_name), x=5, y=5) self.add_effect(image) layout3 = Layout([1, 1, 1]) self.add_layout(layout3) layout3.add_widget(Button("Don't Add And Continue", self._dont_add), 0) layout3.add_widget(Button("Add and Continue", self._add), 1) layout3.add_widget(Button("Quit", self._quit), 2) self.fix()
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") 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()
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()
def __init__(self, screen): super(ClueFrame, self).__init__(screen, screen.height, screen.width, has_border=False, hover_focus=True, name="Jeopardy Clue") layout = Layout([1]) layout2 = Layout([1]) self.add_layout(layout) self.add_layout(layout2) self.add_effect( self._figlet(self._canvas, { "text": "CLUE", "font": 'starwars' }, [screen.width // 2, 1], 20)) padding = Label("", align='^', height=10) padding.custom_colour = "field" layout.add_widget(padding, 0) self.clue = Label("", align='^') self.clue.custom_colour = "field" layout2.add_widget(self.clue, 0) question_padding = Label("", align='^', height=5) layout2.add_widget(question_padding, 0) self.question = Label("", align='^') self.question.custom_colour = "field" layout2.add_widget(self.question, 0) answer_padding = Label("", align='^', height=10) layout2.add_widget(question_padding, 0) self.buzzed_players = Label("", align='^') self.buzzed_players.custom_colour = "field" layout2.add_widget(self.buzzed_players, 0) # Prepare the Frame for use. self.fix()
def _compose_file_picker_layout(self): layout = Layout([1]) self.add_layout(layout) layout.add_widget( FileBrowser( height=11, root=os.getcwd(), on_change=self._on_browser_change, on_select=self._on_file_selected_in_browser, name="file_browser", )) layout.add_widget(Divider())
def __init__(self, screen, model): super(MainView, self).__init__(screen, screen.height, screen.width, has_shadow=True, name='Main View') self.model = model status_layout = Layout([80, 10, 10]) self.add_layout(status_layout) self.status_label = Label('Not Connected') status_layout.add_widget(self.status_label, column=0) status_layout.add_widget(Button('Reload', self.reload_click), column=1) status_layout.add_widget(Button('Logout', self.logout_click), column=2) layout = Layout([100]) self.add_layout(layout) self.emails = MultiColumnListBox(screen.height - 10, ['<50%', '<50%'], self.model.unread_options, name='emails', on_select=self.select_email) layout.add_widget(self.emails) self.fix()
def __init__(self, screen): super(Confirm, self).__init__(screen, screen.height * 1 // 8, screen.width * 1 // 3, 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("{} module {} {}?") layout.add_widget(Label(" ")) layout.add_widget(self.label) layout2 = Layout([1,1]) self.add_layout(layout2) layout2.add_widget(Button("Ok", self._ok), 0) layout2.add_widget(Button("Cancel", self._cancel), 1) self.fix()
def __init__(self, screen, activeDb): super(frame1, self).__init__(screen, int(screen.height * 0.99), int(screen.width * 0.99), on_load=self._reload_list, hover_focus=True, can_scroll=False, title="frame1") self._activeDb = activeDb layout = Layout([100], fill_frame=True) self.add_layout(layout)