當前位置: 首頁>>代碼示例>>Python>>正文


Python SimpleXMLSerializer.getModuleNameList方法代碼示例

本文整理匯總了Python中fife.extensions.serializers.simplexml.SimpleXMLSerializer.getModuleNameList方法的典型用法代碼示例。如果您正苦於以下問題:Python SimpleXMLSerializer.getModuleNameList方法的具體用法?Python SimpleXMLSerializer.getModuleNameList怎麽用?Python SimpleXMLSerializer.getModuleNameList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fife.extensions.serializers.simplexml.SimpleXMLSerializer的用法示例。


在下文中一共展示了SimpleXMLSerializer.getModuleNameList方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: load_project

# 需要導入模塊: from fife.extensions.serializers.simplexml import SimpleXMLSerializer [as 別名]
# 或者: from fife.extensions.serializers.simplexml.SimpleXMLSerializer import getModuleNameList [as 別名]
    def load_project(self, filepath):
        """Tries to load a project

        Args:

            filepath: The path to the project file.

        Returns: True of the project was loaded. False if not."""
        try:
            self.clear()
        except Exception as error:  # pylint: disable=broad-except
            print(error)
        settings = SimpleXMLSerializer()
        try:
            settings.load(filepath)
        except (InvalidFormat, ET.ParseError):
            return False
        if "fife-rpg" in settings.getModuleNameList():
            self.project = settings
            project_dir = str(os.path.normpath(os.path.split(filepath)[0]))
            self.engine.getVFS().addNewSource(project_dir)
            self.project_source = project_dir
            self.project_dir = project_dir
            self.load_project_settings()
            self.changed_maps = []
            self.project_changed = False
            self.entity_changed = False
            try:
                old_dir = os.getcwd()
                os.chdir(self.project_dir)
                self.load_maps()
                os.chdir(old_dir)
            except:  # pylint: disable=bare-except
                pass
            return True
        return False
開發者ID:fife-rpg,項目名稱:editor,代碼行數:38,代碼來源:fife_rpg_editor.py

示例2: Setting

# 需要導入模塊: from fife.extensions.serializers.simplexml import SimpleXMLSerializer [as 別名]
# 或者: from fife.extensions.serializers.simplexml.SimpleXMLSerializer import getModuleNameList [as 別名]

#.........這裏部分代碼省略.........
			'LogModules':['controller','script'],
			'FrameLimitEnabled':False, 'FrameLimit':60,
			'MouseSensitivity':0.0,
			'MouseAcceleration':False
			}

		# has the settings file been read
		self._readSettingsCompleted = {}

		# the global dictionary from which we will read after self._readSettingsCompleted is True
		self._settingsFromFile = {}

		# the logger needed to write in log file. It will be initialized in this file when self.getSettings()
		# method is called by logger
		self._logger = None

		#default settings
		self._resolutions = self._validSetting['FIFE']['ScreenResolution']
		self._renderbackends = self._validSetting['FIFE']['RenderBackend']
		self._lightingmodels = self._validSetting['FIFE']['Lighting']

		#Used to stylize the options gui
		self._gui_style = "default"

		#Initialize the serializer
		if serializer:
			self._serializer = serializer
		else:
			self._serializer = SimpleXMLSerializer()

		self.initSerializer()

		# Get all modules and initialize reading of them from xml file as false
		self._allModules = self._serializer.getModuleNameList()
		# print("All Module Names:",self._allModules)
		for module in self._allModules:
			self._readSettingsCompleted[module] = False

		self._initDefaultSettingEntries()

		#self.setOneSetting('FIFE','Font','fonts/FreeSans.ttf',False)

		#print self.getSettingsFromFile('unknownhorizons')

	# set all Settings in either validSetting or defaultSetting
	def setAllSettings(self,module,settings,validSetting = True):
		if validSettings:
			self._validSetting[module] = settings
		else:
			self._defaultSetting[module] = settings

	# set an entry in the validSetting or defaultSetting dictionary
	def setOneSetting(self,module,name,value,validSetting = True):
		if validSetting:
			self._validSetting[module][name] = value
		else:
			self._defaultSetting[module][name] = value

	# get all the Settings(either validSetting or defaultSetting)
	def getAllSettings(self,module,validSetting = True):
		if validSetting:
			return self._validSetting[module]
		else:
			return self._defaultSetting[module]

	# get an entry from either validSetting or defaultSetting
開發者ID:cheif,項目名稱:fifengine,代碼行數:70,代碼來源:fife_settings.py


注:本文中的fife.extensions.serializers.simplexml.SimpleXMLSerializer.getModuleNameList方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。