Beispiel #1
0
    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=(0.9, 0.9))

        # Create the slider used for numeric input
        self.colorpicker = colorpicker = ColorPicker()

        content.add_widget(colorpicker)
        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 = cMultiLineButton(text=ReplaceVars('$lvar(5008)'), halign='center', valign='middle')
        btn.bind(on_release=self._validate)
        btnlayout.add_widget(btn)
        btn = cMultiLineButton(text=ReplaceVars('$lvar(5009)'), halign='center', valign='middle')
        btn.bind(on_release=self._dismiss)
        btnlayout.add_widget(btn)
        content.add_widget(btnlayout)
        colorpicker.bind(color= self.On_Color)
        # all done, open the popup !

        colorpicker.hex_color = self.value

        popup.open()
Beispiel #2
0
    def _create_popup(self, instance) -> None:
        """ create popup layout  """
        oContent:BoxLayout = BoxLayout(orientation='vertical', spacing='5dp')
        self.popup = popup = Popup(title=self.title,content=oContent, size_hint=(0.9, 0.9))

        # Create the slider used for numeric input
        oColorpicker:ColorPicker = ColorPicker()
        self.oColorpicker = oColorpicker

        oContent.add_widget(oColorpicker)
        oContent.add_widget(SettingSpacer())

        oBtn:cMultiLineButton

        # 2 buttons are created for accept or cancel the current value
        oBtnlayout:BoxLayout = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp')
        oBtn = cMultiLineButton(text=ReplaceVars('$lvar(5008)'), halign='center', valign='middle')
        oBtn.bind(on_release=self._validate)
        oBtnlayout.add_widget(oBtn)
        oBtn = cMultiLineButton(text=ReplaceVars('$lvar(5009)'), halign='center', valign='middle')
        oBtn.bind(on_release=self._dismiss)
        oBtnlayout.add_widget(oBtn)
        oContent.add_widget(oBtnlayout)
        oColorpicker.bind(color= self.On_Color)
        # all done, open the popup !

        oColorpicker.hex_color = self.value

        popup.open()
Beispiel #3
0
    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=(None, None), size=('400dp', '250dp'))

        # Create the slider used for numeric input
        self.slider = slider = Slider(min=self.fMin, max=self.fMax, value=float(self.value),size_hint_y=None, height='50dp')
        slider.bind(on_touch_move = self.OnSliderMoved)
        slider.bind(on_touch_up = self.OnSliderMoved)
        self.textvalue = TextInput(size_hint_y=None, height='30dp',multiline=False, )
        self.textvalue.bind(on_text_validate = self.On_Enter)
        self.textvalue.bind(focus=self.On_Focus)

        # construct the content, widget are used as a spacer
        content.add_widget(Widget())
        content.add_widget(slider)
        content.add_widget(Widget())
        content.add_widget(self.textvalue)
        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 = cMultiLineButton(text=ReplaceVars('$lvar(5008)'), halign='center', valign='middle')
        btn.bind(on_release=self._validate)
        btnlayout.add_widget(btn)
        btn = cMultiLineButton(text=ReplaceVars('$lvar(5009)'), halign='center', valign='middle')
        btn.bind(on_release=self._dismiss)
        btnlayout.add_widget(btn)
        content.add_widget(btnlayout)

        self.textvalue.text=str(self.value)
        # all done, open the popup !
        popup.open()
Beispiel #4
0
    def ShowKeyBoard(self,uDestVar,oFktNotify):
        ''' create popup layout '''
        self.oFktNotify=oFktNotify
        self.uDestVar  =uDestVar
        oContent = BoxLayout(orientation='vertical', spacing='5dp')
        self.oPopup =  Popup(title='Input',content=oContent, size_hint=(None, None), size=(oORCA.iAppWidth*0.9,oORCA.iAppHeight*0.35),auto_dismiss=False, pos_hint={'x': .05, 'top': 1})
        uText=GetVar(self.uDestVar)
        if uText is None:
            uText=u''
        Logger.debug("InputKeyboard: Preassigning Value [%s]" % (uText))
        #self.oTextInput = textinput = TextInput(text=uText, focus=False,multiline=False, size_hint_y=None, height='30dp')
        self.oTextInput = textinput = TextInput(text=uText,multiline=False, size_hint_y=None, height='30dp')
        self.oTextInput.bind(on_text_validate=self.On_Enter)

        # construct the content, widget are used as a spacer
        oContent.add_widget(Widget())
        oContent.add_widget(textinput)
        oContent.add_widget(Widget())
        oContent.add_widget(SettingSpacer())

        # 2 buttons are created for accept or cancel the current value
        oBtnlayout      = BoxLayout(size_hint_y=None, height='50dp', spacing='5dp')
        oBtn            = cMultiLineButton(text=ReplaceVars('$lvar(5008)'), halign='center', valign='middle')
        oBtn.bind (on_release=self.On_Enter)
        oBtnlayout.add_widget(oBtn)
        oBtn             = cMultiLineButton(text=ReplaceVars('$lvar(5009)'), halign='center', valign='middle')
        oBtn.bind(on_release=self.On_Cancel)
        oBtnlayout.add_widget(oBtn)
        oContent.add_widget(oBtnlayout)

        #if we do setup the focus before the popup is shown, no vkeyboard is shown
        self.oPopup.bind(on_open=self.ScheduledSetFocus)
        self.oPopup.open()
Beispiel #5
0
    def ShowKeyBoard(self, *, uDestVar: str, oFktNotify: Union[Callable, None],
                     uTitle: str):
        """ create popup layout """
        uText: str
        oBtn: cMultiLineButton
        self.oFktNotify = oFktNotify
        self.uDestVar = uDestVar

        oContent: BoxLayout = BoxLayout(orientation='vertical', spacing='5dp')
        self.oPopup = Popup(title=uTitle,
                            content=oContent,
                            size_hint=(None, None),
                            size=(Globals.iAppWidth * 0.9,
                                  Globals.iAppHeight * 0.35),
                            auto_dismiss=False,
                            pos_hint={
                                'x': .05,
                                'top': 1
                            })
        uText = GetVar(uVarName=self.uDestVar)
        if uText is None:
            uText = u''
        Logger.debug("InputKeyboard: Preassigning Value [%s]" % uText)
        self.oTextInput = TextInput(text=uText,
                                    multiline=False,
                                    size_hint_y=None,
                                    height='30dp')
        self.oTextInput.bind(on_text_validate=self.On_Enter)

        # construct the content, widget are used as a spacer
        oContent.add_widget(Widget())
        oContent.add_widget(self.oTextInput)
        oContent.add_widget(Widget())
        oContent.add_widget(SettingSpacer())

        # 2 buttons are created for accept or cancel the current value
        oBtnlayout: BoxLayout = BoxLayout(size_hint_y=None,
                                          height='50dp',
                                          spacing='5dp')
        oBtn = cMultiLineButton(text=ReplaceVars('$lvar(5008)'),
                                halign='center',
                                valign='middle')
        oBtn.bind(on_release=self.On_Enter)
        oBtnlayout.add_widget(oBtn)
        self.oButtonCancel = cMultiLineButton(text=ReplaceVars('$lvar(5009)'),
                                              halign='center',
                                              valign='middle')
        self.oButtonCancel.bind(on_release=self.On_Cancel)
        oBtnlayout.add_widget(self.oButtonCancel)
        oContent.add_widget(oBtnlayout)

        #if we do setup the focus before the popup is shown, no vkeyboard is shown
        self.oPopup.bind(on_open=self.ScheduledSetFocus)
        self.oPopup.open()
    def _create_popup(self, instance) -> None:
        """ create popup layout """
        oBtn: cMultiLineButton
        oContent: BoxLayout = BoxLayout(orientation='vertical', spacing='5dp')
        self.popup = popup = Popup(title=self.title,
                                   content=oContent,
                                   size_hint=(None, None),
                                   size=('400dp', '250dp'))

        # Create the slider used for numeric input
        self.slider = oSlider = Slider(min=self.fMin,
                                       max=self.fMax,
                                       value=float(self.value),
                                       size_hint_y=None,
                                       height='50dp')
        oSlider.bind(on_touch_move=self.OnSliderMoved)
        oSlider.bind(on_touch_up=self.OnSliderMoved)
        self.textvalue = TextInput(
            size_hint_y=None,
            height='30dp',
            multiline=False,
        )
        self.textvalue.bind(on_text_validate=self.On_Enter)
        self.textvalue.bind(focus=self.On_Focus)

        # construct the content, widget are used as a spacer
        oContent.add_widget(Widget())
        oContent.add_widget(oSlider)
        oContent.add_widget(Widget())
        oContent.add_widget(self.textvalue)
        oContent.add_widget(Widget())
        oContent.add_widget(SettingSpacer())

        # 2 buttons are created for accept or cancel the current value
        oBtnlayout: BoxLayout = BoxLayout(size_hint_y=None,
                                          height='50dp',
                                          spacing='5dp')
        oBtn = cMultiLineButton(text=ReplaceVars('$lvar(5008)'),
                                halign='center',
                                valign='middle')
        oBtn.bind(on_release=self._validate)
        oBtnlayout.add_widget(oBtn)
        oBtn = cMultiLineButton(text=ReplaceVars('$lvar(5009)'),
                                halign='center',
                                valign='middle')
        oBtn.bind(on_release=self._dismiss)
        oBtnlayout.add_widget(oBtn)
        oContent.add_widget(oBtnlayout)

        self.textvalue.text = str(self.value)
        # all done, open the popup !
        popup.open()
Beispiel #7
0
    def _create_subpopup(self, instance):
        ''' shows the sub popup '''
        # 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.subpopup   = popup = Popup(content=content, title=self.uOption, 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.aSubOption:
            state = 'down' if option == self.value else 'normal'
            oTbtn = ToggleButton(text=option, state=state, group=uid, size=(popup.width, dp(55)), size_hint=(None, None))
            oTbtn.bind(on_release=self._set_suboption)
            scrollcontent.add_widget(oTbtn)

        # finally, add a cancel button to return on the previous panel
        scrollview.add_widget(scrollcontent)
        content.add_widget(scrollview)
        content.add_widget(SettingSpacer())
        oMbtn = cMultiLineButton(text=ReplaceVars('$lvar(5009)'), size=(popup.width, dp(50)),size_hint=(0.9, None), halign='center', valign='middle')
        oMbtn.bind(on_release=popup.dismiss)
        content.add_widget(oMbtn)
Beispiel #8
0
    def __init__(self, **kwargs):
        self.register_event_type('on_release')
        # by purpose: we super to the settingitem directly, as SettingItem tries to read a non existing section
        super(SettingItem, self).__init__(**kwargs) # pylint: disable=bad-super-call

        for aButton in kwargs["buttons"]:
            oButton=cMultiLineButton(text=aButton['title'], font_size= '15sp', halign='center', valign='middle')
            oButton.ID=aButton['id']
            self.add_widget(oButton)
            oButton.bind (on_release=self.On_ButtonPressed)
Beispiel #9
0
    def __init__(self, **kwargs):
        self.register_event_type('on_release')
        # by purpose: we super to the settingitem directly, as SettingItem tries to read a non existing section
        super(SettingItem, self).__init__(**RemoveNoClassArgs(kwargs,SettingItem))

        for aButton in kwargs["buttons"]:
            oButton=cMultiLineButton(text=aButton['title'], font_size= '15sp', halign='center', valign='middle')
            oButton.ID=aButton['id']
            self.add_widget(oButton)
            oButton.bind (on_release=self.On_ButtonPressed)
Beispiel #10
0
    def _create_popup(self, instance):

        # create the popup
        self.oContent           = GridLayout(cols=1, spacing='5dp')
        scrollview              = ScrollView( do_scroll_x=False, bar_width='10dp',scroll_type=['bars'] )
        scrollcontent           = GridLayout(cols=1,  spacing='5dp', size_hint=(None, None))
        scrollcontent.bind(minimum_height=scrollcontent.setter('height'))
        if oORCA.uDeviceOrientation      == u'landscape':
            self.popup   = popup = Popup(content=self.oContent, title=self.title, size_hint=(0.5, 0.9),  auto_dismiss=False)
        else:
            self.popup   = popup = Popup(content=self.oContent, title=self.title, size_hint=(0.9, 0.9),  auto_dismiss=False)

        #we need to open the popup first to get the metrics
        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=self.value, size_hint_y=None, height='30dp',multiline=False, )
            #self.oTextInput = TextInput(text=self.value, size_hint_y=0.7,size_hint_x=0.7, height='30dp',multiline=False, )
            self.oTextInput.bind(on_text_validate=self.OnTextInput)
            self.oContent.add_widget(self.oTextInput)
            self.oContent.add_widget(SettingSpacer())
        # add all the options

        # we test idf we want to show the languagelist
        if len(self.options)>0:
            if self.options[0]=="$LANGUAGELIST":
                self.bIsLanguageInput=True
                if len(aOptionsLanguageList)==0:
                    for uKey in oORCA.oTheScreen.oLanguage.IDToString:
                        uValue="%s [[%s]]" % (oORCA.oTheScreen.oLanguage.IDToString[uKey],uKey)
                        if not uValue in aOptionsLanguageList or True:
                            aOptionsLanguageList.append(uValue)
                    aOptionsLanguageList.sort()
                self.options=aOptionsLanguageList
                self.oButtonHeigth=dp(30)
            if self.options[0]=="$GESTURESLIST":
                if len(aOptionsGesturesList)==0:
                    for uKey in oORCA.oTheScreen.oGestures:
                        aOptionsGesturesList.append(uKey)
                aOptionsGesturesList.sort()
                self.options=aOptionsGesturesList
            if self.options[0]=="$ACTIONLIST":
                if len(aOptionsActionList)==0:
                    for uKey in oORCA.oTheScreen.aActionsCommands:
                        if uKey.startswith("Send "):
                            aOptionsActionList.append(uKey)
                aOptionsActionList.sort()
                self.options=aOptionsActionList
                self.oButtonHeigth=dp(30)

        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, self.oButtonHeigth), size_hint=(None, None),text_size=(popup.width, self.oButtonHeigth), valign="middle",halign="center")
            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)
        self.oContent.add_widget(scrollview)
        self.oContent.add_widget(SettingSpacer())
        self.oButtonCancel = cMultiLineButton(text=ReplaceVars('$lvar(5009)'), size=(popup.width, dp(50)),size_hint=(0.9, None), halign='center', valign='middle')
        self.oButtonCancel .bind(on_release=popup.dismiss)
        self.oContent.add_widget(self.oButtonCancel)
Beispiel #11
0
    def CreatePopup(self, uValue, fktButttonSelect, fktTextInputSelect):
        """ create the popup """
        self.oContent = GridLayout(cols=1, spacing='5dp')
        scrollview = ScrollView(do_scroll_x=False,
                                bar_width='10dp',
                                scroll_type=['bars', 'content'])
        scrollcontent = GridLayout(cols=1,
                                   spacing='5dp',
                                   size_hint=(None, None))
        scrollcontent.bind(minimum_height=scrollcontent.setter('height'))
        if Globals.uDeviceOrientation == u'landscape':
            self.popup = popup = Popup(content=self.oContent,
                                       title=self.title,
                                       size_hint=(0.5, 0.9),
                                       auto_dismiss=False)
        else:
            self.popup = popup = Popup(content=self.oContent,
                                       title=self.title,
                                       size_hint=(0.9, 0.9),
                                       auto_dismiss=False)

        #we need to open the popup first to get the metrics
        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 = str(self.uid)
        uid = "test"
        for option in self.options:
            state = 'down' if option == uValue else 'normal'
            btn = ToggleButton(text=option,
                               state=state,
                               group=uid,
                               size=(popup.width, self.oButtonHeigth),
                               size_hint=(None, None),
                               text_size=(popup.width, self.oButtonHeigth),
                               valign="middle",
                               halign="center")
            btn.bind(on_release=fktButttonSelect)
            scrollcontent.add_widget(btn)

        # finally, add a cancel button to return on the previous panel
        scrollview.add_widget(scrollcontent)
        self.oContent.add_widget(scrollview)
        self.oContent.add_widget(SettingSpacer())
        self.oButtonCancel = cMultiLineButton(text=ReplaceVars('$lvar(5009)'),
                                              size=(popup.width, dp(50)),
                                              size_hint=(0.9, None),
                                              halign='center',
                                              valign='middle')
        self.oButtonCancel.bind(on_release=popup.dismiss)
        self.oContent.add_widget(self.oButtonCancel)