Example #1
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)
    def set_controls(self):

        # Image object
        self.image = pyxbmct.Image(
            'http://chart.apis.google.com/chart?cht=qr&chl={0}&chs=256'.format(
                quote(authorization_link())),
            aspectRatio=2)
        self.placeControl(self.image, 0, 0, 6)
        # Text box
        self.text_box = pyxbmct.TextBox()
        self.placeControl(self.text_box, 0, 1, 2)
        self.text_box.setText(control.lang(30064).format(get_ip()))
        self.text_box.autoScroll(1000, 1000, 1000)
        # Button capable of changing the local ip address
        self.address_button = pyxbmct.Button(control.lang(30056))
        self.placeControl(self.address_button, 2, 1)
        self.connect(self.address_button, lambda: ip_address_set())
        # Button capable of starting the server
        self.server_button = pyxbmct.Button(control.lang(30147))
        self.placeControl(self.server_button, 3, 1)
        self.connect(self.server_button, lambda: reddit_server())
        # Button displaying address for auth, and capable of opening it
        self.link_button = pyxbmct.Button(self.link)
        self.placeControl(self.link_button, 4, 1)
        self.connect(self.link_button,
                     lambda: control.open_web_browser(self.link))
        # Close button
        self.close_button = pyxbmct.Button(control.lang(30062))
        self.placeControl(self.close_button, 5, 1)
        self.connect(self.close_button, self.close)
Example #3
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)
Example #4
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()
Example #5
0
    def set_controls(self):
        """
            Set up UI controls
        """
        # __ Movie title
        self.labelTitle = pyxbmct.Label(self.title,
                                        alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(self.labelTitle, 0, 0, 1, 2)
        # ___ Movie thumbnail
        self.thumnailImg = pyxbmct.Image(self.thumbnail, aspectRatio=2)
        self.placeControl(self.thumnailImg, 1, 0, 8, 2)

        # ___ OK button
        self.ok_button = pyxbmct.Button('OK')
        self.placeControl(self.ok_button, 9, 0)
        # Connect OK button
        self.connect(self.ok_button, self.closePopup)

        # ___ Search again button
        self.search_button = pyxbmct.Button(
            constant.__addon__.getLocalizedString(80021))
        self.placeControl(self.search_button, 9, 1)
        # Connect Search again
        self.connect(self.search_button, self.searchAgain)

        # ___ Set initial focus.
        self.setFocus(self.ok_button)
Example #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)
Example #7
0
  def draw_slot_menu(self):
    # draw and configure select and delete buttons for each slot
    row = 0
    while row < slots:
      platform = labels.pop(0)
      rom = labels.pop(0)

      self.slot_btn.append(pyxbmct.Button('  %s\n  %s' % (platform, rom), alignment=pyxbmct.ALIGN_LEFT))
      self.placeControl(self.slot_btn[row], row, 0, 1, 9)
      self.select_action.append(self.selectAction(self, row+1))
      self.connect(self.slot_btn[row], self.select_action[row].setTargetSlot)

      self.del_btn.append(pyxbmct.Button('Delete', alignment=pyxbmct.ALIGN_CENTER))
      self.placeControl(self.del_btn[row], row, 9)
      self.delete_action.append(self.deleteAction(self, row+1))
      self.connect(self.del_btn[row], self.delete_action[row].deleteSlot)

      row += 1

    # draw "new session" button if free space (sits in the centre, spread over 2 cells)
    if slots < MAX_SLOTS:
      new_row = (((MAX_SLOTS - slots) / 2) + slots)
      self.new_btn = pyxbmct.Button('Start New Session', alignment=pyxbmct.ALIGN_CENTER)
      self.placeControl(self.new_btn, new_row, 4, 1, 2)
      self.connect(self.new_btn, self.new_slot_action.setTargetSlot)
Example #8
0
    def add_buttons(self):
        self.source_browse_button = pyxbmct.Button("Browse")
        self.placeControl(self.source_browse_button, 2, 0)

        self.source_clear_button = pyxbmct.Button("Clear")
        self.placeControl(self.source_clear_button, 2, 1)

        self.files_browse_button = pyxbmct.Button("Browse")
        self.placeControl(self.files_browse_button, 5, 0)

        self.files_clear_button = pyxbmct.Button("Clear")
        self.placeControl(self.files_clear_button, 5, 1)

        self.destination_browse_button = pyxbmct.Button("Browse")
        self.placeControl(self.destination_browse_button, 9, 0)

        self.destination_clear_button = pyxbmct.Button("Clear")
        self.placeControl(self.destination_clear_button, 9, 1)

        self.help_button = pyxbmct.Button("Help")
        self.placeControl(self.help_button, 9, 2)

        self.settings_button = pyxbmct.Button("Settings")
        self.placeControl(self.settings_button, 9, 3)

        self.close_button = pyxbmct.Button("Close")
        self.placeControl(self.close_button, 10, 2)

        self.start_button = pyxbmct.Button("Start")
        self.placeControl(self.start_button, 10, 3)
Example #9
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()
Example #10
0
    def createButtons(self):
        #Pause Button
        self.buttonPause = pyxbmct.Button('Pause')
        self.placeControl(self.buttonPause, 0, 5)
        self.connect(self.buttonPause, lambda: self.controlspotify('pause'))
        #Play Button
        self.buttonPlay = pyxbmct.Button('Play')#
        self.placeControl(self.buttonPlay, 1, 5)
        self.connect(self.buttonPlay,  lambda: self.controlspotify('play'))
        #Next Track Button
        self.buttonNext = pyxbmct.Button('Next')
        self.placeControl(self.buttonNext, 2, 5)
        self.connect(self.buttonNext,  lambda: self.controlspotify('next'))
        #Shuffle Switch
        #self.radioShuffle = pyxbmct.RadioButton('Shuffle')
        #self.radioShuffle.isSelected
        #self.placeControl(self.radioShuffle, 4, 3)
        #Shuffle Switch
        #self.radioRepeat = pyxbmct.RadioButton('Repeat')
        #self.radioRepeat.setSelected(True)
        #self.placeControl(self.radioRepeat, 5, 3)
        #refresh Track Button
#        self.buttonRefresh = pyxbmct.Button('Refresh')
#        self.placeControl(self.buttonRefresh, 4, 3)
#        self.connect(self.buttonRefresh, self.update_infos)
        self.setNavigation()
    def __init__(self, title=''):
        super(MyAddon, self).__init__(title)
        self.setGeometry(400, 240, 4, 4)
        self.active_RGB = [0, 0, 0]
        try:
            active = h.active_color("RGB")
            if len(active) == 3:
                self.active_RGB = active
        except socket.error:
            pass
        self.set_sliderR()
        self.set_sliderG()
        self.set_sliderB()
        # 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)

        self.okButton = pyxbmct.Button('Ok')
        self.placeControl(self.okButton, 3, 2)
        self.connect(self.okButton, self.launch)
        self.closeButton = pyxbmct.Button(translate(30014))
        self.placeControl(self.closeButton, 3, 1)
        self.connect(self.closeButton, self.close)
        self.set_navigation()
        # Connect a key action (Backspace) to close the window.
        self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
Example #12
0
 def radio(self):
     self.prev_button = pyxbmct.Button('Prev', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.prev_button, 4, 1)
     
     freq_type_lable = pyxbmct.Label('FM', alignment=pyxbmct.ALIGN_CENTER, font='header34_title')
     self.placeControl(freq_type_lable, 4, 4, 1, 1)
     
     self.next_button = pyxbmct.Button('Next', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.next_button, 4, 5)
     self.connect(self.next_button, lambda: dab.nextDAB(0,0))
     
     # List
     self.station_fm_list = pyxbmct.List(font='font30_title', _itemHeight=40)
     #self.list(Row Location (Where pos) , column Location (where Pos) , No Items, text Span over column no)
     self.placeControl(self.station_fm_list, 2, 0, 10, 1)
     # Add items to the list
     items = ['Items {0}'.format(i) for i in range(1, 11)]
     self.station_fm_list.addItems(items)
     
     # Connect the list to a function to display which list item is selected.
     self.connect(self.station_fm_list, lambda: xbmc.executebuiltin('Notification(Note!,{0} selected.)'.format(
     self.station_fm_list.getListItem(self.station_fm_list.getSelectedPosition()).getLabel())))
     
     self.mw_button = pyxbmct.Button('MW', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.mw_button, 7, 3)
     
     self.fm_button = pyxbmct.Button('FM', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.fm_button, 7, 4)
     
     self.dab_button = pyxbmct.Button('DAB', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.dab_button, 7, 5)
Example #13
0
    def set_controls(self):
        """Set up UI controls"""
        # Image control
        image = pyxbmct.Image(addonfolder + artsfolder + '/tvh.png')
        self.placeControl(image, 0, 0, rowspan=9, columnspan=16)

        # Image control
        image = pyxbmct.Image(addonfolder + artsfolder + '/installaddons.png')
        self.placeControl(image, 8, 6, rowspan=4, columnspan=4)

        # Tvheadend button
        self.tvh_button = pyxbmct.Button('TVHEADEND')
        self.placeControl(self.tvh_button, 10, 11, rowspan=1, columnspan=3)
        self.connect(
            self.tvh_button, lambda: self.installaddons(
                'service.tvheadend42', 'service.tvheadend43'))

        # Tvheadend HTSP Client button
        self.htsp_button = pyxbmct.Button('HTSP CLIENT')
        self.placeControl(self.htsp_button, 10, 2, rowspan=1, columnspan=3)
        self.connect(self.htsp_button, lambda: self.installaddon('pvr.hts'))

        # Start button
        self.start_button = pyxbmct.Button('START')
        self.placeControl(self.start_button, 12, 7, rowspan=1, columnspan=2)
        self.connect(
            self.start_button, lambda: self.page(
                'service.tvheadend42', 'service.tvheadend43', 'pvr.hts'))

        # 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())
Example #14
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())
Example #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=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())
Example #16
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)
Example #17
0
    def set_active_controls(self):
        my_dynamic_functions = {}
        self.button = {}
        # List
        i = 0
        j = 0
        x = 0
        for img in self.item:
            self.image = pyxbmct.Image(img)
            self.placeControl(self.image, i, j, rowspan=1, columnspan=1)
            self.button[x] = pyxbmct.Button('')

            my_dynamic_functions['button_' + str(x)] = self.function_builder(x)

            self.connect(self.button[x],
                         my_dynamic_functions['button_' + str(x)])
            self.placeControl(self.button[x], i, j)
            j += 1
            if j > 4:
                j = 0
                i += 1
            #self.connect(self.image, self.close)

            x += 1
        self.image = pyxbmct.Image(
            'http://www.cling.co.il/wp-content/uploads/2016/06/%D7%A1%D7%92%D7%95%D7%A8.jpg'
        )
        self.placeControl(self.image, i, j, rowspan=1, columnspan=1)
        self.button2 = pyxbmct.Button('')
        self.connect(self.button2, self.click_c)
        self.placeControl(self.button2, i, j)
Example #18
0
    def set_controls(self):
        '''
        Header Text Placement
        '''
        self.header_text = '[B]Theme Selection[/B]'
        self.Header = pyxbmct.Label(self.header_text,
                                    alignment=pyxbmct.ALIGN_CENTER,
                                    textColor=self.colors.dh_color)
        self.placeControl(self.Header, 3, 0, rowspan=2, columnspan=60)
        '''
        58 characters per line
        '''
        msg = 'Please select the artwork that you would like to use.\nThis is pulled from the selected Artwork Module. You can\nchange the Artwork Module used from the Tools\nMenu by selecting Artwork Module and typing the ID\nof the new module.'
        self.Description = pyxbmct.Label(msg)
        self.placeControl(self.Description, 6, 4, rowspan=12, columnspan=53)

        self.menu = pyxbmct.List(textColor=self.colors.mt_color)
        self.placeControl(self.menu, 24, 21, rowspan=30, columnspan=17)
        items = []
        self.aModule_base = xbmcaddon.Addon(
            'script.atreides.artwork').getSetting('artwork_module')
        self.aModule = os.path.join(
            xbmcaddon.Addon(self.aModule_base).getAddonInfo('path'),
            'resources', 'media')
        for folder in glob.glob("%s/*" % (self.aModule)):
            folder = os.path.split(folder)[1].capitalize()
            items.append(folder)
        self.menu.addItems(items)
        self.connect(self.menu, self.menu_handler)

        self.Preview = pyxbmct.Image('%s/%s/tools.png' %
                                     (self.aModule, items[0]))
        self.placeControl(self.Preview, 24, 3, rowspan=17, columnspan=17)

        self.module_text = 'Current Module: %s' % (self.aModule_base)
        self.Module = pyxbmct.Label(self.module_text,
                                    alignment=pyxbmct.ALIGN_CENTER,
                                    textColor=self.colors.dh_color)
        self.placeControl(self.Module, 50, 0, rowspan=2, columnspan=60)

        self.OKButton = pyxbmct.Button('OK',
                                       textColor='0xFFFFFFFF',
                                       shadowColor='0xFF000000',
                                       focusedColor='0xFFbababa',
                                       focusTexture=themecontrol.btn_focus,
                                       noFocusTexture=themecontrol.btn_nofocus)
        self.placeControl(self.OKButton, 53, 35, rowspan=4, columnspan=10)
        self.connect(self.OKButton, self.save_theme)

        self.CancelButton = pyxbmct.Button(
            'Cancel',
            textColor='0xFFFFFFFF',
            shadowColor='0xFF000000',
            focusedColor='0xFFbababa',
            focusTexture=themecontrol.btn_focus,
            noFocusTexture=themecontrol.btn_nofocus)
        self.placeControl(self.CancelButton, 53, 46, rowspan=4, columnspan=10)
        self.connect(self.CancelButton, self.close)
Example #19
0
 def _set_controls(self):
     self._filter_list = pyxbmct.List()
     self.placeControl(self._filter_list, 0, 0, rowspan=5, columnspan=3)
     self._new_button = pyxbmct.Button('New filter...')
     self.placeControl(self._new_button, 5, 0)
     self._cancel_button = pyxbmct.Button('Cancel')
     self.placeControl(self._cancel_button, 5, 1)
     self._save_button = pyxbmct.Button('Save filters')
     self.placeControl(self._save_button, 5, 2)
Example #20
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()
Example #21
0
 def setup(self, boxscore_obj):
     self.row_number = 3 + 4
     # + 2 for the header & team total rows
     team1total =  len(boxscore_obj['Team1']['Stats']['Hitting']['Players']) + 2
     team1total += len(boxscore_obj['Team1']['Stats']['Hitting']['Extras'].keys())
     # + 1 for the header row
     team1total += len(boxscore_obj['Team1']['Stats']['Fielding'].keys()) + 1
     
     # + 2 for the header & team total rows
     team2total =  len(boxscore_obj['Team2']['Stats']['Hitting']['Players']) + 2
     team2total += len(boxscore_obj['Team2']['Stats']['Hitting']['Extras'].keys())
     # + 1 for the header row
     team2total += len(boxscore_obj['Team2']['Stats']['Fielding'].keys()) + 1
     
     if team1total > team2total:
         self.row_number += team1total
     else:
         self.row_number += team2total
     
     self.setGeometry(1280, 720, self.row_number, 24)
     #3 rows for top head-to-head banner
     #4 rows for team stats - team1, team1 percentages, team2, team2 percentages
     #Now add 1 row for each player on each team
     
     self.boxscore_obj = boxscore_obj
     
     hittingbtn  = pyxbmct.Button('[B]Hitting[/B]', alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(hittingbtn, 0, 0, columnspan=3, rowspan=3)
     self.connect(hittingbtn, lambda: self.switch_stats('Hitting'))
     pitchingbtn  = pyxbmct.Button('[B]Pitching[/B]', alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(pitchingbtn, 3, 0, columnspan=3, rowspan=3)
     self.connect(pitchingbtn, lambda: self.switch_stats('Pitching'))
     
     pitchingbtn.controlUp(hittingbtn)
     pitchingbtn.controlDown(hittingbtn)
     hittingbtn.controlUp(pitchingbtn)
     hittingbtn.controlDown(pitchingbtn)
     self.setFocus(hittingbtn)
     
     team1name   = pyxbmct.Label('[B]%s\n%s[/B]' % (boxscore_obj['Team1']['Name'], 
                                                    boxscore_obj['Team1']['Record']), alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(team1name, 0, 3, columnspan=6, rowspan=6)
     team1logo   = pyxbmct.Image(boxscore_obj['Team1']['Logo'])
     self.placeControl(team1logo, 0, 9, columnspan=2, rowspan=6)
     
     versus      = pyxbmct.Label('[B]VS[/B]', alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(versus, 0, 11, columnspan=3, rowspan=6)
     
     team2logo   = pyxbmct.Image(boxscore_obj['Team2']['Logo'])
     self.placeControl(team2logo, 0, 14, columnspan=2, rowspan=6)
     team2name   = pyxbmct.Label('[B]%s\n%s[/B]' % (boxscore_obj['Team2']['Name'], 
                                                    boxscore_obj['Team2']['Record']), alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(team2name, 0, 16, columnspan=5, rowspan=6)
     self.init_stats()
Example #22
0
	def set_controls(self):
		"""Set up UI controls"""
		# Image control
		# image = pyxbmct.Image('https://peach.blender.org/wp-content/uploads/poster_rodents_small.jpg?3016dc')
		# self.placeControl(image, 0, 0, rowspan=3, columnspan=2)
		
		# Today button
		self.today_button = pyxbmct.Button('Šodien')
		self.placeControl(self.today_button, 0, 0)
		self.connect(self.today_button, self.set_guide_today)
		# Today button
		self.tomorrow_button = pyxbmct.Button('Rīt')
		self.placeControl(self.tomorrow_button, 0, 1)
		self.connect(self.tomorrow_button, self.set_guide_tomorrow)
		# Today button
		self.aftertomorrow_button = pyxbmct.Button('Parīt')
		self.placeControl(self.aftertomorrow_button, 0, 2)
		self.connect(self.aftertomorrow_button, self.set_guide_aftertomorrow)
		# Today button
		self.afteraftertomorrow_button = pyxbmct.Button('Aizparīt')
		self.placeControl(self.afteraftertomorrow_button, 0, 3)
		self.connect(self.afteraftertomorrow_button, self.set_guide_afteraftertomorrow)
		
		# Now Label
		self.program_name_label = pyxbmct.Label('Šodienas Programma')
		self.placeControl(self.program_name_label, 1, 0, 1,4)		
		
		self.now_label = pyxbmct.FadeLabel()
		self.placeControl(self.now_label, 2, 0, 1,4)
		self.now_label.addLabel('Šobrīd rāda:   ' + self.now_playing )
		
		
		# List
		self.list = pyxbmct.List()
		self.placeControl(self.list, 3, 0, rowspan=7, columnspan=4)
		# Add items to the list
		# items = ['Item {0}'.format(i) for i in range(1, 8)]
		
		
			
		# print self.program_today
		
		self.list.addItems(self.program_today )
		
		# Text label
		# label = pyxbmct.Label('Your name:')
		# self.placeControl(label, 8, 0)
		
		# Close button
		self.close_button = pyxbmct.Button('Aizvērt')
		self.placeControl(self.close_button, 10, 0)
		# Connect close button
		self.connect(self.close_button, self.close)
Example #23
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()
Example #24
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'])
        '''
        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)
Example #25
0
 def set_base_layout(self):
     #Time Lable
     time_label = pyxbmct.Label(xbmc.getInfoLabel('system.time'), alignment=pyxbmct.ALIGN_CENTER, font='header50_title')
     self.placeControl(time_label, 0, 0, 1, 2)
     
     self.volume_button = pyxbmct.Button('Volume', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.volume_button, 0, 4, pad_x=0, pad_y=5)
     
     self.home_button = pyxbmct.Button('Home', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.home_button, 0, 5, pad_x=0, pad_y=5)
     
     self.radio_button = pyxbmct.Button('Radio', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.radio_button, 1, 0, pad_x=0, pad_y=5)
     self.connect(self.radio_button, self.radio)
     
     self.mp3_button = pyxbmct.Button('Mp3', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.mp3_button, 1, 1, pad_x=0, pad_y=5)
     
     self.bluetooth_button = pyxbmct.Button('Bluetooth', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.bluetooth_button, 1, 2, pad_x=0, pad_y=5)
     
     self.aux_button = pyxbmct.Button('AUX', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.aux_button, 1, 3, pad_x=0, pad_y=5)
     
     self.spotify_button = pyxbmct.Button('Spotify', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.spotify_button, 1, 4, pad_x=0, pad_y=5)
     
     self.spare_button = pyxbmct.Button('Spare', alignment=pyxbmct.ALIGN_CENTER, font='button34_title')
     self.placeControl(self.spare_button, 1, 5, pad_x=0, pad_y=5)
Example #26
0
    def set_controls(self):
        """Set up UI controls"""
        # Image tnds
        image = pyxbmct.Image(addonfolder+artsfolder+'/tnds82.png')
        self.placeControl(image, 0, 0, rowspan=7, columnspan=17)

		# Channel Manager
        self.cmanager_button = pyxbmct.Button('')
        self.placeControl(self.cmanager_button, 8, 2, rowspan=3, columnspan=3)
        self.connect(self.cmanager_button, self.cmanager_button_update)
        cmanager = pyxbmct.Image(addonfolder+artsfolder+'/cmanager.png')
        self.placeControl(cmanager, 8, 2, rowspan=3, columnspan=3)

		# Group Manager
        self.gmanager_button = pyxbmct.Button('')
        self.placeControl(self.gmanager_button, 12, 2, rowspan=3, columnspan=3)
        self.connect(self.gmanager_button, self.gmanager_button_update)
        gmanager = pyxbmct.Image(addonfolder+artsfolder+'/gmanager.png')
        self.placeControl(gmanager, 12, 2, rowspan=3, columnspan=3)
		
		# Fix Picons
        self.fixpicons_button = pyxbmct.Button('')
        self.placeControl(self.fixpicons_button, 8, 7, rowspan=3, columnspan=3)
        self.connect(self.fixpicons_button, self.fixpicons_button_update)
        fixpicons = pyxbmct.Image(addonfolder+artsfolder+'/fixpicons.png')
        self.placeControl(fixpicons, 8, 7, rowspan=3, columnspan=3)

        # Check update Channels
        self.upchannels_button = pyxbmct.Button('')
        self.placeControl(self.upchannels_button, 8, 12, rowspan=3, columnspan=3)
        self.connect(self.upchannels_button, self.upchannels_button_update)
        upchannels = pyxbmct.Image(addonfolder+artsfolder+'/upchannels.png')
        self.placeControl(upchannels, 8, 12, rowspan=3, columnspan=3)

		# Reset Config
        self.resetconfig_button = pyxbmct.Button('')
        self.placeControl(self.resetconfig_button, 	12, 7, rowspan=3, columnspan=3)
        self.connect(self.resetconfig_button, self.resetconfig_button_update)
        resetconfig = pyxbmct.Image(addonfolder+artsfolder+'/resetconfig.png')
        self.placeControl(resetconfig, 12, 7, rowspan=3, columnspan=3)

		# Upload Channels
        self.uploadchannels_button = pyxbmct.Button('')
        self.placeControl(self.uploadchannels_button, 12, 12, rowspan=3, columnspan=3)
        self.connect(self.uploadchannels_button, self.uploadchannels_button_update)
        uploadchannels = pyxbmct.Image(addonfolder+artsfolder+'/uploadchannels.png')
        self.placeControl(uploadchannels, 12, 12, rowspan=3, columnspan=3)

		# Back button
        self.back_button = pyxbmct.Button('Back')
        self.placeControl(self.back_button, 16, 13, rowspan=1, columnspan=2)
        self.connect(self.back_button, lambda: self.back())


		# Close button
        self.close_button = pyxbmct.Button('Exit')
        self.placeControl(self.close_button, 16, 15, rowspan=1, columnspan=2)
        # Connect close button
        self.connect(self.close_button, self.close)
Example #27
0
        def set_controls(self):

            # Text box
            self.text_box = pyxbmct.TextBox()
            self.placeControl(self.text_box, 0, 0, 4, 5)
            self.text_box.setText(self.text)
            self.text_box.autoScroll(1000, 1000, 1000)
            # Allow
            self.allow_button = pyxbmct.Button(control.lang(30150))
            self.placeControl(self.allow_button, 4, 1)
            self.connect(self.allow_button, lambda: self.authorize())
            # Deny
            self.deny_button = pyxbmct.Button(control.lang(30151))
            self.placeControl(self.deny_button, 4, 3)
            self.connect(self.deny_button, self.close)
Example #28
0
    def queue(self, sports):
        rssStr = ''.join([
            '[B]%s[/B]%s' % (sport.upper(), ''.join([
                ' %s %s %s %s  %s  | ' %
                (game['Name1'], game['Score1'], game['Name2'], game['Score2'],
                 game['Time']) for game in games
            ])) for (sport, games) in sports.iteritems()
        ])
        rssStr = rssStr + rssStr
        rssLabel = pyxbmct.FadeLabel()
        #self.placeControl(rssLabel, 0, 0, columnspan=49, pad_y=-5)
        self.placeControl(rssLabel, 0, 0, columnspan=49, rowspan=4, pad_y=-1)
        rssLabel.addLabel(rssStr)

        self.close_button = pyxbmct.Button('X  ')
        self.placeControl(self.close_button,
                          0,
                          49,
                          columnspan=3,
                          rowspan=4,
                          pad_y=-5,
                          pad_x=5)
        self.connect(self.close_button, self.close)
        extra_iterations = 0
        for key, gs in sports.iteritems():
            if len(gs) > 3:
                extra_iterations += len(gs) - 3 / 3
        total_iterations = len(sports.keys()) + extra_iterations
        self.display_duration = self.display_duration * total_iterations
        self.show()
        xbmc.sleep(self.display_duration)
        self.close()
Example #29
0
    def __init__(self, title=''):
        super(Scores, self).__init__(title)
        #Geometry(Width, Height, Rows, Columns)
        #New Addon Windows always have 1280x720 grid
        self.setGeometry(1280, 30, 3, 50, pos_x=1, pos_y=690)
        main_bg = pyxbmct.Image(blue)
        self.placeControl(main_bg,
                          0,
                          0,
                          rowspan=4,
                          columnspan=49,
                          pad_x=-5,
                          pad_y=-5)

        btn_bg = pyxbmct.Image(blue)
        self.placeControl(btn_bg,
                          0,
                          49,
                          columnspan=2,
                          rowspan=4,
                          pad_x=-5,
                          pad_y=-5)
        self.display_duration = int(addon.getSetting('Ttimeout')) * 1000

        # Connect a key action (Backspace) to close the window.
        self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
        self.close_button = pyxbmct.Button('X  ')
    def __init__(self,
                 text,
                 icon,
                 icon_full_path=False,
                 icon_pad_x=5,
                 icon_pad_y=5,
                 set_icon_colour_diffuse_on_set_enabled=True,
                 *args,
                 **kwargs):
        """:param text: text label for the button
        :param icon: either an icon filename or a :pyxbmct.Image:
        :param icon_full_path: if False icon filename is seen as a relative\
                path from resources/media
        :param icon_pad_x: pixel gap between the right hand edge of the\
                button and the icon
        :parm icon_pad_y: pixel gap between the top and bottom edges of the\
                button and the icon
        """
        # type: (str, Union[str, pyxbmct.Image], bool, int, int, bool, Any, Any) -> None
        super(ButtonWithIcon, self).__init__(1, 2, *args, **kwargs)

        self._set_icon_colour_diffuse_on_set_enabled = (
            set_icon_colour_diffuse_on_set_enabled)

        if isinstance(icon, basestring):
            if not icon_full_path:
                icon = os.path.join(_addon_path, "resources", "media", icon)
            self._icon = pyxbmct.Image(icon, aspectRatio=2)
        else:
            self._icon = icon  # type: pyxbmct.Image

        self._button = pyxbmct.Button(text)
        self._icon_pad_x = icon_pad_x
        self._icon_pad_y = icon_pad_y