Esempio n. 1
0
    def openFileByName(self, filename):
        if(filename=="newFile.map.json"):
            return

        if os.path.isfile(filename):
            current_project.settings["gamefolder"] = os.path.abspath(
                os.path.join(os.path.dirname(str(filename)), "../../"))
            current_project.settings["workingFile"] = filename
            self.setWindowTitle(current_project.settings["workingFile"])
            self.myMap.load(current_project.settings["workingFile"])
            self.myTileSet = tile_set.TileSet(os.path.join(
                current_project.settings["gamefolder"], self.myMap.tileImage), self.myMap.palette)
            self.myMapWidget.DrawMap(self)
            self.gridViewAction.setChecked(False)  # gambiarra
            self.myPaletteWidget.drawPalette(self.myTileSet)
            self.myEventsWidget.updateEventsList()
            self.myEventsWidget.enableButtonsBecauseEventsList()
            self.myCharasPalWidget.reinit()
            game_init.regenerateInit()
            hasinit = self.myMapExplorerWidget.reloadInitFile()
            self.setEnabledAll(hasinit == True)
            cmd.clearCommandStack()
            self.firsttime = False
            self.changeTileCurrent(0)
            if(hasinit):
                self.myServer.runServer(os.path.abspath(current_project.settings["gamefolder"]))
            else:
                self.myServer.stopServer()
Esempio n. 2
0
 def __newFile(self, returnedNFD):
     current_project.settings["gamefolder"] = str(returnedNFD["gameFolder"])
     self.levelName = str(returnedNFD["name"])
     current_project.settings["workingFile"] = os.path.join(
         current_project.settings["gamefolder"], fifl.LEVELS, self.levelName + ".map.json")
     self.setWindowTitle(current_project.settings["workingFile"])
     palette = os.path.join(
         current_project.settings["gamefolder"], fifl.LEVELS,returnedNFD["palette"])
     self.myMap.new(self.levelName, returnedNFD[
                    "width"], returnedNFD["height"], palette)
     self.myTileSet = tile_set.TileSet(os.path.join(
         current_project.settings["gamefolder"], self.myMap.tileImage), self.myMap.palette)
     self.myMapWidget.DrawMap(self)
     self.gridViewAction.setChecked(False)  # gambiarra
     self.myPaletteWidget.drawPalette(self.myTileSet)
     self.myEventsWidget.updateEventsList()
     self.myCharasPalWidget.reinit()
     game_init.regenerateInit()
     hasinit = self.myMapExplorerWidget.reloadInitFile()
     self.setEnabledAll(hasinit == True)
     self.changeTileCurrent(0)
     cmd.clearCommandStack()