本文整理汇总了Python中Resources.getTempDir方法的典型用法代码示例。如果您正苦于以下问题:Python Resources.getTempDir方法的具体用法?Python Resources.getTempDir怎么用?Python Resources.getTempDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resources
的用法示例。
在下文中一共展示了Resources.getTempDir方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MergeTiles
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getTempDir [as 别名]
def MergeTiles():
### STAGE 2 ###
bsbScales = BsbScales(Resources.indir)
sortList = bsbScales.getKapsSortedByScale(".zxy")
for errorBsbFile in Resources.lstBsbErrorFiles:
if sortList.__contains__(errorBsbFile + ".zxy"):
sortList.remove(errorBsbFile + ".zxy")
sortList.reverse()
Resources.numChartsMerge = len(sortList)
if Resources.numChartsMerge > 0:
moPath = Resources.getTempDir() + "/mergeorder.txt"
if os.path.isfile(moPath):
os.remove(moPath)
moFile = open(moPath, "w")
for line in sortList:
if os.path.isdir(Resources.getTempDir() + "/" + line):
moFile.write(Resources.getTempDir() + "/" + line + "\n")
else:
pass
#print "missing tileset: " + line
moFile.close()
Merge(Resources.getTempDir() + "/merge", moPath)
if pleaseContinue:
wx.PostEvent(app, InThreadEvent(advance=True))
示例2: cancelHandler
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getTempDir [as 别名]
def cancelHandler(self, event):
if (event.attr1):
print "Cancelling tasks and cleaning up... please wait."
global pleaseContinue
pleaseContinue = False
if platform.system() == "Windows":
self.Hide()
# if platform.system() == "Linux":
# msgDialog = GUI.Message2(None)
# msgDialog.msg_staticText.SetLabel("Cleaning up... please wait.")
# msgDialog.Show()
for thread in enumerate():
if thread.getName() != "MainThread":
if thread.isAlive():
#print "Joining thread: " + thread.getName()
thread.join()
if os.path.isdir(Resources.getTempDir()):
#print "Removing temporary directory", os.path.abspath(Resources.getTempDir())
shutil.rmtree(os.path.abspath(Resources.getTempDir()))
# if platform.system() == "Linux":
# msgDialog.Destroy()
self.Destroy()
blankParent.Destroy()
示例3: MakeTiles
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getTempDir [as 别名]
def MakeTiles():
### STAGE 1 ###
for kapPath in Resources.lstBsbFiles:
if pleaseContinue:
#we need to wait for this process to finish before moving on
kapToVrtProc = Process(target=KapToVrt, args=(kapPath,))
kapToVrtProc.start()
while kapToVrtProc.is_alive():
sleep(.1)
vrtPath = kapPath[0:-4] + ".vrt"
#print vrtPath
if os.path.isfile(vrtPath):
zxyFullPath = Resources.getTempDir() + "/" + kapPath.split("/")[-1][0:-4] + ".zxy/"
tileError = True
try:
vrtToTilesProc = Process(target=VrtToTiles, args=(Resources.getTempDir(), vrtPath, FindZoom.getKapZoom(kapPath),))
vrtToTilesProc.start()
while vrtToTilesProc.is_alive():
sleep(.1)
if os.path.isdir(zxyFullPath):
# if len(os.listdir(zxyFullPath)) > 0:
# tileError = False
for subDir in os.listdir(zxyFullPath):
if os.path.isdir(zxyFullPath + subDir):
tileError = False
except:
pass
print "VrtToTiles failed!"
if tileError:
print "ERROR gdal_tiler failed processing chart: ", kapPath.split("/")[-1]
Resources.lstBsbErrorFiles.append(kapPath.split("/")[-1][0:-4])
###
os.remove(vrtPath) #clean up vrt files
else:
###map2gdal failed because there is no vrt file...
print vrtPath
print "ERROR map2gdal failed processing chart: ", kapPath.split("/")[-1]
Resources.lstBsbErrorFiles.append(kapPath.split("/")[-1][0:-4])
# mp = Process(target=TileMap, args=(kapPath, parent.currentChart, resourcePipeB, signalPipeA))
# mp.start()
#Event is bound to Step4.nextStage(self, event)
wx.PostEvent(app, InThreadEvent(advance=False))
#posting this event signals to parent window that the task is finished
if pleaseContinue:
#Event is bound to Step4.nextStage(self, event)
wx.PostEvent(app, InThreadEvent(advance=True))
示例4: _evtFinish
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getTempDir [as 别名]
def _evtFinish(self, event):
self.Hide()
if os.path.isdir( os.path.abspath(Resources.getTempDir()) ):
print "Cleaning up temporary directory: ", os.path.abspath(Resources.getTempDir())
print "Please wait..."
shutil.rmtree(os.path.abspath(Resources.getTempDir()))
print "complete, bye now :)"
self.Destroy()
blankParent.Destroy()
示例5: ConcatTiles
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getTempDir [as 别名]
def ConcatTiles():
### STAGE 4 ###
if Resources.numChartsMerge > 0:
directory = Resources.getTempDir() + "/gemf"
if not os.path.isdir(directory):
os.mkdir(directory)
shutil.move(Resources.getTempDir() + "/merge", directory)
GemfBuilder( (directory,) )
shutil.move(directory + "/map_data.gemf", Resources.outdir + "/" + Resources.name + ".gemf")
if pleaseContinue:
wx.PostEvent(app, InThreadEvent(advance=True))
示例6: QuantTiles
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getTempDir [as 别名]
def QuantTiles():
### STAGE 3 ###
if Resources.quantize:
print "Quantizing generated tiles with pngnq..."
pngList = RecursiveSearch(Resources.getTempDir() + "/merge", ".png")
for pngPath in pngList.getFilePaths():
pngPath = pngPath.replace("\\","/")
if platform.system() == "Windows":
thisone = Popen([os.getcwd().replace("\\","/")+'/pngnqi.exe','-s1','-g2.2','-n','256','-e','.nq8',pngPath])
#thisone = Popen([os.path.abspath(os.curdir).replace("\\","/")+'/pngnqi.exe','-s1','-g2.2','-n','256','-e','.nq8',pngPath])
if platform.system() == "Linux":
thisone = Popen(['pngnq','-s1','-g2.2','-n','256','-e','.nq8', pngPath])
thisone.wait()
os.remove(pngPath)
os.rename(pngPath.replace(".png", ".nq8"), pngPath)
if not pleaseContinue:
break
wx.PostEvent(app, InThreadEvent(advance=False))
if pleaseContinue:
print "Quantization finished"
wx.PostEvent(app, InThreadEvent(advance=True))
示例7: freeze_support
# 需要导入模块: import Resources [as 别名]
# 或者: from Resources import getTempDir [as 别名]
if platform.system() == "Windows":
freeze_support()
else:
import sys
sys.path.append(os.path.dirname(os.path.abspath(__file__)) +"/my_tilers_tools")
global pleaseContinue
global app
app = wx.App(redirect=False)
print "MXCart Initialized ..."
print "If you experience problems, please email the contents of this window to [email protected]"
pleaseContinue = True
blankParent = BlankParent(None)
about = About(blankParent)
about.title_staticText.SetLabel(Resources.version)
about.Show()
if not os.path.isdir(Resources.getTempDir()):
#print "Making temporary directory", os.path.abspath(Resources.getTempDir())
os.makedirs(Resources.getTempDir())
else:
#print "Cleaning out temp directory"
shutil.rmtree(Resources.getTempDir(), ignore_errors=True)
app.MainLoop()