本文整理汇总了Python中Resources类的典型用法代码示例。如果您正苦于以下问题:Python Resources类的具体用法?Python Resources怎么用?Python Resources使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Resources类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: playTune
def playTune(tuneName):
"""Plays a short tune. Returns whether it was actually played."""
if _mixerInit and not _quiet:
Resources.music(tuneName, loop=False)
return True
else:
return False
示例2: move
def move(self):
Resources.display()
node = Resources.Node((self.row, Resources.BOARD))
highest_val, best_move = search.search(node, self.row)
print "%s moves" % self.name, best_move
return do_move(best_move, self.row, Resources.BOARD)
示例3: BuildToolbar
def BuildToolbar(self):
tb = wx.ToolBar(self,-1)
self.ToolBar = tb
tb.SetToolBitmapSize((24,24))
tb.AddTool(ID_POINTER_BUTTON, Resources.getPointerBitmap(), isToggle=True, shortHelpString = "Pointer")
wx.EVT_TOOL(self, ID_POINTER_BUTTON, self.SetToolMode)
tb.AddTool(ID_ZOOM_IN_BUTTON, Resources.getMagPlusBitmap(), isToggle=True, shortHelpString = "Zoom In")
wx.EVT_TOOL(self, ID_ZOOM_IN_BUTTON, self.SetToolMode)
tb.AddTool(ID_ZOOM_OUT_BUTTON, Resources.getMagMinusBitmap(), isToggle=True, shortHelpString = "Zoom Out")
wx.EVT_TOOL(self, ID_ZOOM_OUT_BUTTON, self.SetToolMode)
tb.AddTool(ID_MOVE_MODE_BUTTON, Resources.getHandBitmap(), isToggle=True, shortHelpString = "Move")
wx.EVT_TOOL(self, ID_MOVE_MODE_BUTTON, self.SetToolMode)
tb.AddSeparator()
tb.AddControl(wx.Button(tb, ID_ZOOM_TO_FIT_BUTTON, "Zoom To Fit",wx.DefaultPosition, wx.DefaultSize))
wx.EVT_BUTTON(self, ID_ZOOM_TO_FIT_BUTTON, self.ZoomToFit)
tb.Realize()
S = tb.GetSize()
tb.SetSizeHints(S[0],S[1])
return tb
示例4: __init__
def __init__(self, posn, width, nOptions):
self.displayers = []
self.options = []
self.enabledOptions = []
self.posn = posn
for i in xrange(nOptions):
td = TextDisplayer()
td.setText("")
td.setFont(Resources.font(size=16, bold=True))
self.displayers.append(td)
self.box = TextDisplayerBox(self.displayers,
posn,
width,
nOptions)
self.selectedOption = 0
self._showing = False
(textureID,
image,
renderedSize) = GLUtil.renderTextToTexture(Resources.font(size=16,
bold=True),
(255,255,255,255),
">",
False,
None)
self.cursorImage = image
self.cursorTexture = textureID
示例5: compileMapSquareList
def compileMapSquareList(self, sq):
if sq.guiData.has_key("listID"):
glDeleteLists(sq.guiData["listID"], 1)
textureNames = sq.texture()
texIDt = Resources.texture(textureNames[0])
sq.guiData['textureID'] = texIDt #fix me: update with the new amount of textures.
texIDl = Resources.texture(textureNames[1])
texIDb = Resources.texture(textureNames[2])
texIDr = Resources.texture(textureNames[3])
texIDf = Resources.texture(textureNames[4])
textureIDs = [texIDt, texIDl, texIDb, texIDr, texIDf]
listID = glGenLists(1)
sq.guiData["listID"] = listID
glNewList(listID, GL_COMPILE)
GLUtil.makeCube(sq.z, sq.cornerHeights,
textureIDs, sq.cornerColors, sq.waterHeight,
sq.waterColor, sq.minHeight())
#glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
#glLineWidth(0.75)
#GLUtil.makeCube(sq.z, (0.0,0.0,0.0,1.0), sq.cornerHeights, False)
#glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
glEndList()
topListID = glGenLists(1)
sq.guiData['topListID'] = topListID
glNewList(topListID, GL_COMPILE)
GLUtil.makeCubeTop(sq.z, sq.cornerHeights)
glEndList()
示例6: BuildToolbar
def BuildToolbar(self):
tb = wx.ToolBar(self)
self.ToolBar = tb
tb.SetToolBitmapSize((24,24))
self.PointerTool = tb.AddRadioTool(wx.ID_ANY, bitmap=Resources.getPointerBitmap(), shortHelp = "Pointer")
self.Bind(wx.EVT_TOOL, lambda evt : self.SetMode(Mode=self.GUIMouse), self.PointerTool)
self.ZoomInTool = tb.AddRadioTool(wx.ID_ANY, bitmap=Resources.getMagPlusBitmap(), shortHelp = "Zoom In")
self.Bind(wx.EVT_TOOL, lambda evt : self.SetMode(Mode=self.GUIZoomIn), self.ZoomInTool)
self.ZoomOutTool = tb.AddRadioTool(wx.ID_ANY, bitmap=Resources.getMagMinusBitmap(), shortHelp = "Zoom Out")
self.Bind(wx.EVT_TOOL, lambda evt : self.SetMode(Mode=self.GUIZoomOut), self.ZoomOutTool)
self.MoveTool = tb.AddRadioTool(wx.ID_ANY, bitmap=Resources.getHandBitmap(), shortHelp = "Move")
self.Bind(wx.EVT_TOOL, lambda evt : self.SetMode(Mode=self.GUIMove), self.MoveTool)
tb.AddSeparator()
self.ZoomButton = wx.Button(tb, label="Zoom To Fit")
tb.AddControl(self.ZoomButton)
self.ZoomButton.Bind(wx.EVT_BUTTON, self.ZoomToFit)
tb.Realize()
## fixme: remove this when the bug is fixed!
wx.CallAfter(self.HideShowHack) # this required on wxPython 2.8.3 on OS-X
return tb
示例7: cancelHandler
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()
示例8: MergeTiles
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))
示例9: __init__
def __init__(
self, parent, id=wx.ID_ANY, size=wx.DefaultSize, **kwargs
): # The rest just get passed into FloatCanvas
wx.Panel.__init__(self, parent, id, size=size)
self.Modes = [
("Pointer", GUIMode.GUIMouse(), Resources.getPointerBitmap()),
("Zoom In", GUIMode.GUIZoomIn(), Resources.getMagPlusBitmap()),
("Zoom Out", GUIMode.GUIZoomOut(), Resources.getMagMinusBitmap()),
("Pan", GUIMode.GUIMove(), Resources.getHandBitmap()),
]
self.BuildToolbar()
## Create the vertical sizer for the toolbar and Panel
box = wx.BoxSizer(wx.VERTICAL)
box.Add(self.ToolBar, 0, wx.ALL | wx.ALIGN_LEFT | wx.GROW, 4)
self.Canvas = FloatCanvas.FloatCanvas(self, **kwargs)
box.Add(self.Canvas, 1, wx.GROW)
self.SetSizerAndFit(box)
# default to first mode
# self.ToolBar.ToggleTool(self.PointerTool.GetId(), True)
self.Canvas.SetMode(self.Modes[0][1])
return None
示例10: __init__
def __init__(self):
screenWidth = 1000
screenHeight = 600
pygame.init()
if(Resources.getOptionValue("fullscreen") == 1):
pygame.display.set_mode((screenWidth, screenHeight), FULLSCREEN)
else:
pygame.display.set_mode((screenWidth, screenHeight))
pygame.display.set_caption("Bump'N'Jump")
pygame.mixer.music.load("resources/sound/music.wav")
pygame.mixer.music.set_volume(float(Resources.getOptionValue("music"))/100)
pygame.mixer.music.play(-1)
currentScene = MainMenu()
clock = pygame.time.Clock()
game = True
while game:
game, currentScene = currentScene.update()
clock.tick(60)
示例11: compileMapSquareList
def compileMapSquareList(self, sq):
if sq.guiData.has_key("listID"):
glDeleteLists(sq.guiData["listID"], 1)
textureNames = sq.texture()
texIDt = Resources.texture(textureNames[0])
sq.guiData["textureID"] = texIDt # FIXME: update with the new amount of textures.
texIDl = Resources.texture(textureNames[1])
texIDb = Resources.texture(textureNames[2])
texIDr = Resources.texture(textureNames[3])
texIDf = Resources.texture(textureNames[4])
textureIDs = [texIDt, texIDl, texIDb, texIDr, texIDf]
listID = glGenLists(1)
sq.guiData["listID"] = listID
glNewList(listID, GL_COMPILE)
GLUtil.makeCube(
sq.z, sq.cornerHeights, textureIDs, sq.cornerColors, sq.waterHeight, sq.waterColor, sq.minHeight()
)
glEndList()
topListID = glGenLists(1)
sq.guiData["topListID"] = topListID
glNewList(topListID, GL_COMPILE)
GLUtil.makeCubeTop(sq.z, sq.cornerHeights)
glEndList()
示例12: MakeTiles
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))
示例13: _load
def _load():
global _maleNames, _femaleNames, _neuterNames, _loaded
_loaded = True
_maleNames = Resources.text("names-male")
_femaleNames = Resources.text("names-female")
# FIXME: maintain a neuter file at some point
_neuterNames = Resources.text("names-male")
for n in [_maleNames, _femaleNames, _neuterNames]:
for i in xrange(0, len(n)):
n[i] = n[i].strip()
示例14: _evtFinish
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()
示例15: pushZND
def pushZND(self,prog_id):
# define where and what
file_descriptor = os.path.join(self.get_local_solutions_dir(),'*.znd*');
# query for file listing
file_list = glob.glob(file_descriptor);
# push each snx file
for file in file_list:
print "pushing znd file: ",file
Resources.pushSNX(self.get_solution_bucket(prog_id), file);