• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utils.getString函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utils.getString函数的典型用法代码示例。如果您正苦于以下问题:Python getString函数的具体用法?Python getString怎么用?Python getString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: erase

    def erase(self):
        self.showOnly(self.style + ERASE)

        #Not implemented yet
        #if self.flirc.version > 1:
        #    self.getControl(self.style + ERASE_STOP + 1000).setVisible(True)

        self.freeRemote()
        self.timerOff()

        self.lockInfobox = True
        self.setInfoBox(utils.getString(self.style + ERASE_STOP))
        
        response = self.flirc.erase()
        self.timerOn()        
        
        self.setInfoBox(utils.getString(response))        

        self.sleep(INFOSECS) #1 second

        self.showAll()

        self.getControl(self.style + ERASE_STOP + 1000).setVisible(False)

        self.lockInfobox = False
        self._setFocus(self.style + ERASE)
开发者ID:mftvrocks,项目名称:flirc-xbmc-plugin,代码行数:26,代码来源:keyboard.py


示例2: extract

 def extract(self,zipFile,outLoc,progressBar):
     utils.log("extracting zip archive")
     
     result = True #result is true unless we fail
     
     #update the progress bar
     progressBar.updateProgress(0,utils.getString(30100))
     
     #list the files 
     fileCount = float(len(zipFile.listFiles()))
     currentFile = 0
     
     try:
         for aFile in zipFile.listFiles():
             #update the progress bar
             currentFile += 1
             progressBar.updateProgress(int((currentFile/fileCount) * 100),utils.getString(30100))
             
             #extract the file
             zipFile.extract(aFile,outLoc)
             
     except Exception,e:
         print str(e)
         utils.log("Error extracting file", xbmc.LOGDEBUG)
         result = False
开发者ID:azumimuo,项目名称:family-xbmc-addon,代码行数:25,代码来源:extractor.py


示例3: run

    def run(self):
        
        #check if there is even a file playing
        if(self.localPlayer.isPlaying()):
            #figure out what xbmc to send to
            selected_xbmc = xbmcgui.Dialog().select(utils.getString(30036),self.host_manager.listHosts())

            if(selected_xbmc != -1):
                #create a local host
                local_host = XbmcHost("Local","127.0.0.1","8080")
                
                #get the address of the host
                remote_host = self.host_manager.getHost(selected_xbmc)

                #check if the remote player is currently playing something
                remote_player = remote_host.isPlaying()

                if(remote_player >= 0 and utils.getSetting("override_destination") == 'true'):
                     #we need to stop the player before sending the new file
                     remote_host.stop()
                     self.sendTo(local_host,remote_host)
                 
                elif(remote_player >= 0 and utils.getSetting("override_destination") == "false"):
                    #we can't stop the player, notify the user
                    xbmcgui.Dialog().ok("SendTo",remote_host.name + " " + utils.getString(30039),utils.getString(30037))

                elif(remote_player == -2):
                    #catch for if the player is off
                    xbmcgui.Dialog().ok("SendTo",remote_host.name + " " + utils.getString(30040),utils.getString(30038))
                    
                else:
                    #not playing anything, send as normal
                    self.sendTo(local_host,remote_host)
开发者ID:bstrdsmkr,项目名称:script.sendto,代码行数:33,代码来源:sendto.py


示例4: _checkValidationFile

    def _checkValidationFile(self,path):
        result = False
        
        #copy the file and open it
        self.xbmc_vfs.put(path + "xbmcbackup.val",xbmc.translatePath(utils.data_dir() + "xbmcbackup_restore.val"))

        vFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + "xbmcbackup_restore.val"),'r')
        jsonString = vFile.read()
        vFile.close()

        #delete after checking
        xbmcvfs.delete(xbmc.translatePath(utils.data_dir() + "xbmcbackup_restore.val"))

        try:
            json_dict = json.loads(jsonString)

            if(xbmc.getInfoLabel('System.BuildVersion') == json_dict['xbmc_version']):
                result = True
            else:
                result = xbmcgui.Dialog().yesno(utils.getString(30085),utils.getString(30086),utils.getString(30044))
                
        except ValueError:
            #may fail on older archives
            result = True

        return result
开发者ID:azumimuo,项目名称:family-xbmc-addon,代码行数:26,代码来源:backup.py


示例5: startRecording

    def startRecording(self, controlId):
        #utils.log("******************* startRecording *******************")
        #utils.log(controlId)
        self.currentButton = controlId

        if self.currentButton == 0:
            return

        self.lockInfobox = True

        self.showOnly(self.currentButton)       

        cmd  = utils.getRecordCommandString(controlId)
        text = utils.getString(utils.RECORD_TEXT) % utils.getString(controlId).lower()

        self.setInfoBox(text)

        response = self.flirc.recordKey(cmd)

        self.setInfoBox(utils.getString(response))

        ret = True
        
        if response == utils.RECORD_OK:
            self.sleep(INFOSECS) #1 second
        else:
            self.sleep(2*INFOSECS) #2 seconds
            ret = False

        #self._setFocus(controlId)

        self.lockInfobox = False

        return ret
开发者ID:mftvrocks,项目名称:flirc-xbmc-plugin,代码行数:34,代码来源:keyboard.py


示例6: __init__

    def __init__(self,rootString):
        self.set_root(rootString)

        authorizer = DropboxAuthorizer()

        if(authorizer.isAuthorized()):
            self.client = authorizer.getClient()
        else:
            #tell the user to go back and run the authorizer
            xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30105))
            sys.exit()
开发者ID:robweber,项目名称:xbmcbackup,代码行数:11,代码来源:vfs.py


示例7: format

    def format(self):
        #utils.log("******************* format *******************")
        if not utils.yesno(1, 7, 0, 8):
            self.setInfoBox(utils.getString(4))
            return

        self.timerOff()
        self.setInfoBox(utils.getString(9))
        self.sleep(INFOSECS) #1 second   
        response = self.flirc.format()
        self.timerOn()        
        self.setInfoBox(utils.getString(response))
        self.sleep(INFOSECS) #1 second
开发者ID:mftvrocks,项目名称:flirc-xbmc-plugin,代码行数:13,代码来源:keyboard.py


示例8: loadConfig

    def loadConfig(self):
        utils.log("******************* load *******************")

        filename = utils.fileBrowse(14, 'fcfg')
        if not filename:
            return

        self.timerOff()
        self.setInfoBox(utils.getString(15))
        self.sleep(INFOSECS) #1 second   
        response = self.flirc.loadConfig(filename)
        self.timerOn()        
        self.setInfoBox(utils.getString(response))
        self.sleep(INFOSECS) #1 second
开发者ID:mftvrocks,项目名称:flirc-xbmc-plugin,代码行数:14,代码来源:keyboard.py


示例9: upgradeFW

    def upgradeFW(self):
        utils.log("******************* upgrade *******************")


        filename = utils.fileBrowse(10, 'bin')
        if not filename:
            return

        self.timerOff()
        self.setInfoBox(utils.getString(11))
        self.sleep(INFOSECS) #1 second   
        response = self.flirc.upgradeFW(filename)
        self.timerOn()        
        self.setInfoBox(utils.getString(response))
        self.sleep(INFOSECS) #1 second
开发者ID:mftvrocks,项目名称:flirc-xbmc-plugin,代码行数:15,代码来源:keyboard.py


示例10: saveConfig

    def saveConfig(self):
        utils.log("******************* save *******************")

        folder = utils.folderBrowse(12)

        filename = 'my_flirc_config.fcfg'
        filename = os.path.join(folder, filename)

        self.timerOff()
        self.setInfoBox(utils.getString(13))
        self.sleep(INFOSECS) #1 second   
        response = self.flirc.saveConfig(filename)
        self.timerOn()        
        self.setInfoBox(utils.getString(response))
        self.sleep(INFOSECS) #1 second
开发者ID:mftvrocks,项目名称:flirc-xbmc-plugin,代码行数:15,代码来源:keyboard.py


示例11: doAutoMode

    def doAutoMode(self):        
        
        self.showAll()
        failed = False

        self.autoModeOn = True

        self.timerOff()
        #self.flirc.format()

        for i in range(self.buttonMin+10, self.buttonMax+1): #+10 ignore 'Functional' Buttons
            if not self._onClick(i):             
                failed = True
                break 
        self.timerOn()            

        self.autoModeOn = False
        self.getControl(self.style + GO_STOP + 1000).setVisible(False)

        self.showAll()
        self.currentButton = 0
        self.loseFocus()

        if failed:
            return

        utils.setSetting('autoStart', 'false')

        self.lockInfobox = True
        self._setFocus(self.style + GO)
        self.lockInfobox = False

        self.setInfoBox(utils.getString(utils.AUTO_OK))
        self.sleep(10*INFOSECS)
开发者ID:mftvrocks,项目名称:flirc-xbmc-plugin,代码行数:34,代码来源:keyboard.py


示例12: sendTo

    def sendTo(self,local_host,remote_host,reverse=False):
        
        #get the player/playlist id
        playerid = str(local_host.isPlaying())
           
        #get the percentage played and position
        player_props = local_host.playingProperties(playerid)

        #check if the player is currently paused
        if(player_props['speed'] != 0):
            #pause the playing file
            self.pausePlayback(local_host)

        #if reverse these checks don't matter
        keep_playing = True
        if(not reverse):
            #check if we should prompt to keep playback paused
            if(utils.getSetting("pause_prompt") == "true"):
                keep_playing = not xbmcgui.Dialog().yesno(utils.getString(30000),utils.getString(30041))
        
        #get a list of all items in the playlist
        playlist = local_host.getPlaylist(playerid)

        #add these files to the other playlist
        remote_host.addItems(playlist,playerid)

        #play remote playlist
        remote_host.playPosition(str(player_props['position']),playerid)

        #pause the player
        self.pausePlayback(remote_host)

        #seek to the correct spot
        remote_host.seekFile(player_props['percentage'],playerid)

        if(utils.getSetting('continue_host_on_transfer') == 'false'):
            #stop the current player
            local_host.stop(playerid)
            local_host.executeJSON('Playlist.Clear','{"playlistid": ' + playerid + '}')
        else:
            #continue playing
            self.pausePlayback(local_host)
            
        if(keep_playing):
            #unpause
            self.pausePlayback(remote_host)
开发者ID:robweber,项目名称:script.sendto,代码行数:46,代码来源:sendto.py


示例13: restoreFiles

    def restoreFiles(self):
        self.fileManager.createFileList()

        utils.log(utils.getString(30051))
        allFiles = self.fileManager.getFileList()

        #write list from remote to local
        self.writeFiles(allFiles,self.remote_path,self.local_path)

        #call update addons to refresh everything
        xbmc.executebuiltin('UpdateLocalAddons')
开发者ID:dersphere,项目名称:xbmcbackup,代码行数:11,代码来源:backup.py


示例14: onFocus

    def onFocus(self, controlId): 
        #updates text in the infobox for the current focused key 
        if self.lockInfobox:
            return
        
        if controlId > self.buttonMax:
            controlId -= 1000  

        if controlId == SWITCH:
            controlId += self.style
  
        self.setInfoBox(utils.getString(controlId))
开发者ID:mftvrocks,项目名称:flirc-xbmc-plugin,代码行数:12,代码来源:keyboard.py


示例15: syncFiles

    def syncFiles(self):
        
        #make the remote directory
        vfs.mkdir(self.remote_path)

        utils.log(utils.getString(30051))
        self.fileManager.createFileList()

        allFiles = self.fileManager.getFileList()

        #write list from local to remote
        self.writeFiles(allFiles,self.local_path,self.remote_path)
开发者ID:dersphere,项目名称:xbmcbackup,代码行数:12,代码来源:backup.py


示例16: setup

    def setup(self):
        if(APP_KEY == '' or APP_SECRET == ''):
            xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30058),utils.getString(30059))
            return
        
        user_token_key,user_token_secret = self.getToken()
        
        sess = session.DropboxSession(APP_KEY,APP_SECRET,"app_folder")

        if(user_token_key == '' and user_token_secret == ''):
            token = sess.obtain_request_token()
            url = sess.build_authorize_url(token)

            #print url in log
            utils.log("Authorize URL: " + url)
            xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30056),utils.getString(30057))  
            
            #if user authorized this will work
            user_token = sess.obtain_access_token(token)
            self.setToken(user_token.key,user_token.secret)
            
        else:
            sess.set_token(user_token_key,user_token_secret)
        
        self.client = client.DropboxClient(sess)

        try:
            utils.log(str(self.client.account_info()))
        except:
            #this didn't work, delete the token file
            self.deleteToken()
开发者ID:nspierbundel,项目名称:OpenELEC.tv,代码行数:31,代码来源:vfs.py


示例17: _rotateBackups

    def _rotateBackups(self):
        total_backups = int(utils.getSetting('backup_rotation'))
        if(total_backups > 0):
            #get a list of valid backup folders
            dirs = self.listBackups()

            if(len(dirs) > total_backups):
                #remove backups to equal total wanted
                remove_num = 0
                self.filesTotal = self.filesTotal + remove_num + 1

                #update the progress bar if it is available
                while(remove_num < (len(dirs) - total_backups) and not self.progressBar.checkCancel()):
                    self._updateProgress(utils.getString(30054) + " " + dirs[remove_num][1])
                    utils.log("Removing backup " + dirs[remove_num][0])
                    self.remote_vfs.rmdir(self.remote_base_path + dirs[remove_num][0] + "/")
                    remove_num = remove_num + 1
开发者ID:liljayballer1010,项目名称:xbmcbackup,代码行数:17,代码来源:backup.py


示例18: __init__

    def __init__(self):
        self.local_path = xbmc.makeLegalFilename(xbmc.translatePath("special://home"),False);
      
	if(utils.getSetting('remote_selection') == '1'):
	    self.remote_path = utils.getSetting('remote_path_2')
	    utils.setSetting("remote_path","")
        elif(utils.getSetting('remote_selection') == '0'):
            self.remote_path = utils.getSetting("remote_path")

        #fix slashes
        self.remote_path = self.remote_path.replace("\\","/")
        
        #check if trailing slash is included
        if(self.remote_path[-1:] != "/"):
            self.remote_path = self.remote_path + "/"
        
        utils.log(utils.getString(30046))
开发者ID:dersphere,项目名称:xbmcbackup,代码行数:17,代码来源:backup.py


示例19: doCountdown

    def doCountdown(self):        
        self.cancelCountdown = 5
        count = COUNTDOWN 
        text  = utils.getString(utils.AUTO_TEXT)
        
        self.lockInfobox = True

        #self.timerOff()
        while count > 0 and self.cancelCountdown > 0:
            self.setInfoBox(text % count)
            self.cancelCountdown = 5
            count -= 1
            xbmc.sleep(1000)
        #self.timerOn()

        self.lockInfobox = False

        #was the coundtdown canceled?
        if self.cancelCountdown < 1:
            self.loseFocus()
            return False

        return True
开发者ID:mftvrocks,项目名称:flirc-xbmc-plugin,代码行数:23,代码来源:keyboard.py


示例20: run

    def run(self,mode=-1,progressOverride=False):
        #set windows setting to true
        window = xbmcgui.Window(10000)
        window.setProperty(utils.__addon_id__ + ".running","true")
        
        #append backup folder name
        progressBarTitle = utils.getString(30010) + " - "
        if(mode == self.Backup and self.remote_vfs.root_path != ''):
            self.remote_vfs.set_root(self.remote_vfs.root_path + time.strftime("%Y%m%d%H%M") + "/")
            progressBarTitle = progressBarTitle + utils.getString(30016)
	elif(mode == self.Restore and self.restore_point != None and self.remote_vfs.root_path != ''):
	    self.remote_vfs.set_root(self.remote_vfs.root_path + self.restore_point + "/")
	    progressBarTitle = progressBarTitle + utils.getString(30017)
	else:
            #kill the program here
	    self.remote_vfs = None
	    return

        utils.log(utils.getString(30047) + ": " + self.xbmc_vfs.root_path)
        utils.log(utils.getString(30048) + ": " + self.remote_vfs.root_path)

        
        #setup the progress bar
        self.progressBar = BackupProgressBar(progressOverride)
        self.progressBar.create(progressBarTitle,utils.getString(30049) + "......")

        if(mode == self.Backup):
            utils.log(utils.getString(30023) + " - " + utils.getString(30016))
            #check if remote path exists
            if(self.remote_vfs.exists(self.remote_vfs.root_path)):
                #may be data in here already
                utils.log(utils.getString(30050))
            else:
                #make the remote directory
                self.remote_vfs.mkdir(self.remote_vfs.root_path)

            #create a validation file for backup rotation
            self._createValidationFile()

            utils.log(utils.getString(30051))
            allFiles = []
            fileManager = FileManager(self.xbmc_vfs)
         
            #go through each of the user selected items and write them to the backup store
            if(utils.getSetting('backup_addons') == 'true'):
                self.remote_vfs.mkdir(self.remote_vfs.root_path + "addons")
                fileManager.walkTree(xbmc.translatePath('special://home/addons'))

            self.remote_vfs.mkdir(self.remote_vfs.root_path + "userdata")

            if(utils.getSetting('backup_addon_data') == 'true'):
                self.remote_vfs.mkdir(self.remote_vfs.root_path + "userdata/addon_data")
                fileManager.walkTree(xbmc.translatePath('special://home/userdata/addon_data'))

            if(utils.getSetting('backup_database') == 'true'):
                self.remote_vfs.mkdir(self.remote_vfs.root_path + "userdata/Database")
                fileManager.walkTree(xbmc.translatePath('special://home/userdata/Database'))
        
            if(utils.getSetting("backup_playlists") == 'true'):
                self.remote_vfs.mkdir(self.remote_vfs.root_path + "userdata/playlists")
                fileManager.walkTree(xbmc.translatePath('special://home/userdata/playlists'))

            if(utils.getSetting('backup_profiles') == 'true'):
                self.remote_vfs.mkdir(self.remote_vfs.root_path + "userdata/profiles")
                fileManager.walkTree(xbmc.translatePath('special://home/userdata/profiles'))
            
            if(utils.getSetting("backup_thumbnails") == "true"):
                self.remote_vfs.mkdir(self.remote_vfs.root_path + "userdata/Thumbnails")
                fileManager.walkTree(xbmc.translatePath('special://home/userdata/Thumbnails'))
	  
            if(utils.getSetting("backup_config") == "true"):
                self.remote_vfs.mkdir(self.remote_vfs.root_path + "userdata/keymaps")
                fileManager.walkTree(xbmc.translatePath('special://home/userdata/keymaps'))
                
                self.remote_vfs.mkdir(self.remote_vfs.root_path + "userdata/peripheral_data")
                fileManager.walkTree(xbmc.translatePath('special://home/userdata/peripheral_data'))
            
                #this part is an oddity
                dirs,configFiles = self.xbmc_vfs.listdir(xbmc.translatePath('special://home/userdata/'))
                for aFile in configFiles:
                    if(aFile.endswith(".xml")):
                        fileManager.addFile(xbmc.translatePath('special://home/userdata/') + aFile)

            #add to array
            self.filesTotal = fileManager.size()
            allFiles.append({"source":self.xbmc_vfs.root_path,"dest":self.remote_vfs.root_path,"files":fileManager.getFiles()})

            #check if there are custom directories
            if(utils.getSetting('custom_dir_1_enable') == 'true' and utils.getSetting('backup_custom_dir_1') != ''):

                #create a special remote path with hash                
                self.xbmc_vfs.set_root(utils.getSetting('backup_custom_dir_1'))
                self.remote_vfs.mkdir(self.remote_vfs.root_path + "custom_" + self._createCRC(self.xbmc_vfs.root_path))

                #walk the directory
                fileManager.walkTree(self.xbmc_vfs.root_path)
                self.filesTotal = self.filesTotal + fileManager.size()
                allFiles.append({"source":self.xbmc_vfs.root_path,"dest":self.remote_vfs.root_path + "custom_" + self._createCRC(self.xbmc_vfs.root_path),"files":fileManager.getFiles()})

            if(utils.getSetting('custom_dir_2_enable') == 'true' and utils.getSetting('backup_custom_dir_2') != ''):
#.........这里部分代码省略.........
开发者ID:liljayballer1010,项目名称:xbmcbackup,代码行数:101,代码来源:backup.py



注:本文中的utils.getString函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utils.getToolByName函数代码示例发布时间:2022-05-26
下一篇:
Python utils.getSetting函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap