def CreatePopup(self, uValue, fktButttonSelect, fktTextInputSelect): """ create the popup """ i: int = 0 self.oContent: GridLayout = GridLayout(cols=1, spacing='5dp') oScrollview: ScrollView = ScrollView(do_scroll_x=False, bar_width='10dp', scroll_type=['bars', 'content']) oScrollcontent: GridLayout = GridLayout(cols=1, spacing='5dp', size_hint=(None, None)) oScrollcontent.bind(minimum_height=oScrollcontent.setter('height')) if Globals.uDeviceOrientation == u'landscape': self.popup = Popup(content=self.oContent, title=self.title, size_hint=(0.5, 0.9), auto_dismiss=False) else: self.popup = Popup(content=self.oContent, title=self.title, size_hint=(0.9, 0.9), auto_dismiss=False) self.popup.bind(on_dismiss=self.OnClose) self.popup.bind(on_open=self.OnOpen) #we need to open the popup first to get the metrics self.popup.open() #Add some space on top self.oContent.add_widget(Widget(size_hint_y=None, height=dp(2))) # add an inputfield if requested if self.bAddInputField: self.oTextInput = TextInput( text=uValue, size_hint_y=None, height='30dp', multiline=False, ) self.oTextInput.bind(on_text_validate=fktTextInputSelect) self.oContent.add_widget(self.oTextInput) self.oContent.add_widget(SettingSpacer()) # we test if we want to show some special list if len(self.options) > 0: if self.options[0] == "$LANGUAGELIST": self.options = GetLanguageList() self.oButtonHeigth = dp(30) elif self.options[0] == "$GESTURESLIST": self.options = GetGestureList() elif self.options[0] == "$PAGELIST": self.options = GetPageList() elif self.options[0] == "$ACTIONLIST": self.options = GetActionList() self.oButtonHeigth = dp(30) elif self.options[0] == "$ACTIONLISTSEND": self.options = GetSendActionList() self.oButtonHeigth = dp(30) elif self.options[0].startswith("$DIRLIST["): uPath = self.options[0][9:-1] aFiles = cPath(uPath).GetFolderList() aRet = [] for uFile in aFiles: aRet.append(uFile) aRet.sort() self.options = aRet elif self.options[0].startswith("$FILELIST["): uPath = self.options[0][10:-1] aFiles = cPath(uPath).GetFileList() aRet = [] for uFile in aFiles: aRet.append(uFile) aRet.sort() self.options = aRet elif self.options[0].endswith("[]"): aRetTmp = Var_GetArray(uVarName=self.options[0], iLevel=1) aRet = [ReplaceVars(u"$var(" + item + ")") for item in aRetTmp] aRet.sort() self.options = aRet uid = "test" for option in self.options: state = 'down' if option == uValue else 'normal' btn = ToggleButton(text=option, state=state, group=uid, size=(self.popup.width, self.oButtonHeigth), size_hint=(None, None), text_size=(self.popup.width, self.oButtonHeigth), valign="middle", halign="center") btn.bind(on_release=fktButttonSelect) btn.iIndex = i oScrollcontent.add_widget(btn) i = i + 1 # finally, add a cancel button to return on the previous panel oScrollview.add_widget(oScrollcontent) self.oContent.add_widget(oScrollview) self.oContent.add_widget(SettingSpacer()) self.oButtonCancel = cMultiLineButton(text=ReplaceVars('$lvar(5009)'), size=(self.popup.width, dp(50)), size_hint=(0.9, None), halign='center', valign='middle') self.oButtonCancel.bind(on_release=self.popup.dismiss) self.oContent.add_widget(self.oButtonCancel)