本文整理匯總了Python中pyaid.system.SystemUtils.SystemUtils.move方法的典型用法代碼示例。如果您正苦於以下問題:Python SystemUtils.move方法的具體用法?Python SystemUtils.move怎麽用?Python SystemUtils.move使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyaid.system.SystemUtils.SystemUtils
的用法示例。
在下文中一共展示了SystemUtils.move方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _move
# 需要導入模塊: from pyaid.system.SystemUtils import SystemUtils [as 別名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import move [as 別名]
def _move(self, source, destination):
if not SystemUtils.move(source, destination):
print 'FAILED TO MOVE: %s -> %s' % (source, destination)
return False
print 'MOVED: %s -> %s' % (source, destination)
return True
示例2: _createEngineJs
# 需要導入模塊: from pyaid.system.SystemUtils import SystemUtils [as 別名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import move [as 別名]
def _createEngineJs(self):
cb = CoffeescriptBuilder(
'sflow.api.SFlowApi-exec',
FileUtils.createPath(StaticFlowEnvironment.rootResourcePath, '..', 'js', isDir=True),
buildOnly=True)
target = cb.construct()[0]
targetFolder = FileUtils.createPath(
StaticFlowEnvironment.rootResourcePath, 'web', 'js', isDir=True)
result = SiteProcessUtils.compileCoffeescriptFile(target.assembledPath, targetFolder)
if result['code']:
print 'ERROR: Failed compilation of the Static Flow engine'
print result
return False
sourcePath = FileUtils.createPath(targetFolder, target.name + '.js', isFile=True)
destPath = FileUtils.createPath(targetFolder, 'engine.js', isFile=True)
SystemUtils.move(sourcePath, destPath)
return True
示例3: _handleReplaceDatabase
# 需要導入模塊: from pyaid.system.SystemUtils import SystemUtils [as 別名]
# 或者: from pyaid.system.SystemUtils.SystemUtils import move [as 別名]
def _handleReplaceDatabase(self):
self.mainWindow.showLoading(
self,
u'Browsing for Database File',
u'Choose a valid database (*.vcd) file')
defaultPath = self.appConfig.get(UserConfigEnum.DATABASE_IMPORT_PATH)
if not defaultPath:
defaultPath = self.appConfig.get(UserConfigEnum.LAST_BROWSE_PATH)
path = PyGlassBasicDialogManager.browseForFileOpen(
parent=self,
caption=u'Select Database File',
defaultPath=defaultPath)
self.mainWindow.hideLoading(self)
if not path:
self.mainWindow.toggleInteractivity(True)
return
# Store directory for later use
self.appConfig.set(
UserConfigEnum.DATABASE_IMPORT_PATH,
FileUtils.getDirectoryOf(path) )
self.mainWindow.showStatus(
self,
u'Replacing Database File',
u'Removing existing database file and replacing it with selection')
sourcePath = getattr(Tracks_Track, 'URL')[len(u'sqlite:'):].lstrip(u'/')
if not OsUtils.isWindows():
sourcePath = u'/' + sourcePath
savePath = '%s.store' % sourcePath
try:
if os.path.exists(savePath):
SystemUtils.remove(savePath, throwError=True)
except Exception as err:
self.mainWindow.appendStatus(
self, u'<span style="color:#CC3333">ERROR: Unable to access database save location.</span>')
self.mainWindow.showStatusDone(self)
return
try:
SystemUtils.move(sourcePath, savePath)
except Exception as err:
self.mainWindow.appendStatus(
self, u'<span style="color:#CC3333;">ERROR: Unable to modify existing database file.</span>')
self.mainWindow.showStatusDone(self)
return
try:
SystemUtils.copy(path, sourcePath)
except Exception as err:
SystemUtils.move(savePath, sourcePath)
self.mainWindow.appendStatus(
self, u'<span style="color:#CC3333;">ERROR: Unable to copy new database file.</span>')
self.mainWindow.showStatusDone(self)
return
if os.path.exists(savePath):
SystemUtils.remove(savePath)
self.mainWindow.appendStatus(self, u'<span style="color:#33CC33;">Database Replaced</span>')
self.mainWindow.showStatusDone(self)