Exemple #1
0
 def create( self ):
     self.checkMark = xbmcgui.ControlCheckMark(
             x=50, y=200,
             width=200, height=20,
             label="This is my new check mark",
             checkWidth=30, checkHeight=30,
             alignment=0 )
     self.addControl( self.checkMark )
     self.setFocus( self.checkMark )
Exemple #2
0
    def __init__(self,config=None, mVersion=None):
        
        self.config = config
        self.mediaVersion = mVersion
        
        self.scaleX = ( float(self.getWidth())  / float(SIZE_WIDTH) )
        self.scaleY = ( float(self.getHeight()) / float(SIZE_HEIGHT) )
    
        self.addControl(xbmcgui.ControlImage(0, 0, self.getScX(SIZE_WIDTH), self.getScY(SIZE_HEIGHT), BACKGROUND))
    
        labelVersionInfo = xbmcgui.ControlLabel(self.getScX(305), self.getScY(110), self.getScX(200), self.getScY(30), "", "font13", "0xCCCCCCFF") 
        self.addControl(labelVersionInfo) 
        labelVersionInfo.setLabel('Configuration') 
        
        #####
        self.labelMediaPath1 =       xbmcgui.ControlLabel(self.getScX(100), self.getScY(200), self.getScX(150), self.getScY(30), "Podcast Folder", "font13", "0xCCCCCCFF") 
        self.addControl(self.labelMediaPath1) 
        
        self.browseLocalButton =     xbmcgui.ControlButton(self.getScX(280), self.getScY(195), self.getScX(100), self.getScY(30), 'Browse') 
        self.addControl(self.browseLocalButton)

        self.labelMediaPath =       xbmcgui.ControlLabel(self.getScX(100), self.getScY(240), self.getScX(600), self.getScY(30), "", "font13", "0xCCCCCCFF") 
        self.addControl(self.labelMediaPath) 
        
        self.labelMediaPath.setLabel(' > ' +self.config.podcastDownloadPath) 
        
        self.checkDownloadPodcast = xbmcgui.ControlCheckMark(self.getScX(100), self.getScY(280), self.getScX(300), self.getScY(30), "Download Podcasts When Possible?", font="font13", textColor="0xDDDDDDFF") 
        
        self.addControl(self.checkDownloadPodcast)  
        
        if self.config.podcastDownload:
            self.checkDownloadPodcast.setSelected(1)
        else:
            self.checkDownloadPodcast.setSelected(0)
               
        self.mediaButton =     xbmcgui.ControlButton(self.getScX(100), self.getScY(350), self.getScX(200), self.getScY(30), 'Update Media base') 
        self.addControl(self.mediaButton)
        
        self.aboutButton =     xbmcgui.ControlButton(self.getScX(100), self.getScY(400), self.getScX(100), self.getScY(30), 'About') 
        self.addControl(self.aboutButton)

        #####
        self.setFocus(self.browseLocalButton)
Exemple #3
0
 def __init__(self, parent=None):
     noStretch(self)
     self.parent = parent
     self.addControl(
         xbmcgui.ControlImage(parent.blockX - 20, parent.blockY + 70, 213,
                              113, IMAGE_DIR + 'pause.png'))
     self.addControl(
         xbmcgui.ControlLabel(parent.blockX + 10, parent.blockY + 10, 100,
                              25, "High Score:", 'font14', 'FFFFFF00'))
     self.lblHighScoreName = xbmcgui.ControlLabel(parent.blockX + 30,
                                                  parent.blockY + 29, 100,
                                                  25, "Asteron", 'font14',
                                                  'FFFFFFFF')
     self.lblHighScore = xbmcgui.ControlLabel(parent.blockX + 170,
                                              parent.blockY + 27,
                                              100,
                                              25,
                                              "00000",
                                              'font14',
                                              'FFFFFFFF',
                                              alignment=XBFONT_RIGHT)
     self.chkGhostPiece = xbmcgui.ControlCheckMark(
         parent.blockX + 25,
         parent.blockY + 230,
         100,
         25,
         "Ghost Piece",
         font='font14',
         focusTexture=IMAGE_DIR + "check-box.png",
         noFocusTexture=IMAGE_DIR + "check-box-nofocus.png",
         checkWidth=24,
         checkHeight=24)
     self.addControl(self.lblHighScoreName)
     self.addControl(self.lblHighScore)
     self.addControl(self.chkGhostPiece)
     self.setFocus(self.chkGhostPiece)
Exemple #4
0
    def __init__(self, *args, **kwargs):

        self.cptloc = kwargs.get('captcha')
        # self.img = xbmcgui.ControlImage(250, 110, 780, 499, '')
        # xbmc.sleep(500)
        self.img = xbmcgui.ControlImage(250, 110, 780, 499, self.cptloc)
        xbmc.sleep(500)

        bg_image = os.path.join(__addon__.getAddonInfo('path'), 'resources/art/') + 'background.png'
        check_image = os.path.join(__addon__.getAddonInfo('path'), 'resources/art/') + 'trans_checked.png'

        self.ctrlBackground = xbmcgui.ControlImage(0, 0, 1280, 720, bg_image)
        self.cancelled = False
        self.addControl(self.ctrlBackground)

        self.strActionInfo = xbmcgui.ControlLabel(250, 20, 724, 400, 'Veuillez sélectionnez les images correspondants au thème.\nIl devrait y en avoir 3 ou 4 à sélectionner.', 'font40', '0xFFFF00FF')
        self.addControl(self.strActionInfo)

        self.msg = kwargs.get('msg')
        self.roundnum = kwargs.get('roundnum')
        self.strActionInfo = xbmcgui.ControlLabel(250, 70, 700, 300, 'Le thème est: ' + self.msg, 'font13', '0xFFFF00FF')
        self.addControl(self.strActionInfo)

        self.addControl(self.img)

        self.chk = [0]*9
        self.chkbutton = [0]*9
        self.chkstate = [False]*9

        if 1 == 2:
            self.chk[0] = xbmcgui.ControlCheckMark(250, 110, 260, 166, '1', font='font14', focusTexture=check_image, checkWidth=260, checkHeight=166)
            self.chk[1] = xbmcgui.ControlCheckMark(250 + 260, 110, 260, 166, '2', font='font14', focusTexture=check_image, checkWidth=260, checkHeight=166)
            self.chk[2] = xbmcgui.ControlCheckMark(250 + 520, 110, 260, 166, '3', font='font14', focusTexture=check_image, checkWidth=260, checkHeight=166)

            self.chk[3] = xbmcgui.ControlCheckMark(250, 110 + 166, 260, 166, '4', font='font14', focusTexture=check_image, checkWidth=260, checkHeight=166)
            self.chk[4] = xbmcgui.ControlCheckMark(250 + 260, 110 + 166, 260, 166, '5', font='font14', focusTexture=check_image, checkWidth=260, checkHeight=166)
            self.chk[5] = xbmcgui.ControlCheckMark(250 + 520, 110 + 166, 260, 166, '6', font='font14', focusTexture=check_image, checkWidth=260, checkHeight=166)

            self.chk[6] = xbmcgui.ControlCheckMark(250, 110 + 332, 260, 166, '7', font='font14', focusTexture=check_image, checkWidth=260, checkHeight=166)
            self.chk[7] = xbmcgui.ControlCheckMark(250 + 260, 110 + 332, 260, 166, '8', font='font14', focusTexture=check_image, checkWidth=260, checkHeight=166)
            self.chk[8] = xbmcgui.ControlCheckMark(250 + 520, 110 + 332, 260, 166, '9', font='font14', focusTexture=check_image, checkWidth=260, checkHeight=166)

        else:
            self.chk[0] = xbmcgui.ControlImage(250, 110, 260, 166, check_image)
            self.chk[1] = xbmcgui.ControlImage(250 + 260, 110, 260, 166, check_image)
            self.chk[2] = xbmcgui.ControlImage(250 + 520, 110, 260, 166, check_image)

            self.chk[3] = xbmcgui.ControlImage(250, 110 + 166, 260, 166, check_image)
            self.chk[4] = xbmcgui.ControlImage(250 + 260, 110 + 166, 260, 166, check_image)
            self.chk[5] = xbmcgui.ControlImage(250 + 520, 110 + 166, 260, 166, check_image)

            self.chk[6] = xbmcgui.ControlImage(250, 110 + 332, 260, 166, check_image)
            self.chk[7] = xbmcgui.ControlImage(250 + 260, 110 + 332, 260, 166, check_image)
            self.chk[8] = xbmcgui.ControlImage(250 + 520, 110 + 332, 260, 166, check_image)

            self.chkbutton[0] = xbmcgui.ControlButton(250, 110, 260, 166, '1', font='font1')
            self.chkbutton[1] = xbmcgui.ControlButton(250 + 260, 110, 260, 166, '2', font='font1')
            self.chkbutton[2] = xbmcgui.ControlButton(250 + 520, 110, 260, 166, '3', font='font1')

            self.chkbutton[3] = xbmcgui.ControlButton(250, 110 + 166, 260, 166, '4', font='font1')
            self.chkbutton[4] = xbmcgui.ControlButton(250 + 260, 110 + 166, 260, 166, '5', font='font1')
            self.chkbutton[5] = xbmcgui.ControlButton(250 + 520, 110 + 166, 260, 166, '6', font='font1')

            self.chkbutton[6] = xbmcgui.ControlButton(250, 110 + 332, 260, 166, '7', font='font1')
            self.chkbutton[7] = xbmcgui.ControlButton(250 + 260, 110 + 332, 260, 166, '8', font='font1')
            self.chkbutton[8] = xbmcgui.ControlButton(250 + 520, 110 + 332, 260, 166, '9', font='font1')

        for obj in self.chk:
            self.addControl(obj)
            obj.setVisible(False)
        for obj in self.chkbutton:
            self.addControl(obj)

        self.cancelbutton = xbmcgui.ControlButton(250 + 260 - 70, 620, 140, 50, 'Cancel', alignment=2)
        self.okbutton = xbmcgui.ControlButton(250 + 520 - 50, 620, 100, 50, 'OK', alignment=2)
        self.addControl(self.okbutton)
        self.addControl(self.cancelbutton)

        self.chkbutton[6].controlDown(self.cancelbutton);  self.chkbutton[6].controlUp(self.chkbutton[3])
        self.chkbutton[7].controlDown(self.cancelbutton);  self.chkbutton[7].controlUp(self.chkbutton[4])
        self.chkbutton[8].controlDown(self.okbutton);      self.chkbutton[8].controlUp(self.chkbutton[5])

        self.chkbutton[6].controlLeft(self.chkbutton[8]);  self.chkbutton[6].controlRight(self.chkbutton[7]);
        self.chkbutton[7].controlLeft(self.chkbutton[6]);  self.chkbutton[7].controlRight(self.chkbutton[8]);
        self.chkbutton[8].controlLeft(self.chkbutton[7]);  self.chkbutton[8].controlRight(self.chkbutton[6]);

        self.chkbutton[3].controlDown(self.chkbutton[6]);  self.chkbutton[3].controlUp(self.chkbutton[0])
        self.chkbutton[4].controlDown(self.chkbutton[7]);  self.chkbutton[4].controlUp(self.chkbutton[1])
        self.chkbutton[5].controlDown(self.chkbutton[8]);  self.chkbutton[5].controlUp(self.chkbutton[2])

        self.chkbutton[3].controlLeft(self.chkbutton[5]);  self.chkbutton[3].controlRight(self.chkbutton[4]);
        self.chkbutton[4].controlLeft(self.chkbutton[3]);  self.chkbutton[4].controlRight(self.chkbutton[5]);
        self.chkbutton[5].controlLeft(self.chkbutton[4]);  self.chkbutton[5].controlRight(self.chkbutton[3]);

        self.chkbutton[0].controlDown(self.chkbutton[3]);  self.chkbutton[0].controlUp(self.cancelbutton)
        self.chkbutton[1].controlDown(self.chkbutton[4]);  self.chkbutton[1].controlUp(self.cancelbutton)
        self.chkbutton[2].controlDown(self.chkbutton[5]);  self.chkbutton[2].controlUp(self.okbutton)

        self.chkbutton[0].controlLeft(self.chkbutton[2]);  self.chkbutton[0].controlRight(self.chkbutton[1]);
        self.chkbutton[1].controlLeft(self.chkbutton[0]);  self.chkbutton[1].controlRight(self.chkbutton[2]);
        self.chkbutton[2].controlLeft(self.chkbutton[1]);  self.chkbutton[2].controlRight(self.chkbutton[0]);

        self.cancelled = False
        self.setFocus(self.okbutton)
        self.okbutton.controlLeft(self.cancelbutton);      self.okbutton.controlRight(self.cancelbutton);
        self.cancelbutton.controlLeft(self.okbutton);      self.cancelbutton.controlRight(self.okbutton);
        self.okbutton.controlDown(self.chkbutton[2]);      self.okbutton.controlUp(self.chkbutton[8]);
        self.cancelbutton.controlDown(self.chkbutton[0]);  self.cancelbutton.controlUp(self.chkbutton[6]);
Exemple #5
0
    def __init__(self, *args, **kwargs):

        self.cptloc = kwargs.get('captcha')
        self.img = xbmcgui.ControlImage(335, 200, 624, 400, "")
        xbmc.sleep(500)
        self.img = xbmcgui.ControlImage(335, 200, 624, 400, self.cptloc)
        xbmc.sleep(500)

        bg_image = os.path.join(__addon__.getAddonInfo('path'),
                                'resources/art/') + "background.png"
        check_image = os.path.join(__addon__.getAddonInfo('path'),
                                   'resources/art/') + "trans_checked.png"
        uncheck_image = os.path.join(__addon__.getAddonInfo('path'),
                                     'resources/art/') + "trans_unchecked1.png"

        self.ctrlBackgound = xbmcgui.ControlImage(0, 0, 1280, 720, bg_image)
        self.cancelled = False
        self.addControl(self.ctrlBackgound)
        self.msg = kwargs.get(
            'msg'
        ) + '\nNormally there are 3-4 selections and 2 rounds of pictures'
        self.roundnum = kwargs.get('roundnum')
        self.strActionInfo = xbmcgui.ControlLabel(335, 120, 700, 300, self.msg,
                                                  'font13', '0xFFFF00FF')
        self.addControl(self.strActionInfo)

        self.strActionInfo = xbmcgui.ControlLabel(
            335, 20, 724, 400, 'Captcha round %s' % (str(self.roundnum)),
            'font40', '0xFFFF00FF')
        self.addControl(self.strActionInfo)

        self.addControl(self.img)

        self.chk = [0] * 9
        self.chkbutton = [0] * 9
        self.chkstate = [False] * 9

        #self.chk[0] = xbmcgui.ControlCheckMark(335,200,200,200,'select',checkWidth=30, checkHeight=30)
        if 1 == 2:
            self.chk[0] = xbmcgui.ControlCheckMark(
                335,
                190,
                220,
                150,
                '1',
                font='font14',
                focusTexture=check_image,
                noFocusTexture=uncheck_image,
                checkWidth=220,
                checkHeight=150)
            self.chk[1] = xbmcgui.ControlCheckMark(
                335 + 200,
                190,
                220,
                150,
                '2',
                font='font14',
                focusTexture=check_image,
                noFocusTexture=uncheck_image,
                checkWidth=220,
                checkHeight=150)
            self.chk[2] = xbmcgui.ControlCheckMark(
                335 + 400,
                190,
                220,
                150,
                '3',
                font='font14',
                focusTexture=check_image,
                noFocusTexture=uncheck_image,
                checkWidth=220,
                checkHeight=150)

            self.chk[3] = xbmcgui.ControlCheckMark(
                335,
                190 + 130,
                220,
                150,
                '4',
                font='font14',
                focusTexture=check_image,
                noFocusTexture=uncheck_image,
                checkWidth=220,
                checkHeight=150)
            self.chk[4] = xbmcgui.ControlCheckMark(
                335 + 200,
                190 + 130,
                220,
                150,
                '5',
                font='font14',
                focusTexture=check_image,
                noFocusTexture=uncheck_image,
                checkWidth=220,
                checkHeight=150)
            self.chk[5] = xbmcgui.ControlCheckMark(
                335 + 400,
                190 + 130,
                220,
                150,
                '6',
                font='font14',
                focusTexture=check_image,
                noFocusTexture=uncheck_image,
                checkWidth=220,
                checkHeight=150)

            self.chk[6] = xbmcgui.ControlCheckMark(
                335,
                190 + 260,
                220,
                150,
                '7',
                font='font14',
                focusTexture=check_image,
                noFocusTexture=uncheck_image,
                checkWidth=220,
                checkHeight=150)
            self.chk[7] = xbmcgui.ControlCheckMark(
                335 + 200,
                190 + 260,
                220,
                150,
                '8',
                font='font14',
                focusTexture=check_image,
                noFocusTexture=uncheck_image,
                checkWidth=220,
                checkHeight=150)
            self.chk[8] = xbmcgui.ControlCheckMark(
                335 + 400,
                190 + 260,
                220,
                150,
                '9',
                font='font14',
                focusTexture=check_image,
                noFocusTexture=uncheck_image,
                checkWidth=220,
                checkHeight=150)
        else:

            self.chk[0] = xbmcgui.ControlImage(
                335, 190, 220, 150, check_image
            )  # '', font='font1',focusTexture=check_image ,noFocusTexture=uncheck_image,checkWidth=220,checkHeight=150)
            self.chk[1] = xbmcgui.ControlImage(
                335 + 200, 190, 220, 150, check_image
            )  # '', font='font14',focusTexture=check_image ,noFocusTexture=uncheck_image,checkWidth=220,checkHeight=150)
            self.chk[2] = xbmcgui.ControlImage(
                335 + 400, 190, 220, 150, check_image
            )  # '', font='font14',focusTexture=check_image ,noFocusTexture=uncheck_image,checkWidth=220,checkHeight=150)

            self.chk[3] = xbmcgui.ControlImage(
                335, 190 + 130, 220, 150, check_image
            )  # '', font='font14',focusTexture=check_image ,noFocusTexture=uncheck_image,checkWidth=220,checkHeight=150)
            self.chk[4] = xbmcgui.ControlImage(
                335 + 200, 190 + 130, 220, 150, check_image
            )  # '', font='font14',focusTexture=check_image ,noFocusTexture=uncheck_image,checkWidth=220,checkHeight=150)
            self.chk[5] = xbmcgui.ControlImage(
                335 + 400, 190 + 130, 220, 150, check_image
            )  # '', font='font14',focusTexture=check_image ,noFocusTexture=uncheck_image,checkWidth=220,checkHeight=150)

            self.chk[6] = xbmcgui.ControlImage(
                335, 190 + 260, 220, 150, check_image
            )  #, '', font='font14',focusTexture=check_image ,noFocusTexture=uncheck_image,checkWidth=220,checkHeight=150)
            self.chk[7] = xbmcgui.ControlImage(
                335 + 200, 190 + 260, 220, 150, check_image
            )  # '', font='font14',focusTexture=check_image ,noFocusTexture=uncheck_image,checkWidth=220,checkHeight=150)
            self.chk[8] = xbmcgui.ControlImage(
                335 + 400, 190 + 260, 220, 150, check_image
            )  # '', font='font14',focusTexture=check_image ,noFocusTexture=uncheck_image,checkWidth=220,checkHeight=150)

            self.chkbutton[0] = xbmcgui.ControlButton(335,
                                                      190,
                                                      210,
                                                      150,
                                                      '1',
                                                      font='font1')
            #,focusTexture=check_image ,noFocusTexture=uncheck_image);#,checkWidth=220,checkHeight=150)
            self.chkbutton[1] = xbmcgui.ControlButton(335 + 200,
                                                      190,
                                                      220,
                                                      150,
                                                      '2',
                                                      font='font1')
            #,focusTexture=check_image ,noFocusTexture=uncheck_image);#,checkWidth=220,checkHeight=150)
            self.chkbutton[2] = xbmcgui.ControlButton(335 + 400,
                                                      190,
                                                      220,
                                                      150,
                                                      '3',
                                                      font='font1')
            #,focusTexture=check_image ,noFocusTexture=uncheck_image);#,checkWidth=220,checkHeight=150)

            self.chkbutton[3] = xbmcgui.ControlButton(335,
                                                      190 + 130,
                                                      210,
                                                      150,
                                                      '4',
                                                      font='font1')
            #,focusTexture=check_image ,noFocusTexture=uncheck_image);#,checkWidth=220,checkHeight=150)
            self.chkbutton[4] = xbmcgui.ControlButton(335 + 200,
                                                      190 + 130,
                                                      220,
                                                      150,
                                                      '5',
                                                      font='font1')
            #,focusTexture=check_image ,noFocusTexture=uncheck_image);#,checkWidth=220,checkHeight=150)
            self.chkbutton[5] = xbmcgui.ControlButton(335 + 400,
                                                      190 + 130,
                                                      220,
                                                      150,
                                                      '6',
                                                      font='font1')
            #,focusTexture=check_image ,noFocusTexture=uncheck_image);#,checkWidth=220,checkHeight=150)

            self.chkbutton[6] = xbmcgui.ControlButton(335,
                                                      190 + 260,
                                                      210,
                                                      150,
                                                      '7',
                                                      font='font1')
            #,focusTexture=check_image ,noFocusTexture=uncheck_image);#,checkWidth=220,checkHeight=150)
            self.chkbutton[7] = xbmcgui.ControlButton(335 + 200,
                                                      190 + 260,
                                                      220,
                                                      150,
                                                      '8',
                                                      font='font1')
            #,focusTexture=check_image ,noFocusTexture=uncheck_image);#,checkWidth=220,checkHeight=150)
            self.chkbutton[8] = xbmcgui.ControlButton(335 + 400,
                                                      190 + 260,
                                                      220,
                                                      150,
                                                      '9',
                                                      font='font1')
            #,focusTexture=check_image ,noFocusTexture=uncheck_image);#,checkWidth=220,checkHeight=150)

        for obj in self.chk:
            self.addControl(obj)
            obj.setVisible(False)
        for obj in self.chkbutton:
            self.addControl(obj)

        #self.chk[0].setSelected(False)

        self.cancelbutton = xbmcgui.ControlButton(335 + 312 - 100,
                                                  610,
                                                  100,
                                                  40,
                                                  'Cancel',
                                                  alignment=2)
        self.okbutton = xbmcgui.ControlButton(335 + 312 + 50,
                                              610,
                                              100,
                                              40,
                                              'OK',
                                              alignment=2)
        self.addControl(self.okbutton)
        self.addControl(self.cancelbutton)

        self.chkbutton[6].controlDown(self.cancelbutton)
        self.chkbutton[6].controlUp(self.chkbutton[3])
        self.chkbutton[7].controlDown(self.cancelbutton)
        self.chkbutton[7].controlUp(self.chkbutton[4])
        self.chkbutton[8].controlDown(self.okbutton)
        self.chkbutton[8].controlUp(self.chkbutton[5])

        self.chkbutton[6].controlLeft(self.chkbutton[8])
        self.chkbutton[6].controlRight(self.chkbutton[7])
        self.chkbutton[7].controlLeft(self.chkbutton[6])
        self.chkbutton[7].controlRight(self.chkbutton[8])
        self.chkbutton[8].controlLeft(self.chkbutton[7])
        self.chkbutton[8].controlRight(self.chkbutton[6])

        self.chkbutton[3].controlDown(self.chkbutton[6])
        self.chkbutton[3].controlUp(self.chkbutton[0])
        self.chkbutton[4].controlDown(self.chkbutton[7])
        self.chkbutton[4].controlUp(self.chkbutton[1])
        self.chkbutton[5].controlDown(self.chkbutton[8])
        self.chkbutton[5].controlUp(self.chkbutton[2])

        self.chkbutton[3].controlLeft(self.chkbutton[5])
        self.chkbutton[3].controlRight(self.chkbutton[4])
        self.chkbutton[4].controlLeft(self.chkbutton[3])
        self.chkbutton[4].controlRight(self.chkbutton[5])
        self.chkbutton[5].controlLeft(self.chkbutton[4])
        self.chkbutton[5].controlRight(self.chkbutton[3])

        self.chkbutton[0].controlDown(self.chkbutton[3])
        self.chkbutton[0].controlUp(self.cancelbutton)
        self.chkbutton[1].controlDown(self.chkbutton[4])
        self.chkbutton[1].controlUp(self.cancelbutton)
        self.chkbutton[2].controlDown(self.chkbutton[5])
        self.chkbutton[2].controlUp(self.okbutton)

        self.chkbutton[0].controlLeft(self.chkbutton[2])
        self.chkbutton[0].controlRight(self.chkbutton[1])
        self.chkbutton[1].controlLeft(self.chkbutton[0])
        self.chkbutton[1].controlRight(self.chkbutton[2])
        self.chkbutton[2].controlLeft(self.chkbutton[1])
        self.chkbutton[2].controlRight(self.chkbutton[0])

        self.cancelled = False
        self.setFocus(self.okbutton)
        self.okbutton.controlLeft(self.cancelbutton)
        self.okbutton.controlRight(self.cancelbutton)
        self.cancelbutton.controlLeft(self.okbutton)
        self.cancelbutton.controlRight(self.okbutton)
        self.okbutton.controlDown(self.chkbutton[2])
        self.okbutton.controlUp(self.chkbutton[8])
        self.cancelbutton.controlDown(self.chkbutton[0])
        self.cancelbutton.controlUp(self.chkbutton[6])
Exemple #6
0
    def create(self):
        """
            internal:
            creates the control and adds it to the page
            assumes width/height etc are already set
            does not do navigation
        """

        # get generic stuff, position, type, etc
        id = string.lower(self.getoption("id"))
        t = string.lower(self.getoption("type"))
        
        x = int(self.getvalue(self.getoption("posx")))
        y = int(self.getvalue(self.getoption("posy")))
        c=None

        # 0 means auto (afaik)
        w = 0  
        h = 0  
        t1 = self.getoption("width")
        if t1 != "":
            w = int(self.getvalue(t1))
        t1 = self.getoption("height")
        if t1 != "":
            h = int(self.getvalue(t1))
        l = self.getoption("label")
        try:
            t1 = int(l)
            l = self.translator.get(t1)
        except:
            pass
        
        help = self.getoption("help")
        try:
            t1 = int(help)
            help = self.translator.get(t1)
        except:
            pass
        self.options['help'] = help
        
        tx = self.getoption("texture")
        if tx != "":
            tx = util.findMediaFile( tx )
            # if it didn't find the script skin file then use the xbmc skin file
            if tx == None:
                tx = self.getoption("texture")
                
        tx1 = self.getoption("texturefocus")
        if tx1 != "":
            tx1 = util.findMediaFile( tx1 )
        tx2 = self.getoption("texturenofocus")
        if tx2 != "":
            tx2 = util.findMediaFile( tx2 )
            
        ck = self.getoption("colorkey")
        aspectRatio = self.getoption("aspectratio")
        fnt = self.getvalue(self.getoption("font"))
        tcol = self.getoption("textcolor")

        log.debug( "id=[%s] x=[%d] y=[%d] w=[%d] h=[%d] font=[%s]"%(id,x,y,w,h,fnt) )
        c = None
        if t == "image":
            try:
                if ck == "" and aspectRatio == "":
                    c = xbmcgui.ControlImage(x,y,w,h,tx)
                elif aspectRatio != "":
                    c = xbmcgui.ControlImage(x,y,w,h,tx, aspectRatio=int(aspectRatio))
                else: 
                    c = xbmcgui.ControlImage(x,y,w,h,tx,ck)
            except Exception:
                log.exception("Unable to load image id:%s filename:%s" %(id, tx))

        elif t == "button":
            try:
                tox = int(self.getvalue(self.getoption("offsetx")))
            except:
                tox = 17
            try:
                toy = int(self.getvalue(self.getoption("offsety")))
            except:
                toy = 2
            try:
                align = int(self.getvalue(self.getoption("alignment")))
            except:
                align = 0   # left
            log.debug( "font=[%s] tox=[%d] toy=[%d] align=[%d]"%(fnt,tox,toy,align) )

            if tx1 == "":
                if fnt == "":
                    c = xbmcgui.ControlButton(
                        x,y,w,h,l,
                        textXOffset=int(tox),textYOffset=int(toy),
                        alignment=align)
                else:
                    c = xbmcgui.ControlButton(
                        x,y,w,h,l,font=str(fnt),
                        textXOffset=int(tox),textYOffset=int(toy),
                        alignment=align)
            elif tx2 == "":
                if fnt == "":
                    c = xbmcgui.ControlButton(
                        x,y,w,h,l,tx1,
                        textXOffset=int(tox),textYOffset=int(toy),
                        alignment=align)
                else:
                    c = xbmcgui.ControlButton(
                        x,y,w,h,l,tx1,font=fnt,
                        textXOffset=int(tox),textYOffset=int(toy),
                        alignment=align)
            else:

                if fnt == "":
                    c = xbmcgui.ControlButton(
                        x, y, w, h, l, tx1, tx2,
                        textXOffset=int(tox), textYOffset=int(toy),
                        alignment=align)
                else:
                    c = xbmcgui.ControlButton(
                        x, y, w, h, l, tx1, tx2, font=fnt,
                        textXOffset=int(tox), textYOffset=int(toy),
                        alignment=align)
        elif t == "fadelabel":
            try:
                align = int(self.getvalue(self.getoption("alignment")))
            except Exception:
##                traceback.print_exc()
##                print ( "XBMCMYTHTV: %s " % str(ex) )
                align = 6   # left
            c = xbmcgui.ControlFadeLabel(x,y,w,h,str(fnt),tcol,alignment=align)
        
        elif t == "label":
            try:
                align = int(self.getvalue(self.getoption("alignment")))
            except:
                align = 0   # left
            c = xbmcgui.ControlLabel(x,y,w,h,l,str(fnt),tcol,alignment=align)

        elif t == "listcontrol":
            try:
                tox = int(self.getvalue(self.getoption("offsetx")))
            except:
                tox = 17
            try:
                spc = int(self.getvalue(self.getoption("space")))
            except:
                spc = 1
            try:
                ih = int(self.getvalue(self.getoption( "itemheight" )))
            except:
                ih = 20

            #    ALIGN_LEFT                          = 0
            #    ALIGN_RIGHT                         = 1
            #    ALIGN_CENTER_X                      = 2
            #    ALIGN_CENTER_Y                      = 4
            #    ALIGN_TRUNCATED                     = 8

            bt = util.findMediaFile('button-focus.png')
            aly = ui.ALIGN_TRUNCATED | ui.ALIGN_CENTER_Y
            
            log.debug( "font=[%s] tox=[%d] ih=[%d]"%(fnt,tox,ih) )

            if tx1 == "":
                if fnt == "":
                    c = xbmcgui.ControlList(x,y,w,h,itemTextXOffset=int(tox),space=int(spc),itemHeight=int(ih), 
                                            alignmentY = aly, buttonFocusTexture=bt)
                else:
                    c = xbmcgui.ControlList(x,y,w,h,font=fnt,itemTextXOffset=int(tox),space=int(spc),itemHeight=int(ih), 
                                            alignmentY = aly, buttonFocusTexture=bt)
                log.debug( "xbmcgui.ControlList(x,y,w,h)" )
            elif tx2 == "":
                if fnt == "":
                    c = xbmcgui.ControlList(x,y,w,h,tx1,itemTextXOffset=int(tox),space=int(spc),itemHeight=int(ih), 
                                            alignmentY = aly, buttonFocusTexture=bt)
                else:
                    c = xbmcgui.ControlList(x, y, w, h, tx1, font=fnt, itemTextXOffset=int(tox), space=int(spc), itemHeight=int(ih), 
                                            alignmentY = aly, buttonFocusTexture=bt)
                log.debug( "xbmcgui.ControlList(x,y,w,h,tx1)" )
            else:
                if fnt == "":
                    c = xbmcgui.ControlList(x,y,w,h,tx1,tx2,itemTextXOffset=int(tox),space=int(spc),itemHeight=int(ih), 
                                            alignmentY = aly, buttonFocusTexture=bt)
                else:
                    c = xbmcgui.ControlList(x,y,w,h,tx1,tx2,font=fnt,itemTextXOffset=int(tox),space=int(spc),itemHeight=int(ih), 
                                            alignmentY = aly, buttonFocusTexture=bt)
                log.debug( "xbmcgui.ControlList(x,y,w,h,tx1,tx2)" )
        elif t == "textbox":
            c = xbmcgui.ControlTextBox(x,y,w,h,fnt,tcol)
            # c.setText()
        elif t == "checkmark":
            try:
                cw = int(self.getoption( "checkwidth" ))
            except:
                cw = 30
            try:
                ch = int(self.getoption( "checkheight" ))
            except:
                ch = 30
            try:
                align = int(self.getvalue(self.getoption("alignment")))
            except:
                align = 1   # right
            if tx1 == "":
                c = xbmcgui.ControlCheckMark(
                    x,y,w,h,l, checkWidth=cw, checkHeight=ch, alignment=align,
                    textColor=tcol)
            elif tx2 == "":
                c = xbmcgui.ControlCheckMark(
                    x,y,w,h,l,tx1, checkWidth=cw, checkHeight=ch,
                    alignment=align, textColor=tcol)
            else:
                c = xbmcgui.ControlCheckMark(
                    x,y,w,h,l,tx1,tx2,cw,ch,align,textColor=tcol)
        log.debug( "created '%s' control"%t )

        # TODO: Remove OS specific checks
        if c != None:
            if os.name != "nt":
                self.owner.addControl(c)
            else:
                # lists are acting funny. trying remove instead of hide
                t1 = self.owner.getoption("defaultgroup")
                if t1 == self.getoption("group") or \
                        self.getoption("group") == "":
                    self.owner.addControl(c)
                
        self.control = c
Exemple #7
0
 def addCtl(self, control):
     try:
         if (control['type'] == 'image'):
             if (control.has_key('info')):
                 if (control['info'][0] != ''):
                     control['texture'] = xbmc.getInfoImage(
                         control['info'][0])
             self.win.controls[int(control['id'])] = (xbmcgui.ControlImage(x=int(control['posx']) + self.posx,\
              y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']),\
              filename=control['texture'], colorKey=control['colorkey'], aspectRatio=int(control['aspectratio'])))#,\
             #colorDiffuse=control['colordiffuse']))
             self.win.addControl(self.win.controls[int(control['id'])])
         elif (control['type'] == 'label'):
             if (control.has_key('info')):
                 if (control['info'][0] != ''):
                     control['label'][0] = xbmc.getInfoLabel(
                         control['info'][0])
             self.win.controls[int(control['id'])] = (xbmcgui.ControlLabel(x=int(control['posx']) + self.posx,\
              y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']), label=control['label'][0],\
              font=control['font'], textColor=control['textcolor'], disabledColor=control['disabledcolor'], alignment=control['align'],\
              hasPath=control['haspath'], angle=int(control['angle'])))#, shadowColor=control['shadowcolor']))
             self.win.addControl(self.win.controls[int(control['id'])])
         elif (control['type'] == 'button'):
             if (control.has_key('info')):
                 if (control['info'][0] != ''):
                     control['label'][0] = xbmc.getInfoLabel(
                         control['info'][0])
             self.win.controls[int(control['id'])] = (xbmcgui.ControlButton(x=int(control['posx']) + self.posx,\
              y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']), label=control['label'][0],\
              font=control['font'], textColor=control['textcolor'], disabledColor=control['disabledcolor'], alignment=control['align'],\
              angle=int(control['angle']), shadowColor=control['shadowcolor'], focusTexture=control['texturefocus'],\
              noFocusTexture=control['texturenofocus'], textXOffset=int(control['textoffsetx']), textYOffset=int(control['textoffsety'])))
             self.win.addControl(self.win.controls[int(control['id'])])
         elif (control['type'] == 'checkmark'):
             if (control.has_key('info')):
                 if (control['info'][0] != ''):
                     control['label'][0] = xbmc.getInfoLabel(
                         control['info'][0])
             self.win.controls[int(control['id'])] = (xbmcgui.ControlCheckMark(x=int(control['posx']) + self.posx,\
              y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']), label=control['label'][0],\
              font=control['font'], textColor=control['textcolor'], disabledColor=control['disabledcolor'], alignment=control['align'],\
              focusTexture=control['texturecheckmark'], noFocusTexture=control['texturecheckmarknofocus'],\
              checkWidth=int(control['markwidth']), checkHeight=int(control['markheight'])))
             self.win.addControl(self.win.controls[int(control['id'])])
         elif (control['type'] == 'textbox'):
             self.win.controls[int(control['id'])] = (xbmcgui.ControlTextBox(x=int(control['posx']) + self.posx,\
              y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']), font=control['font'],\
              textColor=control['textcolor']))
             self.win.addControl(self.win.controls[int(control['id'])])
             if (control.has_key('label')):
                 self.win.controls[int(control['id'])].setText(
                     control['label'][0])
         elif (control['type'] == 'fadelabel'):
             self.win.controls[int(control['id'])] = (xbmcgui.ControlFadeLabel(x=int(control['posx']) + self.posx,\
              y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']), font=control['font'],\
              textColor=control['textcolor'], alignment=control['align']))#, shadowColor=control['shadowcolor']))
             self.win.addControl(self.win.controls[int(control['id'])])
             if (control.has_key('info')):
                 for item in control['info']:
                     if (item != ''):
                         self.win.controls[int(control['id'])].addLabel(
                             xbmc.getInfoLabel(item))
             if (control.has_key('label')):
                 for item in control['label']:
                     if (item != ''):
                         self.win.controls[int(
                             control['id'])].addLabel(item)
         elif (control['type'] == 'listcontrol'):
             self.win.controls[int(control['id'])] = (xbmcgui.ControlList(x=int(control['posx']) + self.posx,\
              y=int(control['posy']) + self.posy, width=int(control['width']), height=int(control['height']), font=control['font'],\
              textColor=control['textcolor'], alignmentY=control['aligny'], buttonTexture=control['texturenofocus'],\
              buttonFocusTexture=control['texturefocus'], selectedColor=control['selectedcolor'], imageWidth=int(control['itemwidth']),\
              imageHeight=int(control['itemheight']), itemTextXOffset=int(control['textxoff']), itemTextYOffset=int(control['textyoff']),\
              itemHeight=int(control['textureheight']), space=int(control['spacebetweenitems'])))#, shadowColor=control['shadowcolor']))
             self.win.addControl(self.win.controls[int(control['id'])])
             if (control.has_key('label')):
                 for cnt, item in enumerate(control['label']):
                     if (item != ''):
                         if (cnt < len(control['label2'])):
                             tmp = control['label2'][cnt]
                         else:
                             tmp = ''
                         if (cnt < len(control['image'])):
                             tmp2 = control['image'][cnt]
                         elif control['image']:
                             tmp2 = control['image'][len(control['image']) -
                                                     1]
                         else:
                             tmp2 = ''
                         l = xbmcgui.ListItem(item, tmp, '', tmp2)
                         self.win.controls[int(control['id'])].addItem(l)
         try:
             self.win.visibility[int(control['id'])] = control['visible']
             self.win.positions[int(control['id'])] = (int(control['posx']),
                                                       int(control['posy']))
             #self.win.onclick[int(control['id'])] = control['onclick']
             #self.win.onfocus[int(control['id'])] = control['onfocus']
             self.navigation[int(control['id'])] = (int(control['onup']),
                                                    int(control['ondown']),
                                                    int(control['onleft']),
                                                    int(control['onright']))
             self.win.controls[int(control['id'])].setVisible(
                 xbmc.getCondVisibility(control['visible']))
         except:
             pass
     except:
         if (not self.fastMethod): self.dlg.close()
         self.win.SUCCEEDED = False
         self.controlsFailed += control['id'] + ', '
         self.controlsFailedCnt += 1
Exemple #8
0
    def __init__(self, *args, **kwargs):
        self.cptloc = kwargs.get('captcha')

        bg_image = 'special://home/addons/plugin.video.vstream/resources/art/background.png'
        check_image = 'special://home/addons/plugin.video.vstream/resources/art/trans_checked.png'

        self.ctrlBackground = xbmcgui.ControlImage(0, 0, 1280, 720, bg_image)
        self.cancelled = False
        self.addControl(self.ctrlBackground)

        self.strActionInfo = xbmcgui.ControlLabel(
            250, 20, 724, 400, 'Le thème est : ' + kwargs.get('msg'), 'font40',
            '0xFFFF00FF')
        self.addControl(self.strActionInfo)

        self.img = xbmcgui.ControlImage(250, 110, 780, 499, str(self.cptloc))
        self.addControl(self.img)

        self.chk = [0] * 9
        self.chkbutton = [0] * 9
        self.chkstate = [False] * 9

        if 1 == 2:
            self.chk[0] = xbmcgui.ControlCheckMark(250,
                                                   110,
                                                   260,
                                                   166,
                                                   '1',
                                                   font='font14',
                                                   focusTexture=check_image,
                                                   checkWidth=260,
                                                   checkHeight=166)
            self.chk[1] = xbmcgui.ControlCheckMark(250 + 260,
                                                   110,
                                                   260,
                                                   166,
                                                   '2',
                                                   font='font14',
                                                   focusTexture=check_image,
                                                   checkWidth=260,
                                                   checkHeight=166)
            self.chk[2] = xbmcgui.ControlCheckMark(250 + 520,
                                                   110,
                                                   260,
                                                   166,
                                                   '3',
                                                   font='font14',
                                                   focusTexture=check_image,
                                                   checkWidth=260,
                                                   checkHeight=166)

            self.chk[3] = xbmcgui.ControlCheckMark(250,
                                                   110 + 166,
                                                   260,
                                                   166,
                                                   '4',
                                                   font='font14',
                                                   focusTexture=check_image,
                                                   checkWidth=260,
                                                   checkHeight=166)
            self.chk[4] = xbmcgui.ControlCheckMark(250 + 260,
                                                   110 + 166,
                                                   260,
                                                   166,
                                                   '5',
                                                   font='font14',
                                                   focusTexture=check_image,
                                                   checkWidth=260,
                                                   checkHeight=166)
            self.chk[5] = xbmcgui.ControlCheckMark(250 + 520,
                                                   110 + 166,
                                                   260,
                                                   166,
                                                   '6',
                                                   font='font14',
                                                   focusTexture=check_image,
                                                   checkWidth=260,
                                                   checkHeight=166)

            self.chk[6] = xbmcgui.ControlCheckMark(250,
                                                   110 + 332,
                                                   260,
                                                   166,
                                                   '7',
                                                   font='font14',
                                                   focusTexture=check_image,
                                                   checkWidth=260,
                                                   checkHeight=166)
            self.chk[7] = xbmcgui.ControlCheckMark(250 + 260,
                                                   110 + 332,
                                                   260,
                                                   166,
                                                   '8',
                                                   font='font14',
                                                   focusTexture=check_image,
                                                   checkWidth=260,
                                                   checkHeight=166)
            self.chk[8] = xbmcgui.ControlCheckMark(250 + 520,
                                                   110 + 332,
                                                   260,
                                                   166,
                                                   '9',
                                                   font='font14',
                                                   focusTexture=check_image,
                                                   checkWidth=260,
                                                   checkHeight=166)

        else:
            self.chk[0] = xbmcgui.ControlImage(250, 110, 260, 166, check_image)
            self.chk[1] = xbmcgui.ControlImage(250 + 260, 110, 260, 166,
                                               check_image)
            self.chk[2] = xbmcgui.ControlImage(250 + 520, 110, 260, 166,
                                               check_image)

            self.chk[3] = xbmcgui.ControlImage(250, 110 + 166, 260, 166,
                                               check_image)
            self.chk[4] = xbmcgui.ControlImage(250 + 260, 110 + 166, 260, 166,
                                               check_image)
            self.chk[5] = xbmcgui.ControlImage(250 + 520, 110 + 166, 260, 166,
                                               check_image)

            self.chk[6] = xbmcgui.ControlImage(250, 110 + 332, 260, 166,
                                               check_image)
            self.chk[7] = xbmcgui.ControlImage(250 + 260, 110 + 332, 260, 166,
                                               check_image)
            self.chk[8] = xbmcgui.ControlImage(250 + 520, 110 + 332, 260, 166,
                                               check_image)

            self.chkbutton[0] = xbmcgui.ControlButton(250,
                                                      110,
                                                      260,
                                                      166,
                                                      '1',
                                                      font='font1')
            self.chkbutton[1] = xbmcgui.ControlButton(250 + 260,
                                                      110,
                                                      260,
                                                      166,
                                                      '2',
                                                      font='font1')
            self.chkbutton[2] = xbmcgui.ControlButton(250 + 520,
                                                      110,
                                                      260,
                                                      166,
                                                      '3',
                                                      font='font1')

            self.chkbutton[3] = xbmcgui.ControlButton(250,
                                                      110 + 166,
                                                      260,
                                                      166,
                                                      '4',
                                                      font='font1')
            self.chkbutton[4] = xbmcgui.ControlButton(250 + 260,
                                                      110 + 166,
                                                      260,
                                                      166,
                                                      '5',
                                                      font='font1')
            self.chkbutton[5] = xbmcgui.ControlButton(250 + 520,
                                                      110 + 166,
                                                      260,
                                                      166,
                                                      '6',
                                                      font='font1')

            self.chkbutton[6] = xbmcgui.ControlButton(250,
                                                      110 + 332,
                                                      260,
                                                      166,
                                                      '7',
                                                      font='font1')
            self.chkbutton[7] = xbmcgui.ControlButton(250 + 260,
                                                      110 + 332,
                                                      260,
                                                      166,
                                                      '8',
                                                      font='font1')
            self.chkbutton[8] = xbmcgui.ControlButton(250 + 520,
                                                      110 + 332,
                                                      260,
                                                      166,
                                                      '9',
                                                      font='font1')

        for obj in self.chk:
            self.addControl(obj)
            obj.setVisible(False)
        for obj in self.chkbutton:
            self.addControl(obj)

        self.cancelbutton = xbmcgui.ControlButton(250 + 260 - 70,
                                                  620,
                                                  140,
                                                  50,
                                                  'Cancel',
                                                  alignment=2)
        self.okbutton = xbmcgui.ControlButton(250 + 520 - 50,
                                              620,
                                              100,
                                              50,
                                              'OK',
                                              alignment=2)
        self.addControl(self.okbutton)
        self.addControl(self.cancelbutton)

        self.chkbutton[6].controlDown(self.cancelbutton)
        self.chkbutton[6].controlUp(self.chkbutton[3])
        self.chkbutton[7].controlDown(self.cancelbutton)
        self.chkbutton[7].controlUp(self.chkbutton[4])
        self.chkbutton[8].controlDown(self.okbutton)
        self.chkbutton[8].controlUp(self.chkbutton[5])

        self.chkbutton[6].controlLeft(self.chkbutton[8])
        self.chkbutton[6].controlRight(self.chkbutton[7])
        self.chkbutton[7].controlLeft(self.chkbutton[6])
        self.chkbutton[7].controlRight(self.chkbutton[8])
        self.chkbutton[8].controlLeft(self.chkbutton[7])
        self.chkbutton[8].controlRight(self.chkbutton[6])

        self.chkbutton[3].controlDown(self.chkbutton[6])
        self.chkbutton[3].controlUp(self.chkbutton[0])
        self.chkbutton[4].controlDown(self.chkbutton[7])
        self.chkbutton[4].controlUp(self.chkbutton[1])
        self.chkbutton[5].controlDown(self.chkbutton[8])
        self.chkbutton[5].controlUp(self.chkbutton[2])

        self.chkbutton[3].controlLeft(self.chkbutton[5])
        self.chkbutton[3].controlRight(self.chkbutton[4])
        self.chkbutton[4].controlLeft(self.chkbutton[3])
        self.chkbutton[4].controlRight(self.chkbutton[5])
        self.chkbutton[5].controlLeft(self.chkbutton[4])
        self.chkbutton[5].controlRight(self.chkbutton[3])

        self.chkbutton[0].controlDown(self.chkbutton[3])
        self.chkbutton[0].controlUp(self.cancelbutton)
        self.chkbutton[1].controlDown(self.chkbutton[4])
        self.chkbutton[1].controlUp(self.cancelbutton)
        self.chkbutton[2].controlDown(self.chkbutton[5])
        self.chkbutton[2].controlUp(self.okbutton)

        self.chkbutton[0].controlLeft(self.chkbutton[2])
        self.chkbutton[0].controlRight(self.chkbutton[1])
        self.chkbutton[1].controlLeft(self.chkbutton[0])
        self.chkbutton[1].controlRight(self.chkbutton[2])
        self.chkbutton[2].controlLeft(self.chkbutton[1])
        self.chkbutton[2].controlRight(self.chkbutton[0])

        self.cancelled = False
        self.setFocus(self.okbutton)
        self.okbutton.controlLeft(self.cancelbutton)
        self.okbutton.controlRight(self.cancelbutton)
        self.cancelbutton.controlLeft(self.okbutton)
        self.cancelbutton.controlRight(self.okbutton)
        self.okbutton.controlDown(self.chkbutton[2])
        self.okbutton.controlUp(self.chkbutton[8])
        self.cancelbutton.controlDown(self.chkbutton[0])
        self.cancelbutton.controlUp(self.chkbutton[6])