def build(self): b = BoxLayout(orientation='vertical') languages = Spinner(text='language', values=sorted([ 'KvLexer', ] + lexers.LEXERS.keys())) languages.bind(text=self.change_lang) menu = BoxLayout(size_hint_y=None, height='30pt') fnt_size = Spinner(text='12', values=map(str, range(5, 40))) fnt_size.bind(text=self._update_size) fnt_name = Spinner(text='DroidSansMono', option_cls=Fnt_SpinnerOption, values=sorted(map(str, fonts.get_fonts()))) fnt_name.bind(text=self._update_font) mnu_file = Spinner(text='File', values=('Open', 'SaveAs', 'Save', 'Close')) mnu_file.bind(text=self._file_menu_selected) menu.add_widget(mnu_file) menu.add_widget(fnt_size) menu.add_widget(fnt_name) menu.add_widget(languages) b.add_widget(menu) self.codeinput = CodeInput(lexer=KivyLexer(), font_name='data/fonts/DroidSansMono.ttf', font_size=12, text=example_text) b.add_widget(self.codeinput) return b
def __init__(self, **kwargs): super(date_selection, self).__init__(**kwargs) self.cols = 3 l1 = Label(text="day", font_size=20) self.add_widget(l1) l2 = Label(text="month", font_size=20) self.add_widget(l2) l3 = Label(text="year", font_size=20) self.add_widget(l3) self.day = Spinner(text="12", values=("1", "2", "3", '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31')) self.day.size_hint = (0.333, 1.0) self.add_widget(self.day) self.month = Spinner(text="1", values=("1", "2", "3", '4', '5', '6', '7', '8', '9', '10', '11', '12')) self.month.size_hint = (0.333, 1.0) self.add_widget(self.month) now = datetime.datetime.now() self.year_now = now.year self.year = Spinner(text="%s" % str(self.year_now), values=("%s" % str(self.year_now), "%s" % str(self.year_now + 1))) self.year.size_hint = (0.333, 1.0) self.add_widget(self.year)
def __init__(self, **kwargs): super().__init__(**kwargs) layout = GridLayout(cols=2) spinner = Spinner( # default value shown text='Home', # available values values=('Home', 'Work', 'Other', 'Custom'), size_hint=(None, None), size=(400, 200)) spinner2 = Spinner( # default value shown text='Мясо', # available values values=('мясо1', 'мясо2', 'мясо3', 'мясо4'), size_hint=(None, None), size=(400, 200)) but = Button(text="Потвердить", on_press=self.to_main_window) spinner.bind(text=self.show_selected_value) spinner2.bind(text=self.show_selected_value) layout.add_widget(spinner) layout.add_widget(spinner2) layout.add_widget(but) self.add_widget(layout) sm.add_widget(self)
def build(self): self.db_conf = DBWindow() self.connect() self.ex_conf = ExampleWindow(self.age_model) self.layout = GridLayout(cols=2) self.reference_column = None self.query_column = None self.db_popup = Popup(title="Database configuration", content=self.db_conf.layout, size_hint=(None, None), size=(400, 400)) self.db_conf.close_button.bind(on_press=self.db_popup.dismiss) self.ex_popup = Popup(title="Example data", content=self.ex_conf.layout, size_hint=(None, None), size=(400, 400)) self.ex_conf.close_button.bind(on_press=self.ex_popup.dismiss) self.reference_column_spinner = Spinner( text="Choose column", values=self.age_model.get_column_names_from_db(), size_hint=(None, None), size=(125, 42)) self.query_column_spinner = Spinner( text="Choose column", values=self.age_model.get_column_names_from_db(), size_hint=(None, None), size=(125, 42)) self.reference_column_spinner.bind(text=self.select_reference_column) self.query_column_spinner.bind(text=self.select_query_column) self.lbl = Label(text='Welcome to Querio') self.exmpl = Button(text="View Example") self.exmpl.bind(on_press=self.button3) self.btn1 = Button(text='This is a button') self.btn1.bind(on_press=self.button1) self.input = TextInput(text='Insert Value', multiline=False) self.spinner_layout = GridLayout(cols=2) self.spinner_layout.add_widget(self.query_column_spinner) self.spinner_layout.add_widget(self.reference_column_spinner) self.layout.add_widget(self.exmpl) self.layout.add_widget(self.create_db_layout()) self.layout.add_widget(self.spinner_layout) self.layout.add_widget(self.input) self.layout.add_widget(self.lbl) self.layout.add_widget(self.btn1) return self.layout
def on_spinner_layout(self, instance, value): self.spinner_layout.add_widget(Label(text='T&RH Sample Rate')) self.sample_rate_spinner = Spinner( values=self.serial.available_temp_rh_sample_rates) self.spinner_layout.add_widget(self.sample_rate_spinner) self.spinner_layout.add_widget(Label(text='T&RH Repeatability')) self.rep_spinner = Spinner(values=['Low', 'Med', 'High']) self.spinner_layout.add_widget(self.rep_spinner)
def __init__(self, **kwargs): super(CustomScreen, self).__init__(**kwargs) layout = BoxLayout(orientation='vertical') self.spinnerObject = Spinner(text="House", values=("1BHK", "2BHK", "3BHK"), background_color=(0.784, 0.443, 0.216, 1)) self.spinnerObject.size_hint = (0.2, 0.2) self.spinnerObject.pos_hint = {'x': .35, 'y': .40} layout.add_widget(self.spinnerObject) #spinner-selection self.spinnerObject.bind(text=self.spinner_select) self.spinnerSelection = Label(text="%s" % self.spinnerObject.text) layout.add_widget(self.spinnerSelection) self.spinnerSelection.pos_hint = {'x': .1, 'y': .3} #second spinner self.spinnerObject1 = Spinner(text="Area", values=("800", "1200", "1500", "1800", "2200"), background_color=(0.784, 0.443, 0.216, 1)) self.spinnerObject1.size_hint = (0.2, 0.2) self.spinnerObject1.pos_hint = {'x': .35, 'y': .40} layout.add_widget(self.spinnerObject1) #spinner-selection self.spinnerObject1.bind(text=self.spinner_select) self.spinnerSelection1 = Label(text="%s" % self.spinnerObject1.text) layout.add_widget(self.spinnerSelection1) self.spinnerSelection1.pos_hint = {'x': .1, 'y': .3} #third spinner self.spinnerObject2 = Spinner(text="Directions", values=("North", "East"), background_color=(0.784, 0.443, 0.216, 1)) self.spinnerObject2.size_hint = (0.2, 0.2) self.spinnerObject2.pos_hint = {'x': .35, 'y': .20} layout.add_widget(self.spinnerObject2) #spinner-selection self.spinnerObject2.bind(text=self.spinner_select) self.spinnerSelection2 = Label(text="%s" % self.spinnerObject2.text) layout.add_widget(self.spinnerSelection2) self.spinnerSelection2.pos_hint = {'x': .1, 'y': .3} layout.add_widget(Label(text=self.name, font_size=30)) navig = BoxLayout(size_hint=(0.2, 0.4), pos_hint={ 'top': 1, 'center_x': 0.5 }) next = Button(text='Search') next.bind(on_release=self.switch_next) navig.add_widget(next) layout.add_widget(navig) self.add_widget(layout)
def build(self): languages = Spinner(text='Courier New', values=sorted([ 'CppLexer', ] + list(lexers.LEXERS.keys()))) languages.bind(text=self.change_lang) menu = BoxLayout(size_hint_y=None, height='15pt') fnt_size = Spinner(text='20', values=list(map(str, list(range(10, 45, 5))))) fnt_size.bind(text=self._update_size) fonts = [ file for file in LabelBase._font_dirs_files if file.endswith('.ttf') ] fnt_name = Spinner(text='Courier New', option_cls=Fnt_SpinnerOption, values=fonts) fnt_name.bind(text=self._update_font) mnu_file = Spinner(text='File', values=('Open', 'SaveAs', 'Save', 'Close')) mnu_file.bind(text=self._file_menu_selected) key_bindings = Spinner(text='Key bindings', values=('Default key bindings', 'Emacs key bindings')) key_bindings.bind(text=self._bindings_selected) run_button = Button(text='Run') run_button.bind(on_press=self.compile) menu.add_widget(mnu_file) menu.add_widget(fnt_size) menu.add_widget(run_button) self.b.add_widget(menu) self.codeinput = CodeInputWithBindings( lexer=CppLexer(), font_size=20, text=self.current_code, key_bindings='default', ) self.output = ScrolllabelLabel(text="SECTION: OUTPUT\n", ) self.text_input_box = CodeInputWithBindings(text='', multiline=False, height='0dp') self.text_input_box.bind(on_text_validate=self.on_enter) self.text_input_box.size_hint_y = None self.b.add_widget(self.codeinput) self.b.add_widget(self.text_input_box) self.b.add_widget(self.output) return self.b
def init_child_widgets(self): self.scroll_layout = ScrollView() self.root_layout = GridLayout(cols=2, padding=[50, 10, 50, 10], spacing=10) self.book_label = Label(text='Book', font_size=self.app.font_size) self.root_layout.add_widget(self.book_label) self.book_spinner = Spinner( text='Genesis', background_color=(1, 0, 1), font_size=self.app.font_size, values=('Genesis', 'Exodus', 'Leviticus', 'Numbers', 'Deuteronomy', 'Joshua', 'Judges', 'Ruth', '1 Samuel', '2 Samuel', '1 Kings', '2 Kings', '1 Chronicles', '2 Chronicles', 'Ezra', 'Nehemiah', 'Esther', 'Job', 'Psalm', 'Proverbs', 'Ecclesiastes', 'Song of Solomon', 'Isaiah', 'Jeremiah', 'Lamentations', 'Ezekiel', 'Daniel', 'Hosea', 'Joel', 'Amos', 'Obadiah', 'Jonah', 'Micah', 'Nahum', 'Habakkuk', 'Zephaniah', 'Haggai', 'Zechariah', 'Malachi', 'Matthew', 'Mark', 'Luke', 'John', 'Acts', 'Romans', '1 Corinthians', '2 Corinthians', 'Galatians', 'Ephesians', 'Philippians', 'Colossians', '1 Thessalonians', '2 Thessalonians', '1 Timothy', '2 Timothy', 'Titus', 'Philemon', 'Hebrews', 'James', '1 Peter', '2 Peter', '1 John', '2 John', '3 John', 'Jude', 'Revelation')) self.root_layout.add_widget(self.book_spinner) self.chapter_label = Label(text='Chapter', font_size=self.app.font_size) self.root_layout.add_widget(self.chapter_label) self.chapter_spinner = Spinner( text='1', background_color=(1, 0, 1), font_size=self.app.font_size, values=('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20')) self.root_layout.add_widget(self.chapter_spinner) self.verse_label = Label(text='Verse', font_size=self.app.font_size) self.root_layout.add_widget(self.verse_label) self.verse_spinner = Spinner( text='1', background_color=(1, 0, 1), font_size=self.app.font_size, values=('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20')) self.root_layout.add_widget(self.verse_spinner) self.back_button = Button(text='Back', background_normal='buttongold.jpg', font_size=self.app.font_size) self.back_button.bind(on_press=self.on_press) self.add_button = Button(text='Add', background_normal='buttongold.jpg', font_size=self.app.font_size) self.add_button.bind(on_press=self.on_press) self.root_layout.add_widget(self.back_button) self.root_layout.add_widget(self.add_button) self.scroll_layout.add_widget(self.root_layout) self.add_widget(self.scroll_layout)
def set_parameters(self, parent, groups): self.groups = groups self.controller = parent main_layout = GridLayout(rows=3) main = BoxLayout(orientation='vertical') group_layout = GridLayout(cols=2, padding=10, size=(0, 120), size_hint=(1, None)) toolbar = BoxLayout(orientation='horizontal', size_hint=(1, .4)) spinner_groups = Spinner(text=ALL_GROUPS, values=[ALL_GROUPS] + [group.name for group in groups], size=(0, 50), size_hint=(1, None)) spinner_groups.bind(text=self.set_group_filter) group_layout.add_widget(Label(text="Group :")) group_layout.add_widget(spinner_groups) self.spinner_projects = Spinner(text=ALL_PROJECTS, values=[ALL_PROJECTS], size=(0, 50), size_hint=(1, None)) self.spinner_projects.disabled = True self.spinner_projects.bind(text=self.set_project_filter) group_layout.add_widget(Label(text="Project :")) group_layout.add_widget(self.spinner_projects) button_main_start = Button(text='Launch random project') button_main_start.bind(on_press=parent.initialize) main.add_widget(button_main_start) button_toolbar_create_project = Button(text='Create project') button_toolbar_create_project.bind( on_press=parent.create_project_window) toolbar.add_widget(button_toolbar_create_project) button_toolbar_edit_project = Button(text='Edit project') button_toolbar_edit_project.bind(on_press=parent.edit_project_window) toolbar.add_widget(button_toolbar_edit_project) button_toolbar_create_group = Button(text='Create group') button_toolbar_create_group.bind(on_press=parent.create_group_window) toolbar.add_widget(button_toolbar_create_group) button_toolbar_edit_group = Button(text='Edit group') button_toolbar_edit_group.bind(on_press=parent.edit_group_window) toolbar.add_widget(button_toolbar_edit_group) main_layout.add_widget(group_layout) main_layout.add_widget(main) main_layout.add_widget(toolbar) self.add_widget(main_layout)
def __init__(self): super().__init__() self.app = App.get_running_app() tone_label = Label(text='End tone ', size_hint=(None, None)) tone_label.pos = (self.app.root.width / 3.3) - (tone_label.width / 2), \ (self.app.root.height / 1.4) - (tone_label.height / 2) tone_spinner = Spinner(values=('sitar flute', 'sitar', 'tone 1', 'classical', 'tone 2', 'tone 3'),size_hint=(None,None), \ size=(self.app.root.width / 3, self.app.root.height / 18), text=end_tone[1]) tone_spinner.pos = (self.app.root.width / 1.7) - (tone_spinner.width / 2), \ (self.app.root.height / 1.4) - (tone_spinner.height / 2) tone_spinner.bind(text=self.tone_set) notif_label = Label(text='Notif tone ', size_hint=(None, None)) notif_label.pos = (self.app.root.width / 3.3) - (tone_label.width / 2), \ (self.app.root.height / 1.65) - (tone_label.height / 2) notif_spinner = Spinner(values=('tone 1', 'bells ring', 'bells 1', 'bell 2', 'bell 3d'), size_hint=(None,None), \ size=(self.app.root.width / 3, self.app.root.height / 18), text=remind_tone[1]) notif_spinner.pos = (self.app.root.width / 1.7) - (notif_spinner.width / 2), \ (self.app.root.height / 1.65) - (notif_spinner.height / 2) notif_spinner.bind(text=self.notif_set) background_label = Label(text='Background ', size_hint=(None, None)) background_label.pos = (self.app.root.width / 3.3) - (background_label.width / 2), \ (self.app.root.height / 2) - (background_label.height / 2) background_spinner = Spinner(values=('cyberpunk', 'abstract 1', 'unknown', 'abstract 2', 'abstract 3', 'default?'), size_hint=(None,None), \ size=(self.app.root.width / 3, self.app.root.height / 18), text=self.app.background[1]) background_spinner.pos = (self.app.root.width / 1.7) - (background_spinner.width / 2), \ (self.app.root.height / 2) - (background_spinner.height / 2) background_spinner.bind(text=self.background_set) close_btn = Button(text='close', size_hint=(None,None), \ size=(self.app.root.width/6, self.app.root.height/18)) close_btn.pos = (self.app.root.width / 1.35) - (close_btn.width / 2), \ (self.app.root.height / 5) - (close_btn.height / 2) close_btn.bind(on_release=lambda instance: self.popup.dismiss()) about_btn = Button(text='about?', size_hint=(None,None), background_normal='img/alpha.png', \ size=(self.app.root.width/6, self.app.root.height/18)) about_btn.bind(on_release=self.about_dialog) about_btn.pos = (self.app.root.width/4) - (about_btn.width / 2), \ (self.app.root.height/5) - (about_btn.height / 2) floatlayout = FloatLayout() for widget in [ tone_label, tone_spinner, notif_label, notif_spinner, close_btn, about_btn, background_label, background_spinner ]: floatlayout.add_widget(widget) self.popup = Popup(title='settings', content=floatlayout, size_hint=(.7, .7), auto_dismiss=False) self.popup.open()
def build(self): b = BoxLayout(orientation='vertical') languages = Spinner( text='language', values=sorted(['KvLexer', ] + list(lexers.LEXERS.keys()))) languages.bind(text=self.change_lang) menu = BoxLayout( size_hint_y=None, height='30pt') fnt_size = Spinner( text='12', values=list(map(str, list(range(5, 40))))) fnt_size.bind(text=self._update_size) fonts = [ file for file in LabelBase._font_dirs_files if file.endswith('.ttf')] fnt_name = Spinner( text='RobotoMono', option_cls=Fnt_SpinnerOption, values=fonts) fnt_name.bind(text=self._update_font) mnu_file = Spinner( text='File', values=('Open', 'SaveAs', 'Save', 'Close')) mnu_file.bind(text=self._file_menu_selected) key_bindings = Spinner( text='Key bindings', values=('Default key bindings', 'Emacs key bindings')) key_bindings.bind(text=self._bindings_selected) menu.add_widget(mnu_file) menu.add_widget(fnt_size) menu.add_widget(fnt_name) menu.add_widget(languages) menu.add_widget(key_bindings) b.add_widget(menu) self.codeinput = CodeInputWithBindings( lexer=KivyLexer(), font_size=12, text=example_text, key_bindings='default', ) b.add_widget(self.codeinput) return b
def save_frame(self, video, folder): grid_s = GridLayout(rows=5) spinner = Spinner( # default value shown text='Tipo de ficheiro', text_autoupdate=True, # available values values=('.jpg', '.png'), # just for positioning in our example size_hint=(None, None), size=(100, 44), pos_hint={'center_x': .5, 'center_y': .5}) spinner2 = Spinner( # default value shown text='intervalo(segundos)', text_autoupdate=True, # available values values=('10', '20', '30', '40', '50', '60', '90', '120', '240'), # just for positioning in our example size_hint=(None, None), size=(100, 44), pos_hint={'center_x': .5, 'center_y': .5}) spinner.bind(text=self.show_selected_value) input_layout = BoxLayout(orientation='horizontal', size_hint_y=0.1) input_label = Label(text="Timestamp base", size_hint=(None, None), size=(200, 44)) self.text_input = TextInput(text="", hint_text="Ano Mês Dia Hora Minuto Segundo", multiline=False, size_hint=(None, None), size=(300, 44)) self.text_input.bind(text=self.set_text) input_layout.add_widget(self.text_input) input_layout.add_widget(input_label) # save file save = Button(text="Selecionar", size_hint_y=None, size=(100, 44)) file = FileChooserIconView(path=self.path) grid_s.add_widget(file) grid_s.add_widget(spinner2) grid_s.add_widget(spinner) grid_s.add_widget(input_layout) grid_s.add_widget(save) self.s_save_frame.add_widget(grid_s) self.current = 'Gravar Frames' save.bind( on_release=lambda x: self.video_helper(o=self.os, folder=folder, path=file.path, ext=spinner.text, time=int(spinner2.text), video=video, timestamp=self.text))
def add_row(self, instance): """ Add a row to the main exchange screen :param instance: :return: """ self.num_rows += 1 keys_button = Button(text='Keys', size_hint_x=0.2, id='%d' % self.num_rows) keys_button.bind(on_release=self.enter_keys) self.content.add_widget(keys_button) self.keys_button.append(keys_button) address = TextInput(size_hint_x=0.2, padding=[6, 10, 6, 10], multiline=False, font_size=18, id='%d' % self.num_rows) address.bind(text=self.check_address) self.content.add_widget(address) self.address.append(address) unit = Spinner(values=self.currencies, text=self.currencies[0], size_hint_x=0.2, id='%d' % self.num_rows) self.selected_unit = self.currencies[0] unit.bind(text=self.set_unit) self.content.add_widget(unit) self.unit.append(unit) rates = Button(text='Rates', size_hint_x=0.2, id='%d' % self.num_rows) rates.bind(on_release=self.enter_rates) self.content.add_widget(rates) self.rates.append(rates) bot = Spinner(values=self.bots, text=self.bots[0], size_hint_x=0.2, id='%d' % self.num_rows) self.selected_bot = self.bots[0] bot.bind(text=self.set_bot) self.content.add_widget(bot) self.bot.append(bot) if isinstance(instance, dict): keys_button.text = instance['public'][:8] + ' / ' + instance[ 'secret'][:8] address.text = instance['address'] unit.text = instance['unit'] rates.text = instance['ask'] + ' | ' + instance['bid'] bot.text = instance['bot']
def build(self): obj = itemslist() self.items=obj.get() try: self.items.remove(None) except: pass print(obj.get()) self.main_layout2 = FloatLayout(size=(50, 50)) try: Window.clearcolor = (1, 1, 1, 1) a = Image(source='ar1.png',size=(1200,900)) self.main_layout2.add_widget(a) except: pass self.spinner = Spinner( text='Click here',background_color = (0, 255, 0, 0.7), values=self.items, size_hint=(.20, .08), pos_hint={'x': .25, 'y': .80}) self.main_layout2.add_widget(self.spinner) button1 = Button( text='Back',background_color = (0, 255, 0, 0.7), size_hint=(.20,.08), pos_hint={'x': .55, 'y': .80} ) button1.bind(on_press=self.back) self.main_layout2.add_widget(button1) return self.main_layout2
def on_dict(self, instance, value): # 2020_03_10 Sim: Why only import Spinner here? at the top of the file # it was causing a crash when starting in a thread - no idea why from kivy.uix.spinner import Spinner for n, topic in enumerate(sorted(value)): check_box = CheckBox() self.add_widget(check_box) self.add_widget(TextInput(text=str(n))) spinner = Spinner( values=['dvs', 'frame', 'pose6q', 'cam', 'imu', 'flowMap']) if 'events' in topic: spinner.text = 'dvs' check_box.active = True elif 'image' in topic or 'depthmap' in topic: spinner.text = 'frame' check_box.active = True elif 'pose' in topic: spinner.text = 'pose6q' check_box.active = True elif 'flow' in topic: spinner.text = 'flowMap' check_box.active = True self.add_widget(spinner) self.add_widget(TextInput(text=topic))
def build(self): obj = itemslist() self.items = obj.get() try: self.items.remove(None) except: pass print(obj.get()) self.main_layout2 = FloatLayout(size=(50, 50)) self.spinner = Spinner( text='Click here', values=self.items, size_hint=(.15, .10), pos_hint={'x': .25, 'y': .30}) self.main_layout2.add_widget(self.spinner) button1 = Button( text='Back', size_hint=(.15, .10), pos_hint={'x': .55, 'y': .30} ) button1.bind(on_press=self.back) self.main_layout2.add_widget(button1) return self.main_layout2
def build(self): title = ("PsVyu") layout = BoxLayout(orientation='vertical') spinner_disk = Spinner(text='Disk Management', values=('Partitions', 'Partitions_Sizes')) spinner_networks = Spinner(text='Networks', values=('Network_Cards', 'Network_Addresses')) users = Button(text='Users') layout.add_widget(spinner_networks) layout.add_widget(spinner_disk) layout.add_widget(users) spinner_networks.bind(text=self.spinner_networks_def) spinner_disk.bind(text=self.spinner_partitions_def) users.bind(on_press=lambda x: self.popupevent_users(None)) return layout
def clickWrestler(self, instance): vals = [ '106', '113', '120', '126', '132', '138', '145', '152', '160', '170', '182', '195', '220', '285' ] content = BoxLayout(orientation='vertical') lockButton = Button(text='Lock') unlockButton = Button(text='Unlock') delButton = Button(text='Remove') moveButton = Spinner(text=self.name, values=vals) remCallback = partial(self.remWrestler, instance) delButton.bind(on_press=remCallback) lockButton.bind(on_press=instance.lock) unlockButton.bind(on_press=instance.unlock) moveCallback = partial(self.moveWrestler, instance) moveButton.bind(text=moveCallback) content.add_widget(moveButton) content.add_widget(lockButton) content.add_widget(unlockButton) content.add_widget(delButton) popup = Popup(title=instance.text, content=content, size_hint=(.5, .5)) delButton.bind(on_press=popup.dismiss) lockButton.bind(on_press=popup.dismiss) unlockButton.bind(on_press=popup.dismiss) moveButton.bind(text=popup.dismiss) popup.open()
def createHapticsPanel(self): self.hapticsPanel = BoxLayout(orientation='vertical', size_hint_y=0.4) hapticIntro = BoxLayout(orientation='horizontal', size_hint_y=0.1) hapticLabel = Label(text="Haptics") self.hapticEffectName = TextInput( hint_text="Effect Name (e.g. viscousField)", multiline=False) hapticIntro.add_widget(hapticLabel) hapticIntro.add_widget(self.hapticEffectName) hapticType = BoxLayout(orientation='horizontal', size_hint_y=0.1) hapticTypeLabel = Label(text="Effect Type:") self.hapticTypeSpinner = Spinner(values=["HAPTICS_SET_STIFFNESS", "HAPTICS_CONSTANT_FORCE_FIELD",\ "HAPTICS_VISCOSITY_FIELD"]) self.hapticTypeSpinner.bind(text=self.getHapticParameters) hapticType.add_widget(hapticTypeLabel) hapticType.add_widget(self.hapticTypeSpinner) hapticParams = BoxLayout(orientation='horizontal', size_hint_y=0.3) hapticParamLabel = Label(text="Haptic Parameters") self.hapticEffectParams = TreeView(hide_root=True) hapticParams.add_widget(hapticParamLabel) hapticParams.add_widget(self.hapticEffectParams) self.hapticsPanel.add_widget(hapticIntro) self.hapticsPanel.add_widget(hapticType) self.hapticsPanel.add_widget(hapticParams)
def createTrialLayout(self): self.trialPanel = BoxLayout(orientation='vertical', padding=50, spacing=50) self.trialName = TextInput(hint_text="Trial Name (e.g. CST)", multiline=False,\ on_text_validate=self.setName, size_hint_y=0.1, size_hint_x=0.5,\ pos_hint = {'center_x':0.5, 'center_y':0.5}, padding=50) stateNameInfo = BoxLayout(orientation='horizontal', size_hint_y=0.1) stateNameLabel = Label(text="Add states to trial:", size_hint_y=0.1, pos_hint={'center_y': 0.5}) self.stateName = TextInput(hint_text="State Name (e.g. start)", multiline=False, on_text_validate=self.setStateName) self.addStateButton = Button(text="Add State", on_release=self.addState) stateNameInfo.add_widget(stateNameLabel) stateNameInfo.add_widget(self.stateName) stateNameInfo.add_widget(self.addStateButton) self.addStateButton.disabled = True startStateSelection = BoxLayout(orientation="horizontal", size_hint_y=0.1, spacing=50,\ padding=50) selectStartLabel = Label(text="Select start state:") self.startStateName = Spinner(values=[]) self.startStateName.bind(text=self.setStartState) startStateSelection.add_widget(selectStartLabel) startStateSelection.add_widget(self.startStateName) self.trialPanel.add_widget(self.trialName) self.trialPanel.add_widget(stateNameInfo) self.trialPanel.add_widget(startStateSelection)
def __init__(self): super().__init__() self.place_list = PlacesCollection() self.sort_label = Label(text="Sort by:") # sort by country, priority and visited self.spinner = Spinner(text="Name", values=("Country", "Priority", "Visited")) # adding a new place self.add_label = Label(text="New Place:") # input the name self.name_label = Label(text="Name: ") self.name_input = TextInput(write_tab=False, multiline=False) # input the country self.country_label = Label(text="Country: ") self.country_input = TextInput(write_tab=False, multiline=False) # input the priority self.priority_label = Label(text="Priority: ") self.priority_input = TextInput(write_tab=False, multiline=False) # add button for 'add place' and 'clear fields self.add_button = Button(text="Add place") self.top_label = Label(id="count_place_label") self.clear_button = Button(text="Clear Fields")
def __init__(self, character, *args, **kwargs): self.character = character super(CharacterRace, self).__init__(*args, **kwargs) spinner = Spinner(font_size=FONT_XLARGE, text=self.character.race or '', values=[race.name for race in session.query(Race)]) def view_details(_): details = Popup(size_hint=(.8, .8), title=self.character.race) race = (session.query(Race).filter( Race.name == self.character.race).scalar()) if race: text = race.details else: text = "Race '%s' not found" % self.character.race details.add_widget(RstDocument(text=text)) details.open() spinner.bind(text=self.update) self.add_widget(spinner) self.add_widget( Button(text="Race details", font_size=FONT_XLARGE, on_press=view_details))
def __init__(self, character, *args, **kwargs): self.character = character super(CharacterClass, self).__init__(*args, **kwargs) spinner = Spinner( font_size=FONT_XLARGE, text=self.character.class_ or '', values=[class_.name for class_ in session.query(Class)]) spinner.bind(text=self.update) def view_details(_): details = Popup(size_hint=(.8, .8), title=self.character.class_) class_ = (session.query(Class).filter( Class.name == self.character.class_).scalar()) if class_: text = class_.details else: text = "Class_ '%s' not found" % self.character.class_ details.add_widget(RstDocument(text=text)) details.open() self.add_widget(spinner) self.add_widget( Button(text="Class details", font_size=FONT_XLARGE, on_press=view_details))
def __init__(self, **kwargs): """ Install all the needed widgets for the interface of kivy app """ super().__init__(**kwargs) self.place_list = PlaceList() # Top place status label and bottom place status label self.top_place_status_label = Label(text="", id="count_label") self.bottom_place_status_label = Label(text="") # Sorting label self.sort_by_label = Label(text="Sort by:") # Make Country as the default sorting method self.spinner = Spinner(text='Country', values=('Country', 'Place', 'Priority', 'Visited')) self.add_new_place_label = Label(text="Add New Place...") self.place_name_label = Label(text="Name:") self.place_name_text_input = TextInput(write_tab=False, multiline=False) self.place_country_label = Label(text="Country:") self.place_country_text_input = TextInput(write_tab=False, multiline=False) self.place_priority_label = Label(text="Priority:") self.place_priority_text_input = TextInput(write_tab=False, multiline=False) # Add place and clear labels self.add_place_button = Button(text='Add Place') self.clear_button = Button(text='Clear')
def fill(self, layout, character): for entity in character: s = Spinner( text=entity['name'] + " the " + entity['profession'], values=[ "Age : " + str(entity['age']), "Statistics primary : " + str(entity['primary_statistics']), "Statistics secondary : " + str(entity['secondary_statistics']), "Eyes : " + str(entity['eye_colour']), "Hair : " + str(entity['hair_colour']), "Origin : " + str(entity['origin']), "Profession : " + str(entity['profession']), "Race : " + str(entity['race']), "Gender : " + str(entity['sex']), "Star sign : " + str(entity['star_sign']), "Equipment : " + str(entity['equipment']), "Weapon : " + str(entity['weapon']), "Armor : " + str(entity['armor']), "Weight : " + str(entity['weight']) ], height=30, size_hint=(1, None), background_normal='', background_color=[90 / 255, 190 / 255, 90 / 255, 1]) layout.add_widget(s) self.createdNames.append(entity['name'])
def __init__(self, **kwargs): """ Installing all the required widgets for the layout of kivy app """ super().__init__(**kwargs) self.song_list = SongList() # Bottom status label and Top count label self.top_label = Label(text="", id="count_label") self.status_label = Label(text="") # layout widget left part self.sort_label = Label(text="Sort by:") # Putting default sort method as Artist self.spinner = Spinner(text='Artist', values=('Artist', 'Title', 'Year', 'Required')) self.add_song_label = Label(text="Add New Song...") self.title_label = Label(text="Title:") self.title_text_input = TextInput(write_tab=False, multiline=False) self.artist_label = Label(text="Artist:") self.artist_text_input = TextInput(write_tab=False, multiline=False) self.year_label = Label(text="Year:") self.year_text_input = TextInput(write_tab=False, multiline=False) # To add and clear for the bottom widget self.add_song_button = Button(text='Add Song') self.clear_button = Button(text='Clear')
def createSelectStatePanel(self): self.selectStatePanel = BoxLayout(orientation='horizontal', size_hint_y=0.1) selectLabel = Label(text="Select State:") self.selectStateList = Spinner(values=[]) self.selectStatePanel.add_widget(selectLabel) self.selectStatePanel.add_widget(self.selectStateList)
def build_login(self): staff_list = [] for staff in self.staff: staff_list.append(staff.name) box = BoxLayout(orientation='horizontal', spacing=10, size_hint_y=None, height=100) login = BoxLayout(orientation='vertical', size_hint_x=3, spacing=10) u = BoxLayout() self.username = Spinner(size_hint_x=1.5, text='', values=staff_list) u.add_widget(Label(text='Name')) u.add_widget(self.username) p = BoxLayout() self.password = TextInput(size_hint_x=1.5) p.add_widget(Label(text='Password')) p.add_widget(self.password) login.add_widget(u) login.add_widget(p) box.add_widget(login) enter = Button(text='Login') enter.bind(on_release=self.login) box.add_widget(enter) return box
def __init__(self, gui): self.gui = gui self.working = True self.freqOrg = [50.00, 100.00, 200.00, 0.01] self.freq = [50.00, 100.00, 200.00, 0.01] self.status = "off" self.targetHdg = 0 self.tilerPos = 0.0 self.burstRunning = False self.on_updateSettings() self.driverQRL = None self.cMin = 0.0 self.cPlus = 0.0 self.clickSize = 0.15 self.Kp = 0.025 self.Ki = 0.01 self.Kd = 0.1 self.pid = PID(self.Kp, self.Ki, self.Kd, setpoint=0, auto_mode=True) self.pid.proportional_on_measurement = True self.driverType = self.gui.config['apDriver'] self.sDriTyp = Spinner( values=['driver9 3kts', 'driver9 11kts', 'PID'], text=self.driverType, ) self.gui.rl.ids.blAutDri.add_widget(self.sDriTyp) self.sDriTyp.bind(text=self.on_driverChange) _thread.start_new(self.sinWatchDog, ())
def add_patient_fields(self): target = self.ids.opsFieldsP target.clear_widgets() crud_checkin = TextInput(hint_text='Check in date') crud_pid = TextInput(hint_text='patient ID') crud_rn = TextInput(hint_text='Room Number') crud_emg = TextInput(hint_text='Emergancy Number') crud_risk = Spinner(text='Risk', values=['Low', 'High']) crud_rfid = TextInput(hint_text='Rfid Tag Number') crud_submit = Button( text='Add', size_hint_x=None, width=100, on_release=lambda x: self.add_patient( crud_checkin.text, crud_pid.text, crud_rn.text, crud_emg.text, crud_risk.text, crud_rfid.text)) target.add_widget(crud_checkin) target.add_widget(crud_pid) target.add_widget(crud_rn) target.add_widget(crud_emg) target.add_widget(crud_risk) target.add_widget(crud_rfid) target.add_widget(crud_submit)