本文整理汇总了Python中fofix.game.Dialogs类的典型用法代码示例。如果您正苦于以下问题:Python Dialogs类的具体用法?Python Dialogs怎么用?Python Dialogs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Dialogs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: shown
def shown(self):
self.engine.view.pushLayer(self.menu)
shaders.checkIfEnabled()
if not self.shownOnce:
self.shownOnce = True
if hasattr(sys, 'frozen'):
# Check whether this is a release binary being run from an svn/git
# working copy or whether this is an svn/git binary not being run
# from an corresponding working copy.
currentVcs, buildVcs = None, None
if VFS.isdir('/gameroot/.git'):
currentVcs = 'git'
elif VFS.isdir('/gameroot/src/.svn'):
currentVcs = 'Subversion'
if 'git' in Version.version():
buildVcs = 'git'
elif 'svn' in Version.version():
buildVcs = 'Subversion'
if currentVcs != buildVcs:
if buildVcs is None:
msg = _('This binary release is being run from a %(currentVcs)s working copy. This is not the correct way to run FoFiX from %(currentVcs)s. Please see one of the following web pages to set your %(currentVcs)s working copy up correctly:') + \
'\n\nhttp://code.google.com/p/fofix/wiki/RunningUnderPython26' + \
'\nhttp://code.google.com/p/fofix/wiki/RequiredSourceModules'
else:
msg = _('This binary was built from a %(buildVcs)s working copy but is not running from one. The FoFiX Team will not provide any support whatsoever for this binary. Please see the following site for official binary releases:') + \
'\n\nhttp://code.google.com/p/fofix/'
Dialogs.showMessage(self.engine, msg % {'buildVcs': buildVcs, 'currentVcs': currentVcs})
示例2: loadLibrary
def loadLibrary(self):
log.debug("Loading libraries in %s" % self.library)
self.loaded = False
self.tiersPresent = False
if self.splash:
Dialogs.changeLoadingSplashScreenText(self.engine, self.splash, _("Browsing Collection..."))
else:
self.splash = Dialogs.showLoadingSplashScreen(self.engine, _("Browsing Collection..."))
self.loadStartTime = time.time()
self.engine.resource.load(self, "libraries", lambda: song.getAvailableLibraries(self.engine, self.library), onLoad = self.loadSongs, synch = True)
示例3: showTutorial
def showTutorial(self):
# evilynux - Make sure tutorial exists before launching
tutorialpath = self.engine.tutorialFolder
if not os.path.isdir(self.engine.resource.fileName(tutorialpath)):
log.debug("No folder found: %s" % tutorialpath)
Dialogs.showMessage(self.engine, _("No tutorials found!"))
return
self.engine.startWorld(1, None, 0, 0, tutorial = True)
self.launchLayer(lambda: Lobby(self.engine))
示例4: resetWorld
def resetWorld(self):
if self.scene:
self.engine.view.popLayer(self.scene)
self.engine.removeTask(self.scene)
for layer in self.engine.view.layers:
if isinstance(layer, Dialogs.LoadingSplashScreen):
Dialogs.hideLoadingSplashScreen(self.engine, layer)
self.scene = None
self.sceneName = ""
self.players = []
self.songQueue.reset()
self.engine.mainMenu.restartGame()
示例5: finishGame
def finishGame(self):
if self.done:
return
self.players = []
if self.scene:
self.engine.view.popLayer(self.scene)
self.engine.removeTask(self.scene)
for layer in self.engine.view.layers:
if isinstance(layer, Dialogs.LoadingSplashScreen):
Dialogs.hideLoadingSplashScreen(self.engine, layer)
self.scene = None
self.done = True
self.engine.finishGame()
示例6: loading
def loading(self):
"""Loading state loop."""
done = self.task.run()
self.clearScreen()
if self.data.essentialResourcesLoaded():
if not self.loadingScreenShown:
self.loadingScreenShown = True
Dialogs.showLoadingScreen(self, self.data.resourcesLoaded)
if self.startupLayer:
self.view.pushLayer(self.startupLayer)
self.mainloop = self.main
self.view.render()
self.video.flip()
return done
示例7: setNewKeyMapping
def setNewKeyMapping(engine, config, section, option, key):
oldKey = config.get(section, option)
config.set(section, option, key)
keyCheckerMode = Config.get("game", "key_checker_mode")
if key == "None" or key is None:
return True
b = isKeyMappingOK(config, option)
if b != 0:
if keyCheckerMode > 0:
from fofix.game import Dialogs
Dialogs.showMessage(engine, _("This key conflicts with the following keys: %s") % str(b))
if keyCheckerMode == 2: #enforce no conflicts!
config.set(section, option, oldKey)
return False
return True
示例8: deleteCharacter
def deleteCharacter(self):
tsYes = _("Yes")
q = Dialogs.chooseItem(self.engine, [tsYes, _("No")], _("Are you sure you want to delete this player?"))
if q == tsYes:
if self.player:
Player.deletePlayer(self.player)
self.engine.view.popLayer(self)
self.engine.input.removeKeyListener(self)
示例9: loadItemLabel
def loadItemLabel(self, i, preload=False):
# Load the item label if it isn't yet loaded
item = self.items[i]
if self.itemLabels[i] is None:
if isinstance(item, song.SongInfo):
# CD covers
if self.labelType == 1:
f = "label.png"
else:
f = "album.png"
if self.texturedLabels:
label = self.engine.resource.fileName(item.libraryNam, item.songName, f)
if os.path.exists(label):
self.itemLabels[i] = Texture(label)
else:
self.itemLabels[i] = False
else:
self.itemLabels[i] = self.engine.loadImgDrawing(None, "label", os.path.join(item.libraryNam, item.songName, f))
elif isinstance(item, song.LibraryInfo):
if self.texturedLabels:
label = self.engine.resource.fileName(item.libraryName, "label.png")
if os.path.exists(label):
self.itemLabels[i] = Texture(label)
else:
self.itemLabels[i] = False
else:
self.itemLabels[i] = self.engine.loadImgDrawing(None, "label", os.path.join(item.libraryName, "label.png"))
elif isinstance(item, song.RandomSongInfo):
self.itemLabels[i] = "Random"
else:
return
if preload:
if time.time() - self.loadStartTime > 3:
self.loadStartTime = time.time()
percent = (i * 100) / len(self.items)
Dialogs.changeLoadingSplashScreenText(self.engine, self.splash, _("Loading Album Artwork...") + " %d%%" % percent)
示例10: checkParts
def checkParts(self):
info = song.loadSongInfo(self.engine, self.songName, library = self.libraryName)
guitars = []
drums = []
vocals = []
for part in info.parts:
if part.id == 4 or part.id == 7:
drums.append(part)
elif part.id == 5:
vocals.append(part)
else:
guitars.append(part)
if len(drums) == 0 and self.engine.input.gameDrums > 0:
Dialogs.showMessage(self.engine, _("There are no drum parts in this song. Change your controllers to play."))
return False
if len(guitars) == 0 and self.engine.input.gameGuitars > 0:
Dialogs.showMessage(self.engine, _("There are no guitar parts in this song. Change your controllers to play."))
return False
if len(vocals) == 0 and self.engine.input.gameMics > 0:
Dialogs.showMessage(self.engine, _("There are no vocal parts in this song. Change your controllers to play."))
return False
return True
示例11: saveCharacter
def saveCharacter(self):
pref = self.choices[0:8]
pref.insert(7, self.neck)
if len(self.choices[0]) > 0:
if self.choices[0].lower() == "default":
Dialogs.showMessage(self.engine, _("That is a terrible name. Choose something not 'default'"))
elif self.choices[0].lower() not in self.invalidNames or self.choices[0] == self.player:
Player.updatePlayer(self.player, pref)
self.updatedName = self.choices[0]
if self.avatar is not None:
shutil.copy(self.engine.resource.fileName(self.avatar),os.path.join(self.engine.data.path,"users","players",self.choices[0]+".png"))
if self.oldName:
if os.path.exists(self.engine.resource.fileName(os.path.join("users","players",self.oldName+".png"))) and self.oldName != self.choices[0]:
if self.avatar is None:
os.rename(self.engine.resource.fileName(os.path.join("users","players",self.oldName+".png")), os.path.join(self.engine.data.path,"users","players",self.choices[0]+".png"))
else:
os.remove(self.engine.resource.fileName(os.path.join("users","players",self.oldName+".png")))
self.engine.view.popLayer(self)
self.engine.input.removeKeyListener(self)
else:
Dialogs.showMessage(self.engine, _("That name already exists!"))
else:
Dialogs.showMessage(self.engine, _("Please enter a name!"))
示例12: showMessages
def showMessages(self):
msg = self.engine.startupMessages.pop()
self.showStartupMessages = False
Dialogs.showMessage(self.engine, msg)
示例13: restartGame
def restartGame(self):
splash = Dialogs.showLoadingSplashScreen(self.engine, "")
self.engine.view.pushLayer(Lobby(self.engine))
Dialogs.hideLoadingSplashScreen(self.engine, splash)
示例14: progressCallback
def progressCallback(self, percent):
if time.time() - self.loadStartTime > 7:
Dialogs.changeLoadingSplashScreenText(self.engine, self.splash, _("Browsing Collection...") + ' (%d%%)' % (percent*100))
示例15: prepareSetlist
def prepareSetlist(self, songs):
if self.songLoader:
self.songLoader.stop()
msg = self.engine.setlistMsg
self.engine.setlistMsg = None
self.selectedIndex = 0
if self.listingMode == 0 or self.careerMode:
self.items = self.libraries + self.songs
else:
self.items = self.songs
self.itemRenderAngles = [0.0] * len(self.items)
self.itemLabels = [None] * len(self.items)
self.searching = False
self.searchText = ""
shownItems = []
for item in self.items: #remove things we don't want to see. Some redundancy, but that's okay.
if isinstance(item, song.TitleInfo) or isinstance(item, song.SortTitleInfo):
if self.showCareerTiers == 2:
if isinstance(item, song.TitleInfo):
if len(shownItems) > 0:
if isinstance(shownItems[-1], song.TitleInfo):
shownItems.pop()
shownItems.append(item)
elif isinstance(item, song.SortTitleInfo):
continue
else:
if isinstance(item, song.TitleInfo):
continue
elif isinstance(item, song.SortTitleInfo):
if not self.showSortTiers:
continue
if len(shownItems) > 0:
if isinstance(shownItems[-1], song.SortTitleInfo):
shownItems.pop()
shownItems.append(item)
elif isinstance(item, song.SongInfo):
if self.careerMode and (not self.showLockedSongs) and item.getLocked():
continue
else:
shownItems.append(item)
else:
shownItems.append(item)
if len(shownItems) > 0:
if isinstance(shownItems[-1], song.TitleInfo) or isinstance(shownItems[-1], song.SortTitleInfo):
shownItems.pop()
if len(self.items) > 0 and len(shownItems) == 0:
msg = _("No songs in this setlist are available to play!")
if self.careerMode:
msg = msg + " " + _("Make sure you have a working career pack!")
Dialogs.showMessage(self.engine, msg)
elif len(shownItems) > 0:
for item in shownItems:
if isinstance(item, song.SongInfo) or isinstance(item, song.LibraryInfo):
self.items = shownItems #make sure at least one item is selectable
break
else:
msg = _("No songs in this setlist are available to play!")
if self.careerMode:
msg = msg + " " + _("Make sure you have a working career pack!")
Dialogs.showMessage(self.engine, msg)
self.items = []
if self.items == []: #MFH: Catch when there ain't a damn thing in the current folder - back out!
if self.library != song.DEFAULT_LIBRARY:
Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
self.splash = None
self.startingSelected = self.library
self.library = os.path.dirname(self.library)
self.selectedItem = None
self.loadLibrary()
return
log.debug("Setlist loaded.")
self.loaded = True
if self.setlistStyle == 1:
for i in range(self.headerSkip):
self.items.insert(0, song.BlankSpaceInfo())
for i in range(self.footerSkip):
self.items.append(song.BlankSpaceInfo())
if self.startingSelected is not None:
for i, item in enumerate(self.items):
if isinstance(item, song.SongInfo) and self.startingSelected == item.songName: #TODO: SongDB
self.selectedIndex = i
break
elif isinstance(item, song.LibraryInfo) and self.startingSelected == item.libraryName:
self.selectedIndex = i
break
for item in self.items:
if isinstance(item, song.SongInfo):
item.name = song.removeSongOrderPrefixFromName(item.name) #TODO: I don't like this.
elif not self.tiersPresent and (isinstance(item, song.TitleInfo) or isinstance(item, song.SortTitleInfo)):
self.tiersPresent = True
while isinstance(self.items[self.selectedIndex], song.BlankSpaceInfo) or ((isinstance(self.items[self.selectedIndex], song.TitleInfo) or isinstance(self.items[self.selectedIndex], song.SortTitleInfo)) and not self.selectTiers):
#.........这里部分代码省略.........