def __init__(self, screen, frame_type, frame_data): super(CommonSettingsFrame, self).__init__(screen, frame_type, frame_data) self._layout.add_widget(Label("VM count:", height=2), 1) self._layout.add_widget( RadioButtons([("Single VM", 1), ("2 VMs", 2), ("3 VMs", 3)], name="vm_count"), 1) self._layout.add_widget(Divider(height=1, draw_line=False), 1) self._layout.add_widget(Label("Additional options:", height=2), 1) self._layout.add_widget( CheckBox("Add local YAML config", name="add_config"), 1) self._layout.add_widget(Divider(height=1, draw_line=False), 1) self._layout.add_widget( CheckBox("Require 'vagrant-vbguest' plugin", name="require_vagrant_vbguest"), 1) self._layout.add_widget(Divider(height=1, draw_line=False), 1) self._add_intnet_checkbox = CheckBox( "Add VirtualBox internal network", name="add_vb_intnet", on_change=self._on_add_intnet_change) self._layout.add_widget(self._add_intnet_checkbox, 1) self._intnet_name_edit = Text( # label="Network name:", name="intnet_name") # self._intnet_name_edit.offset = 5 self._layout.add_widget(self._intnet_name_edit, 1) # self._layout.add_widget(Divider(height=1, draw_line=False), 1) self.data = frame_data.controls_data self.fix()
def __init__(self, screen): super(DemoFrame2, self).__init__(screen, int(screen.height * 0.95), int(screen.width * 0.9), data=form_data, has_shadow=True, name="My Form") #layout = Layout([1, 18, 1]) #self.add_layout(layout) layout = Layout([1, 3]) self.add_layout(layout) layout.add_widget(Button("Añadir personaje", self._quit), 0) layout.add_widget(Button("Borrar personaje ", self._quit), 0) layout.add_widget(Button("Editar personaje", self._quit), 0) layout.add_widget(Button("Testear personajes", self._quit), 0) layout.add_widget(Button("Salir", self._quit), 0) self._reset_button = Button("Añadir personaje", self._reset) #layout.add_widget(self._reset_button, 0) #layout.add_widget(Button("Salir", self._quit), 0) layout.add_widget( Text(label="Alpha:", name="TB", on_change=self._on_change, validator="^[a-zA-Z]*$"), 1) layout.add_widget( Text(label="Number:", name="TC", on_change=self._on_change, validator="^[0-9]*$"), 1) layout.add_widget( Text(label="Email:", name="TD", on_change=self._on_change, validator=self._check_email), 1) layout.add_widget(Divider(height=2), 1) layout.add_widget(Label("Group 2:"), 1) layout.add_widget( RadioButtons([("Option 1", 1), ("Option 2", 2), ("Option 3", 3)], label="A Longer Selection:", name="Things", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 1", label="A very silly long name for fields:", name="CA", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 2", name="CB", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 3", name="CC", on_change=self._on_change), 1) layout.add_widget(Divider(height=3), 1) layout2 = Layout([1, 1, 1]) self.add_layout(layout2) layout2.add_widget(self._reset_button, 0) layout2.add_widget(Button("View Data", self._view), 1) layout2.add_widget(Button("Quit", self._quit), 2) self.fix()
def __init__(self, screen): super(DemoFrame, self).__init__(screen, int(screen.height * 2 // 3), int(screen.width * 2 // 3), data=form_data, has_shadow=True, name="My Form") layout = Layout([1, 18, 1]) self.add_layout(layout) self._reset_button = Button("Reset", self._reset) layout.add_widget(Label("Group 1:"), 1) layout.add_widget(TextBox(5, label="My First Box:", name="TA", on_change=self._on_change), 1) layout.add_widget( Text(label="Alpha:", name="TB", on_change=self._on_change, validator="^[a-zA-Z]*$"), 1) layout.add_widget( Text(label="Number:", name="TC", on_change=self._on_change, validator="^[0-9]*$"), 1) layout.add_widget( Text(label="Email:", name="TD", on_change=self._on_change, validator=self._check_email), 1) layout.add_widget(Divider(height=2), 1) layout.add_widget(Label("Group 2:"), 1) layout.add_widget(RadioButtons([("Option 1", 1), ("Option 2", 2), ("Option 3", 3)], label="A Longer Selection:", name="Things", on_change=self._on_change), 1) layout.add_widget(CheckBox("Field 1", label="A very silly long name for fields:", name="CA", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 2", name="CB", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 3", name="CC", on_change=self._on_change), 1) layout.add_widget(DatePicker("Date", name="DATE", year_range=range(1999, 2100), on_change=self._on_change), 1) layout.add_widget( TimePicker("Time", name="TIME", on_change=self._on_change, seconds=True), 1) layout.add_widget(Text("Password", name="PWD", on_change=self._on_change, hide_char="*"), 1) layout.add_widget(Divider(height=3), 1) layout2 = Layout([1, 1, 1]) self.add_layout(layout2) layout2.add_widget(self._reset_button, 0) layout2.add_widget(Button("View Data", self._view), 1) layout2.add_widget(Button("Quit", self._quit), 2) self.fix()
def __init__(self, screen): self.screen = screen super(DemoFrame, self).__init__( screen, int(screen.height), int(screen.width), data=form_data, has_shadow=True, has_border=True, name="My Form", x=0, y=0, ) layout = Layout([1], fill_frame=False) self.add_layout(layout) self._reset_button = Button("Reset", self._reset) title = "MISP Event #{} ({}):".format(args.event, event_tag) layout.add_widget( Text(label=title, name="ENA", on_change=self._on_change), 0) layout.add_widget(Divider(height=1), 0) layout1 = Layout([1, 1], fill_frame=False) self.add_layout(layout1) layout1.add_widget( RadioButtons([("Malicious files hosted", 1), ("Compromised server", 2)], label="Templates", name="template", on_change=self._on_change), 0) dryruntext = "Dry-run (all mails to %s)" % override_email layout1.add_widget( CheckBox(dryruntext, name="dryrun", on_change=self._on_change), 1) onlinechecktext = "Verify resource (online and size > %s bytes)" % min_size layout1.add_widget( CheckBox(onlinechecktext, name="onlinecheck", on_change=self._on_change), 1) layout2 = Layout([50, 50], fill_frame=True) self.add_layout(layout2) layout2.add_widget(Divider(height=1), 0) layout2.add_widget(Divider(height=1), 1) layout2.fix(0, 0, 0, 5) i = False for entry in urllist: if i is False: layout2.add_widget( CheckBox(entry, name=entry, on_change=self._on_change), 0) i = True else: layout2.add_widget( CheckBox(entry, name=entry, on_change=self._on_change), 1) i = False self.l = layout2 layout4 = Layout([1, 1, 1]) self.add_layout(layout4) layout4.add_widget(self._reset_button, 0) layout4.add_widget(Button("Quit", self._quit), 1) layout4.add_widget(Button("Process data", self._process), 2) self.fix()
def __init__(self, screen): super(DemoFrame, self).__init__(screen, screen.height, screen.width // 5, data=form_data, x=0, y=0, name="Side bar") layout = Layout([1, 18, 1]) self.add_layout(layout) self._reset_button = Button("Reset", self._reset) layout.add_widget(Label("Group 1:"), 1) layout.add_widget( TextBox(5, label="My First Box:", name="TA", on_change=self._on_change), 1) layout.add_widget( Text(label="Alpha:", name="TB", on_change=self._on_change, validator="^[a-zA-Z]*$"), 1) layout.add_widget( Text(label="Number:", name="TC", on_change=self._on_change, validator="^[0-9]*$"), 1) layout.add_widget( Text(label="Email:", name="TD", on_change=self._on_change, validator=self._check_email), 1) layout.add_widget(Divider(height=2), 1) layout.add_widget(Label("Group 2:"), 1) layout.add_widget( RadioButtons([("Option 1", 1), ("Option 2", 2), ("Option 3", 3)], label="A Longer Selection:", name="Things", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 1", label="A very silly long name for fields:", name="CA", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 2", name="CB", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 3", name="CC", on_change=self._on_change), 1) layout.add_widget(Divider(height=3), 1) layout2 = Layout([1, 1, 1]) self.add_layout(layout2) layout2.add_widget(self._reset_button, 0) layout2.add_widget(Button("View Data", self._view), 1) layout2.add_widget(Button("Quit", self._quit), 2) self.fix()
def __init__(self, screen, has_border=True, reduce_cpu=False): super(TestFrame, self).__init__(screen, screen.height, screen.width, name="Test Form", has_border=has_border, hover_focus=True, reduce_cpu=reduce_cpu) layout = Layout([1, 18, 1]) self.add_layout(layout) self._reset_button = Button("Reset", self._reset) layout.add_widget(Label("Group 1:"), 1) layout.add_widget( TextBox(5, label="My First Box:", name="TA", on_change=self._on_change), 1) layout.add_widget( Text(label="Text1:", name="TB", on_change=self._on_change), 1) layout.add_widget( Text(label="Text2:", name="TC", on_change=self._on_change, validator="^[0-9]*$"), 1) layout.add_widget( Text(label="Text3:", name="TD", on_change=self._on_change, validator=lambda x: x in ("", "a")), 1) layout.add_widget(Divider(height=2), 1) layout.add_widget(Label("Group 2:"), 1) layout.add_widget( RadioButtons([("Option 1", 1), ("Option 2", 2), ("Option 3", 3)], label="A Longer Selection:", name="Things", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 1", label="A very silly long name for fields:", name="CA", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 2", name="CB", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 3", name="CC", on_change=self._on_change), 1) layout.add_widget(Divider(height=3), 1) layout2 = Layout([1, 1, 1]) self.add_layout(layout2) layout2.add_widget(self._reset_button, 0) layout2.add_widget(Button("View Data", self._view), 1) layout2.add_widget(Button("Quit", self._quit), 2) self.fix()
def __init__(self, screen, game): self.game = game self.form_data = { "playerName": "", "cb_one": False, "cb_two": False, "cb_three": False, "cb_four": False, "cb_five": False, "cb_six": False, "cb_seven": False, "cb_eight": False, "cb_nine": False, "cb_ten": False } self._readConfig(game.config) super(SplashScreenFrame, self).__init__(screen, int(self.game.config.windowHeight), int(self.game.config.windowWidth), data=self.form_data, has_shadow=True, name="SplashScreen") layout = Layout([1, 18, 1]) self.add_layout(layout) self._reset_button = Button("Reset", self._reset) layout.add_widget(Divider(height=3), 1) layout.add_widget(Label("MURPHY MAN 1 - Einmaleins"), 1) layout.add_widget(Divider(height=3), 1) layout.add_widget( CheckBox("1", "1x?", "cb_one", self._on_change), 1) layout.add_widget( CheckBox("2", None, "cb_two", self._on_change), 1) layout.add_widget( CheckBox("3", None, "cb_three", self._on_change), 1) layout.add_widget( CheckBox("4", None, "cb_four", self._on_change), 1) layout.add_widget( CheckBox("5", None, "cb_five", self._on_change), 1) layout.add_widget( CheckBox("6", None, "cb_six", self._on_change), 1) layout.add_widget( CheckBox("7", None, "cb_seven", self._on_change), 1) layout.add_widget( CheckBox("8", None, "cb_eight", self._on_change), 1) layout.add_widget( CheckBox("9", None, "cb_nine", self._on_change), 1) layout.add_widget( CheckBox("10", None, "cb_ten", self._on_change), 1) layout.add_widget(Divider(height=3), 1) nameWidget = Text(label="Name:", name="playerName", on_change=self._on_change, validator="^[a-zA-Z]*$") layout.add_widget(nameWidget, 1) layout.add_widget(Divider(height=3), 1) layout2 = Layout([10, 10]) self.add_layout(layout2) layout2.add_widget(Button("Start", self._start), 0) layout2.add_widget(Button("Beenden", self._quit), 1) self.fix()
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()
def _create_checkboxes_from_dict(self, dictionary, layout, name): """Creates checkboxes with documentation""" layout.add_widget(Label(name), 1) layout.add_widget(Label(" "), 2) for flag, doc in dictionary.items(): layout.add_widget(CheckBox(flag, name=flag, on_change=self._on_data_field_change), 1) layout.add_widget(Label("(" + doc + ")"), 2)
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()
def __find_venvs(self, path): self.size_found = 0 venvs = find_virtualenvs(path) for v in venvs: v['checkbox'] = CheckBox(v['location'], on_change=self.__calculate_selected_size) self.size_found += float(v['size']) return venvs
def add_checkbox(self, text, on_change=None, default=False, **kwargs): layout = Layout([100]) self.add_layout(layout) box = CheckBox(text, None, None, on_change, **kwargs) box._value = default layout.add_widget(box) return lambda: box._value
def __init__(self, screen): super(DemoFrame, self).__init__(screen, int(screen.height * 2 // 3), int(screen.width * 2 // 3), data=form_data, has_shadow=True, name="My Form") layout = Layout([1, 18, 1]) self.add_layout(layout) self._reset_button = Button("Reset", self._reset) layout.add_widget(Label("Group 1:"), 1) layout.add_widget( TextBox(5, label="My First Box:", name="TA", on_change=self._on_change), 1) layout.add_widget( Text(label="Text1:", name="TB", on_change=self._on_change), 1) layout.add_widget( Text(label="Text2:", name="TC", on_change=self._on_change), 1) layout.add_widget( Text(label="Text3:", name="TD", on_change=self._on_change), 1) layout.add_widget(Divider(height=2), 1) layout.add_widget(Label("Group 2:"), 1) layout.add_widget( RadioButtons([("Option 1", 1), ("Option 2", 2), ("Option 3", 3)], label="A Longer Selection:", name="Things", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 1", label="A very silly long name for fields:", name="CA", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 2", name="CB", on_change=self._on_change), 1) layout.add_widget( CheckBox("Field 3", name="CC", on_change=self._on_change), 1) layout.add_widget(Divider(height=3), 1) layout2 = Layout([1, 1, 1]) self.add_layout(layout2) layout2.add_widget(self._reset_button, 0) layout2.add_widget(Button("View Data", self._view), 1) layout2.add_widget(Button("Quit", self._quit), 2) self.fix()
def _create_config_menu(self, layout): layout.add_widget(Label("Configs:"), 1) layout.add_widget(Label(" "), 2) layout.add_widget(Label(" "), 3) configs_per_column = math.ceil(len(self.inventory.config_keys) / _CONFIG_COLUMNS) sorted_configs = tuple(itertools.zip_longest(*[iter(self.inventory.config_keys)] * configs_per_column)) for column in range(len(sorted_configs)): for config in sorted_configs[column]: if config: layout.add_widget(CheckBox(config, name=config, on_change=self._on_data_field_change), column + 1)
def __init__(self, screen, table, table_scene): self.table = table self.__screen = screen self.__table_scene = table_scene super().__init__(screen, screen.height, screen.width, hover_focus=True, can_scroll=True, reduce_cpu=True) main_layout = Layout([100], fill_frame=True) self.add_layout(main_layout) for field_type, field_name in zip(self.table.get_column_types(), self.table.get_column_names()): if field_type == datetime: widget = DatePicker(label=field_name, name=field_name) elif field_type == bool: widget = CheckBox('', label=field_name, name=field_name) elif field_type == int: widget = Text(label=field_name, name=field_name, validator='^[0-9]*$') elif field_type == float: widget = Text(label=field_name, name=field_name, validator=r'^[0-9]*\.?[0-9]+$') elif field_type == ID: widget = Text(label=field_name, name=field_name) widget.disabled = True elif field_type == Kennitala: widget = Text(label=field_name, name=field_name, validator=validate_kennitala) else: logging.debug( 'Creating normal textbox for type: {}, name: {}'.format( field_type, field_name)) widget = Text(label=field_name, name=field_name) main_layout.add_widget(widget) bottom_layout = Layout([1, 1, 1]) self.add_layout(bottom_layout) bottom_layout.add_widget(Button("OK", self._ok), 0) bottom_layout.add_widget(Button("Reset", self.reset), 1) bottom_layout.add_widget(Button("Cancel", self._cancel), 2) self.fix() self.set_theme('monochrome')
def __init__(self, screen, model): super(TodoView, self).__init__(screen, screen.height * 2 // 3, screen.width * 2 // 3, hover_focus=True, title="To-Do Details", reduce_cpu=True) self._model = model due_datetime = datetime.datetime.now() due_datetime = due_datetime.replace(microsecond=0) self.data["id"] = -1 self.data["what"] = "" self.data["due_date"] = due_datetime.date() self.data["due_time"] = due_datetime.time() self.data["category"] = 0 self.data["finished"] = False self._category_ddlist = DropdownList([("", -1)], label="Category:", name="category") layout = Layout([100], fill_frame=True) self.add_layout(layout) layout.add_widget(Text("What:", "what")) layout.add_widget( DatePicker("Due Date:", name="due_date", year_range=range(1999, 2100))) layout.add_widget( TimePicker("Due Time:", name="due_time", seconds=True)) layout.add_widget(self._category_ddlist) layout.add_widget( TextBox(Widget.FILL_FRAME, "Notes:", "notes", as_string=True)) layout.add_widget(CheckBox("", label="Finished:", name="finished")) layout2 = Layout([1, 1, 1, 1]) self.add_layout(layout2) layout2.add_widget(Button("Apply", self._apply), 0) layout2.add_widget(Button("Back", self._back), 3) self.fix()
def __init__(self, screen, tests_list): super(ListView, self).__init__(screen, screen.height * 1, screen.width * 1, hover_focus=True, title="Test TPO") self._tests_list = tests_list layout = Layout([1], fill_frame=True) self.add_layout(layout) self._start_button = Button("Start", self._start) layout.add_widget(Label("Available tests")) layout.add_widget(Divider()) self.data = self._tests_list.get_form_data() for x in self.data: layout.add_widget(CheckBox(name=x, text=x, on_change=self._add)) layout.add_widget(Divider()) layout.add_widget(self._start_button) layout.add_widget(Button("Cancel", self._cancel)) self._start_button.disabled = False self.fix()
def __init__(self, screen, hw_list): super(HwView, self).__init__(screen, screen.height * 1, screen.width * 1, hover_focus=True, title="Hardware information") self._hw_list = hw_list self.data = self._hw_list._get_data() layout = Layout([1, 1, 1], fill_frame=False) layout2 = Layout([1, 1, 1], fill_frame=False) self.add_layout(layout) self.add_layout(layout2) self._start_button = Button("Start", self._start) self._start_button.disabled = False for x in self.data: layout.add_widget(CheckBox(name=x, text=x, on_change=self._add), 1) layout2.add_widget(self._start_button) layout2.add_widget(Button("Cancel", self._cancel), 2) self.fix()
def __init__(self, screen: Screen, on_close, default_value: str, mode): """ Parameters ---------- on_close : (value: str, use_reg: bool, hide: bool, auto_ng_id: bool, scope_idx: int) -> None | (value: str, use_reg: bool, hide: bool, scope_idx: int) -> None | (value: str, use_reg: bool, scope_idx: int) -> None scope_idx : 0 - 全ての板 1 - この板のみ 2 - このスレのみ mode : "name" | "id" | "word" | "title" """ super().__init__(screen, screen.height, screen.width, hover_focus=True, can_scroll=False, has_border=True, is_modal=True) self.set_theme("user_theme") self._on_close = on_close self._mode = mode if mode == "title": self._scope_radio = RadioButtons([("全ての板", 0), ("この板のみ", 1)]) else: self._scope_radio = RadioButtons([("全ての板", 0), ("この板のみ", 1), ("このスレのみ", 2)]) self._use_reg_chk = CheckBox("") if mode != "title": self._hide_chk = CheckBox("") if mode == "name" or mode == "word": self._auto_ng_id_chk = CheckBox("") self._value_box = TextBox(Widget.FILL_COLUMN, as_string=True) self._value_box.value = default_value self._save_btn = Button("Save", self._save_clicked) self._cancel_btn = Button("Cancel", lambda: self.disappaer()) layout = Layout([10, 3, 87]) self.add_layout(layout) layout.add_widget(Label("scope"), 0) layout.add_widget(VerticalDivider(), 1) layout.add_widget(self._scope_radio, 2) layout = Layout([100]) self.add_layout(layout) layout.add_widget(Divider()) layout = Layout([10, 3, 87]) self.add_layout(layout) layout.add_widget(Label("use_reg"), 0) layout.add_widget(VerticalDivider(), 1) layout.add_widget(self._use_reg_chk, 2) layout = Layout([100]) self.add_layout(layout) layout.add_widget(Divider()) if mode != "title": layout = Layout([10, 3, 87]) self.add_layout(layout) layout.add_widget(Label("hide"), 0) layout.add_widget(VerticalDivider(), 1) layout.add_widget(self._hide_chk, 2) layout = Layout([100]) self.add_layout(layout) layout.add_widget(Divider()) if mode == "name" or mode == "word": layout = Layout([10, 3, 87]) self.add_layout(layout) layout.add_widget(Label("auto_ng_id"), 0) layout.add_widget(VerticalDivider(), 1) layout.add_widget(self._auto_ng_id_chk, 2) layout = Layout([100]) self.add_layout(layout) layout.add_widget(Divider()) layout = Layout([10, 3, 87], fill_frame=True) self.add_layout(layout) layout.add_widget(Label("value"), 0) layout.add_widget(VerticalDivider(), 1) layout.add_widget(self._value_box, 2) layout = Layout([100]) self.add_layout(layout) layout.add_widget(Divider()) layout = Layout([5, 5]) self.add_layout(layout) layout.add_widget(self._save_btn) layout.add_widget(self._cancel_btn, 1) self.fix()
def MainMenu(game, screen, debug, oldpalette): def endgame(): screen.close() quit() sys.exit(0) None def endmenu(): debug[0] = False game = GameState.GameState() game.hero.inventory = [] Mmenu.save() looksy = Mmenu.data if looksy['seedval'] != "": converted = 0 if str.isnumeric(looksy['seedval']): game.seed = int(looksy['seedval']) else: for char in looksy['seedval']: converted += ord(char) game.seed = int(converted) random.seed(game.seed) if looksy['nameval'] != "": if len(looksy["nameval"]) >= 20: game.name = str(looksy['nameval'])[:21] else: game.name = str(looksy['nameval']) debug[0] = looksy['Debug'] #visual.blackout(screen) main(game, debug, looksy, screen) test1.deadscreen(game, screen) DeathMenu(game, screen, debug, oldpalette) return Mmenu.data endval = True Mmenu = Frame(screen, screen.height * 2 // 3, screen.width * 2 // 3, hover_focus=True, has_border=True, title="Game Settings", reduce_cpu=False) #Mmenu.palette['background'] = (0,0,1) Mmenu.palette = oldpalette mapping = Layout([100], fill_frame=True) Mmenu.add_layout(mapping) mapping.add_widget(Text("Seed:", "seedval")) mapping.add_widget(Text("Adventurer Name:", "nameval")) mapping.add_widget(CheckBox("Debug Mode:", "Debug", "Debug")) bottomrow = Layout([1, 1, 1, 1]) Mmenu.add_layout(bottomrow) bottomrow.add_widget(Button("Exit Game", endgame), 0) bottomrow.add_widget(Button("Start Level", endmenu), 3) Mmenu.fix() #Mmenu._on_pic Scenes = [Scene([Mmenu], -1)] screen.play(Scenes) return Mmenu.data
def __init__(self, screen, ident_model): super().__init__( screen, screen.height, screen.width, title="Identity", ) self._ident_model = ident_model MAX_LEN_CALLSIGN = 12 MAX_LEN_DEV_ID = 4 MAX_LEN_COUNTRY = 3 # Personal input fields # Col 0 layout1 = Layout([1, 4, 4], fill_frame=True) self.add_layout(layout1) layout1.add_widget(Label("Personal:"), 0) layout1.add_widget(Divider(draw_line=False, height=7), 0) layout1.add_widget(Divider(draw_line=True, height=1), 0) # Col 1 layout1.add_widget( Text(label="Common name:", on_change=self._on_change, name="cmn_name"), 1) layout1.add_widget( Text(label="Callsign:", on_change=self._on_change, name="callsign", max_length=MAX_LEN_CALLSIGN), 1) layout1.add_widget( Text(label="Email:", on_change=self._on_change, name="email"), 1) layout1.add_widget( Text(label="Country:", on_change=self._on_change, name="country", max_length=MAX_LEN_COUNTRY), 1) layout1.add_widget( Text(label="State/province:", on_change=self._on_change, name="province"), 1) layout1.add_widget( Text(label="Postal/zip code:", on_change=self._on_change, name="postalcode"), 1) layout1.add_widget(Divider(draw_line=False, height=1), 1) layout1.add_widget( Text(label="Passphrase:", on_change=self._on_change, name="person_pass", validator=self._validate_pwd, hide_char='*'), 1) layout1.add_widget(Divider(draw_line=True, height=1), 1) # Col 2 txt = TextBox(8, line_wrap=True, readonly=True) txt.disabled = True txt.value = [ "Info to create a personal X.509 crypto certficate. " "You must input your callsign and should input " "correct data in the other fields to increase trust." ] layout1.add_widget(txt, 2) layout1.add_widget(Divider(draw_line=True, height=1), 2) # Device input fields # Col 0 layout1.add_widget(Label("Device:", name="dev_lbl"), 0) layout1.add_widget(Divider(draw_line=False, height=2), 0) layout1.add_widget(Divider(draw_line=True, height=1), 0) # Col 1 layout1.add_widget( Text(label="SSID:", on_change=self._on_change, name="ssid", max_length=MAX_LEN_DEV_ID), 1) layout1.add_widget(Divider(draw_line=False, height=1), 1) layout1.add_widget( Text(label="Passphrase:", on_change=self._on_change, name="dev_pass", validator=self._validate_pwd, hide_char='*'), 1) layout1.add_widget(Divider(draw_line=True, height=1), 1) # Col 2 txt = TextBox(3, line_wrap=True, readonly=True) txt.disabled = True txt.value = [ "This information is used to create device credentials. " "Each device should have its own three-digit SSID." ] layout1.add_widget(txt, 2) layout1.add_widget(Divider(draw_line=True, height=1), 2) # Output fields layout1.add_widget(Label("Output:"), 0) layout1.add_widget( CheckBox("Personal cert exists", name="cert_exists", disabled=True), 1) layout1.add_widget( CheckBox("Device cred exists", name="cred_exists", disabled=True), 1) layout1.add_widget(Divider(draw_line=False, height=Widget.FILL_FRAME), 1) # Buttons layout2 = Layout([1, 1, 1, 1], fill_frame=False) self.add_layout(layout2) layout2.add_widget( Button("Apply", on_click=self._on_click_apply, name="btn_apply", disabled=True), 1) layout2.add_widget(Button("Cancel", on_click=self._on_click_cancel), 2) self.fix()
def __init__(self, screen): super().__init__(screen, screen.height, 80, data=FormStateData.data, title="Aqua AIRS HDF Processing", reduce_cpu=False) self.palette = INTERFACE_PALETTE self.controller = MainController(self.status_callback) # supporting variables wavelengths = list( reversed([(str(w), c) for c, w in CHANNELS_TO_WAVELENGTHS.items()])) year_range = range(2002, 2016 + 1) # declare controls self.username = Text('EarthData Login username: '******'username') self.password = Text('EarthData Login password: '******'password', hide_char='*') self.output_directory = Text('Output directory: ', 'output_directory') self.data_directory = Text('HDF data directory: ', 'data_directory') self.before_date_range_start = DatePicker('"Before" date range start:', 'before_date_range_start', year_range=year_range) self.before_date_range_end = DatePicker('"Before" date range end:', 'before_date_range_end', year_range=year_range) self.after_date_range_start = DatePicker('"After" date range start:', 'after_date_range_start', year_range=year_range) self.after_date_range_end = DatePicker('"After" date range end:', 'after_date_range_end', year_range=year_range) self.time_range_start = TimePicker('Start time: ', name='time_range_start') self.time_range_end = TimePicker('End time : ', name='time_range_end') self.min_latitude = CustomText('Minimum latitude: ', name='min_latitude') self.max_latitude = CustomText('Maximum latitude: ', name='max_latitude') self.min_longitude = CustomText('Minimum longitude: ', name='min_longitude') self.max_longitude = CustomText('Maximum longitude: ', name='max_longitude') self.use_radiance_filters = CheckBox('Use radiance filter', 'Radiance filter', name='use_radiance_filters') self.radiance = CustomText('Radiance: ', name='radiance') self.radiance_range = CustomText('Radiance range (mW): ±', name='radiance_range') self.channel = ListBox( 1, wavelengths, label='Wavelength:', name='channel') # value is channel, not wavelength self.max_landfrac = CustomText('Maximum landfrac (0-1): ', name='max_landfrac') self.dust_flag_no_dust = CustomCheckBox('No dust', 'Dust presence', name='dust_flag_no_dust') self.dust_flag_single_fov = CustomCheckBox('Dust in a single FOV', name='dust_flag_single_fov') self.dust_flag_detected = CustomCheckBox('Dust detected', name='dust_flag_detected') self.data_quality_best = CustomCheckBox('Best', 'Data quality level', name='data_quality_best') self.data_quality_enough = CustomCheckBox('Good enough', name='data_quality_enough') self.data_quality_worst = CustomCheckBox('Worst', name='data_quality_worst') self.center_scans_only = CheckBox('Use center IR scans only', 'Other', name='center_scans_only') self.noise_amp = CheckBox('Consider noise amplification', name='noise_amp') self.progress_label = Label('') self.button_process = Button('Process', self._process) self.button_quit = Button('Quit', self._quit) # declare layouts top_layout = Layout([1]) time_layout = Layout([1]) radiance_layout = Layout([1]) options_layout = Layout([1]) buttons_layout = Layout([1, 1, 1, 1]) status_layout = Layout([1]) # attach layouts to self self.add_layout(top_layout) self.add_layout(time_layout) self.add_layout(radiance_layout) self.add_layout(options_layout) self.add_layout(buttons_layout) self.add_layout(status_layout) # attach controls to layouts top_layout.add_widget(self.username) top_layout.add_widget(self.password) top_layout.add_widget(Divider(False)) top_layout.add_widget(self.data_directory) top_layout.add_widget(self.output_directory) top_layout.add_widget(Divider(False)) top_layout.add_widget(self.before_date_range_start) top_layout.add_widget(self.before_date_range_end) top_layout.add_widget(self.after_date_range_start) top_layout.add_widget(self.after_date_range_end) time_layout.add_widget(self.time_range_start) time_layout.add_widget(self.time_range_end) time_layout.add_widget(Divider(False)) time_layout.add_widget(self.min_latitude) time_layout.add_widget(self.max_latitude) time_layout.add_widget(self.min_longitude) time_layout.add_widget(self.max_longitude) time_layout.add_widget(Divider(False)) radiance_layout.add_widget(self.use_radiance_filters) radiance_layout.add_widget(self.radiance) radiance_layout.add_widget(self.radiance_range) radiance_layout.add_widget(self.channel) radiance_layout.add_widget(Divider(False)) options_layout.add_widget(self.max_landfrac) options_layout.add_widget(self.dust_flag_no_dust) options_layout.add_widget(self.dust_flag_single_fov) options_layout.add_widget(self.dust_flag_detected) options_layout.add_widget(Divider(False)) options_layout.add_widget(self.data_quality_best) options_layout.add_widget(self.data_quality_enough) options_layout.add_widget(self.data_quality_worst) options_layout.add_widget(Divider(False)) options_layout.add_widget(self.center_scans_only) options_layout.add_widget(self.noise_amp) options_layout.add_widget(Divider(False)) options_layout.add_widget(Divider(False)) buttons_layout.add_widget(self.button_process, 2) buttons_layout.add_widget(self.button_quit, 3) status_layout.add_widget(Divider(False)) status_layout.add_widget(Divider(False)) status_layout.add_widget(self.progress_label) # add validating regexes self.min_latitude.set_validator('^-?(?:\d+(?:\.\d+)?|\.\d+)$') self.max_latitude.set_validator('^-?(?:\d+(?:\.\d+)?|\.\d+)$') self.min_longitude.set_validator('^-?(?:\d+(?:\.\d+)?|\.\d+)$') self.max_longitude.set_validator('^-?(?:\d+(?:\.\d+)?|\.\d+)$') self.radiance.set_validator('^(?:\d+(?:\.\d+)?|\.\d+)$') self.radiance_range.set_validator('^(?:\d+(?:\.\d+)?|\.\d+)$') self.max_landfrac.set_validator('^(?:[01]+(?:\.\d+)?)|\.\d+$') # checkboxes groups with default values self.dust_flag_group = CheckBoxesGroup([ self.dust_flag_no_dust, self.dust_flag_single_fov, self.dust_flag_detected ], self.dust_flag_no_dust) self.data_quality_group = CheckBoxesGroup([ self.data_quality_best, self.data_quality_enough, self.data_quality_worst ], self.data_quality_enough) self.fix()
def __init__(self, screen: Screen, default_values, on_close, mode: str): super().__init__(screen, int(screen.height * 0.8), int(screen.width * 0.8), hover_focus=True, can_scroll=False, has_border=True, is_modal=True ) self.set_theme("user_theme") self._on_close = on_close self._mode = mode self._board_text = Text() self._board_text.value = default_values.get("board") if default_values.get("board") is not None else "" if mode != "title": self._key_text = Text() self._key_text.value = default_values.get("key") if default_values.get("key") is not None else "" self._use_reg_chk = CheckBox("") self._use_reg_chk.value = default_values.get("use_reg") if default_values.get("use_reg") is not None else False if mode != "title": self._hide_chk = CheckBox("") self._hide_chk.value = default_values.get("hide") if default_values.get("hide") is not None else False if mode == "name" or mode == "word": self._auto_ng_id_chk = CheckBox("") self._auto_ng_id_chk.value = default_values.get( "auto_ng_id") if default_values.get("auto_ng_id") is not None else False self._value_text = TextBox(Widget.FILL_COLUMN, as_string=True) self._value_text.value = default_values.get("value") if default_values.get("value") is not None else "" self._save_btn = Button("Save", self._save_clicked) self._cancel_btn = Button("Cancel", self._cancel_clicked) layout = Layout([10, 3, 87]) self.add_layout(layout) layout.add_widget(Label("board"), 0) layout.add_widget(VerticalDivider(), 1) layout.add_widget(self._board_text, 2) layout = Layout([100]) self.add_layout(layout) layout.add_widget(Divider()) if mode != "title": layout = Layout([10, 3, 87]) self.add_layout(layout) layout.add_widget(Label("key"), 0) layout.add_widget(VerticalDivider(), 1) layout.add_widget(self._key_text, 2) layout = Layout([100]) self.add_layout(layout) layout.add_widget(Divider()) layout = Layout([10, 3, 87]) self.add_layout(layout) layout.add_widget(Label("use_reg"), 0) layout.add_widget(VerticalDivider(), 1) layout.add_widget(self._use_reg_chk, 2) layout = Layout([100]) self.add_layout(layout) layout.add_widget(Divider()) if mode != "title": layout = Layout([10, 3, 87]) self.add_layout(layout) layout.add_widget(Label("hide"), 0) layout.add_widget(VerticalDivider(), 1) layout.add_widget(self._hide_chk, 2) layout = Layout([100]) self.add_layout(layout) layout.add_widget(Divider()) if mode == "name" or mode == "word": layout = Layout([10, 3, 87]) self.add_layout(layout) layout.add_widget(Label("auto_ng_id"), 0) layout.add_widget(VerticalDivider(), 1) layout.add_widget(self._auto_ng_id_chk, 2) layout = Layout([100]) self.add_layout(layout) layout.add_widget(Divider()) layout = Layout([10, 3, 87], fill_frame=True) self.add_layout(layout) layout.add_widget(Label("value"), 0) layout.add_widget(VerticalDivider(), 1) layout.add_widget(self._value_text, 2) layout = Layout([100]) self.add_layout(layout) layout.add_widget(Divider()) layout = Layout([5, 5]) self.add_layout(layout) layout.add_widget(self._save_btn) layout.add_widget(self._cancel_btn, 1) self.fix()
def __init__(self, screen, model: ModelController, logger: LoggingController, ui: UIController): super().__init__(screen, height=screen.height // 2, width=screen.width // 2, can_scroll=False, title="Settings", hover_focus=True) # Controllers that access different aspects of provenance self._logger: LoggingController = logger self._model: ModelController = 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._discovery = CheckBox( "All hosts that connect are regarded as clients", label="Discovery: ", name="discovery") self._display_logs = CheckBox("Display logs on the main menu", label="Display Logs: ", name="logs") self._log_level_widget = DropdownList([("Debug", logging.DEBUG), ("Info", logging.INFO), ("Warning", logging.WARNING), ("Error", logging.ERROR), ("Critical", logging.CRITICAL)], label="Logging Level: ", name="loglevel") self._theme_widget = DropdownList([(t, t) for t in asciimatics_themes.keys()], label="Theme: ", name="theme") self._refreshrate = Text(label="Refresh Rate (s):", name="refresh") # Set default values self._refreshrate.value = str(2) self._log_level_widget.value = self._logger.log_level self._discovery.value = True self._display_logs.value = True self._theme_widget.value = ui.theme # Create and Generate Layouts layout = Layout([1], fill_frame=True) self.add_layout(layout) layout.add_widget(self._discovery) layout.add_widget(self._display_logs) layout.add_widget(self._refreshrate) layout.add_widget(self._log_level_widget) layout.add_widget(self._theme_widget) 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, frame_type, frame_data): super(EditFrame, self).__init__(screen, frame_type, frame_data) self._layout.add_widget(Divider(height=1, draw_line=False), 1) self._vm_name_edit = Text(label="VM name:", name="vm_name") self._vm_name_edit.disabled = not frame_data.multi_vm self._layout.add_widget(self._vm_name_edit, 1) self._layout.add_widget( DropdownList(VAGRANT_BOX_NAMES, label="Box name:", name="box_name"), 1) self._layout.add_widget(Divider(height=1, draw_line=False), 1) self._layout.add_widget( Text(label="CPU count:", name="cpu_count", max_length=2, validator="^[0-9]*$"), 1) self._layout.add_widget( Text(label="Memory (GiB):", name="memory", max_length=3, validator="^[0-9]*$"), 1) self._enable_vbguest_checkbox = CheckBox("'vbguest' auto-update", name="enable_vbguest") self._layout.add_widget(self._enable_vbguest_checkbox, 1) self._enable_vbguest_checkbox.disabled = not frame_data.vbguest_plugin_is_present self._layout.add_widget( CheckBox("Add inline shell provision", name="inline_shell_provision"), 1) self._layout.add_widget( CheckBox("Add shell provision script", name="shell_provisioner"), 1) self._layout.add_widget( CheckBox("Add Ansible provision playbook", name="ansible_provisioner"), 1) self._layout.add_widget( CheckBox("Disable /vagrant shared folder", name="disable_vagrant_share"), 1) self._layout.add_widget( CheckBox("Add port mapping 8080:80", name="port_mapping"), 1) self._disable_autostart_checkbox = CheckBox("Disable autostart", name="disable_autostart") self._layout.add_widget(self._disable_autostart_checkbox, 1) self._disable_autostart_checkbox.disabled = not frame_data.multi_vm self._layout.add_widget(Divider(height=1, draw_line=False), 1) self._add_extra_drive_checkbox = CheckBox( "Add extra virtual HDD", name="add_extra_hdd", on_change=self._on_add_extra_drive_change) self._layout.add_widget(self._add_extra_drive_checkbox, 1) self._extra_drive_name_edit = Text(label="File name:", name="extra_drive_file_name") self._layout.add_widget(self._extra_drive_name_edit, 1) self._extra_drive_size_edit = Text(label="Size (GiB):", name="extra_drive_size", validator="^[0-9]*$") self._layout.add_widget(self._extra_drive_size_edit, 1) self._layout.add_widget(Divider(height=1, draw_line=False), 1) self._ip_address_edit = Text(label="IP address:", name="ip_address") self._layout.add_widget(self._ip_address_edit, 1) self._ip_address_edit.disabled = not frame_data.intnet_is_present self.data = frame_data.controls_data self.fix()