Exemplo n.º 1
0
    def _getData(self):
        
        xbmcgui.lock()
        self.loadingMessage.setVisible(True)
        self.loadingMessage.setLabel('Fetching Data...')
        xbmcgui.unlock()
        
        try:
            authHandler = urllib2.HTTPBasicAuthHandler()
            authHandler.add_password(
                realm='SeedboxPy',
                uri=self.server['uri'],
                user=self.server['user'],
                passwd=self.server['passwd'],
            )

            urlOpener = urllib2.build_opener(authHandler)
            urllib2.install_opener(urlOpener)
            server_status_json = urllib2.urlopen(self.server['uri']).read()

            self.server_status = json.loads(server_status_json)
            
            return True
            
        except:
            xbmcgui.lock()
            self.loadingMessage.setVisible(False)
            xbmcgui.unlock()
            
            self._modal('Download Failed', 'Could not get the Server Status')
            
            return False
Exemplo n.º 2
0
 def _set_controls_values( self ):
     """ sets the value labels """
     xbmcgui.lock()
     try:
         self.getControl( 201 ).setLabel( self.getControl( 201 ).getLabel(), label2=self.settings[ "skin" ] )
         self.getControl( 202 ).setLabel( self.getControl( 202 ).getLabel(), label2=self.quality[ self.settings[ "trailer_quality" ] ] )
         self.getControl( 203 ).setLabel( self.getControl( 203 ).getLabel(), label2=self.mode[ self.settings[ "mode" ] ] )
         self.getControl( 204 ).setLabel( self.getControl( 204 ).getLabel(), label2=self.settings[ "save_folder" ] )
         self.getControl( 204 ).setEnabled( self.settings[ "mode" ] >= 1 )
         #self.getControl( 205 ).setLabel( _( 205 ) )
         self.getControl( 205 ).setSelected( self.settings[ "auto_play_all" ] )
         self.getControl( 206 ).setLabel( self.getControl( 206 ).getLabel(), label2=self.thumbnail[ self.settings[ "thumbnail_display" ] ] )
         #self.getControl( 207 ).setLabel( _( 207 ) )
         self.getControl( 207 ).setSelected( self.settings[ "fade_thumb" ] )
         self.getControl( 207 ).setEnabled( self.settings[ "thumbnail_display" ] == 0 )
         self.getControl( 208 ).setLabel( self.getControl( 208 ).getLabel(), label2=self.startup_categories[ self.settings[ "startup_category_id" ] ] )
         self.getControl( 209 ).setLabel( self.getControl( 209 ).getLabel(), label2=self.startup_categories[ self.settings[ "shortcut1" ] ] )
         self.getControl( 210 ).setLabel( self.getControl( 210 ).getLabel(), label2=self.startup_categories[ self.settings[ "shortcut2" ] ] )
         self.getControl( 211 ).setLabel( self.getControl( 211 ).getLabel(), label2=self.startup_categories[ self.settings[ "shortcut3" ] ] )
         #self.getControl( 212 ).setLabel( _( 212 ) )
         self.getControl( 212 ).setSelected( self.settings[ "refresh_newest" ] )
         #self.getControl( 213 ).setLabel( _( 213 ) )
         self.getControl( 213 ).setSelected( self.settings[ "use_simple_search" ] )
         #self.getControl( 214 ).setLabel( _( 214 ) )
         self.getControl( 214 ).setSelected( self.settings[ "match_whole_words" ] )
         self.getControl( 214 ).setEnabled( self.settings[ "use_simple_search" ] )
         self.getControl( 215 ).setLabel( self.getControl( 215 ).getLabel(), label2=self.videoplayer_displayresolutions[ self.settings[ "videoplayer_displayresolution" ] ] )
         self.getControl( 216 ).setLabel( self.getControl( 216 ).getLabel(), label2= self.settings[ "showtimes_local" ] )
         self.getControl( 217 ).setLabel( self.getControl( 217 ).getLabel(), label2=self.settings[ "showtimes_scraper" ] )
         #self.getControl( 218 ).setLabel( _( 218 ) )
         self.getControl( 218 ).setSelected( self.settings[ "refresh_trailers" ] )
         self.getControl( 250 ).setEnabled( self.settings_original != self.settings )
     except:
         pass
     xbmcgui.unlock()
Exemplo n.º 3
0
    def getCurrentVausRect( self ):
        try:
            # vaus step = 24
            xbmcgui.lock()
            vaus_pos = self.vausControl.getSelectedPosition()
            offset = vaus_pos * 24
            if self.vaus_statut != "BIG":
                # normal vaus
                vaus_width = self.defaultVausRect.w
            else:
                # big vaus
                vaus_width = self.defaultVausBigRect.w
            default_offset = int( ( vaus_width - 24 ) / 2 ) #-36
            offset -= default_offset
            if vaus_pos == 0:    offset += default_offset
            elif vaus_pos == 25: offset -= default_offset

            if self.vaus_statut != "BIG":
                # normal vaus
                if vaus_pos == 1:  offset += ( default_offset / 2 )
                elif vaus_pos == 24: offset -= ( default_offset / 2 )
            else:
                # big vaus
                if vaus_pos == 1:  offset += ( ( default_offset / 3 ) * 2 )
                elif vaus_pos == 2: offset += ( default_offset / 3 )
                elif vaus_pos == 23:  offset -= ( default_offset / 3 )
                elif vaus_pos == 24: offset -= ( ( default_offset / 3 ) * 2 )

            xbmcgui.unlock()
            return Rect( self.defaultWallRect.left+offset, self.defaultVausRect.top, vaus_width, self.defaultVausRect.h )
        except:
            print_exc()
        xbmcgui.unlock()
        return Rect( 0, 0, 0, 0 )
Exemplo n.º 4
0
    def __init__(self):
        if Emulating: xbmcgui.Window.__init__(self)
        xbmcgui.lock()
        self.setCoordinateResolution(6)
        self.addControl(xbmcgui.ControlImage(0,0,0,0, ScriptHome  + "background.png"))
        self.addControl(xbmcgui.ControlImage(50, 50, 0, 0,ScriptHome + "ircx_logo.png"))
        self.chan_topic = xbmcgui.ControlFadeLabel(60, 530,720-60*2, 30)
        self.addControl(self.chan_topic)
        self.chan_topic.addLabel("")

        self.curmsgline = 0
        # Control Decarlation Start
        self.usrlist = xbmcgui.ControlList(500, 130, 150, 300,itemTextXOffset=-5)
        self.addControl(self.usrlist)
        self.msgbox = xbmcgui.ControlList(40, 130, 460, 300,itemTextXOffset=-5)
        self.addControl(self.msgbox)
        global themessage
        global ircmg2
        self.ircmg = ircmg2
        self.themessage = themessage
        self.mymsg = xbmcgui.ControlLabel(60, 450, 370, 30, self.themessage)
        self.addControl(self.mymsg)

        SetupButtons(self, 520,450, 70, 30, "Hori",gap=10)
        self.but_sendmsg = AddButon(self,"Send")
        self.but_changemsg = AddButon(self,"Type MSG")
        self.but_sendmsg2usr = AddButon(self,"PM USR")

        self.but_chtopic = xbmcgui.ControlButton(500, 50, 150, 30, "Change Topic")
        self.addControl(self.but_chtopic)
        self.but_joinchan = xbmcgui.ControlButton(420, - 50, 150, 30, "Join Chan") # was y = 50
        self.addControl(self.but_joinchan)
        # Control Decarlation End

        # Navigation Code Start
        self.setFocus(self.but_sendmsg)

        self.but_sendmsg.controlRight(self.but_changemsg)
        self.but_changemsg.controlRight(self.but_sendmsg2usr)
        self.but_sendmsg2usr.controlRight(self.usrlist)
        #self.but_joinchan.controlRight(self.msgbox)
        self.but_chtopic.controlRight(self.msgbox)
        self.msgbox.controlRight(self.but_changemsg)
        #self.usrlist.controlRight(self.but_joinchan)
        self.usrlist.controlRight(self.but_chtopic)

        self.but_changemsg.controlLeft(self.but_sendmsg)
        self.but_sendmsg.controlLeft(self.msgbox) #usrlist
        #self.msgbox.controlLeft(self.but_joinchan)
        self.msgbox.controlLeft(self.but_chtopic)
        self.usrlist.controlLeft(self.but_sendmsg2usr)
        self.but_sendmsg2usr.controlLeft(self.but_changemsg)
        #self.but_joinchan.controlLeft(self.usrlist)
        self.but_chtopic.controlLeft(self.usrlist)
        self.but_sendmsg.controlUp(self.usrlist)
        self.msgbox.controlDown(self.but_sendmsg)
         # Navigation Code End

        xbmcgui.unlock()
        self.startircthread() # Executing Function to Create a thread
Exemplo n.º 5
0
 def update_center(self, n="default"):
     print("%s : %s" % (n, DB.get_room_by_name(n)))
     if n != "default":
         dev = DB.search_devices(room_id=DB.get_room_by_name(n).id)
         devices = []
         for d in dev:
             this_dev = (d.type, d.technology_id, d.id, d.name, DB.get_last_stat_of_device(d.id).value)
             devices.append(this_dev)
         print(devices)
     else:
         devices = [
             ("type1", "techno1", 1, "%s1" % n, "value1"),
             ("type2", "techno2", 2, "%s2" % n, "value2"),
             ("type3", "techno3", 3, "%s3" % n, "value3"),
             ("type4", "techno4", 4, "%s4" % n, "value4"),
             ("type5", "techno5", 5, "%s5" % n, "value5"),
             ("type6", "techno6", 6, "%s6" % n, "value6"),
             ("type7", "techno7", 7, "%s7" % n, "value7"),
             ("type8", "techno8", 8, "%s8" % n, "value8"),
             ("type9", "techno9", 9, "%s9" % n, "value9"),
             ("type10", "techno10", 10, "%s10" % n, "value10"),
             ("type11", "techno11", 11, "%s11" % n, "value11"),
             ("type12", "techno12", 12, "%s12" % n, "value12"),
             ("type13", "techno13", 13, "%s13" % n, "value13"),
         ]
     if self._set is not None:
         del self._set
     xbmcgui.lock()
     self._set = DeviceSet(self, self.left.menu, 150, 100, 4, devices)
     xbmcgui.unlock()
Exemplo n.º 6
0
 def show_lyrics( self, lyrics):
     try:
         xbmcgui.lock()
         self.reset_controls()
         self.getControl( 100 ).setText( "" )
         self.getControl( 200 ).setLabel( "" )
         self.menu_items = []
         self.allow_exception = False
         if ( self.current_song == lyrics.song ):
             lyricsText = lyrics.lyrics
             if (lyricsText == "{{Instrumental}}"):
                 lyricsText = "Instrumental"
             self.getControl( 100 ).setText( lyricsText )
             splitLyrics = lyricsText.splitlines()
             for x in splitLyrics:
                 self.getControl( 110 ).addItem( x )
             
             self.getControl( 110 ).selectItem( 0 )
             
             self.focus_lyrics()
             
             self.getControl( 200 ).setEnabled( False )
             self.getControl( 200 ).setLabel( lyrics.source )
         
     finally:
         xbmcgui.unlock()
Exemplo n.º 7
0
	def _setup_list( self ):
		xbmcgui.lock()
		#self.getControl( 502 ).setVisible( False )
		self.getControl( 503 ).setVisible( self.list_control == 0 )
		self.getControl( 504 ).setVisible( self.list_control == 1 )
		self.getControl( 505 ).setVisible( self.list_control == 0 and self.descriptions[ 0 ] != "" )
		self.getControl( 503 ).setVisible( True )
		self.getControl( 503 + self.list_control ).reset()
		for placemark in  self.choices:
			if len(self.choices) > 1:
				#if "lon" in placemark and "lat" in placemark:
				#	self.markercontainer.append(marker(self, float(placemark["lat"]), float(placemark["lon"]), BASE_RESOURCE_PATH + '\\skins\\Default\\media\\icon' + str(index) + '.png',12,38,24,38))
				list_item = xbmcgui.ListItem(placemark["name"], '', '', '')
			else:
				#if "lon" in placemark and "lat" in placemark:
				#	self.markercontainer.append(marker(self, float(placemark["lat"]), float(placemark["lon"])))
				#	self.zoom = 1
				list_item = xbmcgui.ListItem(placemark["name"], '', '', '')
			
			#listitem = xbmcgui.ListItem( choice, self.descriptions[ count ] )
			self.getControl( 503 + self.list_control ).addItem( list_item )
			#if ( count == self.original ):
			#	self.getControl( 503 + self.list_control ).selectItem( count )
			#	self.getControl( 503 + self.list_control ).getSelectedItem().select( True )
		self.getControl( 503 + self.list_control ).selectItem( self.selection )
		self.setFocus( self.getControl( 503 + self.list_control ) )
		xbmcgui.unlock()
Exemplo n.º 8
0
 def onControl(self, control):
     if not self.focusWindow == WINDOW_GAME:
         return
     LOG("OC1 - " + str(control.getId()))
     if control == self.btnUsername:
         oldname = self.username
         self.setUsername(unikeyboard(self.username, "Enter New Name"))
         self.dlgHighScores.replaceName(oldname, self.username, self.score)
         if self.dlgSubmit.username == "":
             self.dlgSubmit.setUsername(self.username)
     LOG("OC2")
     if control == self.btnNewGame:
         LOG("OC2.3")
         self.retVal = True
         xbmcgui.lock()
         self.close()
     LOG("OC3")
     if control == self.btnQuit:
         self.retVal = False
         xbmcgui.lock()
         self.close()
     LOG("OC4")
     if control == self.btnSubmit:
         self.focusWindow = WINDOW_SUBMIT
         self.dlgSubmit.doModal()
         self.focusWindow = WINDOW_GAME
     LOG("OC5")
     if control == self.btnHighScores:
         self.focusWindow = WINDOW_HIGHSCORE
         self.dlgHighScores.doModal()
         self.focusWindow = WINDOW_GAME
     LOG("OC6")
Exemplo n.º 9
0
 def __init__( self, *args, **kwargs ):
     logFile.info("contextmenu opening")
     xbmcgui.lock()
     self.parent = kwargs["parent"]
     self.menuItems = kwargs["menuItems"]
     self.selectedItem = None
     self.doModal()
Exemplo n.º 10
0
    def setupWindow( self ):
        error = 0
        try: xbmcgui.lock()
        except: pass
        # get the id for the current 'active' window as an integer.
        # http://wiki.xbmc.org/index.php?title=Window_IDs
        try: currentWindowId = xbmcgui.getCurrentWindowId()
        except: currentWindowId = self.window

        if hasattr( self.button, "isSelected" ):
            self.canceled = self.button.isSelected()
        if hasattr( self.window, "getProperty" ):
            self.canceled = self.canceled  or ( self.window.getProperty( "DialogAddonScan.Cancel" ) == "true" )
        if hasattr( self.window, "setProperty" ):
            self.window.setProperty( "DialogAddonScan.Hide", __settings__.getSetting( "hidedialog" ) )

        #if self.window is None and hasattr( currentWindowId, "__int__" ):
        #    self.window = xbmcgui.Window( currentWindowId )
        if hasattr( currentWindowId, "__int__" ) and currentWindowId != self.windowId:
            self.removeControls()
            self.windowId = currentWindowId
            self.window = xbmcgui.Window( self.windowId )
            self.initialize()

        if not self.window or not hasattr( self.window, "addControl" ):
            self.removeControls()
            error = 1

        self.window.setProperty( "DialogAddonScan.Hide", __settings__.getSetting( "hidedialog" ) )
        xbmcgui.unlock()
        if error:
            raise xbmcguiWindowError( "xbmcgui.Window(%s)" % repr( currentWindowId ) )

        #self.canceled = ( self.window.getProperty( "DialogAddonScan.Cancel" ) == "true" )
        self.window.setProperty( "DialogAddonScan.IsAlive", "true" )
Exemplo n.º 11
0
    def _set_controls_labels( self ):
        xbmcgui.lock()
        self.i_itemId = self.i_itemId or str( self.mainwin.getCurrentListPosition()+1 )
        try:
            if self.i_previewPicture:
                filename = os.path.basename( self.i_previewPicture )
                thumbnail = os.path.join( BASE_THUMBS_PATH, filename[ 0 ], filename )
                if os.path.isfile( thumbnail ): self.i_thumbnail = thumbnail
        except:
            print_exc()
        try:
            self.getControl( 48 ).reset()
            listitem = xbmcgui.ListItem( self.i_title, "", self.i_thumbnail, self.i_thumbnail )
            listitem.setProperty( "title", self.i_title )
            listitem.setProperty( "itemId", self.i_itemId )
            listitem.setProperty( "author", self.i_author )
            listitem.setProperty( "DLSource", self.i_dlsource )
            listitem.setProperty( "type", self.i_type )
            listitem.setProperty( "language", self.i_language )
            listitem.setProperty( "version", self.i_version )
            listitem.setProperty( "date", self.i_date )
            listitem.setProperty( "added", self.i_added )
            listitem.setProperty( "outline", self.i_outline )
            #listitem.setProperty( "rating", self.i_rating ) # not implanted
            listitem.setProperty( "fileName", self.i_fileName )

            listitem.setProperty( "description", self.i_description or _( 604 ) )
            listitem.setProperty( "fanartpicture", self.i_previewPicture )
            listitem.setProperty( "previewVideoURL", self.i_previewVideoURL )
            self.getControl( 48 ).addItem( listitem )
        except:
            print_exc()
        xbmcgui.unlock()
Exemplo n.º 12
0
    def download_data(self, arg, func, save=False):
        """Show a progress dialog while downloading and return the data."""

        if (save):
            self.func = func
            self.arg = arg

        xbmcgui.lock()

        dlg = xbmcgui.DialogProgress()
        dlg.create('YouTube', 'Downloading...')

        self.yt.set_report_hook(self.progress_handler, dlg)

        try:

            data = func(arg)

        except:
            dlg.close()
            err_dlg = xbmcgui.Dialog()
            err_dlg.ok('YouTube', 'There was an error.')
            return None

        dlg.close()

        xbmcgui.unlock()

        return data
Exemplo n.º 13
0
 def _set_controls_values( self ):
     """ sets the value labels """
     xbmcgui.lock()
     try:
         self.getControl( 201 ).setLabel( _( 201 ), label2=self.scrapers_title[ self.current_scraper ] )
         self.getControl( 202 ).setLabel( _( 202 ) )
         self.getControl( 202 ).setSelected( self.settings[ "save_lyrics" ] )
         self.getControl( 203 ).setLabel( _( 203 ), label2=self.settings[ "lyrics_path" ] )
         self.getControl( 203 ).setEnabled( self.settings[ "save_lyrics" ] )
         self.getControl( 204 ).setLabel( _( 204 ) )
         self.getControl( 204 ).setSelected( self.settings[ "smooth_scrolling" ] )
         self.getControl( 205 ).setLabel( _( 205 ) )
         self.getControl( 205 ).setSelected( self.settings[ "show_viz" ] )
         self.getControl( 206 ).setLabel( _( 206 ) )
         self.getControl( 206 ).setSelected( self.settings[ "use_filename" ] )
         self.getControl( 207 ).setLabel( _( 207 ), label2=self.filename_format[ self.settings[ "filename_format" ] ] )
         self.getControl( 208 ).setLabel( _( 208 ), label2=self.settings[ "music_path" ] )
         self.getControl( 209 ).setLabel( _( 209 ) )
         self.getControl( 209 ).setSelected( self.settings[ "shuffle" ] )
         self.getControl( 210 ).setLabel( _( 210 ) )
         self.getControl( 210 ).setSelected( self.settings[ "compatible" ] )
         self.getControl( 210 ).setEnabled( self.settings[ "save_lyrics" ] )
         self.getControl( 211 ).setLabel( _( 211 ) )
         self.getControl( 211 ).setSelected( self.settings[ "use_extension" ] )
         self.getControl( 211 ).setEnabled( self.settings[ "save_lyrics" ] )
         self.getControl( 250 ).setEnabled( self.settings_original != self.settings )
         self.getControl( 254 ).setEnabled( not xbmc.Player().isPlayingAudio() )
     except:
         pass
     xbmcgui.unlock()
Exemplo n.º 14
0
 def _fetch_10day_forecast(self):
     # fetch hour by hour forecast
     alerts, alertscolor, alertscount, headings, forecasts = self.TWCClient.fetch_10day_forecast()
     # lock the gui for faster updating
     xbmcgui.lock()
     try:
         # set any alerts
         self._set_alerts(alerts, alertscolor, alertscount)
         # reset list
         self.getControl(self.CONTROL_10DAY_LIST).reset()
         # enumerate thru and set our heading properties
         for count, heading in enumerate(headings):
             self.CURRENT_WINDOW.setProperty("10DayHead%d" % (count + 1,), heading.strip())
         # enumerate thru and set the info
         for forecast in forecasts:
             listitem = xbmcgui.ListItem(forecast[0])
             listitem.setProperty("date", forecast[1])
             listitem.setProperty("icon", forecast[2])
             listitem.setProperty("brief", forecast[3].replace(" / ", "/").replace(" ", "\n").replace("/", " /\n"))
             listitem.setProperty("high", forecast[4])
             listitem.setProperty("low", forecast[5])
             listitem.setProperty("precip", forecast[6])
             listitem.setProperty("wind", forecast[7])
             listitem.setProperty("speed", forecast[8])
             self.getControl(self.CONTROL_10DAY_LIST).addItem(listitem)
     except:
         pass
     # unlock the gui
     xbmcgui.unlock()
Exemplo n.º 15
0
    def onAction(self, action):
        if action == ACTION_PREVIOUS_MENU:
            self.close()

        elif (
            action == ACTION_MOVE_LEFT
            or action == ACTION_MOVE_RIGHT
            or action == ACTION_MOVE_UP
            or action == ACTION_MOVE_DOWN
            or action == ACTION_PAGE_UP
            or action == ACTION_PAGE_DOWN
            or action == ACTION_SCROLL_UP
            or action == ACTION_SCROLL_DOWN
        ):

            def SubthreadUpdate(self):
                self.lblDescription.reset()
                try:
                    self.lblDescription.setText(self.listedItems[self.lstVideos.getSelectedPosition()].description)
                except:
                    pass

            subThread = threading.Thread(target=SubthreadUpdate, args=[self])
            subThread.setDaemon(True)
            xbmcgui.lock()
            subThread.start()
            subThread.join(0.05)
            xbmcgui.unlock()

        if action == ACTION_MOVE_LEFT:
            self.setFocus(self.btnCategories[self.currentCategory])
Exemplo n.º 16
0
 def _show_credits( self ):
     try:
         xbmcgui.lock()
         #team credits
         self.getControl( 20 ).setLabel( __scriptname__ )
         self.getControl( 30 ).setLabel( "%s: %s-%s" % ( _( 1006 ), __version__, __svn_revision__, ) )
         self.getControl( 40 ).addLabel( __svn_url__ )
         self.getControl( 901 ).setLabel( _( 901 ) )
         self.getControl( 101 ).reset()
         list_item = xbmcgui.ListItem( sys.modules[ "__main__" ].__credits_l1__, sys.modules[ "__main__" ].__credits_r1__ )
         self.getControl( 101 ).addItem( list_item )
         list_item = xbmcgui.ListItem( sys.modules[ "__main__" ].__credits_l2__, sys.modules[ "__main__" ].__credits_r2__ )
         self.getControl( 101 ).addItem( list_item )
         list_item = xbmcgui.ListItem( sys.modules[ "__main__" ].__credits_l3__, sys.modules[ "__main__" ].__credits_r3__ )
         self.getControl( 101 ).addItem( list_item )
         # Additional credits
         self.getControl( 902 ).setLabel( _( 902 ) )
         self.getControl( 102 ).reset()
         list_item = xbmcgui.ListItem( sys.modules[ "__main__" ].__add_credits_l1__, sys.modules[ "__main__" ].__add_credits_r1__ )
         self.getControl( 102 ).addItem( list_item )
         list_item = xbmcgui.ListItem( sys.modules[ "__main__" ].__add_credits_l2__, sys.modules[ "__main__" ].__add_credits_r2__ )
         self.getControl( 102 ).addItem( list_item )
         list_item = xbmcgui.ListItem( sys.modules[ "__main__" ].__add_credits_l3__, sys.modules[ "__main__" ].__add_credits_r3__ )
         self.getControl( 102 ).addItem( list_item )
         # Skin credits
         self.getControl( 903 ).setLabel( _( 903 ) )
     except:
         pass
     xbmcgui.unlock()
 def refresh(self):
     xbmcgui.lock()
     self.getCurr()
     xbmcgui.unlock()
     #print "hello world"
     self.t = Timer(30.0,self.refresh)
     self.t.start()
Exemplo n.º 18
0
 def CtMnUpdateItem(self, selectedIndex):
     logFile.debug('Updating item (Called from ContextMenu)')
     #tempPB = uriPB = xbmcgui.DialogProgress()
     #tempPB.create("Updating item", "Please Wait")
     xbmcgui.lock()
     self.onUpDown(ignoreDisabled = True)
     xbmcgui.unlock()
Exemplo n.º 19
0
 def _fetch_hour_forecast(self):
     # fetch hour by hour forecast
     alerts, alertscolor, alertscount, headings, forecasts = self.TWCClient.fetch_hour_forecast(
     )
     try:
         # set any alerts
         self._set_alerts(alerts, alertscolor, alertscount)
         # lock the gui for faster updating
         xbmcgui.lock()
         # reset list
         self.getControl(self.CONTROL_HOUR_LIST).reset()
         # enumerate thru and set our heading properties
         for count, heading in enumerate(headings):
             self.CURRENT_WINDOW.setProperty("HBHHead%d" % (count + 1, ),
                                             heading)
         # enumerate thru and set the info
         for forecast in forecasts:
             listitem = xbmcgui.ListItem(forecast[0])
             listitem.setProperty("icon", forecast[1])
             listitem.setProperty("temp", forecast[2])
             listitem.setProperty("brief", forecast[3])
             listitem.setProperty("feels", forecast[4])
             listitem.setProperty("precip", forecast[5])
             #listitem.setProperty( "dew", forecast[ 6 ] )
             listitem.setProperty("humidity", forecast[6])
             listitem.setProperty("wind", forecast[7])
             self.getControl(self.CONTROL_HOUR_LIST).addItem(listitem)
     except:
         pass
     # unlock the gui
     xbmcgui.unlock()
Exemplo n.º 20
0
 def _fetch_10day_forecast(self):
     # fetch hour by hour forecast
     alerts, alertscolor, alertscount, headings, forecasts = self.TWCClient.fetch_10day_forecast(
     )
     # lock the gui for faster updating
     xbmcgui.lock()
     try:
         # set any alerts
         self._set_alerts(alerts, alertscolor, alertscount)
         # reset list
         self.getControl(self.CONTROL_10DAY_LIST).reset()
         # enumerate thru and set our heading properties
         for count, heading in enumerate(headings):
             self.CURRENT_WINDOW.setProperty("10DayHead%d" % (count + 1, ),
                                             heading.strip())
         # enumerate thru and set the info
         for forecast in forecasts:
             listitem = xbmcgui.ListItem(forecast[0])
             listitem.setProperty("date", forecast[1])
             listitem.setProperty("icon", forecast[2])
             listitem.setProperty(
                 "brief", forecast[3].replace(" / ", "/").replace(
                     " ", "\n").replace("/", " /\n"))
             listitem.setProperty("high", forecast[4])
             listitem.setProperty("low", forecast[5])
             listitem.setProperty("precip", forecast[6])
             listitem.setProperty("wind", forecast[7])
             listitem.setProperty("speed", forecast[8])
             self.getControl(self.CONTROL_10DAY_LIST).addItem(listitem)
     except:
         pass
     # unlock the gui
     xbmcgui.unlock()
Exemplo n.º 21
0
 def _fetch_36_forecast(self, showView=True):
     # fetch 36 hour forecast
     alerts, alertscolor, alertscount, forecasts, video = self.TWCClient.fetch_36_forecast(
         self.CURRENT_WINDOW.getProperty("Video")
     )
     # lock the gui for faster updating
     xbmcgui.lock()
     try:
         # set any alerts
         self._set_alerts(alerts, alertscolor, alertscount)
         # set video
         self._set_video(video)
         # enumerate thru and set the info
         for day, forecast in enumerate(forecasts):
             self.CURRENT_WINDOW.setProperty("36Hour%dicon" % (day + 1,), forecast[1])
             self.CURRENT_WINDOW.setProperty("36Hour%dbrief" % (day + 1,), forecast[2])
             self.CURRENT_WINDOW.setProperty("36Hour%dtemptitle" % (day + 1,), forecast[3])
             self.CURRENT_WINDOW.setProperty("36Hour%dtemp" % (day + 1,), forecast[4])
             self.CURRENT_WINDOW.setProperty("36Hour%dpreciptitle" % (day + 1,), forecast[5])
             self.CURRENT_WINDOW.setProperty("36Hour%dprecip" % (day + 1,), forecast[6])
             self.CURRENT_WINDOW.setProperty("36Hour%doutlook" % (day + 1,), forecast[7])
             self.CURRENT_WINDOW.setProperty("36Hour%ddaylight" % (day + 1,), forecast[8])
             self.CURRENT_WINDOW.setProperty("36Hour%dtitle" % (day + 1,), forecast[0])
     except:
         pass
     # unlock the gui
     xbmcgui.unlock()
Exemplo n.º 22
0
 def refresh(self):
     self.lock.acquire()
     xbmcgui.lock()
     try:
         #May be XBMC is not playing any media file
         cur_time = xbmc.Player().getTime()
         nums = self.getControl( 110 ).size()
         pos = self.getControl( 110 ).getSelectedPosition()
         if (cur_time < self.pOverlay[pos][0]):
             while (pos > 0 and self.pOverlay[pos - 1][0] > cur_time):
                 pos = pos -1
         else:
             while (pos < nums - 1 and self.pOverlay[pos + 1][0] < cur_time):
                 pos = pos +1
             if (pos + 5 > nums - 1):
                 self.getControl( 110 ).selectItem( nums - 1 )
             else:
                 self.getControl( 110 ).selectItem( pos + 5 )
         self.getControl( 110 ).selectItem( pos )
         self.setFocus( self.getControl( 110 ) )
         if (self.allowtimer and cur_time < self.pOverlay[nums - 1][0]):
             waittime = self.pOverlay[pos + 1][0] - cur_time
             self.timer = Timer(waittime, self.refresh)
             self.timer.start()
         xbmcgui.unlock()
         self.lock.release()
     except:
         xbmcgui.unlock()
         self.lock.release()
Exemplo n.º 23
0
 def show_choices( self, choices ):
     xbmcgui.lock()
     for song in choices:
         self.getControl( 120 ).addItem( song[ 0 ] )
     self.getControl( 120 ).selectItem( 0 )
     self.menu_items = choices
     self.show_control( 120 )
Exemplo n.º 24
0
 def _set_controls_values(self):
     """ sets the value labels """
     xbmcgui.lock()
     try:
         self.getControl(201).setLabel(
             self.getControl(201).getLabel(),
             label2=self.scrapers_title[self.current_scraper])
         self.getControl(202).setSelected(self.settings["save_lyrics"])
         self.getControl(203).setLabel(self.getControl(203).getLabel(),
                                       label2=self.settings["lyrics_path"])
         self.getControl(203).setEnabled(self.settings["save_lyrics"])
         self.getControl(204).setSelected(self.settings["smooth_scrolling"])
         self.getControl(205).setSelected(self.settings["show_viz"])
         self.getControl(206).setSelected(self.settings["use_filename"])
         self.getControl(207).setLabel(
             self.getControl(207).getLabel(),
             label2=self.filename_format[self.settings["filename_format"]])
         self.getControl(208).setLabel(self.getControl(208).getLabel(),
                                       label2=self.settings["music_path"])
         self.getControl(209).setSelected(self.settings["shuffle"])
         self.getControl(209).setEnabled(self.settings["music_path"] != "")
         self.getControl(210).setSelected(self.settings["compatible"])
         self.getControl(210).setEnabled(self.settings["save_lyrics"])
         self.getControl(211).setSelected(self.settings["use_extension"])
         self.getControl(211).setEnabled(self.settings["save_lyrics"])
         self.getControl(250).setEnabled(
             self.settings_original != self.settings)
         self.getControl(254).setEnabled(not xbmc.Player().isPlayingAudio())
     except:
         pass
     xbmcgui.unlock()
Exemplo n.º 25
0
	def download_data(self, arg, func, save=False):
		"""Show a progress dialog while downloading and return the data."""

		if (save):
			self.func = func
			self.arg = arg
		
		xbmcgui.lock()
		
		dlg = xbmcgui.DialogProgress()
		dlg.create('YouTube', 'Downloading...')
			
		
		self.yt.set_report_hook(self.progress_handler, dlg)

		try:
		
			data = func(arg)
			
		except:
			dlg.close()
			err_dlg = xbmcgui.Dialog()
			err_dlg.ok('YouTube', 'There was an error.')			
			return None
		

		dlg.close()

		xbmcgui.unlock()	
		
		return data
Exemplo n.º 26
0
    def getCurrentVausRect( self ):
        try:
            # vaus step = 24
            xbmcgui.lock()
            vaus_pos = self.vausControl.getSelectedPosition()
            offset = vaus_pos * 24
            if self.vaus_statut != "BIG":
                # normal vaus
                vaus_width = self.defaultVausRect.w
            else:
                # big vaus
                vaus_width = self.defaultVausBigRect.w
            default_offset = int( ( vaus_width - 24 ) / 2 ) #-36
            offset -= default_offset
            if vaus_pos == 0:    offset += default_offset
            elif vaus_pos == 25: offset -= default_offset

            if self.vaus_statut != "BIG":
                # normal vaus
                if vaus_pos == 1:  offset += ( default_offset / 2 )
                elif vaus_pos == 24: offset -= ( default_offset / 2 )
            else:
                # big vaus
                if vaus_pos == 1:  offset += ( ( default_offset / 3 ) * 2 )
                elif vaus_pos == 2: offset += ( default_offset / 3 )
                elif vaus_pos == 23:  offset -= ( default_offset / 3 )
                elif vaus_pos == 24: offset -= ( ( default_offset / 3 ) * 2 )

            xbmcgui.unlock()
            return Rect( self.defaultWallRect.left+offset, self.defaultVausRect.top, vaus_width, self.defaultVausRect.h )
        except:
            print_exc()
        xbmcgui.unlock()
        return Rect( 0, 0, 0, 0 )
Exemplo n.º 27
0
 def _fetch_hour_forecast(self):
     # fetch hour by hour forecast
     alerts, alertscolor, alertscount, headings, forecasts = self.TWCClient.fetch_hour_forecast()
     try:
         # set any alerts
         self._set_alerts(alerts, alertscolor, alertscount)
         # lock the gui for faster updating
         xbmcgui.lock()
         # reset list
         self.getControl(self.CONTROL_HOUR_LIST).reset()
         # enumerate thru and set our heading properties
         for count, heading in enumerate(headings):
             self.CURRENT_WINDOW.setProperty("HBHHead%d" % (count + 1,), heading)
         # enumerate thru and set the info
         for forecast in forecasts:
             listitem = xbmcgui.ListItem(forecast[0])
             listitem.setProperty("icon", forecast[1])
             listitem.setProperty("temp", forecast[2])
             listitem.setProperty("brief", forecast[3])
             listitem.setProperty("feels", forecast[4])
             listitem.setProperty("precip", forecast[5])
             # listitem.setProperty( "dew", forecast[ 6 ] )
             listitem.setProperty("humidity", forecast[6])
             listitem.setProperty("wind", forecast[7])
             self.getControl(self.CONTROL_HOUR_LIST).addItem(listitem)
     except:
         pass
     # unlock the gui
     xbmcgui.unlock()
Exemplo n.º 28
0
 def refresh(self):
     self.lock.acquire()
     xbmcgui.lock()
     try:
         #May be XBMC is not playing any media file
         cur_time = xbmc.Player().getTime()
         nums = self.getControl(110).size()
         pos = self.getControl(110).getSelectedPosition()
         if (cur_time < self.pOverlay[pos][0]):
             while (pos > 0 and self.pOverlay[pos - 1][0] > cur_time):
                 pos = pos - 1
         else:
             while (pos < nums - 1
                    and self.pOverlay[pos + 1][0] < cur_time):
                 pos = pos + 1
             if (pos + 5 > nums - 1):
                 self.getControl(110).selectItem(nums - 1)
             else:
                 self.getControl(110).selectItem(pos + 5)
         self.getControl(110).selectItem(pos)
         self.setFocus(self.getControl(110))
         if (self.allowtimer and cur_time < self.pOverlay[nums - 1][0]):
             waittime = self.pOverlay[pos + 1][0] - cur_time
             self.timer = Timer(waittime, self.refresh)
             self.timer.start()
         xbmcgui.unlock()
         self.lock.release()
     except:
         xbmcgui.unlock()
         self.lock.release()
Exemplo n.º 29
0
	def onControl(self, control):
		if not self.listen:
			return
		LOG('OC1 - ' + str(control.getId()))
		if control == self.btnUsername:
			oldname = self.username
			self.setUsername(unikeyboard(self.username, _(76)))
			self.dlgHighScores.replaceName(oldname, self.username, self.score)
			if self.dlgSubmit.username == '':
				self.dlgSubmit.setUsername(self.username)
		LOG('OC2')
		if control == self.btnNewGame:
			LOG('OC2.3')
			self.retVal = True
			xbmcgui.lock()
			self.close()
		LOG('OC3')
		if control == self.btnQuit:
			self.retVal = False
			xbmcgui.lock()
			self.close()
		LOG('OC4')
		if control == self.btnSubmit:
			self.listen = False
			self.dlgSubmit.doModal()
			self.listen = True
		LOG('OC5')
		if control == self.btnHighScores:
			self.listen = False
			self.dlgHighScores.doModal()
			self.listen = True
		LOG('OC6')
Exemplo n.º 30
0
    def onAction(self, action):
        #
        # Exit
        #
        if (action in self.ACTION_EXIT_SCRIPT):
            # File changed, save?
            if self.fileChanged:
                dialog = xbmcgui.Dialog()
                save = xbmcgui.Dialog().yesno(self.fileName,
                                              xbmc.getLocalizedString(30203))
                if save:
                    xbmcgui.lock()
                    numLines = self.listControl.size()
                    textLines = []
                    for i in range(0, numLines):
                        textLine = self.listControl.getListItem(i).getLabel2()
                        if i < numLines - 1:
                            textLine = textLine + os.linesep
                        textLines.append(textLine)
                    xbmcgui.unlock()

                    # Save file...
                    f = open(self.file, "wb")
                    f.writelines(textLines)
                    f.close()

            # Close window...
            self.close()
Exemplo n.º 31
0
 def CtMnUpdateItem(self, selectedIndex):
     logFile.debug('Updating item (Called from ContextMenu)')
     #tempPB = uriPB = xbmcgui.DialogProgress()
     #tempPB.create("Updating item", "Please Wait")
     xbmcgui.lock()
     self.onUpDown(ignoreDisabled=True)
     xbmcgui.unlock()
Exemplo n.º 32
0
	def onAction(self, action):
		LOG("PW - OA")
		if not self.listen:
			return
		if action.getId() == ACTION_PREVIOUS_MENU or action.getId() == ACTION_PAUSE or action.getButtonCode() == KEY_BUTTON_START:
			xbmcgui.lock()
			self.close()
Exemplo n.º 33
0
 def _fill_cast( self, listitem ):
     xbmcgui.lock()
     try:
         # clear the cast list
         self.getControl( self.CONTROL_INFO_CAST ).reset()
         # grab the cast from the main lists listitem, we use this for actor thumbs
         cast = xbmc.getInfoLabel( "Container(100).ListItem.Cast" )
         # if cast exists we fill the cast list
         if ( cast ):
             # we set these class variables for the player
             self.title = xbmc.getInfoLabel( "Container(100).ListItem.Title" )
             self.genre = xbmc.getInfoLabel( "Container(100).ListItem.Genre" )
             self.plot = xbmc.getInfoLabel( "Container(100).ListItem.Plot" )
             self.director = xbmc.getInfoLabel( "Container(100).ListItem.Director" )
             self.year = int( xbmc.getInfoLabel( "Container(100).ListItem.Year" ) )
             self.trailer = xbmc.getInfoLabel( "Container(100).ListItem.Trailer" )
             self.thumb = xbmc.getInfoImage( "Container(100).ListItem.Thumb" )
             # we actually use the ListItem.CastAndRole infolabel to fill the list
             role = xbmc.getInfoLabel( "Container(100).ListItem.CastAndRole" ).split( "\n" )
             # enumerate through our cast list and set cast and role
             for count, actor in enumerate( cast.split( "\n" ) ):
                 # create the actor cached thumb
                 actor_path = xbmc.translatePath( os.path.join( "P:\\Thumbnails", "Video", xbmc.getCacheThumbName( "actor" + actor )[ 0 ], xbmc.getCacheThumbName( "actor" + actor ) ) )
                 # if an actor thumb exists use it, else use the default thumb
                 actor_thumbnail = ( "DefaultActorBig.png", actor_path, )[ os.path.isfile( actor_path ) ]
                 # set the default icon
                 actor_icon = "DefaultActorBig.png"
                 # add the item to our cast list
                 self.getControl( self.CONTROL_INFO_CAST ).addItem( xbmcgui.ListItem( role[ count ], iconImage=actor_icon, thumbnailImage=actor_thumbnail ) )
             # set the play trailer buttons status
             self._set_trailer_button( self.trailer )
     except:
         pass
     xbmcgui.unlock()
Exemplo n.º 34
0
 def onControl(self, control):
     if not self.focusWindow == WINDOW_GAME:
         return
     LOG('OC1 - ' + str(control.getId()))
     if control == self.btnUsername:
         oldname = self.username
         self.setUsername(unikeyboard(self.username, "Enter New Name"))
         self.dlgHighScores.replaceName(oldname, self.username, self.score)
         if self.dlgSubmit.username == '':
             self.dlgSubmit.setUsername(self.username)
     LOG('OC2')
     if control == self.btnNewGame:
         LOG('OC2.3')
         self.retVal = True
         xbmcgui.lock()
         self.close()
     LOG('OC3')
     if control == self.btnQuit:
         self.retVal = False
         xbmcgui.lock()
         self.close()
     LOG('OC4')
     if control == self.btnSubmit:
         self.focusWindow = WINDOW_SUBMIT
         self.dlgSubmit.doModal()
         self.focusWindow = WINDOW_GAME
     LOG('OC5')
     if control == self.btnHighScores:
         self.focusWindow = WINDOW_HIGHSCORE
         self.dlgHighScores.doModal()
         self.focusWindow = WINDOW_GAME
     LOG('OC6')
Exemplo n.º 35
0
    def show_lyrics(self, lyrics):
        try:
            xbmcgui.lock()
            self.reset_controls()
            self.getControl(100).setText("")
            self.getControl(200).setLabel("")
            self.menu_items = []
            self.allow_exception = False
            if (self.current_song == lyrics.song):
                lyricsText = lyrics.lyrics
                if (lyricsText == "{{Instrumental}}"):
                    lyricsText = "Instrumental"
                self.getControl(100).setText(lyricsText)
                splitLyrics = lyricsText.splitlines()
                for x in splitLyrics:
                    self.getControl(110).addItem(x)

                self.getControl(110).selectItem(0)

                self.focus_lyrics()

                self.getControl(200).setEnabled(False)
                self.getControl(200).setLabel(lyrics.source)

        finally:
            xbmcgui.unlock()
Exemplo n.º 36
0
	def __init__(self):
	
		self.addControl(xbmcgui.ControlImage(0,0,720,576, 'background.png'))
		self.list = xbmcgui.ControlList(200, 100, 400, 400)
		self.strAction = xbmcgui.ControlLabel(50, 100, 100, 20, 'action', 'font13', '0xFFFF3300')
		self.strButton = xbmcgui.ControlLabel(50, 150, 100, 20, 'button', 'font13', '0xFFFFFFFF')
		
		self.addControl(self.list)
		self.addControl(self.strAction)
		self.addControl(self.strButton)
				
		self.button1 = xbmcgui.ControlButton(50, 200, 90, 30, "Button 1")
		self.button2 = xbmcgui.ControlButton(50, 240, 90, 30, "Button 2")
		self.addControl(self.button1)
		self.addControl(self.button2)
		
		self.button1.controlDown(self.button2)
		self.button1.controlRight(self.list)
		self.button2.controlUp(self.button1)
		self.button2.controlRight(self.list)
		self.list.controlLeft(self.button1)
		
		# add a few items to the list
		xbmcgui.lock()
		for i in range(50):
			self.list.addItem('item' + str(i))
		xbmcgui.unlock()
		self.setFocus(self.button1)
Exemplo n.º 37
0
    def hidegroup(self, strgrp):
        """
            hides all controls that have group=strgroup
            if strgrp is "" nothing will happen
        """
        log.debug("hidegroup( strgrp=[%s] )"%strgrp )
        
        # lock the gui for speed
        xbmcgui.lock()
        isLocked = 1
        
        try:
            # add/hide all the controls
            for id in self.controls:
                n = self.controls[id]
                m = n.getoption("group")
                try:
                    if m == strgrp:
                        if os.name != "nt":
                            n.control.setVisible(False)
                        else:
                            self.removeControl(n.control)
                except:
                    pass
                    
            # unlock the gui
            xbmcgui.unlock()
            isLocked = 0

        except:
            if isLocked > 0:
                xbmcgui.unlock()
            traceback.print_exc()
            raise
Exemplo n.º 38
0
 def setupvars(self):
     xbmcgui.lock()
     self.unreadvalue = 0
     self.click = 0
     self.ziplist = []
     self.subject = self.emailsettings[1][0]
     self.emfrom = self.emailsettings[1][1]
     self.to = self.myemail.get('to').replace("\n","")
     self.cc = self.myemail.get('Cc')
     if self.cc == None:
         self.cc = ""
     else:self.cc = self.cc.replace("\n","")
     date = self.myemail.get('date')
     if date == None:
         mytime = time.strptime(xbmc.getInfoLabel("System.Date") + xbmc.getInfoLabel("System.Time"),'%A , %B %d, %Y %I:%M %p')
         self.sent = time.strftime('%a, %d %b %Y %X +0000',mytime).replace("\n","")
     else:self.sent = str(date).replace("\n","")
     self.attachments = []
     self.replyvalue = 0
     self.curpos = 0
     self.showing = False
     self.returnvalue = "-"
     self.control_action = XinBox_Util.setControllerAction()
     self.attachlist = False
     xbmc.executebuiltin("Skin.Reset(attachlistnotempty)")
     xbmc.executebuiltin("Skin.Reset(emaildialog)")
Exemplo n.º 39
0
 def _get_log_list(self, channel):
     try:
         self.getControl(self.CONTROL_LABEL_HEADING).setLabel(
             "%s - (%s)" % (
                 __script__,
                 channel,
             ))
         self.getControl(self.CONTROL_LIST_LOGS).reset()
         self.getControl(self.CONTROL_LIST_MESSAGES).reset()
         self.getControl(self.CONTROL_LABEL_LOG_TITLE).setLabel("")
         self.getControl(
             self.CONTROL_LIST_LOGS).addItem("Fetching log list...")
         xbmcgui.lock()
         htmlSource = self._fetch_info(url=self.BASE_LOG_URL % self.domain)
         log_list = self._parse_list(htmlSource)
         self.getControl(self.CONTROL_LIST_LOGS).reset()
         for log in log_list:
             # create our listitem
             listitem = xbmcgui.ListItem(log[1], log[0])
             self.getControl(self.CONTROL_LIST_LOGS).addItem(listitem)
         self.setFocus(self.getControl(self.CONTROL_LIST_LOGS))
     except:
         # oops print error message
         print "ERROR: %s::%s (%d) - %s" % (
             self.__class__.__name__,
             sys.exc_info()[2].tb_frame.f_code.co_name,
             sys.exc_info()[2].tb_lineno,
             sys.exc_info()[1],
         )
         self.setFocus(self.getControl(self.CONTROL_BUTTON_XBMC))
     xbmcgui.unlock()
Exemplo n.º 40
0
	def init_button_state(self):
		xbmcgui.lock()
		
		visible = True
		self.getControl(02).setVisible(visible)
		self.getControl(10).setVisible(visible)
		self.getControl(11).setVisible(visible)
		self.getControl(14).setVisible(visible)
		self.getControl(13).setVisible(visible)	
		
		visible = False
		self.getControl(6).setVisible(visible)
		self.getControl(20).setVisible(visible)
		self.getControl(21).setVisible(visible)
		self.getControl(22).setVisible(visible)
		self.getControl(23).setVisible(visible)
		self.getControl(24).setVisible(visible)
		self.getControl(25).setVisible(visible)
		self.getControl(26).setVisible(visible)
		self.getControl(27).setVisible(visible)		
		self.getControl(28).setVisible(visible)		

		self.getControl(30).setVisible(visible)
		self.getControl(31).setVisible(visible)
		self.getControl(32).setVisible(visible)
		self.getControl(33).setVisible(visible)

		self.getControl(90).setVisible(visible)
		self.getControl(91).setVisible(visible)
		self.getControl(92).setVisible(visible)
		
		self.getControl(40).setVisible(visible)
		self.getControl(41).setVisible(visible)		

		xbmcgui.unlock()
Exemplo n.º 41
0
 def _fetch_36_forecast(self, showView=True):
     # fetch 36 hour forecast
     alerts, alertscolor, alertscount, forecasts, video = self.TWCClient.fetch_36_forecast(
         self.CURRENT_WINDOW.getProperty("Video"))
     # lock the gui for faster updating
     xbmcgui.lock()
     try:
         # set any alerts
         self._set_alerts(alerts, alertscolor, alertscount)
         # set video
         self._set_video(video)
         # enumerate thru and set the info
         for day, forecast in enumerate(forecasts):
             self.CURRENT_WINDOW.setProperty("36Hour%dicon" % (day + 1, ),
                                             forecast[1])
             self.CURRENT_WINDOW.setProperty("36Hour%dbrief" % (day + 1, ),
                                             forecast[2])
             self.CURRENT_WINDOW.setProperty(
                 "36Hour%dtemptitle" % (day + 1, ), forecast[3])
             self.CURRENT_WINDOW.setProperty("36Hour%dtemp" % (day + 1, ),
                                             forecast[4])
             self.CURRENT_WINDOW.setProperty(
                 "36Hour%dpreciptitle" % (day + 1, ), forecast[5])
             self.CURRENT_WINDOW.setProperty("36Hour%dprecip" % (day + 1, ),
                                             forecast[6])
             self.CURRENT_WINDOW.setProperty(
                 "36Hour%doutlook" % (day + 1, ), forecast[7])
             self.CURRENT_WINDOW.setProperty(
                 "36Hour%ddaylight" % (day + 1, ), forecast[8])
             self.CURRENT_WINDOW.setProperty("36Hour%dtitle" % (day + 1, ),
                                             forecast[0])
     except:
         pass
     # unlock the gui
     xbmcgui.unlock()
Exemplo n.º 42
0
 def update_center(self, n="default"):
     print("%s : %s" % (n, DB.get_room_by_name(n)))
     if n != "default":
         dev = DB.search_devices(room_id=DB.get_room_by_name(n).id)
         devices = []
         for d in dev:
             this_dev = (d.type, d.technology_id, d.id, d.name,
                         DB.get_last_stat_of_device(d.id).value)
             devices.append(this_dev)
         print(devices)
     else:
         devices = [
             ("type1", "techno1", 1, "%s1" % n, "value1"),
             ("type2", "techno2", 2, "%s2" % n, "value2"),
             ("type3", "techno3", 3, "%s3" % n, "value3"),
             ("type4", "techno4", 4, "%s4" % n, "value4"),
             ("type5", "techno5", 5, "%s5" % n, "value5"),
             ("type6", "techno6", 6, "%s6" % n, "value6"),
             ("type7", "techno7", 7, "%s7" % n, "value7"),
             ("type8", "techno8", 8, "%s8" % n, "value8"),
             ("type9", "techno9", 9, "%s9" % n, "value9"),
             ("type10", "techno10", 10, "%s10" % n, "value10"),
             ("type11", "techno11", 11, "%s11" % n, "value11"),
             ("type12", "techno12", 12, "%s12" % n, "value12"),
             ("type13", "techno13", 13, "%s13" % n, "value13"),
         ]
     if self._set is not None:
         del self._set
     xbmcgui.lock()
     self._set = DeviceSet(self, self.left.menu, 150, 100, 4, devices)
     xbmcgui.unlock()
Exemplo n.º 43
0
    def init_button_state(self):
        xbmcgui.lock()

        visible = True
        self.getControl(02).setVisible(visible)
        self.getControl(10).setVisible(visible)
        self.getControl(11).setVisible(visible)
        self.getControl(14).setVisible(visible)
        self.getControl(13).setVisible(visible)

        visible = False
        self.getControl(6).setVisible(visible)
        self.getControl(20).setVisible(visible)
        self.getControl(21).setVisible(visible)
        self.getControl(22).setVisible(visible)
        self.getControl(23).setVisible(visible)
        self.getControl(24).setVisible(visible)
        self.getControl(25).setVisible(visible)
        self.getControl(26).setVisible(visible)
        self.getControl(27).setVisible(visible)
        self.getControl(28).setVisible(visible)

        self.getControl(30).setVisible(visible)
        self.getControl(31).setVisible(visible)
        self.getControl(32).setVisible(visible)
        self.getControl(33).setVisible(visible)

        self.getControl(90).setVisible(visible)
        self.getControl(91).setVisible(visible)
        self.getControl(92).setVisible(visible)

        self.getControl(40).setVisible(visible)
        self.getControl(41).setVisible(visible)

        xbmcgui.unlock()
Exemplo n.º 44
0
 def showInfo(self):
     log("> showInfo()")
     backend_version = "unknown"
     for node in self.dom.getElementsByTagName('version'):
         backend_version = node.firstChild.data
     options = {"cdr":120,"vm":121}
     if (__os__ == 'xbox'): xbmcgui.lock()
     for option in options.keys():
         self.getControl(options[option]).reset()
         # Parse CDR/VM XML content
         for node in self.dom.getElementsByTagName(option):
             listitem = xbmcgui.ListItem()
             for childNode in node.childNodes:
                 if (childNode.nodeName != "#text"):
                     if (childNode.firstChild):
                         listitem.setProperty(childNode.nodeName,childNode.firstChild.data)
                     else:
                         listitem.setProperty(childNode.nodeName,"")
             self.getControl(options[option]).addItem(listitem)
             del listitem
     if (__os__ == 'xbox'): xbmcgui.unlock()
     del self.dom
     if (backend_version != __version__):
         log(">> Version mismatch!: Frontend is " + __version__ + " while Backend is " + backend_version)
         xbmc_notification = "You have to update the backend!"
         xbmc_img = xbmc.translatePath(os.path.join(RESOURCE_PATH,'media','xbmc-pbx-addon.png'))
         log(">> Notification: " + xbmc_notification)
         xbmc.executebuiltin("XBMC.Notification("+ __language__(30051) +","+ xbmc_notification +","+ str(15*1000) +","+ xbmc_img +")")
Exemplo n.º 45
0
 def show_choices(self, choices):
     xbmcgui.lock()
     for song in choices:
         self.getControl(120).addItem(song[0])
     self.getControl(120).selectItem(0)
     self.menu_items = choices
     self.show_control(120)
Exemplo n.º 46
0
 def loadData( self ):
     log.debug( '> schedules.Window.loadData()' )
     self.schedules = []
     xbmcgui.lock()
     try:
         listControl = self.controls["schedule_list"].control
         listControl.reset()
         self.schedules = self.db.getRecordingSchedules()
         self.schedules.sort( compareTypeAsc )
         for s in self.schedules:
             item = xbmcgui.ListItem()
             label = s.title()
             if s.type() == 3:   # channel
             #    item.setLabel2( s.formattedChannel() )
                 label += " (%s)"%s.formattedChannel()
             else:
             #    item.setLabel2( s.formattedType() )
                 label += " (%s)"%s.formattedType()
             item.setLabel( label )
             listControl.addItem( item )
         #self.updateShowDetails( 0 )
         xbmcgui.unlock()
     except:
         xbmcgui.unlock()
         raise
     log.debug( '< schedules.Window.loadData()' )
Exemplo n.º 47
0
 def _add_items(self, items):
     xbmcgui.lock()
     try:
         for revision, author, date, message in items:
             self._add_item(revision, author, date, message)
     except:
         pass
     xbmcgui.unlock()
Exemplo n.º 48
0
 def populateList(self, scores):
     LOG("PL setting to " + str(scores))
     xbmcgui.lock()
     self.updateTabImages()
     self.lstHighScores.reset()
     for name, score in scores:
         self.lstHighScores.addItem(xbmcgui.ListItem(name, str(score)))
     xbmcgui.unlock()
Exemplo n.º 49
0
    def update_list_mini(self, content_list):

        xbmcgui.lock()

        for listitem in self.listItems:
            content_list.addItem(listitem)

        content_list.setCurrentListPosition(self.current_position)
        xbmcgui.unlock()
Exemplo n.º 50
0
    def setChannelButtons(self, starttime, curchannel, singlerow=-1):
        self.log('setChannelButtons ' + str(starttime) + ', ' +
                 str(curchannel))
        xbmcgui.lock()
        self.removeControl(self.currentTimeBar)
        self.centerChannel = self.MyOverlayWindow.fixChannel(curchannel)
        # This is done twice to guarantee we go back 2 channels.  If the previous 2 channels
        # aren't valid, then doing a fix on curchannel - 2 may result in going back only
        # a single valid channel.
        curchannel = self.MyOverlayWindow.fixChannel(curchannel - 1, False)
        curchannel = self.MyOverlayWindow.fixChannel(curchannel - 1, False)
        starttime = self.roundToHalfHour(int(starttime))
        self.setTimeLabels(starttime)
        self.shownTime = starttime
        basex, basey = self.getControl(111).getPosition()
        basew = self.getControl(111).getWidth()
        tmpx, tmpy = self.getControl(110 + self.rowCount).getPosition()
        timex, timey = self.getControl(120).getPosition()
        timew = self.getControl(120).getWidth()
        timeh = self.getControl(120).getHeight()

        for i in range(self.rowCount):
            if singlerow == -1 or singlerow == i:
                self.setButtons(starttime, curchannel, i)

            self.getControl(301 + i).setLabel(
                self.MyOverlayWindow.channels[curchannel - 1].name)

            try:
                self.getControl(311 + i).setLabel(str(curchannel))
            except:
                pass

            try:
                self.getControl(321 + i).setImage(
                    self.channelLogos +
                    self.MyOverlayWindow.channels[curchannel - 1].name +
                    ".png")
            except:
                pass

            curchannel = self.MyOverlayWindow.fixChannel(curchannel + 1)

        if time.time() >= starttime and time.time() < starttime + 5400:
            dif = int((starttime + 5400 - time.time()))
            self.currentTimeBar.setPosition(
                int((basex + basew - 2) - (dif * (basew / 5400.0))), timey)
        else:
            if time.time() < starttime:
                self.currentTimeBar.setPosition(basex + 2, timey)
            else:
                self.currentTimeBar.setPosition(basex + basew - 2 - timew,
                                                timey)

        self.addControl(self.currentTimeBar)
        xbmcgui.unlock()
        self.log('setChannelButtons return')
Exemplo n.º 51
0
 def onInit(self):
     self.controls = {}
     try:
         xbmcgui.lock()
         self.getControls()
     except:
         print_exc()
     xbmcgui.unlock()
     self.close()
Exemplo n.º 52
0
 def onInit(self):
     xbmcgui.lock()
     self.getControl(4).setLabel("[B]" + self.title + "[/B]")
     if (self.isZX == "yes"):
         self.getControl(25).setLabel("втя║рфЁЖ")
     self.setFocus(self.getControl(20))
     self.showMin()
     #self.getControl( 30 ).setText(self.cont)
     xbmcgui.unlock()
Exemplo n.º 53
0
 def remove_control(self):
     #self.delay += 1
     if not self._stop:
         self.enemyControl.setVisible(0)
         try:
             xbmcgui.lock()
             self.window.removeControl(self.enemyControl)
         except:
             print_exc()
         xbmcgui.unlock()
         self._stop = True
Exemplo n.º 54
0
 def processEvent(self, event, rows):
     xbmcgui.lock()
     LOG('ProcessEvent-> ' + str(event) + ' ' + str(rows))
     self.updatePiece()
     entryEvent = event
     clearLev = bloomX = bloomY = 0
     if event == EVENT_NEW_PIECE or event == EVENT_LEVEL_UP:
         if rows > 0 or True:
             clearLev = self.controller.nLevel - (event == EVENT_LEVEL_UP)
             bloomX = self.controller.curPiece.x + self.controller.curPiece.type.size / 2 - 1
             bloomY = self.controller.curPiece.y
         self.imgBlocks.extend(self.imgPiece)
         self.imgPiece = []
         event = self.controller.doNewPiece()
         self.updatePiece()
     if event == EVENT_GAME_OVER:  #sound priority
         self.state = STATE_PAUSED
         xbmc.playSFX(SOUND_DIR + "gameover.wav")
         xbmcgui.unlock()
         doNewGame = self.dlgGame.showDialog(
             self.controller.nScore)  #it unlocks and locks gui
         xbmcgui.lock()
         if doNewGame:
             self.state = STATE_READY
             self.controller.newGame()
             self.updateBlocks()
             self.updatePiece()
         else:
             self.state = STATE_QUITTING
             self.close()
         LOG('PE after GO - ' + str(self.state))
     elif entryEvent == EVENT_LEVEL_UP:
         xbmc.playSFX(SOUND_DIR + "levelup.wav")
         self.updateBlocks()
         self.drawBloom("+" + str(rows * rows * clearLev), bloomX, bloomY)
         self.drawBloom("Level Up! +" + str(self.controller.nLevel * 15),
                        -1,
                        5,
                        font="font14",
                        duration=90)
     elif rows > 0:
         xbmc.playSFX(SOUND_DIR + "clear" + str(rows) + ".wav")
         self.updateBlocks()
         self.drawBloom("+" + str(rows * rows * clearLev), bloomX, bloomY)
     elif entryEvent == EVENT_NEW_PIECE:
         xbmc.playSFX(SOUND_DIR + "lock.wav")
     elif entryEvent == EVENT_MOVE:
         xbmc.playSFX(SOUND_DIR + "move.wav")
     elif entryEvent == EVENT_ROTATE:
         xbmc.playSFX(SOUND_DIR + "rotate.wav")
     elif entryEvent == EVENT_DROP:
         xbmc.playSFX(SOUND_DIR + "drop.wav")
     LOG('ProcessEvent<-')
     xbmcgui.unlock()
Exemplo n.º 55
0
 def remove_control(self):
     self.vausCatch = None
     if not self._stop:
         self.bonus.setVisible(0)
         try:
             xbmcgui.lock()
             self.window.removeControl(self.bonus)
         except:
             print_exc()
         xbmcgui.unlock()
         self._stop = True