Ejemplo n.º 1
0
    def set_controls(self):
        """Set up UI controls"""
        # Image control
        image = pyxbmct.Image(addonfolder + artsfolder + '/tvh.png')
        self.placeControl(image, 0, 0, rowspan=8, columnspan=16)

        # Wetek Button
        self.wetek_button = pyxbmct.RadioButton('')
        self.placeControl(self.wetek_button, 9, 3, rowspan=3, columnspan=3)
        self.connect(self.wetek_button, self.wetek_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'wetek', 2) == 1:
            self.wetek_button.setSelected(True)
        else:
            self.wetek_button.setSelected(False)
        wetek = pyxbmct.Image(addonfolder + artsfolder + '/weteksmall.png')
        self.placeControl(wetek, 9, 3, rowspan=3, columnspan=3)

        # K Button
        self.k_button = pyxbmct.RadioButton('')
        self.placeControl(self.k_button, 9, 10, rowspan=3, columnspan=3)
        self.connect(self.k_button, self.k_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'k', 2) == 1:
            self.k_button.setSelected(True)
        else:
            self.k_button.setSelected(False)
        k = pyxbmct.Image(addonfolder + artsfolder + '/ksmall.png')
        self.placeControl(k, 9, 10, rowspan=3, columnspan=3)

        # Close button
        self.close_button = pyxbmct.Button('Exit')
        self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1)
        self.connect(self.close_button, lambda: self.closepage())
Ejemplo n.º 2
0
    def set_controls(self):
        """Set up UI controls"""
        image = pyxbmct.Image(addonfolder + artsfolder + '/dvb.png')
        self.placeControl(image, 0, 0, rowspan=8, columnspan=16)

        # DVB-C
        self.dvbc_button = pyxbmct.RadioButton('')
        self.placeControl(self.dvbc_button, 9, 3, rowspan=2, columnspan=4)
        self.connect(self.dvbc_button, self.dvbc_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'wdvbc', 2) == 1:
            self.dvbc_button.setSelected(True)
        else:
            self.dvbc_button.setSelected(False)
        dvbc = pyxbmct.Image(addonfolder + artsfolder + '/dvbc.png')
        self.placeControl(dvbc, 9, 3, rowspan=2, columnspan=4)

        # DVB-S
        self.dvbs_button = pyxbmct.RadioButton('')
        self.placeControl(self.dvbs_button, 9, 10, rowspan=2, columnspan=4)
        self.connect(self.dvbs_button, self.dvbs_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'wdvbs', 2) == 1:
            self.dvbs_button.setSelected(True)
        else:
            self.dvbs_button.setSelected(False)
        dvbs = pyxbmct.Image(addonfolder + artsfolder + '/dvbs2.png')
        self.placeControl(dvbs, 9, 10, rowspan=2, columnspan=4)

        # Close button
        self.close_button = pyxbmct.Button('Exit')
        self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1)
        self.connect(self.close_button, lambda: self.closepage())
Ejemplo n.º 3
0
    def set_controls(self):
        """Set up UI controls"""
        # Image control
        image = pyxbmct.Image(addonfolder + artsfolder + '/kbox.png')
        self.placeControl(image, 0, 0, rowspan=10, columnspan=16)

        # DVBC
        self.kdvbc_button = pyxbmct.RadioButton('')
        self.placeControl(self.kdvbc_button, 11, 3, rowspan=1, columnspan=3)
        self.connect(self.kdvbc_button, self.kdvbc_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'kdvbc', 2) == 1:
            self.kdvbc_button.setSelected(True)
        else:
            self.kdvbc_button.setSelected(False)
        lnb1 = pyxbmct.Image(addonfolder + artsfolder + '/dvbc.png')
        self.placeControl(lnb1, 11, 3, rowspan=1, columnspan=3)

        # DVBS2
        self.kdvbs_button = pyxbmct.RadioButton('')
        self.placeControl(self.kdvbs_button, 11, 10, rowspan=1, columnspan=3)
        self.connect(self.kdvbs_button, self.kdvbs_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'kdvbs', 2) == 1:
            self.kdvbs_button.setSelected(True)
        else:
            self.kdvbs_button.setSelected(False)
        lnb2 = pyxbmct.Image(addonfolder + artsfolder + '/dvbs2.png')
        self.placeControl(lnb2, 11, 10, rowspan=1, columnspan=3)

        # Close button
        self.close_button = pyxbmct.Button('Exit')
        self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1)
        self.connect(self.close_button, lambda: self.closepage())
Ejemplo n.º 4
0
    def set_controls(self):
        """Set up UI controls"""
        # Image control
        image = pyxbmct.Image(addonfolder + artsfolder + '/tnds82.png')
        self.placeControl(image, 0, 0, rowspan=8, columnspan=16)

        # Portugal
        self.portugal_button = pyxbmct.RadioButton('')
        self.placeControl(self.portugal_button, 9, 3, rowspan=2, columnspan=4)
        self.connect(self.portugal_button, self.portugal_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'portugal', 2) == 1:
            self.portugal_button.setSelected(True)
        else:
            self.portugal_button.setSelected(False)
        portugal = pyxbmct.Image(addonfolder + artsfolder + '/portugal.png')
        self.placeControl(portugal, 9, 3, rowspan=2, columnspan=4)

        # Brasil
        self.brasil_button = pyxbmct.RadioButton('')
        self.placeControl(self.brasil_button, 9, 9, rowspan=2, columnspan=4)
        self.connect(self.brasil_button, self.brasil_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'brasil', 2) == 1:
            self.brasil_button.setSelected(True)
        else:
            self.brasil_button.setSelected(False)
        brasil = pyxbmct.Image(addonfolder + artsfolder + '/brasil.png')
        self.placeControl(brasil, 9, 9, rowspan=2, columnspan=4)

        # Close button
        self.close_button = pyxbmct.Button('Exit')
        self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1)
        self.connect(self.close_button, lambda: self.closepage())
Ejemplo n.º 5
0
    def add_radiobuttons(self):
        self.files_radiobutton = pyxbmct.RadioButton(
            "Select all files inside the directory")
        self.placeControl(self.files_radiobutton, 6, 0, columnspan=2)

        self.working_dir_radiobutton = pyxbmct.RadioButton(
            "Stay in working directory")
        self.placeControl(self.working_dir_radiobutton, 10, 0)

        self.symlink_radiobutton = pyxbmct.RadioButton("Use symlinks")
        self.placeControl(self.symlink_radiobutton, 10, 1)
Ejemplo n.º 6
0
    def set_controls(self):
        """Set up UI controls"""
        # Image control
        image = pyxbmct.Image(addonfolder + artsfolder + '/k.png')
        self.placeControl(image, 0, 0, rowspan=8, columnspan=16)

        # KI Plus
        self.k1plus_button = pyxbmct.RadioButton('')
        self.placeControl(self.k1plus_button, 8, 1, rowspan=2, columnspan=4)
        self.connect(self.k1plus_button, self.k1plus_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'k1plus', 2) == 1:
            self.k1plus_button.setSelected(True)
        else:
            self.k1plus_button.setSelected(False)
        k1plus = pyxbmct.Image(addonfolder + artsfolder + '/k1plus.png')
        self.placeControl(k1plus, 8, 1, rowspan=2, columnspan=4)

        # KI Pro
        self.k1pro_button = pyxbmct.RadioButton('')
        self.placeControl(self.k1pro_button, 11, 6, rowspan=2, columnspan=4)
        self.connect(self.k1pro_button, self.k1pro_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'k1pro', 2) == 1:
            self.k1pro_button.setSelected(True)
        else:
            self.k1pro_button.setSelected(False)
        k1pro = pyxbmct.Image(addonfolder + artsfolder + '/k1pro.png')
        self.placeControl(k1pro, 11, 6, rowspan=2, columnspan=4)

        # KII Pro
        self.k2pro_button = pyxbmct.RadioButton('')
        self.placeControl(self.k2pro_button, 8, 6, rowspan=2, columnspan=4)
        self.connect(self.k2pro_button, self.k2pro_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'k2pro', 2) == 1:
            self.k2pro_button.setSelected(True)
        else:
            self.k2pro_button.setSelected(False)
        k2pro = pyxbmct.Image(addonfolder + artsfolder + '/k2pro.png')
        self.placeControl(k2pro, 8, 6, rowspan=2, columnspan=4)

        # KIII Pro
        self.k3pro_button = pyxbmct.RadioButton('')
        self.placeControl(self.k3pro_button, 8, 11, rowspan=2, columnspan=4)
        self.connect(self.k3pro_button, self.k3pro_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'k3pro', 2) == 1:
            self.k3pro_button.setSelected(True)
        else:
            self.k3pro_button.setSelected(False)
        k3pro = pyxbmct.Image(addonfolder + artsfolder + '/k3pro.png')
        self.placeControl(k3pro, 8, 11, rowspan=2, columnspan=4)

        # Close button
        self.close_button = pyxbmct.Button('Exit')
        self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1)
        self.connect(self.close_button, lambda: self.closepage())
Ejemplo n.º 7
0
    def draw_page(self):
        for item in self.list:
            self.removeControl(item['btn'])

        self.list = []

        start_index = self.page * 8
        for i, addon in enumerate(self._supported_addons[start_index:]):
            radiobutton = pyxbmct.RadioButton(addon['name'])
            self.placeControl(radiobutton, i, 0, 1, 4)
            addon_object = xbmcaddon.Addon(addon['id'])
            if addon['learned']:
                united_search = (
                    addon_object.getSetting('united_search_learned') == 'true')
            else:
                united_search = (
                    addon_object.getSetting('united_search') == 'true')
            radiobutton.setSelected(united_search)
            self.connect(radiobutton, self.radio_update)

            self.list.append({
                'btn': radiobutton,
                'id': addon['id'],
                'status': united_search,
                'learned': addon['learned']
            })
            if i >= 7: break

        self.vis_prev_btn = (self.page > 0)
        self.button_prev.setVisible(self.vis_prev_btn)
        self.vis_next_btn = (len(
            self._supported_addons[((self.page + 1) * 8):]) > 0)
        self.button_next.setVisible(self.vis_next_btn)

        self.set_page_navigation()
Ejemplo n.º 8
0
    def set_active_controls(self):
        row = 0

        for category in self.categories:
            for catId in category:
                catName = category[catId]

                radiobutton = pyxbmct.RadioButton(catName)
                catSetting = plugintools.get_setting(catName)
                self.placeControl(radiobutton, row, 0)
                self.connect(radiobutton, self.radio_update)

                if catSetting == True:
                    radiobutton.setSelected(True)
                else:
                    radiobutton.setSelected(False)

                self.listOfRadioButtons.append(radiobutton)
                self.radioMap[catName] = radiobutton

                row = row + 1

        self.close_button = pyxbmct.Button('Close')
        self.placeControl(self.close_button, row, 0)
        self.connect(self.close_button, self.close)
Ejemplo n.º 9
0
    def set_controls(self):
        '''
        Left Side Menu Top Section
        '''
        self.MenuSection = pyxbmct.Label(
            '[B]Tool Menu[/B]', alignment=pyxbmct.ALIGN_LEFT, textColor=self.colors.mh_color)
        self.placeControl(self.MenuSection, 3, 1, columnspan=17)
        self.menu = pyxbmct.List(textColor=self.colors.mt_color)
        self.placeControl(self.menu, 4, 1, rowspan=8, columnspan=17)
        self.menu.addItems(['Pairing', 'Authorize'])

        '''
        Primary buttons in left menu
        '''
        self.CloseButton = pyxbmct.Button(
            'Close', textColor='0xFFFFFFFF', shadowColor='0xFF000000', focusedColor='0xFFbababa',
            focusTexture=themecontrol.btn_focus, noFocusTexture=themecontrol.btn_nofocus)
        self.placeControl(self.CloseButton, 17, 10, rowspan=2, columnspan=8)
        self.connect(self.CloseButton, self.close)

        self.OpenButton = pyxbmct.RadioButton(
            'Open in Browser', textColor='0xFFFFFFFF', shadowColor='0xFF000000', focusedColor='0xFFbababa')
        self.placeControl(self.OpenButton, 12, 1, rowspan=2, columnspan=17)
        self.OpenButton.setSelected(self.open_browser)
        self.connect(self.OpenButton, self.toggle)

        '''
        Right Side, to display stuff for the above menu items
        '''
        self.pairingheader = '[B]Pairing Tool[/B]'
        self.Header = pyxbmct.Label(self.pairingheader, alignment=pyxbmct.ALIGN_CENTER, textColor=self.colors.dh_color)
        self.placeControl(self.Header, 2, 20, rowspan=1, columnspan=40)
        self.pairMenu = pyxbmct.List(textColor=self.colors.mt_color, _imageWidth=50, _imageHeight=50)
        self.placeControl(self.pairMenu, 3, 21, rowspan=20, columnspan=30)
        pairItems = []
        for item in PAIR_LIST:
            the_title = 'Pair for %s' % (item[0].replace('_', ' ').capitalize())
            the_item = control.item(label=the_title)
            the_icon = item[2].decode('base64')
            the_item.setArt({'icon': the_icon, 'thumb': the_icon})
            pairItems.append(the_item)
        self.pairMenu.addItems(pairItems)
        self.connect(self.pairMenu, self.pairHandler)

        self.authMenu = pyxbmct.List(textColor=self.colors.mt_color, _imageWidth=50, _imageHeight=50)
        self.placeControl(self.authMenu, 3, 21, rowspan=20, columnspan=30)
        self.authMenu.setVisible(False)
        authItems = []
        for item in AUTH_LIST:
            the_title = 'Authorize %s' % (item[0].replace('_', ' ').capitalize())
            the_item = control.item(label=the_title)
            the_icon = item[2].decode('base64')
            the_item.setArt({'icon': the_icon, 'thumb': the_icon})
            authItems.append(the_item)
        self.authMenu.addItems(authItems)
        self.connect(self.authMenu, self.authHandler)
Ejemplo n.º 10
0
    def set_active_controls(self):
        # RadioButton
        if self.has_searchers:
            self.radiobutton = {}
            self.radiobutton_top, self.radiobutton_bottom = [
                None, None, None
            ], [None, None, None]
            for searcher in self.keys:
                place = self.placed[searcher]
                self.radiobutton[searcher] = pyxbmct.RadioButton(searcher)
                self.placeControl(self.radiobutton[searcher], place[0],
                                  place[1])
                self.radiobutton[searcher].setSelected(self.dic[searcher])
                self.connect(self.radiobutton[searcher], self.radio_update)
                if place[0] == 0:
                    self.radiobutton_top[place[1]] = self.radiobutton[searcher]
                self.radiobutton_bottom[place[1]] = self.radiobutton[searcher]

        # Button
        self.button_install = pyxbmct.Button(__language__(30415))
        self.placeControl(self.button_install, 2 + self.button_columns, 0)
        self.connect(self.button_install, self.installSearcher)

        # Button
        self.button_openserchset = pyxbmct.Button(__language__(30416))
        self.placeControl(self.button_openserchset, 2 + self.button_columns, 1)
        self.connect(self.button_openserchset, self.openSearcherSettings)

        # Button
        self.button_clearstor = pyxbmct.Button(__language__(30417))
        self.placeControl(self.button_clearstor, 2 + self.button_columns, 2)
        self.connect(self.button_clearstor, self.clearStorage)

        # Button
        self.button_openset = pyxbmct.Button(__language__(30413))
        self.placeControl(self.button_openset, 3 + self.button_columns, 0)
        self.connect(self.button_openset, self.openSettings)

        # Button
        self.button_utorrent = pyxbmct.Button(__language__(30414))
        self.placeControl(self.button_utorrent, 3 + self.button_columns, 1)
        self.connect(self.button_utorrent, self.openUtorrent)

        # Button
        self.button_close = pyxbmct.Button(__language__(30412))
        self.placeControl(self.button_close, 3 + self.button_columns, 2)
        self.connect(self.button_close, self.close)
Ejemplo n.º 11
0
    def _placedCallback(self, window, *args, **kwargs):
        super(FileSelectorOrZero,
              self)._placedCallback(window, *args, **kwargs)
        selector_width = self._total_width - self._enable_radio_button_width
        self.placeControl(
            self._file_selector,
            0,
            self._enable_radio_button_width,
            columnspan=selector_width,
            pad_x=0,
            pad_y=0,
        )

        self._enable_radio_button = pyxbmct.RadioButton("Enable")
        self.placeControl(self._enable_radio_button, 0, 0, pad_x=0, pad_y=0)
        self._enable_radio_button.setSelected(self._enabled_by_default)
        window.connect(self._enable_radio_button,
                       self._enable_radio_button_changed)
Ejemplo n.º 12
0
    def set_controls(self):
        """Set up UI controls"""
        # Image control
        image = pyxbmct.Image(addonfolder + artsfolder + '/mapdvbc.png')
        self.placeControl(image, 0, 0, rowspan=10, columnspan=16)

        # NET
        self.net_button = pyxbmct.RadioButton('')
        self.placeControl(self.net_button, 11, 6, rowspan=1, columnspan=4)
        self.connect(self.net_button, self.net_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'net', 2) == 1:
            self.net_button.setSelected(True)
        else:
            self.net_button.setSelected(False)
        net = pyxbmct.Image(addonfolder + artsfolder + '/net.png')
        self.placeControl(net, 11, 6, rowspan=1, columnspan=4)

        # Close button
        self.close_button = pyxbmct.Button('Exit')
        self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1)
        self.connect(self.close_button, lambda: self.closepage())
Ejemplo n.º 13
0
    def set_controls(self):
        """Set up UI controls"""
        # Image control
        image = pyxbmct.Image(addonfolder + artsfolder + '/wetek.png')
        self.placeControl(image, 0, 0, rowspan=8, columnspan=16)

        # WetekPlay2
        self.wp2_button = pyxbmct.RadioButton('')
        self.placeControl(self.wp2_button, 9, 6, rowspan=2, columnspan=4)
        self.connect(self.wp2_button, self.wp2_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'wetekplay2', 2) == 1:
            self.wp2_button.setSelected(True)
        else:
            self.wp2_button.setSelected(False)
        wp2 = pyxbmct.Image(addonfolder + artsfolder + '/wp2.png')
        self.placeControl(wp2, 9, 6, rowspan=2, columnspan=4)

        # Close button
        self.close_button = pyxbmct.Button('Exit')
        self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1)
        self.connect(self.close_button, lambda: self.closepage())
Ejemplo n.º 14
0
    def set_active_controls(self):
        row = 0
        bouquets = self.prefs['bouquet']
        for category in self.bouqMap:

            catId = category['id']
            catName = category['name']
            radiobutton = pyxbmct.RadioButton(catName)
            catSetting = plugintools.get_setting(catName)
            self.placeControl(radiobutton, row, 0)
            self.connect(radiobutton, self.radio_update)
            if catId in bouquets:
                radiobutton.setSelected(True)
            else:
                radiobutton.setSelected(False)

            self.listOfRadioButtons.append(radiobutton)
            self.radioMap[catName] = radiobutton
            row = row + 1

        self.close_button = pyxbmct.Button('Close')
        self.placeControl(self.close_button, row, 0)
        self.connect(self.close_button, self.close)
Ejemplo n.º 15
0
    def set_controls(self):
        """
            Set up UI controls
        """
        # ___ Init all choice button
        self.choice1 = None
        self.choice2 = None
        self.choice3 = None
        self.choice4 = None
        self.choice5 = None
        self.choice6 = None
        self.choice7 = None
        self.choice8 = None
        self.choice9 = None
        self.choice10 = None
        self.choiceArray = [
            self.choice1, self.choice2, self.choice3, self.choice4,
            self.choice5, self.choice6, self.choice7, self.choice8,
            self.choice9, self.choice10
        ]
        # __ Filter label
        self.filterArray = [{
            'title': 'Romantique',
            'value': ''
        }, {
            'title': 'Violent',
            'value': ''
        }, {
            'title': 'Drôle',
            'value': ''
        }, {
            'title': 'Action',
            'value': ''
        }, {
            'title': 'Scénario orignal',
            'value': ''
        }, {
            'title': 'Compliqué',
            'value': ''
        }, {
            'title': 'Fait peur',
            'value': ''
        }, {
            'title': 'Fin surprenante',
            'value': ''
        }, {
            'title': 'Emotions',
            'value': ''
        }, {
            'title': 'Populaire',
            'value': ''
        }]

        # ___ Add all radio button to the grid and connect the function 'choice_update'
        # Romantique
        self.choiceArray[0] = pyxbmct.RadioButton(self.filterArray[0]['title'])
        self.placeControl(self.choiceArray[0], 0, 0, 1, 2)
        self.connect(self.choiceArray[0], lambda: self.choice_update(0))

        # Violent
        self.choiceArray[1] = pyxbmct.RadioButton(self.filterArray[1]['title'])
        self.placeControl(self.choiceArray[1], 1, 0, 1, 2)
        self.connect(self.choiceArray[1], lambda: self.choice_update(1))

        # Drôle
        self.choiceArray[2] = pyxbmct.RadioButton(self.filterArray[2]['title'])
        self.placeControl(self.choiceArray[2], 2, 0, 1, 2)
        self.connect(self.choiceArray[2], lambda: self.choice_update(2))

        # Action
        self.choiceArray[3] = pyxbmct.RadioButton(self.filterArray[3]['title'])
        self.placeControl(self.choiceArray[3], 3, 0, 1, 2)
        self.connect(self.choiceArray[3], lambda: self.choice_update(3))

        # Scénario original
        self.choiceArray[4] = pyxbmct.RadioButton(self.filterArray[4]['title'])
        self.placeControl(self.choiceArray[4], 4, 0, 1, 2)
        self.connect(self.choiceArray[4], lambda: self.choice_update(4))

        # Compliqué
        self.choiceArray[5] = pyxbmct.RadioButton(self.filterArray[5]['title'])
        self.placeControl(self.choiceArray[5], 5, 0, 1, 2)
        self.connect(self.choiceArray[5], lambda: self.choice_update(5))

        # Fait peur
        self.choiceArray[6] = pyxbmct.RadioButton(self.filterArray[6]['title'])
        self.placeControl(self.choiceArray[6], 6, 0, 1, 2)
        self.connect(self.choiceArray[6], lambda: self.choice_update(6))

        # Fin surprenante
        self.choiceArray[7] = pyxbmct.RadioButton(self.filterArray[7]['title'])
        self.placeControl(self.choiceArray[7], 7, 0, 1, 2)
        self.connect(self.choiceArray[7], lambda: self.choice_update(7))

        # Emotions
        self.choiceArray[8] = pyxbmct.RadioButton(self.filterArray[8]['title'])
        self.placeControl(self.choiceArray[8], 8, 0, 1, 2)
        self.connect(self.choiceArray[8], lambda: self.choice_update(8))

        # Populaire
        self.choiceArray[9] = pyxbmct.RadioButton(self.filterArray[9]['title'])
        self.placeControl(self.choiceArray[9], 9, 0, 1, 2)
        self.connect(self.choiceArray[9], lambda: self.choice_update(9))

        # Année : De .... à ....
        self.anneeLabel = pyxbmct.Label('Année de sortie')
        self.placeControl(self.anneeLabel, 10, 0)
        self.anneeMin = pyxbmct.Edit('1918')
        self.placeControl(self.anneeMin, 11, 0)
        self.anneeMin.setText('1918')
        self.anneeMax = pyxbmct.Edit('2016')
        self.placeControl(self.anneeMax, 11, 1)
        self.anneeMax.setText('2016')

        # Durée : De .. min à  .. min
        self.dureeLabel = pyxbmct.Label('Durée (min)')
        self.placeControl(self.dureeLabel, 12, 0)
        self.dureeMin = pyxbmct.Edit('60')
        self.placeControl(self.dureeMin, 13, 0)
        self.dureeMin.setText('60')
        self.dureeMax = pyxbmct.Edit('300')
        self.placeControl(self.dureeMax, 13, 1)
        self.dureeMax.setText('300')

        # Search button
        self.search_button = pyxbmct.Button(
            constant.__addon__.getLocalizedString(80013))
        self.placeControl(self.search_button, 14, 0)
        # Connect search button
        self.connect(self.search_button, self.search)

        # Close button
        self.close_button = pyxbmct.Button(
            constant.__addon__.getLocalizedString(80014))
        self.placeControl(self.close_button, 14, 1)
        # Connect close button
        self.connect(self.close_button, self.close)
Ejemplo n.º 16
0
    def set_controls(self):
        """Set up UI controls"""
        # Image control
        image = pyxbmct.Image(addonfolder + artsfolder + '/tvh.png')
        self.placeControl(image, 0, 0, rowspan=7, columnspan=16)

        # Label information
        image = pyxbmct.Image(addonfolder + artsfolder + '/newcamd.png')
        self.placeControl(image, 7, 1, rowspan=1, columnspan=14)

        # Hostname input
        image = pyxbmct.Image(addonfolder + artsfolder + '/hostname.png')
        self.placeControl(image, 9, 0, rowspan=1, columnspan=4)
        self.hostname_input = pyxbmct.Edit('')
        self.placeControl(self.hostname_input, 9, 4, rowspan=1, columnspan=4)

        # Port input
        image = pyxbmct.Image(addonfolder + artsfolder + '/port.png')
        self.placeControl(image, 12, 1, rowspan=1, columnspan=3)
        self.port_input = pyxbmct.Edit('')
        self.placeControl(self.port_input, 12, 4, rowspan=1, columnspan=2)

        # Username input
        image = pyxbmct.Image(addonfolder + artsfolder + '/username.png')
        self.placeControl(image, 10, 1, rowspan=1, columnspan=3)
        self.username_input = pyxbmct.Edit('')
        self.placeControl(self.username_input, 10, 4, rowspan=1, columnspan=4)

        # Password input
        image = pyxbmct.Image(addonfolder + artsfolder + '/password.png')
        self.placeControl(image, 11, 1, rowspan=1, columnspan=3)
        self.password_input = pyxbmct.Edit('', isPassword=True)
        self.placeControl(self.password_input, 11, 4, rowspan=1, columnspan=4)

        # DES Key
        image = pyxbmct.Image(addonfolder + artsfolder + '/deskey.png')
        self.placeControl(image, 9, 9, rowspan=1, columnspan=3)

        # DESKey1
        self.deskey1_button = pyxbmct.RadioButton('')
        self.placeControl(self.deskey1_button, 10, 9, rowspan=1, columnspan=6)
        self.connect(self.deskey1_button, self.deskey1_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'deskey1', 2) == 1:
            self.deskey1_button.setSelected(True)
        else:
            self.deskey1_button.setSelected(False)
        deskey1 = pyxbmct.Image(addonfolder + artsfolder + '/deskey1.png')
        self.placeControl(deskey1, 10, 9, rowspan=1, columnspan=6)

        # DESKey2
        self.deskey2_button = pyxbmct.RadioButton('')
        self.placeControl(self.deskey2_button, 11, 9, rowspan=1, columnspan=6)
        self.connect(self.deskey2_button, self.deskey2_button_update)
        if tools.return_data('TVHWIZARD', 'STRING', 'deskey2', 2) == 1:
            self.deskey2_button.setSelected(True)
        else:
            self.deskey2_button.setSelected(False)
        deskey2 = pyxbmct.Image(addonfolder + artsfolder + '/deskey2.png')
        self.placeControl(deskey2, 11, 9, rowspan=1, columnspan=6)

        # Close button
        self.close_button = pyxbmct.Button('Exit')
        self.placeControl(self.close_button, 13, 15, rowspan=1, columnspan=1)
        self.connect(self.close_button, lambda: self.closepage())
Ejemplo n.º 17
0
    def init_controls(self):
        self.placeControl(pyxbmct.Label('Continuous Parameters', alignment=pyxbmct.ALIGN_CENTER), 0, 0, 1, 4)
        
        volt = pyxbmct.Label('Voltage', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(volt, 1, 0)
        self.voltage = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.voltage, 1, 1)
        self.placeControl(pyxbmct.Label('Vehicle speed', alignment=pyxbmct.ALIGN_LEFT), 2, 0)
        self.groundSpeed = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.groundSpeed, 2, 1)
        self.placeControl(pyxbmct.Label('Engine speed', alignment=pyxbmct.ALIGN_LEFT), 3, 0)
        self.engineSpeed = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.engineSpeed, 3, 1)
        self.placeControl(pyxbmct.Label('Coolant temperature', alignment=pyxbmct.ALIGN_LEFT), 4, 0)
        self.coolantTemp = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.coolantTemp, 4, 1)
        self.placeControl(pyxbmct.Label('Ignition timing', alignment=pyxbmct.ALIGN_LEFT), 5, 0)
        self.timing = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.timing, 5, 1)
        self.placeControl(pyxbmct.Label('Airflow signal', alignment=pyxbmct.ALIGN_LEFT), 6, 0)
        self.airflow = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.airflow, 6, 1)
        self.placeControl(pyxbmct.Label('Load', alignment=pyxbmct.ALIGN_LEFT), 7, 0)
        self.load = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.load, 7, 1)
        self.placeControl(pyxbmct.Label('Throttle position signal', alignment=pyxbmct.ALIGN_LEFT), 8, 0)
        self.throttle = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.throttle, 8, 1)
        self.placeControl(pyxbmct.Label('Zeroed throttle position', alignment=pyxbmct.ALIGN_LEFT), 9, 0)
        self.zeroedThrottle = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.zeroedThrottle, 9, 1)
        
        self.placeControl(pyxbmct.Label('Injector pulse width', alignment=pyxbmct.ALIGN_LEFT), 1, 2)
        self.injectionWidth = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.injectionWidth, 1, 3)
        self.placeControl(pyxbmct.Label('IAC valve duty cycle', alignment=pyxbmct.ALIGN_LEFT), 2, 2)
        self.dutyCycle = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.dutyCycle, 2, 3)
        self.placeControl(pyxbmct.Label('Oxygen sensor signal', alignment=pyxbmct.ALIGN_LEFT), 3, 2)
        self.oxygen = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.oxygen, 3, 3)
        self.placeControl(pyxbmct.Label('Fuel trim', alignment=pyxbmct.ALIGN_LEFT), 4, 2)
        self.fuelTrim = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.fuelTrim, 4, 3)
        self.placeControl(pyxbmct.Label('Timing correction', alignment=pyxbmct.ALIGN_LEFT), 5, 2)
        self.timingCorrection = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.timingCorrection, 5, 3)
        self.placeControl(pyxbmct.Label('Boost control duty cycle', alignment=pyxbmct.ALIGN_LEFT), 6, 2)
        self.boostControl = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.boostControl, 6, 3)
        self.placeControl(pyxbmct.Label('Barometric pressure', alignment=pyxbmct.ALIGN_LEFT), 7, 2)
        self.barPressure = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.barPressure, 7, 3)
        self.placeControl(pyxbmct.Label('Boost/vacuum', alignment=pyxbmct.ALIGN_LEFT), 8, 2)
        self.boost = pyxbmct.Label('0.0', alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.boost, 8, 3)
    
        self.placeControl(pyxbmct.Label('Binary Parameters', alignment=pyxbmct.ALIGN_CENTER), 0, 4, 1, 1)
        self.ignition = pyxbmct.RadioButton('Ignition')
        self.placeControl(self.ignition, 1, 4)
        self.transmissionMode = pyxbmct.RadioButton('Automatic transmission mode')
        self.placeControl(self.transmissionMode, 2, 4)
        #Test mode
        #Read memory mode
        self.neutral = pyxbmct.RadioButton('Neutral switch')
        self.placeControl(self.neutral, 3, 4)
        #Park switch   
        #California mode
        self.idle = pyxbmct.RadioButton('Idle switch')
        self.placeControl(self.idle, 4, 4)
        #Air conditioning switch
        #Air conditioning relay active
        self.fanActive= pyxbmct.RadioButton('Radiator fan relay active')
        self.placeControl(self.fanActive, 5, 4)
        self.fuelActive = pyxbmct.RadioButton('Fuel pump relay active')
        self.placeControl(self.fuelActive, 6, 4)
        self.canActive = pyxbmct.RadioButton('Canister purge valve active')
        self.placeControl(self.canActive, 7, 4)
        self.pingingActive = pyxbmct.RadioButton('Pinging detected')
        self.placeControl(self.pingingActive, 8, 4)
        self.pressureMeas = pyxbmct.RadioButton('Pressure exchange')
        self.placeControl(self.pressureMeas, 9, 4)
    
        # Button
        self.button = pyxbmct.Button('Close')
        self.placeControl(self.button, 9, 2)
        # Connect control to close the window.
        self.connect(self.button, self.close)

        """
        # Demo for PyXBMCt UI controls.
        no_int_label = pyxbmct.Label('Information output', alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(no_int_label, 0, 0, 1, 2)
        #
        label_label = pyxbmct.Label('Label')
        self.placeControl(label_label, 1, 0)
        # Label
        self.label = pyxbmct.Label('Simple label')
        self.placeControl(self.label, 1, 1)
        #
        fadelabel_label = pyxbmct.Label('FadeLabel')
        self.placeControl(fadelabel_label, 2, 0)
        # FadeLabel
        self.fade_label = pyxbmct.FadeLabel()
        self.placeControl(self.fade_label, 2, 1)
        self.fade_label.addLabel('Very long string can be here.')
        #
        textbox_label = pyxbmct.Label('TextBox')
        self.placeControl(textbox_label, 3, 0)
        # TextBox
        self.textbox = pyxbmct.TextBox()
        self.placeControl(self.textbox, 3, 1, 2, 1)
        self.textbox.setText('It can display long text.\n'
                             'Lorem ipsum dolor sit amet, consectetur adipiscing elit.')
        # Set auto-scrolling for long TexBox contents
        self.textbox.autoScroll(1000, 1000, 1000)
        #
        image_label = pyxbmct.Label('Image')
        self.placeControl(image_label, 5, 0)
        # Image
        self.image = pyxbmct.Image(os.path.join(_addon_path, 'bbb-splash.jpg'))
        self.placeControl(self.image, 5, 1, 2, 1)
        """
        pass
Ejemplo n.º 18
0
 def set_active_controls(self):
     int_label = pyxbmct.Label('Interactive Controls',
                               alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(int_label, 0, 2, 1, 2)
     #
     radiobutton_label = pyxbmct.Label('RadioButton')
     self.placeControl(radiobutton_label, 1, 2)
     # RadioButton
     self.radiobutton = pyxbmct.RadioButton('Off')
     self.placeControl(self.radiobutton, 1, 3)
     self.connect(self.radiobutton, self.radio_update)
     #
     edit_label = pyxbmct.Label('Edit')
     self.placeControl(edit_label, 2, 2)
     # Edit
     self.edit = pyxbmct.Edit('Edit')
     self.placeControl(self.edit, 2, 3)
     # Additional properties must be changed after (!) displaying a control.
     self.edit.setText('Enter text here')
     #
     list_label = pyxbmct.Label('List')
     self.placeControl(list_label, 3, 2)
     #
     self.list_item_label = pyxbmct.Label('', textColor='0xFF808080')
     self.placeControl(self.list_item_label, 4, 2)
     # List
     self.list = pyxbmct.List()
     self.placeControl(self.list, 3, 3, 3, 1)
     # Add items to the list
     items = ['Item {0}'.format(i) for i in range(1, 8)]
     self.list.addItems(items)
     # Connect the list to a function to display which list item is selected.
     self.connect(
         self.list, lambda: xbmc.executebuiltin(
             'Notification(Note!,{0} selected.)'.format(
                 self.list.getListItem(self.list.getSelectedPosition()).
                 getLabel())))
     # Connect key and mouse events for list navigation feedback.
     self.connectEventList([
         pyxbmct.ACTION_MOVE_DOWN, pyxbmct.ACTION_MOVE_UP,
         pyxbmct.ACTION_MOUSE_WHEEL_DOWN, pyxbmct.ACTION_MOUSE_WHEEL_UP,
         pyxbmct.ACTION_MOUSE_MOVE
     ], self.list_update)
     # Slider value label
     SLIDER_INIT_VALUE = 25.0
     self.slider_value = pyxbmct.Label(str(SLIDER_INIT_VALUE),
                                       alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(self.slider_value, 6, 3)
     #
     slider_caption = pyxbmct.Label('Slider')
     self.placeControl(slider_caption, 7, 2)
     # Slider
     self.slider = pyxbmct.Slider()
     self.placeControl(self.slider, 7, 3, pad_y=10)
     self.slider.setPercent(SLIDER_INIT_VALUE)
     # Connect key and mouse events for slider update feedback.
     self.connectEventList([
         pyxbmct.ACTION_MOVE_LEFT, pyxbmct.ACTION_MOVE_RIGHT,
         pyxbmct.ACTION_MOUSE_DRAG, pyxbmct.ACTION_MOUSE_LEFT_CLICK
     ], self.slider_update)
     #
     button_label = pyxbmct.Label('Button')
     self.placeControl(button_label, 8, 2)
     # Button
     self.button = pyxbmct.Button('Close')
     self.placeControl(self.button, 8, 3)
     # Connect control to close the window.
     self.connect(self.button, self.close)
Ejemplo n.º 19
0
    def __init__(self, name, ip, user, password):
        # You need to call base class' constructor.
        super(DahuaCamPlayback, self).__init__(dlgTitle)
        # Set the window width, height and the grid resolution: 18 rows, 15 columns.
        self.setGeometry(880, 600, 18, 15)

        self._monitor = xbmc.Monitor()
        self._player = xbmc.Player()

        self.cams = []

        self.cam = {
            'Name': name,
            'IPAddr': ip,
            'User': user,
            'Password': password
        }

        self.cams.append(self.cam)
        self.active_cam = 0
        self.session = None

        self.button_cam = []

        self.date = {
            'Day': datetime.now().day,
            'Month': datetime.now().month,
            'Year': datetime.now().year
        }

        self.month_offset = 0

        self.label_info = {}
        self.label_system = {}
        self.button_cal = []

        self.items = []
        self.type = 'mp4'

        self.selected_item = None

        log('Addon started.')
        xbmc.executebuiltin('ActivateWindow(busydialognocancel)')

        # placeControl(obj, row, column, rowspan=, columnspan=)

        label = pyxbmct.Label(dlgFileType, alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(label, 1, 1, columnspan=2)

        self.radio_jpg = pyxbmct.RadioButton('jpg')
        self.placeControl(self.radio_jpg, 1, 4, columnspan=2)
        self.connect(self.radio_jpg, self.set_type('jpg'))

        self.radio_mp4 = pyxbmct.RadioButton('mp4')
        self.placeControl(self.radio_mp4, 1, 6, columnspan=2)
        self.connect(self.radio_mp4, self.set_type('mp4'))

        self.radio_mp4.setSelected(True)

        # Create a text label.
        label = pyxbmct.Label(dlgCalMonth, alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(label, 3, 1, columnspan=3)

        self.button_mprev = pyxbmct.Button('<')
        self.placeControl(self.button_mprev, 4, 1)
        self.connect(self.button_mprev,
                     self.set_month('-'))  # self.month_prev)

        self.label_month = pyxbmct.Label(str(self.date['Month']),
                                         textColor=self.BLUE,
                                         alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(self.label_month, 4, 2)

        self.button_mnext = pyxbmct.Button('>')
        self.placeControl(self.button_mnext, 4, 3)
        self.connect(self.button_mnext,
                     self.set_month('+'))  # self.month_next)

        # Create a text label.
        label = pyxbmct.Label(dlgCalYear, alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(label, 3, 5, columnspan=3)

        self.button_yprev = pyxbmct.Button('<')
        self.placeControl(self.button_yprev, 4, 5)
        self.connect(self.button_yprev, self.set_year('-'))  # self.year_prev)

        self.label_year = pyxbmct.Label(str(self.date['Year']),
                                        textColor=self.BLUE,
                                        alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(self.label_year, 4, 6)

        self.button_ynext = pyxbmct.Button('>')
        self.placeControl(self.button_ynext, 4, 7)
        self.connect(self.button_ynext, self.set_year('+'))  # self.year_next)

        # Create a text label.
        label = pyxbmct.Label(dlgItems, alignment=pyxbmct.ALIGN_CENTER)
        # Place the label on the window grid.
        self.placeControl(label, 1, 10, columnspan=3)

        label = pyxbmct.Label(dlgStartTime[:-1],
                              font='font10',
                              textColor=self.GREY,
                              alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(label, 2, 9, columnspan=2)

        label = pyxbmct.Label(dlgRecordType[:-1],
                              font='font10',
                              textColor=self.GREY,
                              alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(label, 2, 11, columnspan=2)

        self.list = pyxbmct.List(_space=-1,
                                 _itemTextXOffset=-3,
                                 _itemTextYOffset=-1,
                                 _alignmentY=0)  #XBFONT_LEFT
        self.placeControl(self.list, 3, 9, rowspan=10, columnspan=5)
        # Connect the list to a function to display which list item is selected.
        self.connect(self.list, self.update_info)

        self.label_total = pyxbmct.Label(str(len(self.items)),
                                         alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(self.label_total, 1, 13)

        self.image_preview = pyxbmct.Image('', aspectRatio=2)
        self.placeControl(self.image_preview, 12, 9, rowspan=3, columnspan=5)
        self.image_preview.setVisible(False)

        self.label_info['txtStartTime'] = pyxbmct.Label(
            dlgStartTime,
            font='font10',
            textColor=self.GREY,
            alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.label_info['txtStartTime'], 12, 9, columnspan=2)

        self.label_info['StartTime'] = pyxbmct.Label(
            '',
            font='font10',
            textColor=self.BLUE,
            alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.label_info['StartTime'], 12, 11, columnspan=3)

        self.label_info['txtEndTime'] = pyxbmct.Label(
            dlgEndTime,
            font='font10',
            textColor=self.GREY,
            alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.label_info['txtEndTime'], 13, 9, columnspan=2)

        self.label_info['EndTime'] = pyxbmct.Label(
            '',
            font='font10',
            textColor=self.BLUE,
            alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.label_info['EndTime'], 13, 11, columnspan=3)

        self.label_info['txtFileSize'] = pyxbmct.Label(
            dlgFileSize,
            font='font10',
            textColor=self.GREY,
            alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.label_info['txtFileSize'], 14, 9, columnspan=2)

        self.label_info['FileSize'] = pyxbmct.Label(
            '',
            font='font10',
            textColor=self.BLUE,
            alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.label_info['FileSize'], 14, 11, columnspan=3)

        for col, day in enumerate(dlgWeekDays):
            label = pyxbmct.Label(day,
                                  font='font10',
                                  textColor=self.GREY,
                                  alignment=pyxbmct.ALIGN_CENTER)
            self.placeControl(label, 5, 1 + col)

        for row in range(6):
            for col in range(7):
                button_cal = pyxbmct.Button('')
                self.placeControl(button_cal, 6 + row, 1 + col)
                self.connect(button_cal, self.set_day(row * 7 + col))
                self.button_cal.append(button_cal)

        self.label_system['txtErrState'] = pyxbmct.Label(
            dlgErrState,
            font='font10',
            textColor=self.GREY,
            alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.label_system['txtErrState'],
                          12,
                          1,
                          columnspan=2)

        self.label_system['ErrState'] = pyxbmct.Label(
            '',
            font='font10',
            textColor=self.RED,
            alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.label_system['ErrState'], 12, 3, columnspan=5)

        self.label_system['txtLocStore'] = pyxbmct.Label(
            dlgLocStore,
            font='font10',
            textColor=self.GREY,
            alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.label_system['txtLocStore'],
                          13,
                          1,
                          columnspan=2)

        self.label_system['LocStore'] = pyxbmct.Label(
            '',
            font='font10',
            textColor=self.GREY,
            alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.label_system['LocStore'], 13, 3, columnspan=5)

        self.label_system['txtHWInfo'] = pyxbmct.Label(
            dlgHWInfo,
            font='font10',
            textColor=self.GREY,
            alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.label_system['txtHWInfo'], 14, 1, columnspan=2)

        self.label_system['HWInfo'] = pyxbmct.Label(
            '',
            font='font10',
            textColor=self.GREY,
            alignment=pyxbmct.ALIGN_LEFT)
        self.placeControl(self.label_system['HWInfo'], 14, 3, columnspan=5)

        # Create the 'Close' button.
        self.button_close = pyxbmct.Button(dlgBtnClose)
        self.placeControl(self.button_close, 16, 1, columnspan=2)
        self.connect(self.button_close, self.close)

        for i in range(4):
            button_cam = pyxbmct.Button(
                str(i + 1),
                textColor=self.BLUE if i == self.active_cam else self.WHITE)
            self.placeControl(button_cam, 16, 4 + i)
            self.connect(button_cam, self.set_cam(i))
            button_cam.setEnabled(True if i < len(self.cams) else False)
            self.button_cam.append(button_cam)

        self.update_system()

        tid = self.label_total.getId()

        # Create the 'Play' button.
        self.button_play = pyxbmct.Button(dlgBtnPlay)
        self.placeControl(self.button_play, 16, 9, columnspan=2)
        self.button_play.setEnableCondition(
            'Integer.IsGreater(Control.GetLabel(' + str(tid) + '),0)')
        self.connect(self.button_play, self.play)

        # Create the 'Download' button.
        self.button_dnld = pyxbmct.Button(dlgBtnSave)
        self.placeControl(self.button_dnld, 16, 12, columnspan=2)
        self.button_dnld.setEnableCondition(
            'Integer.IsGreater(Control.GetLabel(' + str(tid) + '),0)')
        self.connect(self.button_dnld, self.download)

        xbmc.executebuiltin('Dialog.Close(busydialognocancel)')

        self.update_calendar()

        # Connect a key action to a function.
        self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
        self.connect(ACTION_PLAY, self.play)

        log('Addon initialization done.')

        return
Ejemplo n.º 20
0
    def __init__(self):
        super(WakeMenu, self).__init__("Wake Server")
        self.setGeometry(400, 300, 6, 1)

        self.radiobutton1 = pyxbmct.RadioButton(
            __settings__.getSetting("name1"))
        self.placeControl(self.radiobutton1, 0, 0)
        self.radiobutton2 = pyxbmct.RadioButton(
            __settings__.getSetting("name2"))
        self.placeControl(self.radiobutton2, 1, 0)
        self.radiobutton3 = pyxbmct.RadioButton(
            __settings__.getSetting("name3"))
        self.placeControl(self.radiobutton3, 2, 0)
        self.radiobutton4 = pyxbmct.RadioButton(
            __settings__.getSetting("name4"))
        self.placeControl(self.radiobutton4, 3, 0)
        self.radiobutton5 = pyxbmct.RadioButton(
            __settings__.getSetting("name5"))
        self.placeControl(self.radiobutton5, 4, 0)
        self.button = pyxbmct.Button('Close')
        self.placeControl(self.button, 5, 0)

        self.radiobutton1.controlDown(self.radiobutton2)
        self.radiobutton1.controlUp(self.button)

        self.radiobutton2.controlUp(self.radiobutton1)
        self.radiobutton2.controlDown(self.radiobutton3)

        self.radiobutton3.controlUp(self.radiobutton2)
        self.radiobutton3.controlDown(self.radiobutton4)

        self.radiobutton4.controlUp(self.radiobutton3)
        self.radiobutton4.controlDown(self.radiobutton5)

        self.radiobutton5.controlUp(self.radiobutton4)
        self.radiobutton5.controlDown(self.button)

        self.button.controlUp(self.radiobutton5)
        self.button.controlDown(self.radiobutton1)

        self.connect(self.radiobutton1, self.radio_update1)
        self.connect(self.radiobutton2, self.radio_update2)
        self.connect(self.radiobutton3, self.radio_update3)
        self.connect(self.radiobutton4, self.radio_update4)
        self.connect(self.radiobutton5, self.radio_update5)
        self.connect(self.button, self.close)

        self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
        self.setFocus(self.radiobutton1)

        host1 = __settings__.getSetting("ip1")
        host2 = __settings__.getSetting("ip2")
        host3 = __settings__.getSetting("ip3")
        host4 = __settings__.getSetting("ip4")
        host5 = __settings__.getSetting("ip5")

        try:
            if host1 <> "":
                if Ping(host1, "SkinHelperPING.server1", "on", "off") == True:
                    self.status1 = True
                    self.radiobutton1.setSelected(True)
            if host2 <> "":
                if Ping(host2, "SkinHelperPING.server2", "on", "off") == True:
                    self.status2 = True
                    self.radiobutton2.setSelected(True)
            if host3 <> "":
                if Ping(host3, "SkinHelperPING.server3", "on", "off") == True:
                    self.status3 = True
                    self.radiobutton3.setSelected(True)
            if host4 <> "":
                if Ping(host4, "SkinHelperPING.server4", "on", "off") == True:
                    self.status4 = True
                    self.radiobutton4.setSelected(True)
            if host5 <> "":
                if Ping(host5, "SkinHelperPING.server5", "on", "off") == True:
                    self.status5 = True
                    self.radiobutton1.setSelected(True)
        except Exception as msg:
            xbmc.log("PING Helper:" + str(msg), level=xbmc.LOGNOTICE)
Ejemplo n.º 21
0
    def setControls(self):
        """Set up UI controls"""

        for i, control in enumerate(self.control):
            # Title in row 2, column 1 spanning over all 9 columns
            control['title'] = pyxbmct.Label(self.thermostat[i].name,
                                             alignment=ALIGN_CENTER_X
                                             | ALIGN_CENTER_Y,
                                             font=BIG_FONT,
                                             textColor=BLUE)
            control['modeOff'] = pyxbmct.RadioButton(
                strOff, textOffsetX=3, noFocusTexture=__transparent__)
            control['modeHeat'] = pyxbmct.RadioButton(
                strHeat, textOffsetX=3, noFocusTexture=__transparent__)
            control['modeCool'] = pyxbmct.RadioButton(
                strCool, textOffsetX=3, noFocusTexture=__transparent__)
            control['modeAuto'] = pyxbmct.RadioButton(
                strAuto, textOffsetX=3, noFocusTexture=__transparent__)
            control['temp'] = pyxbmct.Button(
                strNV,
                textOffsetX=0,
                noFocusTexture=__transparent__,
                alignment=ALIGN_RIGHT | ALIGN_CENTER_Y,
                font=LARGE_FONT,
                textColor=TColor[self.thermostat[i].state])
            control['state'] = pyxbmct.Label(strNV,
                                             font=SMALL_FONT,
                                             alignment=ALIGN_RIGHT
                                             | ALIGN_CENTER_Y)
            control['targetLabel'] = pyxbmct.Button(
                strNV,
                textOffsetX=0,
                noFocusTexture=__transparent__,
                alignment=ALIGN_LEFT | ALIGN_CENTER_Y,
                font=SMALL_FONT,
                textColor=tColor[self.thermostat[i].mode])
            control['target'] = pyxbmct.Button(
                strNV,
                textOffsetX=0,
                noFocusTexture=__transparent__,
                alignment=ALIGN_RIGHT | ALIGN_CENTER_Y,
                textColor=tColor[self.thermostat[i].mode])
            control['targetUp'] = pyxbmct.Button(strArrowUp,
                                                 textOffsetX=0,
                                                 alignment=ALIGN_CENTER_X
                                                 | ALIGN_CENTER_Y)
            control['targetDn'] = pyxbmct.Button(strArrowDn,
                                                 textOffsetX=0,
                                                 alignment=ALIGN_CENTER_X
                                                 | ALIGN_CENTER_Y)
            control['fan'] = pyxbmct.Button(strFan,
                                            textOffsetX=3,
                                            alignment=ALIGN_LEFT
                                            | ALIGN_CENTER_Y)
            control['hold'] = pyxbmct.RadioButton(
                strHold, textOffsetX=3, noFocusTexture=__transparent__)
            control['reload'] = pyxbmct.Button(strReload)
            control['apply'] = pyxbmct.Button(strSet)

            self.placeControl(control['title'],
                              2,
                              1 + i * 10,
                              rowspan=2,
                              columnspan=9)

            # Define inividual labels for each value that must be updated
            # Columns 1 & 2: TMode States
            self.placeControl(control['modeOff'],
                              6,
                              1 + i * 10,
                              rowspan=2,
                              columnspan=2)
            self.placeControl(control['modeHeat'],
                              8,
                              1 + i * 10,
                              rowspan=2,
                              columnspan=2)
            self.placeControl(control['modeCool'],
                              10,
                              1 + i * 10,
                              rowspan=2,
                              columnspan=2)
            self.placeControl(control['modeAuto'],
                              12,
                              1 + i * 10,
                              rowspan=2,
                              columnspan=2)

            # Columns 3 to 5: Temperature and TState
            self.placeControl(control['temp'],
                              6,
                              3 + i * 10,
                              rowspan=3,
                              columnspan=3)
            self.placeControl(control['state'],
                              9,
                              3 + i * 10,
                              rowspan=1,
                              columnspan=3)

            # Columns 7 to 9: Fan, Hold and Target Temperature
            self.placeControl(control['targetLabel'],
                              6,
                              7 + i * 10,
                              rowspan=1,
                              columnspan=2)
            self.placeControl(control['target'],
                              7,
                              7 + i * 10,
                              rowspan=2,
                              columnspan=2)
            self.placeControl(control['targetUp'], 6, 9 + i * 10, rowspan=2)
            self.placeControl(control['targetDn'], 8, 9 + i * 10, rowspan=2)

            self.placeControl(control['fan'],
                              10,
                              7 + i * 10,
                              rowspan=2,
                              columnspan=3)
            self.placeControl(control['hold'],
                              12,
                              7 + i * 10,
                              rowspan=2,
                              columnspan=3)

            # Reload and set buttons in row 16, columns 2 to 4 and 6 to 8
            self.placeControl(control['reload'],
                              16,
                              2 + i * 10,
                              rowspan=2,
                              columnspan=3)
            self.placeControl(control['apply'],
                              16,
                              6 + i * 10,
                              rowspan=2,
                              columnspan=3)

            # Connect the buttons
            self.connect(control['fan'],
                         (lambda: self.setFan(0)) if i == 0 else
                         (lambda: self.setFan(1)))
            self.connect(control['hold'],
                         (lambda: self.setHold(0)) if i == 0 else
                         (lambda: self.setHold(1)))
            self.connect(control['modeOff'],
                         (lambda: self.setMode(0, strOff)) if i == 0 else
                         (lambda: self.setMode(1, strOff)))
            self.connect(control['modeHeat'],
                         (lambda: self.setMode(0, strHeat)) if i == 0 else
                         (lambda: self.setMode(1, strHeat)))
            self.connect(control['modeCool'],
                         (lambda: self.setMode(0, strCool)) if i == 0 else
                         (lambda: self.setMode(1, strCool)))
            self.connect(control['modeAuto'],
                         (lambda: self.setMode(0, strAuto)) if i == 0 else
                         (lambda: self.setMode(1, strAuto)))
            self.connect(control['targetUp'],
                         (lambda: self.setTargetUp(0)) if i == 0 else
                         (lambda: self.setTargetUp(1)))
            self.connect(control['targetDn'],
                         (lambda: self.setTargetDn(0)) if i == 0 else
                         (lambda: self.setTargetDn(1)))
            self.connect(control['reload'],
                         (lambda: self.reloadValues(0)) if i == 0 else
                         (lambda: self.reloadValues(1)))
            self.connect(control['apply'],
                         (lambda: self.applyValues(0)) if i == 0 else
                         (lambda: self.applyValues(1)))

        # Vertical Line
        vLine = pyxbmct.Image(__verticalLine__, aspectRatio=1)
        self.placeControl(vLine, 5, 10, rowspan=13)

        # Close button
        self.buttonClose = pyxbmct.Button(strClose)
        self.placeControl(self.buttonClose, 20, 9, rowspan=2, columnspan=3)

        # Connect the close button
        self.connect(self.buttonClose, self.stop)