コード例 #1
0
    def onInit(self):
        self.controls = {}
        if not self.hasTag('onup'):
            # create a fake button to allow scroll up
            # print 'create onup'
            self.controls['FakebtnUp'] = ButtonControl(
                Tag('description', 'hidden button to scroll up the list'), Tag('visible', 'false'), defaultSKin=False)
            ControlXml.setTag(self, Tag('onup', self.controls['FakebtnUp'].getId()))
            # print self.tags

        if not self.hasTag('ondown'):
            # create a fake button to allow scroll down
            self.controls['FakebtnDown'] = ButtonControl(
                Tag('description', 'hidden button to scroll down the list'), Tag('visible', 'false'), defaultSKin=False)
            ControlXml.setTag(self, Tag('ondown', self.controls['FakebtnDown'].getId()))

        # print self.tags
        # create the groupControl
        self.controls['groupControl'] = GroupControl(*self.getArrayTags())
        self.controls['ApplyButtonControl'] = ButtonControl(*self.getArrayTags(), defaultSKin=False)
        self.controls['ApplyButtonControl'].setTag(Tag('align', 'center'))
        self.controls['ApplyButtonControl'].setTag(Tag('width', '150'))
        self.controls['ApplyButtonControl'].setTag(
            Tag('height', '%d' % (self.getTag('height').getValue()['value'] - 10)))
        self.controls['ApplyButtonControl'].setTag(Tag('posy', '5'))
        self.controls['ApplyButtonControl'].setTag(
            Tag('posx', '%d' % (self.getTag('width').getValue()['value'] - 160)))
        self.controls['groupControl'].addControl(self.controls['ApplyButtonControl'])
コード例 #2
0
ファイル: xbmcControl.py プロジェクト: muyihx/xbian
    def onInit(self):
        self.controls = {}
        if not self.hasTag('onup'):
            #create a fake button to allow scroll up
            #print 'create onup'
            self.controls['FakebtnUp'] = ButtonControl(Tag(
                'description', 'hidden button to scroll up the list'),
                                                       Tag('visible', 'false'),
                                                       defaultSKin=False)
            ControlXml.setTag(self,
                              Tag('onup', self.controls['FakebtnUp'].getId()))
            #print self.tags

        if not self.hasTag('ondown'):
            #create a fake button to allow scroll down
            self.controls['FakebtnDown'] = ButtonControl(
                Tag('description', 'hidden button to scroll down the list'),
                Tag('visible', 'false'),
                defaultSKin=False)
            ControlXml.setTag(
                self, Tag('ondown', self.controls['FakebtnDown'].getId()))

        #print self.tags
        #create the groupControl
        self.controls['groupControl'] = GroupControl(*self.getArrayTags())
        self.controls['ApplyButtonControl'] = ButtonControl(
            *self.getArrayTags(), defaultSKin=False)
        self.controls['ApplyButtonControl'].setTag(Tag('align', 'center'))
        self.controls['ApplyButtonControl'].setTag(Tag('width', '150'))
        self.controls['ApplyButtonControl'].setTag(
            Tag('height',
                '%d' % (self.getTag('height').getValue()['value'] - 10)))
        self.controls['ApplyButtonControl'].setTag(Tag('posy', '5'))
        self.controls['ApplyButtonControl'].setTag(
            Tag('posx',
                '%d' % (self.getTag('width').getValue()['value'] - 160)))
        self.controls['groupControl'].addControl(
            self.controls['ApplyButtonControl'])
コード例 #3
0
    def onInit(self):
        self.controls = {}
        self.values = []
        self.idx = 0
        self.value = None

        if not self.hasTag('onup'):
            # create a fake button to allow scroll up
            # print 'create onup'
            self.controls['FakebtnUp'] = ButtonControl(
                Tag('description', 'hidden button to scroll up the list'), Tag('visible', 'false'), defaultSKin=False)
            ControlXml.setTag(self, Tag('onup', self.controls['FakebtnUp'].getId()))
            # print self.tags

        if not self.hasTag('ondown'):
            # create a fake button to allow scroll down
            self.controls['FakebtnDown'] = ButtonControl(
                Tag('description', 'hidden button to scroll down the list'), Tag('visible', 'false'), defaultSKin=False)
            ControlXml.setTag(self, Tag('ondown', self.controls['FakebtnDown'].getId()))

        # print self.tags
        # create the groupControl
        self.controls['groupControl'] = GroupControl(*self.getArrayTags())
        self.controls['buttondown'] = ButtonControl()
        global SKIN_DIR
        if SKIN_DIR == 'skin.estouchy':
            currentProperties = [ {'key' : 'colordiffuse', 'value' : 'FF12B2E7'} ]
            offsetX = 42
            self.controls['buttondown'].setTag(Tag('posx', 975))
            self.controls['buttondown'].setTag(Tag('posy', 20))
            self.controls['buttondown'].setTag(Tag('width', 33))
            self.controls['buttondown'].setTag(Tag('height', 20))
            self.controls['buttondown'].setTag(Tag('texturefocus', 'arrow-light-down1-nf.png', currentProperties))
            self.controls['buttondown'].setTag(Tag('texturenofocus', 'arrow-light-down1-nf.png'))
        elif SKIN_DIR == 'skin.estuary':
            if os.path.isfile(WIZ_FILE):
                posx = 1235
            else:
                posx = 1337
            currentProperties = [ {'key' : 'colordiffuse', 'value' : 'button_focus'} ]
            offsetX = 42
            self.controls['buttondown'].setTag(Tag('posx', posx))
            self.controls['buttondown'].setTag(Tag('posy', 25))
            self.controls['buttondown'].setTag(Tag('width', 33))
            self.controls['buttondown'].setTag(Tag('height', 20))
            self.controls['buttondown'].setTag(Tag('texturefocus', 'arrow-light-down1-nf.png', currentProperties))
            self.controls['buttondown'].setTag(Tag('texturenofocus', 'arrow-light-down1-nf.png'))
        else:
            currentProperties = None
            offsetX = None
            self.controls['buttondown'].setTag(Tag('posx', 680))
            self.controls['buttondown'].setTag(Tag('posy', 9))
            self.controls['buttondown'].setTag(Tag('width', 33))
            self.controls['buttondown'].setTag(Tag('height', 22))
            self.controls['buttondown'].setTag(Tag('texturefocus', 'scroll-down-focus-2.png'))
            self.controls['buttondown'].setTag(Tag('texturenofocus', 'scroll-down-2.png'))
        self.controls['buttondown'].setTag(Tag('onup', self.controls['FakebtnUp'].getId()))
        self.controls['buttondown'].setTag(Tag('ondown', self.controls['FakebtnDown'].getId()))
        if not self.hasTag('onleft'):
            # hardcode on left value - don't find how to do
            self.controls['buttondown'].setTag(Tag('onleft', 9000))

        self.controls['buttonup'] = ButtonControl()
        if SKIN_DIR == 'skin.estouchy':
            self.controls['buttonup'].setTag(Tag('posx', 1008))
            self.controls['buttonup'].setTag(Tag('posy', 20))
            self.controls['buttonup'].setTag(Tag('width', 33))
            self.controls['buttonup'].setTag(Tag('height', 20))
            self.controls['buttonup'].setTag(Tag('texturefocus', 'arrow-light-up1-nf.png', currentProperties))
            self.controls['buttonup'].setTag(Tag('texturenofocus', 'arrow-light-up1-nf.png'))
        elif SKIN_DIR == 'skin.estuary':
            self.controls['buttonup'].setTag(Tag('posx', posx + 33))
            self.controls['buttonup'].setTag(Tag('posy', 25))
            self.controls['buttonup'].setTag(Tag('width', 33))
            self.controls['buttonup'].setTag(Tag('height', 20))
            self.controls['buttonup'].setTag(Tag('texturefocus', 'arrow-light-up1-nf.png', currentProperties))
            self.controls['buttonup'].setTag(Tag('texturenofocus', 'arrow-light-up1-nf.png'))
        else:
            self.controls['buttonup'].setTag(Tag('posx', 713))
            self.controls['buttonup'].setTag(Tag('posy', 9))
            self.controls['buttonup'].setTag(Tag('width', 33))
            self.controls['buttonup'].setTag(Tag('height', 22))
            self.controls['buttonup'].setTag(Tag('texturefocus', 'scroll-up-focus-2.png'))
            self.controls['buttonup'].setTag(Tag('texturenofocus', 'scroll-up-2.png'))
        self.controls['buttonup'].setTag(Tag('onleft', self.controls['buttondown'].getId()))
        self.controls['buttonup'].setTag(Tag('onup', self.controls['FakebtnUp'].getId()))
        self.controls['buttonup'].setTag(Tag('ondown', self.controls['FakebtnDown'].getId()))
        self.controls['buttondown'].setTag(Tag('onright', self.controls['buttonup'].getId()))
        if not self.hasTag('onright'):
            # hardcode on left value - don't find how to do
            self.controls['buttonup'].setTag(Tag('onright', 9000))

        self.controls['FakebtnLabelFocus'] = ButtonControl(*self.getArrayTags())
        self.controls['FakebtnLabelFocus'].setTag(Tag('enable', "false"))
        self.controls['FakebtnLabelFocus'].setTag(Tag('posx', 0))
        self.controls['FakebtnLabelFocus'].setTag(Tag('posy', 0))
        self.controls['FakebtnLabelFocus'].setTag(
            Tag('disabledcolor', self.getTag('focusedcolor').getValue()['value']))
        self.controls['FakebtnLabelFocus'].setTag(Tag('visible', 'Control.HasFocus(%d) | Control.HasFocus(%d)' % (
            self.controls['buttonup'].getId(), self.controls['buttondown'].getId())))
        self.controls['FakebtnLabelFocus'].setTag(
            Tag('texturenofocus', self.controls['FakebtnLabelFocus'].getTag('texturefocus').getValue()['value'], currentProperties))
        self.controls['groupControl'].addControl(self.controls['FakebtnLabelFocus'])

        self.controls['FakebtnLabelNoFocus'] = ButtonControl(*self.getArrayTags())
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('enable', "false"))
        self.controls['FakebtnLabelNoFocus'].setTag(
            Tag('disabledcolor', self.getTag('textcolor').getValue()['value']))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('posx', 0))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('posy', 0))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('visible', '![Control.HasFocus(%d) | Control.HasFocus(%d)] + Control.IsEnabled(%d)' % (
            self.controls['buttonup'].getId(), self.controls['buttondown'].getId(), self.controls['buttonup'].getId())))
        self.controls['FakebtnLabelNoFocus'].setTag(
            Tag('texturefocus', self.controls['FakebtnLabelFocus'].getTag('texturenofocus').getValue()['value']))
        self.controls['groupControl'].addControl(self.controls['FakebtnLabelNoFocus'])

        self.controls['FakebtnLabelDisabled'] = ButtonControl(*self.getArrayTags())
        self.controls['FakebtnLabelDisabled'].setTag(Tag('enable', "false"))
        self.controls['FakebtnLabelDisabled'].setTag(Tag('posx', 0))
        self.controls['FakebtnLabelDisabled'].setTag(Tag('posy', 0))
        self.controls['FakebtnLabelDisabled'].setTag(Tag('visible', '!Control.IsEnabled(%d) + control.IsVisible(%d)' % (
            self.controls['buttondown'].getId(), self.controls['buttondown'].getId())))

        if offsetX is not None:
            self.controls['FakebtnLabelFocus'].setTag(Tag('textoffsetx', offsetX))
            self.controls['FakebtnLabelNoFocus'].setTag(Tag('textoffsetx', offsetX))
            self.controls['FakebtnLabelDisabled'].setTag(Tag('textoffsetx', offsetX))

        self.controls['groupControl'].addControl(self.controls['FakebtnLabelDisabled'])

        self.controls['groupControl'].addControl(self.controls['buttondown'])

        self.controls['groupControl'].addControl(self.controls['buttonup'])

        self.key = 'spincontrol%d' % self.getId()
コード例 #4
0
ファイル: xbmcControl.py プロジェクト: muyihx/xbian
    def onInit(self):
        self.controls = {}

        if not self.hasTag('onup'):
            #create a fake button to allow scroll up
            #print 'create onup'
            self.controls['FakebtnUp'] = ButtonControl(Tag(
                'description', 'hidden button to scroll up the list'),
                                                       Tag('visible', 'false'),
                                                       defaultSKin=False)
            ControlXml.setTag(self,
                              Tag('onup', self.controls['FakebtnUp'].getId()))
            #print self.tags

        if not self.hasTag('ondown'):
            #create a fake button to allow scroll down
            self.controls['FakebtnDown'] = ButtonControl(
                Tag('description', 'hidden button to scroll down the list'),
                Tag('visible', 'false'),
                defaultSKin=False)
            ControlXml.setTag(
                self, Tag('ondown', self.controls['FakebtnDown'].getId()))

        #print self.tags
        #create the groupControl
        self.controls['groupControl'] = GroupControl(*self.getArrayTags())

        #create the spin control
        self.controls['SpinControlButton'] = SpinControl(*self.getArrayTags())
        self.controls['SpinControlButton'].setTag(
            Tag(
                'posx', self.controls['groupControl'].getTag(
                    'width').getValue()['value'] - 80))
        self.controls['SpinControlButton'].setTag(Tag('posy', 8))
        self.controls['SpinControlButton'].setTag(Tag('height', None))
        self.controls['SpinControlButton'].setTag(Tag('width', None))
        self.controls['SpinControlButton'].setTag(Tag('subtype', 'page'))
        self.controls['SpinControlButton'].setTag(Tag('textoffsetx', 5000))
        if not self.hasTag('onleft'):
            #hardcode on left value - don't find how to do
            self.controls['SpinControlButton'].setTag(Tag('onleft', 9000))
        if not self.hasTag('onright'):
            #hardcode on right value - don't find how to do
            #maybe do a group list, but have to change all the control
            self.controls['SpinControlButton'].setTag(Tag('onright', 9000))

        self.controls['groupControl'].addControl(
            self.controls['SpinControlButton'])

        #create 3 fake button control for checking focus+enabled and have label
        #MainControl visible conditon

        self.controls['FakebtnLabelFocus'] = ButtonControl(
            *self.getArrayTags())
        self.controls['FakebtnLabelFocus'].setTag(Tag('enable', "false"))
        self.controls['FakebtnLabelFocus'].setTag(Tag('posx', 0))
        self.controls['FakebtnLabelFocus'].setTag(Tag('posy', 0))
        self.controls['FakebtnLabelFocus'].setTag(
            Tag('disabledcolor',
                self.getTag('focusedcolor').getValue()['value']))
        self.controls['FakebtnLabelFocus'].setTag(
            Tag(
                'visible',
                'Control.HasFocus(%d) + Control.IsEnabled(%d) + control.IsVisible(%d)'
                % (self.controls['SpinControlButton'].getId(),
                   self.controls['SpinControlButton'].getId(),
                   self.controls['SpinControlButton'].getId())))
        self.controls['FakebtnLabelFocus'].setTag(
            Tag(
                'texturenofocus', self.controls['FakebtnLabelFocus'].getTag(
                    'texturefocus').getValue()['value']))
        self.controls['groupControl'].addControl(
            self.controls['FakebtnLabelFocus'])

        self.controls['FakebtnLabelNoFocus'] = ButtonControl(
            *self.getArrayTags())
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('enable', "false"))
        self.controls['FakebtnLabelNoFocus'].setTag(
            Tag('disabledcolor',
                self.getTag('textcolor').getValue()['value']))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('posx', 0))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('posy', 0))

        self.controls['FakebtnLabelNoFocus'].setTag(
            Tag(
                'visible',
                '!Control.HasFocus(%d) + Control.IsEnabled(%d) + control.IsVisible(%d)'
                % (self.controls['SpinControlButton'].getId(),
                   self.controls['SpinControlButton'].getId(),
                   self.controls['SpinControlButton'].getId())))
        self.controls['FakebtnLabelNoFocus'].setTag(
            Tag(
                'texturefocus', self.controls['FakebtnLabelFocus'].getTag(
                    'texturenofocus').getValue()['value']))
        self.controls['groupControl'].addControl(
            self.controls['FakebtnLabelNoFocus'])

        self.controls['FakebtnLabelDisabled'] = ButtonControl(
            *self.getArrayTags())
        self.controls['FakebtnLabelDisabled'].setTag(Tag('enable', "false"))
        self.controls['FakebtnLabelDisabled'].setTag(Tag('posx', 0))
        self.controls['FakebtnLabelDisabled'].setTag(Tag('posy', 0))
        self.controls['FakebtnLabelDisabled'].setTag(
            Tag(
                'visible', '!Control.IsEnabled(%d) + control.IsVisible(%d)' %
                (self.controls['SpinControlButton'].getId(),
                 self.controls['SpinControlButton'].getId())))
        self.controls['groupControl'].addControl(
            self.controls['FakebtnLabelDisabled'])

        #create the wraplist Control (contain different choice)
        self.controls['wraplistControl'] = WrapListControl(
            *self.getArrayTags())
        self.controls['wraplistControl'].setTag(Tag('width', 225))
        self.controls['wraplistControl'].setTag(Tag('height', 40))
        self.controls['wraplistControl'].setTag(Tag('enable', 'false'))
        self.controls['wraplistControl'].setTag(Tag('posy', 0))
        self.controls['wraplistControl'].setTag(Tag('posx', 450))
        self.controls['wraplistControl'].setTag(
            Tag('pagecontrol', self.controls['SpinControlButton'].getId()))
        self.controls['wraplistControl'].setTag(Tag('scrolltime', 0))

        #create 3 label (focus,nofocus,disable) to handle different text color
        self.controls['labelbtndisable'] = LabelControl(*self.getArrayTags())
        self.controls['labelbtndisable'].setTag(Tag('posx', 215))
        self.controls['labelbtndisable'].setTag(Tag('posy', 0))
        self.controls['labelbtndisable'].setTag(Tag('posy', 0))
        self.controls['labelbtndisable'].setTag(Tag('width', 225))
        self.controls['labelbtndisable'].setTag(Tag('align', 'right'))
        self.controls['labelbtndisable'].setTag(Tag('aligny', 'center'))
        self.controls['labelbtndisable'].setTag(
            Tag('textcolor',
                self.getTag('disabledcolor').getValue()['value']))
        self.controls['labelbtndisable'].setTag(
            Tag('label', '$INFO[ListItem.Label]'))
        self.controls['labelbtndisable'].setTag(
            Tag(
                'visible', '!Control.IsEnabled(%d)' %
                self.controls['SpinControlButton'].getId()))
        self.controls['wraplistControl'].addFocusedLayout(
            self.controls['labelbtndisable'])

        self.controls['labelbtnfocus'] = LabelControl(*self.getArrayTags())
        self.controls['labelbtnfocus'].setTag(Tag('posx', 215))
        self.controls['labelbtnfocus'].setTag(Tag('posy', 0))
        self.controls['labelbtnfocus'].setTag(Tag('posy', 0))
        self.controls['labelbtnfocus'].setTag(Tag('width', 225))
        self.controls['labelbtnfocus'].setTag(Tag('align', 'right'))
        self.controls['labelbtnfocus'].setTag(Tag('aligny', 'center'))
        self.controls['labelbtnfocus'].setTag(
            Tag('textcolor',
                self.getTag('focusedcolor').getValue()['value']))
        self.controls['labelbtnfocus'].setTag(
            Tag('label', '$INFO[ListItem.Label]'))
        self.controls['labelbtnfocus'].setTag(
            Tag(
                'visible', 'Control.HasFocus(%d) + Control.IsEnabled(%d)' %
                (self.controls['SpinControlButton'].getId(),
                 self.controls['SpinControlButton'].getId())))
        self.controls['wraplistControl'].addFocusedLayout(
            self.controls['labelbtnfocus'])

        self.controls['labelbtnnofocus'] = LabelControl(*self.getArrayTags())
        self.controls['labelbtnnofocus'].setTag(Tag('posx', 215))
        self.controls['labelbtnnofocus'].setTag(Tag('posy', 0))
        self.controls['labelbtnnofocus'].setTag(Tag('posy', 0))
        self.controls['labelbtnnofocus'].setTag(Tag('width', 225))
        self.controls['labelbtnnofocus'].setTag(Tag('align', 'right'))
        self.controls['labelbtnnofocus'].setTag(Tag('aligny', 'center'))
        self.controls['labelbtnnofocus'].setTag(
            Tag('textcolor',
                self.getTag('textcolor').getValue()['value']))
        self.controls['labelbtnnofocus'].setTag(
            Tag('label', '$INFO[ListItem.Label]'))
        self.controls['labelbtnnofocus'].setTag(
            Tag(
                'visible', '!Control.HasFocus(%d) + Control.IsEnabled(%d)' %
                (self.controls['SpinControlButton'].getId(),
                 self.controls['SpinControlButton'].getId())))
        self.controls['wraplistControl'].addFocusedLayout(
            self.controls['labelbtnnofocus'])

        self.controls['groupControl'].addControl(
            self.controls['wraplistControl'])
コード例 #5
0
ファイル: xbmcControl.py プロジェクト: Iri-Dium/xbian
    def onInit(self):
        self.controls = {}
        
        if not self.hasTag('onup') :
            #create a fake button to allow scroll up
            #print 'create onup'
            self.controls['FakebtnUp'] = ButtonControl(Tag('description','hidden button to scroll up the list'),Tag('visible','false'),defaultSKin=False)
            ControlXml.setTag(self,Tag('onup',self.controls['FakebtnUp'].getId()))
            #print self.tags

        if not self.hasTag('ondown')  :
            #create a fake button to allow scroll down
            self.controls['FakebtnDown'] = ButtonControl(Tag('description','hidden button to scroll down the list'),Tag('visible','false'),defaultSKin=False)
            ControlXml.setTag(self,Tag('ondown',self.controls['FakebtnDown'].getId()))

        #print self.tags
        #create the groupControl
        self.controls['groupControl'] = GroupControl(*self.getArrayTags())


        #create the spin control
        self.controls['SpinControlButton'] = SpinControl(*self.getArrayTags())
        self.controls['SpinControlButton'].setTag(Tag('posx',self.controls['groupControl'].getTag('width').getValue()['value'] - 80))
        self.controls['SpinControlButton'].setTag(Tag('posy',8))
        self.controls['SpinControlButton'].setTag(Tag('height',None))
        self.controls['SpinControlButton'].setTag(Tag('width',None))
        self.controls['SpinControlButton'].setTag(Tag('subtype','page'))
        self.controls['SpinControlButton'].setTag(Tag('textoffsetx',5000))
        if not self.hasTag('onleft')  :
            #hardcode on left value - don't find how to do
            self.controls['SpinControlButton'].setTag(Tag('onleft',9000))
        if not self.hasTag('onright')  :
            #hardcode on right value - don't find how to do
            #maybe do a group list, but have to change all the control
            self.controls['SpinControlButton'].setTag(Tag('onright',9000))
            
            
        self.controls['groupControl'].addControl(self.controls['SpinControlButton'])

        #create 3 fake button control for checking focus+enabled and have label
        #MainControl visible conditon
        
        self.controls['FakebtnLabelFocus'] = ButtonControl(*self.getArrayTags())
        self.controls['FakebtnLabelFocus'].setTag(Tag('enable',"false"))
        self.controls['FakebtnLabelFocus'].setTag(Tag('posx',0))
        self.controls['FakebtnLabelFocus'].setTag(Tag('posy',0))
        self.controls['FakebtnLabelFocus'].setTag(Tag('disabledcolor',self.getTag('focusedcolor').getValue()['value']))
        self.controls['FakebtnLabelFocus'].setTag(Tag('visible','Control.HasFocus(%d) + Control.IsEnabled(%d) + control.IsVisible(%d)'%(self.controls['SpinControlButton'].getId(),self.controls['SpinControlButton'].getId(),self.controls['SpinControlButton'].getId())))
        self.controls['FakebtnLabelFocus'].setTag(Tag('texturenofocus',self.controls['FakebtnLabelFocus'].getTag('texturefocus').getValue()['value']))
        self.controls['groupControl'].addControl(self.controls['FakebtnLabelFocus'])

        self.controls['FakebtnLabelNoFocus'] = ButtonControl(*self.getArrayTags())
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('enable',"false"))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('disabledcolor',self.getTag('textcolor').getValue()['value']))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('posx',0))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('posy',0))
        
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('visible','!Control.HasFocus(%d) + Control.IsEnabled(%d) + control.IsVisible(%d)'%(self.controls['SpinControlButton'].getId(),self.controls['SpinControlButton'].getId(),self.controls['SpinControlButton'].getId())))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('texturefocus',self.controls['FakebtnLabelFocus'].getTag('texturenofocus').getValue()['value']))
        self.controls['groupControl'].addControl(self.controls['FakebtnLabelNoFocus'])

        self.controls['FakebtnLabelDisabled'] = ButtonControl(*self.getArrayTags())
        self.controls['FakebtnLabelDisabled'].setTag(Tag('enable',"false"))
        self.controls['FakebtnLabelDisabled'].setTag(Tag('posx',0))
        self.controls['FakebtnLabelDisabled'].setTag(Tag('posy',0))
        self.controls['FakebtnLabelDisabled'].setTag(Tag('visible','!Control.IsEnabled(%d) + control.IsVisible(%d)'%(self.controls['SpinControlButton'].getId(),self.controls['SpinControlButton'].getId())))
        self.controls['groupControl'].addControl(self.controls['FakebtnLabelDisabled'])

        #create the wraplist Control (contain different choice)
        self.controls['wraplistControl'] = WrapListControl(*self.getArrayTags())
        self.controls['wraplistControl'].setTag(Tag('width',225))
        self.controls['wraplistControl'].setTag(Tag('height',40))
        self.controls['wraplistControl'].setTag(Tag('enable','false'))
        self.controls['wraplistControl'].setTag(Tag('posy',0))
        self.controls['wraplistControl'].setTag(Tag('posx',450))
        self.controls['wraplistControl'].setTag(Tag('pagecontrol',self.controls['SpinControlButton'].getId()))
        self.controls['wraplistControl'].setTag(Tag('scrolltime',0))

        #create 3 label (focus,nofocus,disable) to handle different text color
        self.controls['labelbtndisable']  = LabelControl(*self.getArrayTags())
        self.controls['labelbtndisable'].setTag(Tag('posx',215))
        self.controls['labelbtndisable'].setTag(Tag('posy',0))
        self.controls['labelbtndisable'].setTag(Tag('posy',0))
        self.controls['labelbtndisable'].setTag(Tag('width',225))
        self.controls['labelbtndisable'].setTag(Tag('align','right'))
        self.controls['labelbtndisable'].setTag(Tag('aligny','center'))
        self.controls['labelbtndisable'].setTag(Tag('textcolor',self.getTag('disabledcolor').getValue()['value']))
        self.controls['labelbtndisable'].setTag(Tag('label','$INFO[ListItem.Label]'))
        self.controls['labelbtndisable'].setTag(Tag('visible','!Control.IsEnabled(%d)'%self.controls['SpinControlButton'].getId()))
        self.controls['wraplistControl'].addFocusedLayout(self.controls['labelbtndisable'])

        self.controls['labelbtnfocus']  = LabelControl(*self.getArrayTags())
        self.controls['labelbtnfocus'].setTag(Tag('posx',215))
        self.controls['labelbtnfocus'].setTag(Tag('posy',0))
        self.controls['labelbtnfocus'].setTag(Tag('posy',0))
        self.controls['labelbtnfocus'].setTag(Tag('width',225))
        self.controls['labelbtnfocus'].setTag(Tag('align','right'))
        self.controls['labelbtnfocus'].setTag(Tag('aligny','center'))
        self.controls['labelbtnfocus'].setTag(Tag('textcolor',self.getTag('focusedcolor').getValue()['value']))
        self.controls['labelbtnfocus'].setTag(Tag('label','$INFO[ListItem.Label]'))
        self.controls['labelbtnfocus'].setTag(Tag('visible','Control.HasFocus(%d) + Control.IsEnabled(%d)'%(self.controls['SpinControlButton'].getId(),self.controls['SpinControlButton'].getId())))
        self.controls['wraplistControl'].addFocusedLayout(self.controls['labelbtnfocus'])

        self.controls['labelbtnnofocus']  = LabelControl(*self.getArrayTags())
        self.controls['labelbtnnofocus'].setTag(Tag('posx',215))
        self.controls['labelbtnnofocus'].setTag(Tag('posy',0))
        self.controls['labelbtnnofocus'].setTag(Tag('posy',0))
        self.controls['labelbtnnofocus'].setTag(Tag('width',225))
        self.controls['labelbtnnofocus'].setTag(Tag('align','right'))
        self.controls['labelbtnnofocus'].setTag(Tag('aligny','center'))
        self.controls['labelbtnnofocus'].setTag(Tag('textcolor',self.getTag('textcolor').getValue()['value']))
        self.controls['labelbtnnofocus'].setTag(Tag('label','$INFO[ListItem.Label]'))
        self.controls['labelbtnnofocus'].setTag(Tag('visible','!Control.HasFocus(%d) + Control.IsEnabled(%d)'%(self.controls['SpinControlButton'].getId(),self.controls['SpinControlButton'].getId())))
        self.controls['wraplistControl'].addFocusedLayout(self.controls['labelbtnnofocus'])


        self.controls['groupControl'].addControl(self.controls['wraplistControl'])
コード例 #6
0
    def onInit(self):
        self.controls = {}
        self.values = []
        self.idx = 0
        self.value = None
        
        
        if not self.hasTag('onup') :
            #create a fake button to allow scroll up
            #print 'create onup'
            self.controls['FakebtnUp'] = ButtonControl(Tag('description','hidden button to scroll up the list'),Tag('visible','false'),defaultSKin=False)
            ControlXml.setTag(self,Tag('onup',self.controls['FakebtnUp'].getId()))
            #print self.tags

        if not self.hasTag('ondown')  :
            #create a fake button to allow scroll down
            self.controls['FakebtnDown'] = ButtonControl(Tag('description','hidden button to scroll down the list'),Tag('visible','false'),defaultSKin=False)
            ControlXml.setTag(self,Tag('ondown',self.controls['FakebtnDown'].getId()))

        #print self.tags
        #create the groupControl        
        self.controls['groupControl'] = GroupControl(*self.getArrayTags())
        
        self.controls['buttondown'] = ButtonControl()
        self.controls['buttondown'].setTag(Tag('posx',680))
        self.controls['buttondown'].setTag(Tag('posy',9))
        self.controls['buttondown'].setTag(Tag('width',33))
        self.controls['buttondown'].setTag(Tag('height',22))        
        self.controls['buttondown'].setTag(Tag('texturefocus','scroll-down-focus-2.png'))
        self.controls['buttondown'].setTag(Tag('texturenofocus','scroll-down-2.png'))        
        self.controls['buttondown'].setTag(Tag('onup',self.controls['FakebtnUp'].getId()))
        self.controls['buttondown'].setTag(Tag('ondown',self.controls['FakebtnDown'].getId()))        
        if not self.hasTag('onleft')  :
            #hardcode on left value - don't find how to do
            self.controls['buttondown'].setTag(Tag('onleft',9000))        
        
        self.controls['buttonup'] = ButtonControl()
        self.controls['buttonup'].setTag(Tag('posx',713))
        self.controls['buttonup'].setTag(Tag('posy',9))
        self.controls['buttonup'].setTag(Tag('width',33))
        self.controls['buttonup'].setTag(Tag('height',22))
        self.controls['buttonup'].setTag(Tag('texturefocus','scroll-up-focus-2.png'))
        self.controls['buttonup'].setTag(Tag('texturenofocus','scroll-up-2.png'))
        self.controls['buttonup'].setTag(Tag('onleft',self.controls['buttondown'].getId()))
        self.controls['buttonup'].setTag(Tag('onup',self.controls['FakebtnUp'].getId()))
        self.controls['buttonup'].setTag(Tag('ondown',self.controls['FakebtnDown'].getId()))        
        self.controls['buttondown'].setTag(Tag('onright',self.controls['buttonup'].getId()))
        if not self.hasTag('onright')  :
            #hardcode on left value - don't find how to do
            self.controls['buttonup'].setTag(Tag('onright',9000))        
                
        self.controls['FakebtnLabelFocus'] = ButtonControl(*self.getArrayTags())
        self.controls['FakebtnLabelFocus'].setTag(Tag('enable',"false"))
        self.controls['FakebtnLabelFocus'].setTag(Tag('posx',0))
        self.controls['FakebtnLabelFocus'].setTag(Tag('posy',0))        
        self.controls['FakebtnLabelFocus'].setTag(Tag('disabledcolor',self.getTag('focusedcolor').getValue()['value']))
        self.controls['FakebtnLabelFocus'].setTag(Tag('visible','Control.HasFocus(%d) | Control.HasFocus(%d)'%(self.controls['buttonup'].getId(),self.controls['buttondown'].getId())))
        self.controls['FakebtnLabelFocus'].setTag(Tag('texturenofocus',self.controls['FakebtnLabelFocus'].getTag('texturefocus').getValue()['value']))
        self.controls['groupControl'].addControl(self.controls['FakebtnLabelFocus'])

        self.controls['FakebtnLabelNoFocus'] = ButtonControl(*self.getArrayTags())
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('enable',"false"))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('disabledcolor',self.getTag('textcolor').getValue()['value']))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('posx',0))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('posy',0))           
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('visible','![Control.HasFocus(%d) | Control.HasFocus(%d)] + Control.IsEnabled(%d)'%(self.controls['buttonup'].getId(),self.controls['buttondown'].getId(),self.controls['buttonup'].getId())))
        self.controls['FakebtnLabelNoFocus'].setTag(Tag('texturefocus',self.controls['FakebtnLabelFocus'].getTag('texturenofocus').getValue()['value']))
        self.controls['groupControl'].addControl(self.controls['FakebtnLabelNoFocus'])

        self.controls['FakebtnLabelDisabled'] = ButtonControl(*self.getArrayTags())
        self.controls['FakebtnLabelDisabled'].setTag(Tag('enable',"false"))
        self.controls['FakebtnLabelDisabled'].setTag(Tag('posx',0))
        self.controls['FakebtnLabelDisabled'].setTag(Tag('posy',0))        
        self.controls['FakebtnLabelDisabled'].setTag(Tag('visible','!Control.IsEnabled(%d) + control.IsVisible(%d)'%(self.controls['buttondown'].getId(),self.controls['buttondown'].getId())))
        self.controls['groupControl'].addControl(self.controls['FakebtnLabelDisabled'])

        self.controls['groupControl'].addControl(self.controls['buttondown'])

        self.controls['groupControl'].addControl(self.controls['buttonup'])
        
        self.key = 'spincontrol%d'%self.getId()