Exemplo n.º 1
0
 def _set_controls(self):
     name_label = pyxbmct.Label('Name:')
     self.placeControl(name_label, 0, 0)
     self._filter_name = pyxbmct.Label(self.filter.get('name', ''))
     self.placeControl(self._filter_name, 0, 1, columnspan=2)
     tvdb_label = pyxbmct.Label('[B]TheTVDB ID[/B]:')
     self.placeControl(tvdb_label, 1, 0)
     self._tvdb_edit = pyxbmct.Edit('')
     self.placeControl(self._tvdb_edit, 1, 1, columnspan=2)
     self._tvdb_edit.setText(self.filter.get('tvdb', ''))
     extra_label = pyxbmct.Label('Additional filter:')
     self.placeControl(extra_label, 2, 0)
     self._extra_edit = pyxbmct.Edit('')
     self.placeControl(self._extra_edit, 2, 1, columnspan=2)
     self._extra_edit.setText(self.filter.get('extra_filter', ''))
     exclude_label = pyxbmct.Label('Exclude:')
     self.placeControl(exclude_label, 3, 0)
     self._exclude_edit = pyxbmct.Edit('')
     self.placeControl(self._exclude_edit, 3, 1, columnspan=2)
     self._exclude_edit.setText(self.filter.get('exclude', ''))
     save_path_label = pyxbmct.Label('[B]Download folder[/B]:')
     self.placeControl(save_path_label, 4, 0)
     self._select_folder_button = pyxbmct.Button(
         self.filter.get('save_path', ''), alignment=pyxbmct.ALIGN_LEFT)
     self.placeControl(self._select_folder_button, 4, 1, columnspan=2)
     self._delete_button = pyxbmct.Button('Delete filter')
     self.placeControl(self._delete_button, 5, 0)
     if not self.filter.get('tvdb'):
         self._delete_button.setVisible(False)
     self._cancel_button = pyxbmct.Button('Cancel')
     self.placeControl(self._cancel_button, 5, 1)
     self._save_button = pyxbmct.Button('Save filter')
     self.placeControl(self._save_button, 5, 2)
Exemplo n.º 2
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)

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

        # 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)

        # Next button
        self.next_button = pyxbmct.Button('Next')
        self.placeControl(self.next_button, 13, 14, rowspan=1, columnspan=1)
        # Connect close button
        self.connect(self.next_button, lambda: self.page())

        # 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())
Exemplo n.º 3
0
 def __init__(self, title='', soup=None, email=None):
     super(Captcha, self).__init__(title)
     if 'ap_captcha_img_label' in unicode(soup):
         head = soup.find('div', attrs={'id': 'message_warning'})
         if not head:
             head = soup.find('div', attrs={'id': 'message_error'})
         title = soup.find('div', attrs={'id': 'ap_captcha_guess_alert'})
         self.head = head.p.renderContents().strip()
         self.head = re.sub('(?i)<[^>]*>', '', self.head)
         self.picurl = soup.find('div', attrs={'id': 'ap_captcha_img'}).img.get('src')
     else:
         self.head = soup.find('span', attrs={'class': 'a-list-item'}).renderContents().strip()
         title = soup.find('div', attrs={'id': 'auth-guess-missing-alert'}).div.div
         self.picurl = soup.find('div', attrs={'id': 'auth-captcha-image-container'}).img.get('src')
     self.setGeometry(500, 550, 9, 2)
     self.email = email
     self.pwd = ''
     self.cap = ''
     self.title = title.renderContents().strip()
     self.image = pyxbmct.Image('', aspectRatio=2)
     self.tb_head = pyxbmct.TextBox()
     self.fl_title = pyxbmct.FadeLabel(_alignment=pyxbmct.ALIGN_CENTER)
     self.username = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_LEFT | pyxbmct.ALIGN_CENTER_Y)
     self.password = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_LEFT | pyxbmct.ALIGN_CENTER_Y)
     self.captcha = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_LEFT | pyxbmct.ALIGN_CENTER_Y)
     self.btn_submit = pyxbmct.Button(getString(30004).split('.')[0])
     self.btn_cancel = pyxbmct.Button(getString(30223))
     self.set_controls()
     self.set_navigation()
Exemplo n.º 4
0
        def set_controls(self):

            # Username label
            self.username_label = pyxbmct.Label(control.lang(30152))
            self.placeControl(self.username_label, 0, 0)
            # Username input
            self.user_input = pyxbmct.Edit(control.lang(30152))
            self.placeControl(self.user_input, 1, 0)
            # Password label
            self.password_label = pyxbmct.Label(control.lang(30153))
            self.placeControl(self.password_label, 2, 0)
            # Password input
            if control.kodi_version() >= 18.0:
                self.pass_input = pyxbmct.Edit(control.lang(30153))
                self.placeControl(self.pass_input, 3, 0)
                self.pass_input.setType(6, control.lang(30153))
            else:
                self.pass_input = pyxbmct.Edit(control.lang(30153),
                                               isPassword=True)
                self.placeControl(self.pass_input, 3, 0)
            # Submit button
            self.submit_button = pyxbmct.Button(control.lang(30154))
            self.placeControl(self.submit_button, 4, 0)
            self.connect(self.submit_button, lambda: self.submit(True))
            # Cancel button
            self.cancel_button = pyxbmct.Button(control.lang(30064))
            self.placeControl(self.cancel_button, 5, 0)
            self.connect(self.cancel_button, self.close)
Exemplo n.º 5
0
    def set_controls(self):
        recipient_label = pyxbmct.Label(_('recipient'), alignment=pyxbmct.ALIGN_RIGHT)
        self.placeControl(recipient_label, 0, 0)
        self._recipient_ctl = pyxbmct.Edit('recipient')
        self.placeControl(self._recipient_ctl, 0, 1)
        self._recipient_ctl.setText(self._recipient)

        subject_label = pyxbmct.Label(_('subject'), alignment=pyxbmct.ALIGN_RIGHT)
        self.placeControl(subject_label, 1, 0)
        self._subject_ctl = pyxbmct.Edit('subject')
        self.placeControl(self._subject_ctl, 1, 1)
        self._subject_ctl.setText(self._subject)

        body_label = pyxbmct.Label(_('body'), alignment=pyxbmct.ALIGN_RIGHT)
        self.placeControl(body_label, 2, 0)
        self._body_ctl = pyxbmct.Edit('body')
        self.placeControl(self._body_ctl, 2, 1)

        self._view_body_ctl = pyxbmct.TextBox('view_body')
        self.placeControl(self._view_body_ctl, 3, 0, 6, 2)

        self._ok_button = pyxbmct.Button(_('ok'), alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(self._ok_button, 9, 1)

        self._cancel_button = pyxbmct.Button(_('cancel'), alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(self._cancel_button, 9, 0)
Exemplo n.º 6
0
 def __init__(self, title='', soup=None, email=None):
     super(Captcha, self).__init__(title)
     head = soup.find('div', attrs={'id': 'message_warning'})
     if not head:
         head = soup.find('div', attrs={'id': 'message_error'})
     title = soup.find('div', attrs={'id': 'ap_captcha_guess_alert'})
     url = soup.find('div', attrs={'id': 'ap_captcha_img'}).img.get('src')
     pic = xbmc.translatePath('special://temp/captcha%s.jpg' %
                              randint(0, 99999999999999)).decode('utf-8')
     SaveFile(pic, getURL(url, retjson=False))
     self.setGeometry(500, 550, 9, 2)
     self.email = email
     self.pwd = ''
     self.cap = ''
     self.head = head.p.renderContents().strip()
     self.head = re.sub('(?i)<[^>]*>', '', self.head)
     self.title = title.renderContents().strip()
     self.image = pyxbmct.Image(pic, aspectRatio=2)
     self.tb_head = pyxbmct.TextBox()
     self.fl_title = pyxbmct.FadeLabel(_alignment=pyxbmct.ALIGN_CENTER)
     self.username = pyxbmct.Edit('',
                                  _alignment=pyxbmct.ALIGN_LEFT
                                  | pyxbmct.ALIGN_CENTER_Y)
     self.password = pyxbmct.Edit('',
                                  _alignment=pyxbmct.ALIGN_LEFT
                                  | pyxbmct.ALIGN_CENTER_Y)
     self.captcha = pyxbmct.Edit('',
                                 _alignment=pyxbmct.ALIGN_LEFT
                                 | pyxbmct.ALIGN_CENTER_Y)
     self.btn_submit = pyxbmct.Button(getString(30008).split('.')[0])
     self.btn_cancel = pyxbmct.Button(getString(30123))
     self.set_controls()
     self.set_navigation()
     xbmcvfs.delete(pic)
Exemplo n.º 7
0
    def add_edits(self):
        self.source_edit = pyxbmct.Edit("Set source path")
        self.placeControl(self.source_edit, 1, 0, columnspan=2)

        self.regex_edit = pyxbmct.Edit("Set custom regular expression")
        self.placeControl(self.regex_edit, 1, 2, columnspan=2)

        self.files_edit = pyxbmct.Edit("Files to select")
        self.placeControl(self.files_edit, 4, 0, columnspan=2)

        self.destination_edit = pyxbmct.Edit("Set destination")
        self.placeControl(self.destination_edit, 8, 0, columnspan=2)
Exemplo n.º 8
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)

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

        # Browse information
        self.browse_label = pyxbmct.Edit('')
        self.placeControl(self.browse_label, 11, 2, rowspan=1, columnspan=6)
        if tools.return_data('RECORDS', 'ID', 1, 1) == '':
            self.browse_label.setText('')
        else:
            path = tools.return_data('RECORDS', 'ID', 1, 1)
            self.browse_label.setText(path)

# Browse input
        self.browse_button = pyxbmct.Button('Browse')
        self.placeControl(self.browse_button, 11, 6, rowspan=1, columnspan=2)
        self.connect(self.browse_button, lambda: self.browse())

        # Next button
        self.next_button = pyxbmct.Button('Next')
        self.placeControl(self.next_button, 13, 14, rowspan=1, columnspan=1)
        self.connect(self.next_button, lambda: self.page())

        # 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())
Exemplo n.º 9
0
    def __init__(self, msg):
        box = msg.find_parent('div',
                              class_='a-box-inner a-padding-extra-large')
        if box is None:
            self.head = msg.find('title').get_text(strip=True)
            self.hint = msg.find('p', class_='a-last').get_text(strip=True)
            form = msg.find('form').find('div', class_='a-box-inner')
            self.task = form.h4.get_text(strip=True)
            self.img_url = pyxbmct.Image(form.find('img')['src'],
                                         aspectRatio=2)
        else:
            self.head = box.find('span',
                                 class_='a-size-large').get_text(strip=True)
            self.hint = box.find(
                'span',
                class_='a-size-base a-color-secondary').get_text(strip=True)
            self.task = box.find('label',
                                 class_='a-form-label').get_text(strip=True)
            self.img_url = pyxbmct.Image(msg['src'], aspectRatio=2)

        super(_Challenge, self).__init__(self.head)
        self.setGeometry(500, 450, 8, 2)
        self.cap = ''
        self.tb_hint = pyxbmct.TextBox()
        self.fl_task = pyxbmct.FadeLabel(_alignment=pyxbmct.ALIGN_CENTER)
        self.ed_cap = pyxbmct.Edit('',
                                   _alignment=pyxbmct.ALIGN_LEFT
                                   | pyxbmct.ALIGN_CENTER_Y)
        self.btn_submit = pyxbmct.Button('OK')
        self.btn_cancel = pyxbmct.Button(getString(30123))
        self.set_controls()
        def set_controls(self):

            # Username label
            self.username_label = pyxbmct.Label(control.lang(30152))
            self.placeControl(self.username_label, 0, 0)
            # Username input
            self.user_input = pyxbmct.Edit(control.lang(30152))
            self.placeControl(self.user_input, 1, 0)
            # Password label
            self.password_label = pyxbmct.Label(control.lang(30153))
            self.placeControl(self.password_label, 2, 0)
            # Password input
            self.pass_input = pyxbmct.Edit(control.lang(30153),
                                           isPassword=True)
            self.placeControl(self.pass_input, 3, 0)
            # Close button
            self.submit_button = pyxbmct.Button(control.lang(30154))
            self.placeControl(self.submit_button, 4, 0)
            self.connect(self.submit_button, lambda: self.submit(True))
Exemplo n.º 11
0
 def _set_controls(self):
     login_label = pyxbmct.Label(ui_string(32003))
     self.placeControl(login_label, 0, 0)
     password_label = pyxbmct.Label(ui_string(32004))
     self.placeControl(password_label, 1, 0)
     self._username_field = pyxbmct.Edit('')
     self.placeControl(self._username_field, 0, 1)
     password_field_kwargs = {}
     if KODI_VERSION < '18':
         password_field_kwargs['isPassword'] = True
     self._password_field = pyxbmct.Edit('', **password_field_kwargs)
     self.placeControl(self._password_field, 1, 1)
     if KODI_VERSION >= '18':
         from xbmcgui import INPUT_TYPE_TEXT, INPUT_TYPE_PASSWORD
         self._username_field.setType(INPUT_TYPE_TEXT, ui_string(32003))
         self._password_field.setType(INPUT_TYPE_PASSWORD, ui_string(32004))
     self._ok_btn = pyxbmct.Button(ui_string(32005))
     self.placeControl(self._ok_btn, 2, 1)
     self._cancel_btn = pyxbmct.Button(ui_string(32006))
     self.placeControl(self._cancel_btn, 2, 0)
Exemplo n.º 12
0
 def __init__(self, title=''):
     super(AgeSettings, self).__init__(title)
     self.age_list = [age[0] for age in Ages]
     self.pin_req = PinReq
     self.pin = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_CENTER)
     self.btn_ages = pyxbmct.Button(self.age_list[self.pin_req])
     self.btn_save = pyxbmct.Button(getString(30222))
     self.btn_close = pyxbmct.Button(getString(30223))
     self.setGeometry(500, 300, 5, 2)
     self.set_controls()
     self.set_navigation()
Exemplo n.º 13
0
 def __init__(self, title=''):
     self._g = Globals()
     super(_AgeSettings, self).__init__(title)
     self.age_list = [age[0] for age in AgeRestrictions().Ages]
     self.pin_req = int(getConfig('pin_req', '0'))
     self.pin = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_CENTER)
     self.btn_ages = pyxbmct.Button(self.age_list[self.pin_req])
     self.btn_save = pyxbmct.Button(getString(30122))
     self.btn_close = pyxbmct.Button(getString(30123))
     self.setGeometry(500, 300, 5, 2)
     self.set_controls()
     self.set_navigation()
Exemplo n.º 14
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)
Exemplo n.º 15
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())
Exemplo n.º 16
0
 def __init__(self, title):
     super(MainWindow, self).__init__(title)
     self.setGeometry(
         WINDOW_WIDTH,
         WINDOW_HEIGHT,
         WINDOW_ROWS,
         WINDOW_COLUMNS
     )
     self.history = ""
     self.history_box = pyxbmct.TextBox()
     self.placeControl(
         self.history_box,
         row=0,
         column=0,
         rowspan=WINDOW_ROWS-COMMAND_HEIGHT,
         columnspan=WINDOW_COLUMNS-ARROW_WIDTH
     )
     self.history_shift = 0
     self.scroll_up_button = pyxbmct.Button(
         label="",
         focusTexture=image("up_blue.png"),
         noFocusTexture=image("up_white.png")
     )
     self.fake_button = pyxbmct.Button(
         label="",
         focusTexture="",
         noFocusTexture=""
     )
     self.placeControl(
         self.fake_button,
         row=0,
         column=0,
         rowspan=WINDOW_ROWS,
         columnspan=WINDOW_COLUMNS
     )
     self.placeControl(
         self.scroll_up_button,
         row=0,
         column=WINDOW_COLUMNS-ARROW_WIDTH,
         rowspan=1,
         columnspan=ARROW_WIDTH
     )
     self.connect(self.scroll_up_button, self.scroll_up)
     self.scroll_down_button = pyxbmct.Button(
         label="",
         focusTexture=image("down_blue.png"),
         noFocusTexture=image("down_white.png")
     )
     self.placeControl(
         self.scroll_down_button,
         row = WINDOW_ROWS-COMMAND_HEIGHT-1,
         column=WINDOW_COLUMNS-ARROW_WIDTH,
         rowspan=1,
         columnspan=ARROW_WIDTH
     )
     self.connect(self.scroll_down_button, self.scroll_down)
     self.prompt = pyxbmct.Label(">>>")
     self.placeControl(
         self.prompt,
         row=WINDOW_ROWS-COMMAND_HEIGHT,
         column=0,
         rowspan=COMMAND_HEIGHT,
         columnspan=PROMPT_WIDTH
     )
     self.command = pyxbmct.Edit("")
     self.placeControl(
         self.command,
         row=WINDOW_ROWS-COMMAND_HEIGHT,
         column=PROMPT_WIDTH,
         rowspan=COMMAND_HEIGHT,
         columnspan=WINDOW_COLUMNS-PROMPT_WIDTH-BUTTON_WIDTH
     )
     self.command_history = CommandHistory()
     self.run_button = pyxbmct.Button("Run")
     self.placeControl(
         self.run_button,
         row=WINDOW_ROWS-COMMAND_HEIGHT,
         column=WINDOW_COLUMNS-BUTTON_WIDTH,
         rowspan=COMMAND_HEIGHT,
         columnspan=BUTTON_WIDTH
     )
     self.connect(self.run_button, self.run_command)
     self.setFocus(self.command)
     self.globals = {}
Exemplo n.º 17
0
    def set_controls(self):
        '''
        Left Side Menu Top Section
        '''
        self.Section1 = pyxbmct.Label('[B]Addon Information[/B]',
                                      alignment=pyxbmct.ALIGN_LEFT,
                                      textColor=self.colors.mh_color)
        self.placeControl(self.Section1, 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(
            ['News', 'Changes', 'Builds', 'Paypal', 'Bug Reports'])
        '''
        Left Side Menu Bottom Section, currently unused
        '''
        self.Section2 = pyxbmct.Label('[B]Tips and Tricks[/B]',
                                      alignment=pyxbmct.ALIGN_LEFT,
                                      textColor=self.colors.mh_color)
        self.placeControl(self.Section2, 11, 1, rowspan=4, columnspan=17)
        self.menu2 = pyxbmct.List(textColor=self.colors.mt_color)
        self.placeControl(self.menu2, 12, 1, rowspan=12, columnspan=17)
        self.menu2.addItems(['Scraper Tips', 'Real Debrid', 'Torrents'])

        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)
        '''
        Right Side, to display stuff for the above menu items
        '''
        self.newsheader = '[B]Latest News[/B]'
        self.Header = pyxbmct.Label(self.newsheader,
                                    alignment=pyxbmct.ALIGN_CENTER,
                                    textColor=self.colors.dh_color)
        self.placeControl(self.Header, 2, 20, rowspan=1, columnspan=40)
        self.Description = pyxbmct.TextBox(self.news)
        self.placeControl(self.Description, 3, 21, rowspan=16, columnspan=40)
        self.Description.setText(self.news)

        self.RDLink = pyxbmct.Label('Referral Debrid Link: ' +
                                    str(get_rd_link()))
        self.placeControl(self.RDLink, 17, 21, rowspan=2, columnspan=32)
        self.RDLink.setVisible(False)

        self.WatchButton = pyxbmct.Button(
            'Watch',
            textColor='0xFFFFFFFF',
            shadowColor='0xFF000000',
            focusedColor='0xFFbababa',
            focusTexture=themecontrol.btn_focus,
            noFocusTexture=themecontrol.btn_nofocus)
        self.placeControl(self.WatchButton, 15, 36, rowspan=2, columnspan=8)
        self.WatchButton.setVisible(False)
        self.connect(self.WatchButton, self.watchVideo)

        self.BugForm = pyxbmct.Edit('', _alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(self.BugForm, 8, 24, 2, 31)
        self.BugForm.setVisible(False)

        self.SubmitButton = pyxbmct.Button(
            'Submit',
            textColor='0xFFFFFFFF',
            shadowColor='0xFF000000',
            focusedColor='0xFFbababa',
            focusTexture=themecontrol.btn_focus,
            noFocusTexture=themecontrol.btn_nofocus)
        self.placeControl(self.SubmitButton, 15, 36, rowspan=2, columnspan=8)
        self.SubmitButton.setVisible(False)
        self.connect(self.SubmitButton, self.submitForm)
Exemplo 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)