mirror of
https://github.com/ModOrganizer2/modorganizer-tool_configurator.git
synced 2026-07-27 14:03:25 -07:00
added build scripts, support for fo4 and now accepts if config file is missing
This commit is contained in:
+4
-1
@@ -1 +1,4 @@
|
||||
Thumbs.db
|
||||
build
|
||||
std*.log
|
||||
CMakeLists.txt.user
|
||||
edit
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
||||
|
||||
SET(PROJ_NAME tool_configurator LANGUAGES NONE)
|
||||
|
||||
PROJECT(${PROJ_NAME})
|
||||
|
||||
SET(DEPENDENCIES_DIR CACHE PATH "")
|
||||
|
||||
FILE(GLOB_RECURSE PYTHON_ROOT ${DEPENDENCIES_DIR}/pyconfig.h.in)
|
||||
GET_FILENAME_COMPONENT(PYTHON_ROOT ${PYTHON_ROOT} DIRECTORY)
|
||||
|
||||
MESSAGE(${PYTHON_ROOT})
|
||||
|
||||
ADD_SUBDIRECTORY(src)
|
||||
@@ -0,0 +1,25 @@
|
||||
CMAKE_MINIMUM_REQUIRED (VERSION 2.8)
|
||||
|
||||
SET(default_project_path "${CMAKE_SOURCE_DIR}/..")
|
||||
GET_FILENAME_COMPONENT(${default_project_path} ${default_project_path} REALPATH)
|
||||
|
||||
SET(project_path "${default_project_path}" CACHE PATH "path to the other mo projects")
|
||||
|
||||
FIND_PATH(pyuic_path pyuic5.bat PATHS "${PYTHON_ROOT}")
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${PYTHON_ROOT}/pyuic5.bat -o ${CMAKE_CURRENT_BINARY_DIR}/pyCfgDialog.py ${CMAKE_CURRENT_SOURCE_DIR}/pyCfgDialog.ui WORKING_DIRECTORY ${PYTHON_ROOT})
|
||||
EXECUTE_PROCESS(COMMAND ${PYTHON_ROOT}/pyrcc5.exe -o ${CMAKE_CURRENT_BINARY_DIR}/pyCfgResource_rc.py ${CMAKE_CURRENT_SOURCE_DIR}/pyCfgResource.qrc)
|
||||
|
||||
|
||||
###############
|
||||
## Installation
|
||||
|
||||
INSTALL(FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/pyCfg.py
|
||||
DESTINATION bin/plugins)
|
||||
|
||||
INSTALL(FILES
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pyCfgDialog.py
|
||||
${CMAKE_CURRENT_BINARY_DIR}/pyCfgResource_rc.py
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/settings.json
|
||||
DESTINATION bin/plugins/data)
|
||||
+22
-13
@@ -110,8 +110,8 @@ class MainWindow(QDialog):
|
||||
self.__save()
|
||||
elif res == QMessageBox.Cancel:
|
||||
event.ignore()
|
||||
else:
|
||||
super(MainWindow, self).__init__(event)
|
||||
#else:
|
||||
# super(MainWindow, self).__init__(event)
|
||||
|
||||
def __save(self):
|
||||
self.saveSettings.emit(self.__settings)
|
||||
@@ -437,6 +437,8 @@ class IniEdit(mobase.IPluginTool):
|
||||
return ["fallout.ini", "falloutprefs.ini"]
|
||||
elif str(gameType) == "skyrim":
|
||||
return ["skyrim.ini", "skyrimprefs.ini"]
|
||||
elif str(gameType) == "fallout4":
|
||||
return ["fallout4.ini", "fallout4prefs.ini", "fallout4custom.ini"]
|
||||
else:
|
||||
return []
|
||||
|
||||
@@ -466,7 +468,10 @@ class IniEdit(mobase.IPluginTool):
|
||||
def updateSettings(self, settings, fileName):
|
||||
parser = ConfigParser.SafeConfigParser(allow_no_value=True)
|
||||
parser.optionxform = str
|
||||
cfgFile = MagicFile(self.__organizer.profilePath() + "/" + fileName, 'r')
|
||||
filePath = self.__organizer.profilePath() + "/" + fileName
|
||||
if not os.path.exists(filePath):
|
||||
return
|
||||
cfgFile = MagicFile(filePath, 'r')
|
||||
parser.readfp(cfgFile)
|
||||
for section in parser.sections():
|
||||
if section not in settings:
|
||||
@@ -518,12 +523,14 @@ class IniEdit(mobase.IPluginTool):
|
||||
try:
|
||||
ini_files = {}
|
||||
for fileName in self.__iniFiles():
|
||||
parser = ConfigParser.SafeConfigParser(allow_no_value=True)
|
||||
parser.optionxform = str
|
||||
cfgFile = MagicFile(self.__organizer.profilePath() + "/" + fileName, 'r')
|
||||
parser.readfp(cfgFile)
|
||||
ini_files[fileName] = parser
|
||||
cfgFile.close()
|
||||
filePath = self.__organizer.profilePath() + "/" + fileName
|
||||
if os.path.exists(filePath):
|
||||
parser = ConfigParser.SafeConfigParser(allow_no_value=True)
|
||||
parser.optionxform = str
|
||||
cfgFile = MagicFile(filePath, 'r')
|
||||
parser.readfp(cfgFile)
|
||||
ini_files[fileName] = parser
|
||||
cfgFile.close()
|
||||
count = 0
|
||||
for sectionkey, section in settings.iteritems():
|
||||
count += 1
|
||||
@@ -539,10 +546,12 @@ class IniEdit(mobase.IPluginTool):
|
||||
else:
|
||||
ini_files[setting["file"]].set(sectionkey, settingkey, str(setting["value"]))
|
||||
setting["saved"] = setting["value"]
|
||||
for fileName, data in ini_files.iteritems():
|
||||
out = open(self.__organizer.profilePath() + "/" + fileName, 'w')
|
||||
data.write(out)
|
||||
out.close()
|
||||
for fileName, data in ini_files.iteritems():
|
||||
filePath = self.__organizer.profilePath() + "/" + fileName
|
||||
if os.path.exists(filePath):
|
||||
out = open(filePath, 'w')
|
||||
data.write(out)
|
||||
out.close()
|
||||
except Exception, e:
|
||||
print e
|
||||
|
||||
|
||||
Reference in New Issue
Block a user