def _create_popup(self, instance): self.data_clock = Clock.schedule_interval(self.get_data, 1) # create popup layout self.content = BoxLayout(orientation='vertical', spacing='5dp') popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = Popup(title=self.title, content=self.content, size_hint=(None, None), size=(popup_width, '480dp'), pos_hint={ 'middle': 1, 'top': 1 }) # construct the content, widget are used as a spacer self.content.add_widget(SettingSpacer()) self.content.add_widget(self.data_viewer) self.content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Close') btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) self.content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def _create_popup(self, instance): # Get temperature units from config file config = App.get_running_app().config Units = '[sup]o[/sup]' + config['Units']['Temp'].upper() # Create Popup layout content = BoxLayout(orientation='vertical', spacing='5dp') self.popup = Popup(content=content, title=self.title, size_hint=(0.25, None), auto_dismiss=False, separator_color=[1, 1, 1, 0], height='234dp') content.add_widget(SettingSpacer()) # Create the label to show the numeric value self.Label = Label(text=self.value + Units, markup=True, font_size='24sp', size_hint_y=None, height='50dp', halign='left') content.add_widget(self.Label) # Add a plus and minus increment button to change the value by +/- one btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='-') btn.bind(on_press=self._minus_value) btnlayout.add_widget(btn) btn = Button(text='+') btn.bind(on_press=self._plus_value) btnlayout.add_widget(btn) content.add_widget(btnlayout) content.add_widget(SettingSpacer()) # Add an OK button to set the value, and a cancel button to return to # the previous panel btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Ok') btn.bind(on_release=self._set_value) btnlayout.add_widget(btn) btn = Button(text='Cancel') btn.bind(on_release=self.popup.dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # Open the popup self.popup.open()
def _create_popup(self, instance): # create popup layout content = BoxLayout(orientation='vertical', spacing=5) popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = Popup(title=self.title, content=content, size_hint=(None, 0.9), width=popup_width) # create the filechooser initial_path = os.path.join(os.getcwd(), app_settings.flame_log_dir) self.textinput = textinput = FileChooserListView( path=initial_path, size_hint=(1, 1), dirselect=False, show_hidden=self.show_hidden, filters=['*.csv']) #textinput.bind(on_path=self._print_csv_data) # construct the content content.add_widget(textinput) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Open') btn.bind(on_release=self._csv_data_popup) btnlayout.add_widget(btn) btn = Button(text='Close') btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def _create_popup(self, instance): # create popup layout content = BoxLayout(orientation='vertical', spacing='5dp') popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = Popup(title=self.title, content=content, size_hint=(None, None), size=(popup_width, '250dp'), pos_hint={ 'middle': 1, 'top': 1 }) # create the textinput used for numeric input self.label = label = Label(text='Are you sure you want to ' + self.title + '?') # construct the content, widget are used as a spacer content.add_widget(Widget()) content.add_widget(label) content.add_widget(Widget()) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Yes') btn.bind(on_release=self._validate) btnlayout.add_widget(btn) btn = Button(text='No') btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def _create_popup(self, instance): # create the popup content = BoxLayout(orientation='vertical', spacing='5dp') popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = Popup(content=content, title=self.title, size_hint=(None, None), size=(popup_width, '400dp')) popup.height = len(self.options) * dp(55) + dp(150) # add all the options content.add_widget(Widget(size_hint_y=None, height=1)) uid = str(self.uid) for key in self.options: state = 'down' if key == self.value else 'normal' btn = ToggleButton(text=self.options[key], state=state, group=uid) btn.key = key btn.bind(on_release=self._set_option) content.add_widget(btn) # finally, add a cancel button to return on the previous panel content.add_widget(SettingSpacer()) btn = Button(text='Cancel', size_hint_y=None, height=dp(50)) btn.bind(on_release=popup.dismiss) content.add_widget(btn) # and open the popup ! popup.open()
def _create_popup(self,instance): # Create the popup and scrollview content = BoxLayout(orientation='vertical', spacing='5dp') scrollview = ScrollView(do_scroll_x=False, bar_inactive_color=[.7, .7, .7, 0.9], bar_width=4) scrollcontent = GridLayout(cols=1, spacing='5dp', size_hint=(0.95, None)) self.popup = Popup(content=content, title=self.title, size_hint=(0.25, 0.8), auto_dismiss=False, separator_color=[1,1,1,1]) # Add all the options to the ScrollView scrollcontent.bind(minimum_height=scrollcontent.setter('height')) content.add_widget(Widget(size_hint_y=None, height=dp(1))) uid = str(self.uid) for option in self.options: state = 'down' if option == self.value else 'normal' btn = ToggleButton(text=option, state=state, group=uid, height=dp(58), size_hint=(0.9, None)) btn.bind(on_release=self._set_option) scrollcontent.add_widget(btn) # Finally, add a cancel button to return on the previous panel scrollview.add_widget(scrollcontent) content.add_widget(scrollview) content.add_widget(SettingSpacer()) btn = Button(text='Cancel', height=dp(58), size_hint=(1, None)) btn.bind(on_release=self.popup.dismiss) content.add_widget(btn) self.popup.open()
def _create_popup(self, instance): # create popup layout content = BoxLayout(orientation='vertical', spacing='5dp') popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = Popup( title=self.title, content=content, size_hint=(None, None), size=(popup_width, '250dp')) # create the textinput used for numeric input self.textinput = textinput = TextInput( text=self.value, font_size='24sp', multiline=False, size_hint_y=None, height='42sp') self.last_value = self.value textinput.bind(text=self._on_text) self.textinput = textinput # construct the content, widget are used as a spacer content.add_widget(Widget()) content.add_widget(textinput) content.add_widget(Widget()) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') self._ok_button = Button(text=self.ok_button_text) self._ok_button.bind(on_release=self._write) btnlayout.add_widget(self._ok_button) btn = Button(text=self.cancel_button_text) btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def _create_popup(self, instance): # create popup layout content = BoxLayout(orientation='vertical', spacing='5dp') self.popup = popup = Popup( title=self.title, content=content, size_hint=( .8, .8)) #, size_hint=(None, None), size=('400dp', '250dp')) # create the textinput used for numeric input self.textinput = textinput = FontChooser(font=str(self.value), size_hint_y=1) self.textinput = textinput # construct the content, widget are used as a spacer content.add_widget(textinput) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='OK') btn.bind(on_release=self._validate) btnlayout.add_widget(btn) btn = Button(text='Cancel') btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def _create_popup(self, instance): # Create the popup content = BoxLayout(orientation='vertical', spacing='5dp') self.popup = Popup(content=content, title=self.title, size_hint=(0.25, None), auto_dismiss=False, separator_color=[1, 1, 1, 1], height=134 + min(len(self.options), 4) * 63) # Add all the options to the Popup content.add_widget(Widget(size_hint_y=None, height=1)) uid = str(self.uid) for option in self.options: state = 'down' if option == self.value else 'normal' btn = ToggleButton(text=option, state=state, group=uid, height=dp(58), size_hint=(1, None)) btn.bind(on_release=self._set_option) content.add_widget(btn) # Add a cancel button to return on the previous panel content.add_widget(SettingSpacer()) btn = Button(text='Cancel', height=dp(58), size_hint=(1, None)) btn.bind(on_release=self.popup.dismiss) content.add_widget(btn) self.popup.open()
def _create_popup(self, instance): # create popup layout content = BoxLayout(orientation='vertical', spacing=5) self.popup = popup = Popup(title=self.title, content=content, size_hint=(None, None), size=(400, 400)) # create the filechooser self.textinput = textinput = FileChooserListView(size_hint=(1, 1), dirselect=False, filters=["*.sf2"]) if str(self.value) not in ("", "None"): self.textinput.path = os.path.dirname(str(self.value)) textinput.bind(on_path=self._validate) self.textinput = textinput # construct the content content.add_widget(textinput) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='OK') btn.bind(on_release=self._validate) btnlayout.add_widget(btn) btn = Button(text='Cancel') btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def on_release(self): # create popup layout content = BoxLayout(orientation='vertical', spacing=5) popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = Popup( title=self.title, content=content, size_hint=(None, 0.9), width=popup_width) # create the filechooser initial_path = self.value or os.getcwd() self.textinput = textinput = FileChooserListView( path=initial_path, size_hint=(1, 1), dirselect=self.dirselect, show_hidden=self.show_hidden) textinput.bind(on_path=self._validate) # construct the content content.add_widget(textinput) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Ok') btn.bind(on_release=self._validate) btnlayout.add_widget(btn) btn = Button(text='Cancel') btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def _create_popup(self, instance): # create popup layout content = BoxLayout(orientation='vertical', spacing='5dp') # popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = Popup( title=self.title, content=content) pos = [float(c) for c in self.value.split('*')] scat = ScatterCross(size=(20, 20), size_hint=(None, None), pos=pos) scat.bind(on_touch_up=self._register) self.img.add_widget(scat) content.add_widget(self.img) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Ok') btn.bind(on_release=self._validate) btnlayout.add_widget(btn) btn = Button(text='Cancel') btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def _create_popup(self, instance): # global oORCA # create the popup content = GridLayout(cols=1, spacing='5dp') scrollview = ScrollView(do_scroll_x=False) scrollcontent = GridLayout(cols=1, spacing='5dp', size_hint=(None, None)) scrollcontent.bind(minimum_height=scrollcontent.setter('height')) self.popup = popup = Popup(content=content, title=self.title, size_hint=(0.5, 0.9), auto_dismiss=False) # we need to open the popup first to get the metrics popup.open() # Add some space on top content.add_widget(Widget(size_hint_y=None, height=dp(2))) # add all the options uid = str(self.uid) for option in self.options: state = 'down' if option == self.value else 'normal' btn = ToggleButton(text=option, state=state, group=uid, size=(popup.width, dp(55)), size_hint=(None, None)) btn.bind(on_release=self._set_option) scrollcontent.add_widget(btn) # finally, add a cancel button to return on the previous panel scrollview.add_widget(scrollcontent) content.add_widget(scrollview) content.add_widget(SettingSpacer()) # btn = Button(text='Cancel', size=((oORCA.iAppWidth/2)-sp(25), dp(50)),size_hint=(None, None)) btn = Button(text='Cancel', size=(popup.width, dp(50)), size_hint=(0.9, None)) btn.bind(on_release=popup.dismiss) content.add_widget(btn)
def _create_popup(self, instance): from kivy.core.window import Window from kivy.metrics import dp # create the popup content = BoxLayout(orientation='vertical', spacing='5dp') popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = Popup(content=content, title=self.title, size_hint=(None, None), size=(popup_width, '400dp')) popup.height = len(self.options) * dp(55) + dp(150) # add all the options content.add_widget(Widget(size_hint_y=None, height=1)) uid = str(self.uid) for option in self.options: state = 'down' if option == self.value else 'normal' btn = KognitivoSettingOptionsButton(value=option, state=state, group=uid) btn.bind(on_release=self._set_option) content.add_widget(btn) # finally, add a cancel button to return on the previous panel btn = Button(text=_('Cancel'), size_hint_y=None, height=dp(50)) content.add_widget(SettingSpacer()) btn.bind(on_release=popup.dismiss) content.add_widget(btn) # and open the popup ! popup.open()
def _create_popup(self, instance): # Create Popup layout content = BoxLayout(orientation='vertical', spacing=dp(5)) self.popup = Popup(content=content, title=self.title, size_hint=(0.25, None), auto_dismiss=False, separator_color=[1, 1, 1, 0], height=dp(234)) content.add_widget(SettingSpacer()) # Create the label to show the numeric value self._set_unit() self.Label = Label(text=self.value + self.units, markup=True, font_size=sp(24), size_hint_y=None, height=dp(50), halign='left') content.add_widget(self.Label) # Add a plus and minus increment button to change the value by +/- one btnlayout = BoxLayout(size_hint_y=None, height=dp(50), spacing=dp(50)) btn = Button(text='-') btn.bind(on_press=self._minus_value) btnlayout.add_widget(btn) btn = Button(text='+') btn.bind(on_press=self._plus_value) btnlayout.add_widget(btn) content.add_widget(btnlayout) content.add_widget(SettingSpacer()) # Add an OK button to set the value, and a cancel button to return to # the previous panel btnlayout = BoxLayout(size_hint_y=None, height=dp(50), spacing=dp(5)) btn = Button(text='Ok') btn.bind(on_release=self._set_value) btnlayout.add_widget(btn) btn = Button(text='Cancel') btn.bind(on_release=self.popup.dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # Open the popup self.popup.open()
def __init__(self, app, **kwargs): super().__init__(**kwargs) self.content = BoxLayout(orientation='vertical', spacing='5dp') self.content.add_widget(Label(text='Please restart the game to apply these changes', size_hint_y=None, height=dp(100))) self.content.add_widget(SettingSpacer()) btn = Button(text='Ok', size_hint_y=None, height=dp(50)) btn.bind(on_release=self.dismiss) self.content.add_widget(btn) self.app = app
def _create_popup(self, instance): """ Create the main Exchange popup to which new rows can be added :param instance: :return: """ self.exchange = self.key main_layout = BoxLayout(orientation='vertical', spacing='5dp') scroll_view = ScrollView(do_scroll_x=False) header = GridLayout(cols=5, spacing='5dp', row_default_height='50dp', row_force_default=True, size_hint_y=None, height='50dp') header.add_widget(Label(text='API', valign='top', size_hint_x=0.2)) header.add_widget(Label(text='NBT', valign='top', size_hint_x=0.2)) header.add_widget(Label(text='Cur', valign='top', size_hint_x=0.2)) header.add_widget(Label(text='rates', valign='top', size_hint_x=0.2)) header.add_widget(Label(text='Bot', valign='top', size_hint_x=0.2)) self.content = GridLayout(cols=5, spacing='5dp', row_default_height='50dp', row_force_default=True, size_hint_x=1, size_hint_y=None) self.content.bind(minimum_height=self.content.setter('height')) main_layout.add_widget(header) scroll_view.add_widget(self.content) main_layout.add_widget(scroll_view) self.popup = popup = Popup(title=self.title, content=main_layout) # construct the content, widget are used as a spacer main_layout.add_widget(SettingSpacer()) # buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Ok') btn.bind(on_release=self._validate) btnlayout.add_widget(btn) btn = Button(text='Cancel') btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) btn = Button(text='Add Row') btn.bind(on_release=self.add_row) btnlayout.add_widget(btn) main_layout.add_widget(btnlayout) self.load_data() # all done, open the popup ! popup.open()
def _create_popup(self, instance): # Don't use it unless on windows if sys.platform not in ["win32", "cygwin"]: return super(WinSettingPath, self)._create_popup(instance) # create popup layout content = BoxLayout(orientation='vertical', spacing=5) popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = Popup(title=self.title, content=content, size_hint=(None, 0.9), width=popup_width) # create the filechooser self.textinput = textinput = FileChooserListView(path=self.value, size_hint=(1, 1), dirselect=True) textinput.bind(on_path=self._validate) self.textinput = textinput # Spinner for drives drives = win32api.GetLogicalDriveStrings() drives = drives.split("\000")[:-1] if self.textinput.path: partition = os.path.splitdrive(self.textinput.path)[0] + "\\" else: partition = "C:\\" self.spinner = spinner = Spinner(values=drives, size_hint=(1, None), height=48, text=partition) spinner.bind(text=self.change_drive) # construct the content content.add_widget(spinner) content.add_widget(textinput) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Ok') btn.bind(on_release=self._validate) btnlayout.add_widget(btn) btn = Button(text='Cancel') btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def _csv_data_popup(self, instance): value = self.textinput.selection[0] if not value: return # read csv file with open(value, 'r') as csvfile: reader = csv.reader(csvfile, delimiter=',') items = [row for row in reader] self.data_viewer.clear() for i, item in reversed(list(enumerate(items[0]))): self.data_viewer.insert(item + ': ' + items[1][i]) # create popup layout self.csv_content = BoxLayout(orientation='vertical', spacing=5) popup_width = min(0.95 * Window.width, dp(500)) self.csv_popup = Popup(title=value, content=self.csv_content, size_hint=(None, 0.9), width=popup_width) # construct the self.csv_content self.csv_content.add_widget(SettingSpacer()) self.csv_content.add_widget(self.data_viewer) self.csv_content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Close') btn.bind(on_release=self._csv_dismiss) btnlayout.add_widget(btn) self.csv_content.add_widget(btnlayout) # all done, open the popup ! self.csv_popup.open()
def enter_keys(self, instance): """ Show a pop-up in which previously entered api keys can be selected from a drop down There are edit and add buttons on the bottom which fire other methods :param instance: :return: """ self.calling_keys_button = instance content = BoxLayout(orientation='vertical', spacing=10) top = BoxLayout(orientation='vertical', size_hint=(1, 0.7)) top.add_widget( Label(text='API Key Pair', size_hint=(1, None), height='70dp')) self.api_key_spinner = Spinner(size_hint=(1, None), height='40dp') top.add_widget(self.api_key_spinner) self.api_key_spinner.bind(text=self.enable_edit) top.add_widget(BoxLayout()) btnlayout = BoxLayout(spacing='5dp', size_hint=(1, 0.15)) btn = Button(text='Ok', size_hint_y=None, height='50dp') btn.bind(on_release=self.close_api_keys_popup) btnlayout.add_widget(btn) btn = Button(text='Cancel', size_hint_y=None, height='50dp') btn.bind(on_release=self.close_api_keys_popup) btnlayout.add_widget(btn) self.edit_keys_button = Button(text='Edit Keys', size_hint_y=None, height='50dp', disabled=True) self.edit_keys_button.bind(on_release=self.edit_keys) btnlayout.add_widget(self.edit_keys_button) self.add_keys_button = Button(text='Add Keys', size_hint_y=None, height='50dp') self.add_keys_button.bind(on_release=self.add_keys) btnlayout.add_widget(self.add_keys_button) content.add_widget(top) content.add_widget(SettingSpacer()) content.add_widget(btnlayout) popup_width = min(0.95 * Window.width, dp(500)) self.enter_keys_popup = Popup(title='API Keys', content=content, auto_dismiss=False, size_hint=(None, None), size=(popup_width, '250dp')) self.update_api_spinners() if instance.text != 'Keys': self.api_key_spinner.text = instance.text self.enter_keys_popup.open()
def add_keys(self, instance, edit=False): """ Show a different pop-up into which api_keys can be entered. In edit mode the fields are pre-populated and a delete button is shown :param instance: :param edit: :return: """ content = BoxLayout(orientation='vertical', spacing=10) grid = GridLayout(cols=2, spacing=10, size_hint=(1, 0.85)) grid.add_widget(Label(text='Public', size_hint_x=None, width='100dp')) self.add_public_key = TextInput(size_hint=(1, None), height='40dp') self.add_public_key.bind(text=self.tab_switch) grid.add_widget(self.add_public_key) grid.add_widget(Label(text='Secret', size_hint_x=None, width='100dp')) self.add_secret_key = TextInput(size_hint=(1, None), height='40dp') self.add_secret_key.bind(text=self.tab_switch) grid.add_widget(self.add_secret_key) btnlayout = BoxLayout(spacing='5dp', size_hint=(1, 0.15)) ok_btn = Button(text='Ok', size_hint_y=None, height='50dp') ok_btn.bind(on_release=self.save_api_keys) btnlayout.add_widget(ok_btn) btn = Button(text='Cancel', size_hint_y=None, height='50dp') btn.bind(on_release=self.save_api_keys) btnlayout.add_widget(btn) self.edit_public, self.edit_secret = None, None if edit is True: self.edit_public, self.edit_secret = self.get_keys(instance.id) if self.edit_public is None and self.edit_secret is None: return self.add_public_key.text = self.edit_public self.add_secret_key.text = self.edit_secret btn = Button(text='Delete', size_hint_y=None, height='50dp') btn.bind(on_release=self.delete_api_keys) btnlayout.add_widget(btn) content.add_widget(SettingSpacer()) content.add_widget(grid) content.add_widget(btnlayout) self.add_keys_popup = Popup(title='Add API Keys', content=content, auto_dismiss=False, size_hint=(1, None), height='250dp') self.add_keys_popup.open() self.add_public_key.focus = True
def _create_popup(self, instance): # create popup layout content = BoxLayout(orientation="vertical", spacing="5dp") popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = KeyInputPopup( title="Type the Key for this hotkey", content=content, size_hint=(None, None), size=(popup_width, "250dp"), ) self.popup.setting_obj = self # create the textinput used for numeric input self.textinput = textinput = TextInput( text=self.value, font_size="24sp", multiline=False, size_hint_y=None, height="42sp", readonly=True, disabled=True, ) textinput.bind(on_text_validate=self._validate) self.textinput = textinput # construct the content, widget are used as a spacer content.add_widget(Widget()) content.add_widget(textinput) content.add_widget(Widget()) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height="50dp", spacing="5dp") btn = Button(text="Ok") btn.bind(on_release=self._validate) btnlayout.add_widget(btn) btn = Button(text="Cancel") btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def _create_popup(self, instance): # create popup layout content = BoxLayout(orientation='vertical', spacing='5dp') popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = Popup(title=self.title, content=content, size_hint=(None, None), size=(popup_width, '250dp'), pos_hint={ 'middle': 1, 'top': 1 }) # create the textinput used for numeric input #f = os.popen('ifconfig eth0 | grep "inet\ addr" | cut -d: -f2 | cut -d" " -f1') #ip_address = f.read() #ip_address = '10.30.189.255' ip_address = get_ip_address() self.label = label = Label(text='IP Address: ' + ip_address) '''f = os.popen('ifconfig wlan0 | grep "inet\ addr" | cut -d: -f2 | cut -d" " -f1') ip_address = f.read() #ip_address = '10.30.189.255' self.label2 = label2 = Label( text='WLAN: ' + ip_address)''' # construct the content, widget are used as a spacer content.add_widget(Widget()) content.add_widget(label) #content.add_widget(label2) content.add_widget(Widget()) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Close') btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def _create_popup(self, instance): # create popup layout content = BoxLayout(orientation='vertical', spacing='5dp') popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = Popup(title=self.title, content=content, size_hint=(None, 0.9), width=popup_width) # create the textinput used for numeric input # self.textinput = textinput = TextInput( # text=self.value, font_size='24sp', multiline=False, # size_hint_y=None, height='42sp') # textinput.bind(on_text_validate=self._validate) # self.textinput = textinput # construct the content, widget are used as a spacer # content.add_widget(Widget()) # content.add_widget(textinput) self.colorpicker = colorpicker = ColorPicker( color=utils.get_color_from_hex(self.value)) colorpicker.bind(on_color=self._validate) self.colorpicker = colorpicker content.add_widget(colorpicker) # content.add_widget(Widget()) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Ok') btn.bind(on_release=self._validate) btnlayout.add_widget(btn) btn = Button(text='Cancel') btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def _warning_popup(self, instance): if self.key != 'SYS_SCREEN_BACKGROUND_COLOR': # create popup layout content = BoxLayout(orientation='vertical') popup_width = min(0.95 * Window.width, dp(500)) self.warning_popup = popup = Popup(title=self.title, content=content, size_hint=(None, None), size=(popup_width, '250dp'), pos_hint={ 'middle': 1, 'center': 1 }) # create the textinput used for numeric input self.label = Label( text='This action will affect ALL widgets. Is that ok?') # construct the content, widget are used as a spacer content.add_widget(Widget()) content.add_widget(self.label) content.add_widget(Widget()) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Yes') btn.bind(on_release=self._validate) btnlayout.add_widget(btn) btn = Button(text='Cancel') btn.bind(on_release=self._dismiss_warning) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open() else: self._validate(instance)
def _create_popup(self, instance): # create popup layout content = BoxLayout(orientation='vertical', spacing='5dp') self.popup = popup = Popup(title=self.title, content=content, size_hint=(.9, .6)) self.textinput = TimeSettingLabel(text=self.value) self.textinput.bind(on_text_validate=self._validate) self.up_button = TimeSettingButton(direction='up') self.down_button = TimeSettingButton(direction='down') self.up_button.bind(on_press=self.on_button_press) self.down_button.bind(on_press=self.on_button_press) # construct the content, widget are used as a spacer content.add_widget(Widget()) content.add_widget(self.up_button) content.add_widget(self.textinput) content.add_widget(self.down_button) content.add_widget(Widget()) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text=u"\uE013", font_name="glyphicons") btn.bind(on_release=self._validate) btnlayout.add_widget(btn) btn = Button(text=u"\uE014", font_name="glyphicons") btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()
def _create_popup(self, instance): from jnius import autoclass # SDcard Android # Get path to SD card Android try: Environment = autoclass('android.os.Environment') # print(Environment.DIRECTORY_DCIM) # print(Environment.DIRECTORY_MOVIES) # print(Environment.DIRECTORY_MUSIC) env = Environment() print('two') sdpath = env.getExternalStorageDirectory().getAbsolutePath() try: if not env.isExternalStorageRemovable(): if os.path.lexists('/storage/sdcard1'): sdpath = '/storage/sdcard1/'\ + Environment.DIRECTORY_PICTURES else: print('removable') except Exception as err: print(err) print('three') print(':)') # Not on Android except: print(':(') sdpath = os.path.expanduser('~') print('popup!') print(sdpath) # create popup layout content = BoxLayout(orientation='vertical', spacing=5) # popup_width = min(0.95 * Window.width, dp(500)) self.popup = popup = Popup( title=self.title, content=content, size_hint=(None, 0.9), width=dp(300)) # create the filechooser print('1') if os.path.isfile(self.value): print('file!') path = os.path.split(self.value)[0] if len(sdpath) == 0: path = os.path.expanduser('~') elif '/data/living.png' in self.value: print('living found!') path = sdpath else: path = sdpath print(path) self.textinput = textinput = FileChooserListView( path=path, size_hint=(1, 1), dirselect=True) textinput.bind(on_path=self._validate) self.textinput = textinput # construct the content content.add_widget(textinput) content.add_widget(SettingSpacer()) # 2 buttons are created for accept or cancel the current value btnlayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp') btn = Button(text='Ok') btn.bind(on_release=self._validate) btnlayout.add_widget(btn) btn = Button(text='Cancel') btn.bind(on_release=self._dismiss) btnlayout.add_widget(btn) content.add_widget(btnlayout) # all done, open the popup ! popup.open()