Example #1
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)
Example #2
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 #3
0
    def __init__(self, title='[B]Play-By-Play[/B]'):
        super(Plays, self).__init__('[B]Play-By-Play - %s[/B]' % title)
        #Geometry(Width, Height, Rows, Columns)
        #New Addon Windows always have 1280x720 grid
        #self.setGeometry(1280, 720, 27, 4)
        self.setGeometry(1280, 720, 27, 15)

        teamheader = pyxbmct.Label('[B]Team[/B]',
                                   alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(teamheader, 0, 0)
        timeheader = pyxbmct.Label('[B]Time[/B]',
                                   alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(timeheader, 0, 1)
        scoreheader = pyxbmct.Label('   [B]Score[/B]',
                                    alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(scoreheader, 0, 2)
        playheader = pyxbmct.Label('[B]Play[/B]',
                                   alignment=pyxbmct.ALIGN_CENTER)
        self.placeControl(playheader, 0, 3, columnspan=12)

        self.listing = pyxbmct.List(_imageWidth=35, _imageHeight=35)
        self.placeControl(self.listing, 1, 0, rowspan=26, columnspan=15)

        # Connect a key action (Backspace) to close the window.
        self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
Example #4
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 #5
0
    def __init__(self, playlistFile, epgFile, iconsFolder, timezone):
        super(DialogEPG, self).__init__('IPTV')
        self.setGeometry(1150, 600, 3, 3)

        self.timezone = timezone
        self.channels = util.m3uChannels(playlistFile)
        self.epg = util.xmltvParse(epgFile, self.timezone)
        self.connect(pyxbmct.ACTION_NAV_BACK, self.close)
        self.connect(pyxbmct.ACTION_PREVIOUS_MENU, self.close)
        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.handleEvent)

        ### Setup channels list ###
        self.listChannels = pyxbmct.List(_imageWidth=20, _imageHeight=20)
        self.placeControl(self.listChannels, 0, 0, rowspan=2, columnspan=1)
        for channel in self.channels:
            item = xbmcgui.ListItem(channel['name'],
                                    iconImage=iconsFolder +
                                    channel['tvg_logo'])
            self.listChannels.addItem(item)
        self.connect(self.listChannels, lambda: self.play())

        ### Setup programs list ###
        self.listPrograms = pyxbmct.List()
        self.placeControl(self.listPrograms, 0, 1, rowspan=2, columnspan=2)

        ### Setup description textbox ###
        self.textboxDescription = pyxbmct.TextBox()
        self.placeControl(self.textboxDescription,
                          2,
                          0,
                          rowspan=1,
                          columnspan=3)
        self.textboxDescription.autoScroll(1000, 1000, 1000)

        ### Setup navigation ###
        self.listChannels.setNavigation(self.listPrograms, self.listPrograms,
                                        self.listPrograms, self.listPrograms)
        self.listPrograms.setNavigation(self.listChannels, self.listChannels,
                                        self.listChannels, self.listChannels)
        self.setFocus(self.listChannels)
        self.selectedChannel = None
        self.selectedProgram = None
        self.selectChannel()
Example #6
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 #7
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 #8
0
 def set_controls(self):
     ###Left Side###
     ###Section 1###
     ###  Money  ###
     ###Donations###
     self.Section1 = pyxbmct.Label('[B]If you have money to\nspare[/B]',
                                   alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(self.Section1, 0, 0, columnspan=10)
     self.menu = pyxbmct.List()
     self.placeControl(self.menu, 1, 0, rowspan=6, columnspan=10)
     self.menu.addItems([
         'Paypal', 'Bitcoin (BTC)', 'Bitcoin Cash (BCH)', 'Ethereum (ETH)',
         'Litecoin (LTC)'
     ])
     ###Section 2###
     ###Referral ###
     ###Donations###
     self.Section2 = pyxbmct.Label(
         '[B]You can donate for free\nif you own an android\ndevice[/B]',
         alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(self.Section2, 5, 0, rowspan=2, columnspan=10)
     self.menu2 = pyxbmct.List()
     self.placeControl(self.menu2, 7, 0, rowspan=10, columnspan=10)
     self.menu2.addItems(
         ['Bitcoin Spinner', 'Ethereum Spinner', 'Litecoin Spinner'])
     ###Right Side###
     ###   Main   ###
     ###  Detail  ###
     self.QRcode = pyxbmct.Image(paypal, aspectRatio=2)
     self.placeControl(self.QRcode, 0, 16, rowspan=3, columnspan=10)
     self.Addr = pyxbmct.Label(self.paypalAddr,
                               alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(self.Addr, 3, 11, columnspan=20)
     self.Balance = pyxbmct.Label('Total Donated:\n%s' % self.paypalValue,
                                  alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(self.Balance, 4, 16, rowspan=3, columnspan=10)
     self.Download = pyxbmct.Button('Download',
                                    alignment=pyxbmct.ALIGN_CENTER)
     self.placeControl(self.Download, 4, 16, rowspan=2, columnspan=10)
     self.connect(self.Download, self.downloadApp)
     self.Download.setVisible(False)
     self.Description = pyxbmct.Label('')
     self.placeControl(self.Description, 7, 11, rowspan=4, columnspan=20)
Example #9
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 #10
0
    def set_controls(self):
        '''
        Left Side Menu Top Section
        '''
        self.Section1 = pyxbmct.Label('[B]Cache Options[/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(['Base', 'Providers', 'Meta', 'Search', 'All'])

        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.ClearButton = pyxbmct.Button(
            'Clear',
            textColor='0xFFFFFFFF',
            shadowColor='0xFF000000',
            focusedColor='0xFFbababa',
            focusTexture=themecontrol.btn_focus,
            noFocusTexture=themecontrol.btn_nofocus)
        self.placeControl(self.ClearButton, 15, 36, rowspan=2, columnspan=8)
        self.connect(self.ClearButton, self.clearCache)
        '''
        Right Side, to display stuff for the above menu items
        '''
        self.cacheheader = '[B]Clear Base Cache[/B]'
        self.Header = pyxbmct.Label(self.cacheheader,
                                    alignment=pyxbmct.ALIGN_CENTER,
                                    textColor=self.colors.dh_color)
        self.placeControl(self.Header, 2, 20, rowspan=1, columnspan=40)
        self.Description = pyxbmct.Label(control.lang(32648).encode('utf-8'))
        self.placeControl(self.Description, 3, 21, rowspan=20, columnspan=40)
Example #11
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)
Example #12
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