mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-30 19:47:50 +08:00
[conf] rename configre.py to select_conf.py
some other minor improvements
This commit is contained in:
@@ -93,11 +93,11 @@ class ConfChooser:
|
|||||||
print("Made a backup: " + newname)
|
print("Made a backup: " + newname)
|
||||||
|
|
||||||
if use_personal:
|
if use_personal:
|
||||||
conf_personal = os.path.join(self.conf_dir, "conf.xml.personal")
|
backup_name = self.conf_personal_name + "." + timestr
|
||||||
conf_personal_backup = os.path.join(self.conf_dir, "conf.xml.personal." + timestr)
|
conf_personal_backup = os.path.join(self.conf_dir, backup_name)
|
||||||
if os.path.exists(conf_personal):
|
if os.path.exists(self.conf_personal):
|
||||||
print("Backup conf.xml.personal to conf.xml.personal." + timestr)
|
print("Backup conf.xml.personal to " + backup_name)
|
||||||
shutil.copyfile(conf_personal, conf_personal_backup)
|
shutil.copyfile(self.conf_personal, conf_personal_backup)
|
||||||
|
|
||||||
def delete(self, widget):
|
def delete(self, widget):
|
||||||
filename = os.path.join(self.conf_dir, self.conf_file_combo.get_active_text())
|
filename = os.path.join(self.conf_dir, self.conf_file_combo.get_active_text())
|
||||||
@@ -120,14 +120,16 @@ class ConfChooser:
|
|||||||
self.find_conf_files()
|
self.find_conf_files()
|
||||||
|
|
||||||
def personal(self, widget):
|
def personal(self, widget):
|
||||||
self.backupconf(True)
|
if os.path.exists(self.conf_personal):
|
||||||
template_file = os.path.join(self.conf_dir, self.conf_file_combo.get_active_text())
|
print("Your personal conf file already exists!")
|
||||||
personal_file = os.path.join(self.conf_dir, "conf.xml.personal")
|
else:
|
||||||
shutil.copyfile(template_file, personal_file)
|
self.backupconf(True)
|
||||||
os.remove(self.conf_xml)
|
template_file = os.path.join(self.conf_dir, self.conf_file_combo.get_active_text())
|
||||||
os.symlink("conf.xml.personal", self.conf_xml)
|
shutil.copyfile(template_file, self.conf_personal)
|
||||||
self.update_label()
|
os.remove(self.conf_xml)
|
||||||
self.find_conf_files()
|
os.symlink(self.conf_personal_name, self.conf_xml)
|
||||||
|
self.update_label()
|
||||||
|
self.find_conf_files()
|
||||||
|
|
||||||
# Constructor Functions
|
# Constructor Functions
|
||||||
|
|
||||||
@@ -145,6 +147,8 @@ class ConfChooser:
|
|||||||
self.paparazzi_home = os.getenv("PAPARAZZI_HOME", os.path.dirname(os.path.abspath(__file__)))
|
self.paparazzi_home = os.getenv("PAPARAZZI_HOME", os.path.dirname(os.path.abspath(__file__)))
|
||||||
self.conf_dir = os.path.join(self.paparazzi_home, "conf")
|
self.conf_dir = os.path.join(self.paparazzi_home, "conf")
|
||||||
self.conf_xml = os.path.join(self.conf_dir, "conf.xml")
|
self.conf_xml = os.path.join(self.conf_dir, "conf.xml")
|
||||||
|
self.conf_personal_name = "conf.xml.personal"
|
||||||
|
self.conf_personal = os.path.join(self.conf_dir, self.conf_personal_name)
|
||||||
|
|
||||||
self.exclude_backups = True
|
self.exclude_backups = True
|
||||||
self.verbose = False
|
self.verbose = False
|
||||||
Reference in New Issue
Block a user