def my_read_block_dialog(self, instance): grid = GridLayout() grid.cols = 1 grid.spacing = [6, 6] grid.padding = [6, 6] my_path = os.path.join(self.my_path.text, self.my_fname.text) if os.path.isdir(my_path): my_path = os.path.join(my_path, self.my_default_fname) if os.path.isfile(my_path): warn = Label( text= "FILE ALREADY EXISTS, IF YOU SELECT DOWNLOAD\nTHE FILE WILL BE OVERWRITTEN", markup=True, halign="center") grid.add_widget(warn) pathinput = make_my_text_input(my_path, True) grid.add_widget(pathinput) self.pathinput = pathinput self.popup = popup = Popup(title='confirm persistent block download', content=grid) popup.size_hint = (None, None) popup.size = (0.95 * Window.width, 250) bg = GridLayout(cols=2) bg.spacing = [6, 6] b = Button(text='close') b.height = 60 b.size_hint_y = None b.bind(on_release=popup.dismiss) bg.add_widget(b) b = Button(text='download') b.height = 60 b.size_hint_y = None b.bind(on_release=self.read_selected) bg.add_widget(b) grid.add_widget(bg) pb = ProgressBar(value=0, max=1000) grid.add_widget(pb) popup.progress_bar = pb # all done, open the popup ! popup.open()
def my_select_block_dialog(self, instance): button_list = [ "1. program", "2. config", "3. defaults", "5. server key", "6. server cert", "7. root cert", "8. cert chain", "9. publish chain", "10. wifi select", "12. cust", "21. accounts" ] grid = GridLayout() grid.cols = 2 grid.spacing = [6, 6] grid.padding = [6, 6] for button_text in button_list: b = Button(text=button_text) b.height = 60 b.size_hint_y = None b.bind(on_release=self.block_selected) grid.add_widget(b) self.popup = popup = Popup(title='select persistent block', content=grid) popup.size_hint = (None, None) popup.size = (0.90 * Window.width, 0.90 * Window.height) # all done, open the popup ! popup.open()
def user_screen(self): self.manager.get_screen( 'main').ids.btn_camera.color = get_color_from_hex('#FFFFFF') self.manager.get_screen( 'main').ids.btn_home.color = get_color_from_hex('#FFFFFF') self.manager.get_screen( 'main').ids.btn_user.color = get_color_from_hex('#2196F3') self.manager.get_screen('main').ids.master.clear_widgets() user_layout = GridLayout() user_layout.id = 'user_layout' user_layout.spacing = (0, 0.5) user_layout.padding = 40, 10, 40, 10 user_layout.cols = 1 user_layout.row_default_height = self.height * 0.25 user_layout.row_force_default = True lbl_user = Label() lbl_user.id = 'lbl_home' lbl_user.color = get_color_from_hex('#212121') lbl_user.text = 'User Layout' self.manager.get_screen('main').ids[user_layout.id] = \ WeakProxy(user_layout) self.manager.get_screen('main').ids[lbl_user.id] = \ WeakProxy(lbl_user) self.manager.get_screen('main').ids.master.\ add_widget(user_layout) self.manager.get_screen('main').ids.user_layout.\ add_widget(lbl_user)
def home_screen(self): self.manager.get_screen( 'main').ids.btn_camera.color = get_color_from_hex('#FFFFFF') self.manager.get_screen( 'main').ids.btn_home.color = get_color_from_hex('#2196F3') self.manager.get_screen( 'main').ids.btn_user.color = get_color_from_hex('#FFFFFF') self.manager.get_screen('main').ids.master.clear_widgets() home_layout = GridLayout() home_layout.id = 'home_layout' home_layout.spacing = (0, 0.5) home_layout.padding = 40, 10, 40, 10 home_layout.cols = 1 home_layout.row_default_height = self.height * 0.25 home_layout.row_force_default = True lbl_home = Label() lbl_home.id = 'lbl_home' lbl_home.color = get_color_from_hex('#212121') lbl_home.text = 'Home Layout' self.manager.get_screen('main').ids[home_layout.id] = \ WeakProxy(home_layout) self.manager.get_screen('main').ids[lbl_home.id] = \ WeakProxy(home_layout) self.manager.get_screen('main').ids.master.\ add_widget(home_layout) self.manager.get_screen('main').ids.lbl_home.\ add_widget(lbl_home)
def camera_screen(self): self.manager.get_screen( 'main').ids.btn_camera.color = get_color_from_hex('#2196F3') self.manager.get_screen( 'main').ids.btn_home.color = get_color_from_hex('#FFFFFF') self.manager.get_screen( 'main').ids.btn_user.color = get_color_from_hex('#FFFFFF') self.manager.get_screen('main').ids.master.clear_widgets() camera_layout = GridLayout() camera_layout.id = 'camera_layout' camera_layout.spacing = (0, 0.5) camera_layout.padding = 40, 10, 40, 10 camera_layout.cols = 1 camera_layout.row_default_height = self.height * 0.25 camera_layout.row_force_default = True lbl_camera = Label() lbl_camera.id = 'lbl_camera' lbl_camera.color = get_color_from_hex('#212121') lbl_camera.text = 'Camera Layout' self.manager.get_screen('main').ids[camera_layout.id] = \ WeakProxy(camera_layout) self.manager.get_screen('main').ids[lbl_camera.id] = \ WeakProxy(lbl_camera) self.manager.get_screen('main').ids.master.\ add_widget(camera_layout) self.manager.get_screen('main').ids.camera_layout.\ add_widget(lbl_camera)
def my_write_block_dialog(self, instance): grid = GridLayout() grid.cols = 1 grid.spacing = [6, 6] grid.padding = [6, 6] my_path = os.path.join(self.my_path.text, self.my_fname.text) if os.path.isdir(my_path): my_path = os.path.join(my_path, self.my_default_fname) pathinput = make_my_text_input(my_path, True) grid.add_widget(pathinput) self.pathinput = pathinput self.popup = popup = Popup(title='confirm file upload', content=grid) popup.size_hint = (None, None) popup.size = (0.95 * Window.width, 250) bg = GridLayout(cols=2) bg.spacing = [6, 6] b = Button(text='close') b.height = 60 b.size_hint_y = None b.bind(on_release=popup.dismiss) bg.add_widget(b) b = Button(text='upload') b.height = 60 b.size_hint_y = None b.bind(on_release=self.write_selected) bg.add_widget(b) grid.add_widget(bg) pb = ProgressBar(value=0, max=1000) grid.add_widget(pb) popup.progress_bar = pb # all done, open the popup ! popup.open()
def build(self): box = BoxLayout() box.orientation = 'vertical' navigation_bar = CupertinoNavigationBar() navigation_bar.size_hint_y = 0.15 title = CupertinoLabel() title.text = 'Symbols' title.bold = True title.pos_hint = {'center': (0.5, 0.5)} scrollview = CupertinoScrollView() scrollview.scroll_wheel_distance = 200 layout = GridLayout() layout.cols = 1 layout.spacing = 15 layout.padding = 2, 15 layout.size_hint_y = None layout.bind(minimum_height=layout.setter('height')) navigation_bar.add_widget(title) scrollview.add_widget(layout) with open(root_path + 'symbols.json', 'r') as json: symbols = load(json) for s in symbols: cell = BoxLayout() cell.orientation = 'horizontal' cell.size_hint_y = None cell.height = 20 symbol = CupertinoSymbol() symbol.symbol = s symbol.color = 0, 0, 0, 1 symbol.size_hint_x = 0.2 name = CupertinoLabel() name.text = s name.font_size = 14 name.halign = 'left' name.bind(size=name.setter('text_size')) cell.add_widget(symbol) cell.add_widget(name) layout.add_widget(cell) box.add_widget(navigation_bar) box.add_widget(scrollview) return box
def __init__(self, **kwargs): super(InputsScreen, self).__init__(**kwargs) scroll = ScrollView() scroll.size_hint = (1, 1) self.add_widget(scroll) layout = GridLayout() layout.cols = 3 layout.padding = '8dp' layout.spacing = '8dp' layout.size_hint_y = None layout.bind(minimum_height=layout.setter('height')) scroll.add_widget(layout) self.layout = layout
def colorDialog(self, button): # Create a layout for the widget layout = GridLayout(cols = 1, padding = 10); layout.spacing = [0, 5]; # Add widget and close button clr_picker = ColorPicker(); closeButton = Button(text ='Close', size_hint=(1, 0.075)); layout.add_widget(clr_picker); layout.add_widget(closeButton); # Instantiate the modal popup and display popup = Popup(title ='Pick a Color', content = layout, auto_dismiss=False); popup.open(); # Bind the widgets with respective functions clr_picker.bind(color=self.pickColor); closeButton.bind(on_press=popup.dismiss);
def __init__(self, **kwargs): super(LoginScreen, self).__init__(**kwargs) layout = GridLayout() layout.cols = 2 layout.spacing = 50 layout.row_default_height = window_height layout.col_default_width = window_width / 10 layout.add_widget(Label(text='Observer')) layout.observer_field = TextInput(multiline=False) layout.add_widget(layout.observer_field) layout.add_widget(Label(text='Box open')) layout.box_open_field = TextInput(box_open_field=True, multiline=False) layout.add_widget(layout.box_open_field) self.layout = layout self.add_widget(layout)
def __init__(self, **kwargs): super().__init__(**kwargs) self.cols = 2 self.padding = [100, 100, 100, 100] self.add_widget(Image(source='image.jpg')) buttons = GridLayout(cols=2) buttons.spacing = [20, 20] button_1 = Button(text='BIOMETRIC \nVERIFICATION', font_size=45, italic=True, background_color=[1, 255, 1, 1]) button_2 = Button(text='SHOW \nATTENDANCE', font_size=45, italic=True, background_color=[255, 1, 1, 1]) button_3 = Button(text='USER \nREGISTRATION', font_size=45, italic=True, background_color=[1, 1, 255, 1]) button_4 = Button(text='USER \nDELETION', font_size=45, italic=True, background_color=[1, 50, 50, 1]) button_1.bind(on_press=self.biometric_verification) button_2.bind(on_press=self.show_attendance) button_3.bind(on_press=self.add_user) button_4.bind(on_press=self.remove_user) buttons.add_widget(button_1) buttons.add_widget(button_2) buttons.add_widget(button_3) buttons.add_widget(button_4) self.add_widget(buttons)
def __init__(self, **kwargs): super().__init__(**kwargs) self.cols = 2 self.padding = [100, 100, 100, 100] self.add_widget(Image(source='Attendance.jpg')) buttons = GridLayout(cols=2) buttons.spacing = [20, 20] button_1 = Button(text='TAKE \nATTENDANCE', font_size=30, italic=True, background_color=[1, 255, 1, 1]) button_2 = Button(text='SHOW \nATTENDANCE', font_size=30, italic=True, background_color=[255, 1, 1, 1]) button_3 = Button(text='ADD \nSTUDENT', font_size=30, italic=True, background_color=[1, 1, 255, 1]) button_4 = Button(text='REMOVE \nSTUDENT', font_size=30, italic=True, background_color=[100, 140, 0, 1]) button_1.bind(on_press=self.take_attendance) button_2.bind(on_press=self.show_attendance) button_3.bind(on_press=self.add_student) button_4.bind(on_press=self.remove_student) buttons.add_widget(button_1) buttons.add_widget(button_2) buttons.add_widget(button_3) buttons.add_widget(button_4) self.add_widget(buttons)
def render_builder(self,tab): self.MainBx=BoxLayout(orientation='vertical') self.MainBx.size_hint=( 1, 1) UpBx=BoxLayout() UpBx.padding=10 UpBx.spacing=10 UpBx.size_hint = (1,.99) btnBuild=Button(text='Build',size_hint=(1, 1)) btnBuild.bind(on_press=self.start_build) btnInstall=Button(text='Install',size_hint=(1,1)) btnInstall.bind(on_press=self.start_install) btnInstall.bind(on_release=self.install_prj) btnInstall.disabled=False BtnBx=BoxLayout() BtnBx.size_hint = (1,.1) BtnBx.add_widget(btnBuild) BtnBx.add_widget(btnInstall) self.MainBx.add_widget(UpBx) self.MainBx.add_widget(BtnBx) DxBox=BoxLayout(orientation='vertical') DxBox.padding=5 DxBox.spacing=5 ProojIntBx = GridLayout(cols=2) #init ProojIntBx.size_hint = (1, 0.3) vl=Label(text=u'Version') vl.text_size=(self.width, None) self.vt=TextInput() self.vt.multiline=False pnl=Label(text=u'Project Name') self.pnt=TextInput() self.pnt.multiline=False pkgl=Label(text=u'Base Package Name') self.pkgt=TextInput() self.pkgt.multiline=False ProojIntBx.add_widget(vl) ProojIntBx.add_widget(self.vt) ProojIntBx.add_widget(pnl) ProojIntBx.add_widget(self.pnt) ProojIntBx.add_widget(pkgl) ProojIntBx.add_widget(self.pkgt) FileBx=BoxLayout() #add file search and list permission FileBx.size_hint = (1, 0.95) self.prj_path=FileChooserListView(path=self.prj_load_path) self.prj_path.size_hint = (1, 1) FileBx.add_widget(self.prj_path) ActionOptBx = GridLayout(cols=4) #debug install .... ActionOptBx.padding=10 ActionOptBx.spacing=10 ActionOptBx.size_hint = (1, 0.1) DebugBox=BoxLayout() DebugBox.add_widget(Label(text='Debug')) self.chkDebug=CheckBox() DebugBox.add_widget(self.chkDebug) DebugBox.add_widget(Label(text='Release')) self.chkRelease=CheckBox() DebugBox.add_widget(self.chkRelease) ActionOptBx.add_widget(DebugBox) DxBox.add_widget(ProojIntBx) DxBox.add_widget(FileBx) DxBox.add_widget(ActionOptBx) #dxbox -> second in up box PermissionBx=BoxLayout(orientation='vertical') #treeviw pwrmission PermissionBx.padding=5 PermissionBx.spacing=5 PermissionBx.pos=(10, 0) #~ PermissionBx.size_hint = (1, 1) layouttv = GridLayout(cols=1, spacing=5, size_hint_y=None,pos=(0,10)) layouttv.bind(minimum_height=layouttv.setter('height')) for x in self.obj_builder.permissions_list: btn = ToggleButton(text=x, size_hint_y=None, height=40) btn.bind(state=self.add_remove_permission) layouttv.add_widget(btn) root = ScrollView(size_hint=(None, None), size=(400, 500)) root.size_hint = (1, .9) root.add_widget(layouttv) PermissionBx.add_widget(root) #reder all UpBx.add_widget(DxBox) UpBx.add_widget(PermissionBx) #add all in tab item tab.add_widget(self.MainBx)
def __init__(self, **kw): super().__init__(**kw) layout = BoxLayout() layout.orientation = "vertical" layout.opacity = 1.0 layout.padding = 20 layout.spacing = 20 grid = GridLayout() grid.spacing = 10 grid.cols = 2 #RENDSZAM rendszamgomb = Button(text="Rendszám:", size_hint=(1.0, 0.1)) rendszamgomb.pos_hint = {"center_x": 0.5, 'y': 0.0} rendszamgomb.color = (1.0, 1.0, 1.0, 1) rendszamgomb.bind(on_press=self.clearRendszammezo) grid.add_widget(rendszamgomb) rendszammezo = TextInput(multiline=False, write_tab=False) rendszammezo.foreground_color = (0.0, 0.0, 0.0, 5) rendszammezo.background_color = (1.0, 1.0, 1.0, 5) rendszammezo.font_size = 30 rendszammezo.font_name = "Roboto-Bold" layout.rendszammezo = rendszammezo grid.add_widget(rendszammezo) #ÉVJÁRAT evjaratgomb = Button(text="Évjárat:", size_hint=(1.0, 0.1)) evjaratgomb.pos_hint = {"center_x": 0.5, 'y': 0.0} evjaratgomb.color = (1.0, 1.0, 1.0, 1) evjaratgomb.bind(on_press=self.clearEvjaratmezo) grid.add_widget(evjaratgomb) evjaratmezo = TextInput(multiline=False, write_tab=False) evjaratmezo.foreground_color = (0.0, 0.0, 0.0, 5) evjaratmezo.background_color = (1.0, 1.0, 1.0, 5) evjaratmezo.font_size = 30 evjaratmezo.font_name = "Roboto-Bold" layout.evjaratmezo = evjaratmezo grid.add_widget(evjaratmezo) #Tipus tipusgomb = Button(text="Típus:", size_hint=(1.0, 0.1)) tipusgomb.pos_hint = {"center_x": 0.5, 'y': 0.0} tipusgomb.bind(on_press=self.clearTipusmezo) grid.add_widget(tipusgomb) tipusmezo = TextInput(multiline=False, write_tab=False) tipusmezo.foreground_color = (0.0, 0.0, 0.0, 5) tipusmezo.background_color = (1.0, 1.0, 1.0, 5) tipusmezo.font_size = 30 tipusmezo.font_name = "Roboto-Bold" layout.tipusmezo = tipusmezo grid.add_widget(tipusmezo) #ÁR argomb = Button(text="Ár:", size_hint=(1.0, 0.1)) argomb.pos_hint = {"center_x": 0.5, 'y': 0.0} argomb.bind(on_press=self.clearArmezo) grid.add_widget(argomb) armezo = TextInput(multiline=False, write_tab=False) armezo.foreground_color = (0.0, 0.0, 0.0, 5) armezo.background_color = (1.0, 1.0, 1.0, 5) armezo.font_size = 30 armezo.font_name = "Roboto-Bold" layout.armezo = armezo grid.add_widget(armezo) layout.add_widget(grid) #Gomb button1 = Button(text="Hozzáadás", size_hint=(1.0, 0.3)) button1.background_color = (1.5, 1.5, 1.5, 1) button1.bind(on_press=self.checkFieldsAndPrintData) layout.add_widget(button1) button2 = Button(text="Lista", size_hint=(1.0, 0.3)) button2.background_color = (1.5, 1.5, 1.5, 1) button2.bind(on_press=self.showDetails) layout.add_widget(button2) self.layout = layout self.add_widget(layout) self.bind(on_leave=self.clearOnLeave)
def build(self): box = BoxLayout() box.orientation = 'vertical' navigation_bar = CupertinoNavigationBar() navigation_bar.height = 60 title = CupertinoLabel() title.text = 'Showcase' title.bold = True title.pos_hint = {'center_x': 0.5, 'center_y': 0.5} scrollview = CupertinoScrollView() scrollview.size_hint_y = None scrollview.height = Window.height - navigation_bar.height layout = GridLayout() layout.cols = 1 layout.spacing = 15 layout.padding = 15 layout.size_hint_y = None layout.bind(minimum_height=layout.setter('height')) system_button = CupertinoSystemButton() system_button.text = 'Send' system_button.size_hint_y = None system_button.height = 20 symbol_button = CupertinoSymbolButton() symbol_button.symbol = 'info' symbol_button.color = 0.05, 0.5, 0.95, 1 symbol_button.size_hint_y = None symbol_button.size = 32, 32 button = CupertinoButton() button.text = 'Hello World' button.size_hint_y = None button.height = 50 segmented_controls = CupertinoSegmentedControls() segmented_controls.size_hint_y = None segmented_controls.height = 30 segmented_controls.add_tab('Segmented') segmented_controls.add_tab('Controls') switch = CupertinoSwitch() switch.size_hint = None, None switch.size = 70, 40 self.progress_bar = CupertinoProgressbar() self.progress_bar.value = 10 self.progress_bar.size_hint_y = None self.progress_bar.height = 5 stepper = CupertinoStepper() stepper.size_hint = None, None stepper.size = 100, 30 stepper.bind(on_plus=lambda widget: self.increment_progress(10), on_minus=lambda widget: self.increment_progress(-10)) ny_label = CupertinoLabel() ny_label.font_name = 'New York' ny_label.text = 'New York Font Label' ny_label.size_hint_y = None ny_label.height = 20 sf_label = CupertinoLabel() sf_label.font_name = 'San Francisco' sf_label.text = 'San Francisco Font Label' sf_label.size_hint_y = None sf_label.height = 20 alert_dialog_button = CupertinoButton() alert_dialog_button.text = 'Open Alert Dialog' alert_dialog_button.size_hint_y = None alert_dialog_button.height = 50 alert_dialog_button.on_release = self.open_alert_dialog action_sheet_button = CupertinoButton() action_sheet_button.text = 'Open Action Sheet' action_sheet_button.size_hint_y = None action_sheet_button.height = 50 action_sheet_button.on_release = self.open_action_sheet text_field = CupertinoTextField() text_field.hint_text = 'Text Field' text_field.size_hint_y = None text_field.height = 30 instructions = CupertinoLabel() instructions.text = 'Enter Text Below:' instructions.size_hint = None, None instructions.size = 120, 20 text_view = CupertinoTextView() text_view.size_hint_y = None text_view.height = 100 navigation_bar.add_widget(title) layout.add_widget(system_button) layout.add_widget(symbol_button) layout.add_widget(button) layout.add_widget(segmented_controls) layout.add_widget(switch) layout.add_widget(self.progress_bar) layout.add_widget(stepper) layout.add_widget(ny_label) layout.add_widget(sf_label) layout.add_widget(alert_dialog_button) layout.add_widget(action_sheet_button) layout.add_widget(text_field) layout.add_widget(instructions) layout.add_widget(text_view) scrollview.add_widget(layout) box.add_widget(navigation_bar) box.add_widget(scrollview) return box