mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 19:29:02 +08:00
Reset configuration files on start if old config files were found
This commit is contained in:
parent
651b4fdfea
commit
8b9dbec188
@ -41,7 +41,9 @@ from PyQt5.QtGui import QColor, QIcon
|
|||||||
|
|
||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
import configparser
|
||||||
import numpy
|
import numpy
|
||||||
numpy.seterr(all="ignore")
|
numpy.seterr(all="ignore")
|
||||||
|
|
||||||
@ -51,6 +53,23 @@ class CuraApplication(QtApplication):
|
|||||||
if not hasattr(sys, "frozen"):
|
if not hasattr(sys, "frozen"):
|
||||||
Resources.addResourcePath(os.path.join(os.path.abspath(os.path.dirname(__file__)), ".."))
|
Resources.addResourcePath(os.path.join(os.path.abspath(os.path.dirname(__file__)), ".."))
|
||||||
|
|
||||||
|
# Reset the configuration files if they exist on the machine, only for 15.05.xx releases
|
||||||
|
try:
|
||||||
|
Resources.ApplicationIdentifier = "cura"
|
||||||
|
parser = configparser.ConfigParser()
|
||||||
|
parser.read(Resources.getStoragePath(Resources.PreferencesLocation, "cura.cfg"))
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
if parser["general"]["version"] != "2":
|
||||||
|
Logger.log("i", "Found old settings files, removing them")
|
||||||
|
|
||||||
|
os.remove(Resources.getStoragePath(Resources.PreferencesLocation, "cura.cfg"))
|
||||||
|
|
||||||
|
path = Resources.getStorageLocation(Resources.SettingsLocation)
|
||||||
|
for file in os.listdir(path):
|
||||||
|
os.remove(os.path.join(path, file))
|
||||||
|
|
||||||
super().__init__(name = "cura", version = "15.06.00")
|
super().__init__(name = "cura", version = "15.06.00")
|
||||||
|
|
||||||
self.setWindowIcon(QIcon(Resources.getPath(Resources.ImagesLocation, "cura-icon.png")))
|
self.setWindowIcon(QIcon(Resources.getPath(Resources.ImagesLocation, "cura-icon.png")))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user