попытка перехода на python 3.12 и nutika для компиляции без зависимостей
This commit is contained in:
+20
-4
@@ -458,8 +458,16 @@ class VariableSelectorDialog(QDialog):
|
||||
set_text('show_var', 'false')
|
||||
set_text('enable', 'false')
|
||||
|
||||
ET.indent(tree, space=" ", level=0)
|
||||
tree.write(self.xml_path, encoding='utf-8', xml_declaration=True)
|
||||
# Преобразуем дерево в строку
|
||||
rough_string = ET.tostring(root, encoding="utf-8")
|
||||
|
||||
# Парсим и форматируем с отступами
|
||||
reparsed = minidom.parseString(rough_string)
|
||||
pretty_xml = reparsed.toprettyxml(indent=" ")
|
||||
|
||||
# Записываем в файл
|
||||
with open(self.xml_path, "w", encoding="utf-8") as f:
|
||||
f.write(pretty_xml)
|
||||
|
||||
self.populate_tree()
|
||||
self.accept()
|
||||
@@ -509,8 +517,16 @@ class VariableSelectorDialog(QDialog):
|
||||
self.all_vars[:] = [v for v in self.all_vars if v['name'] not in selected_names]
|
||||
|
||||
if removed_any:
|
||||
ET.indent(tree, space=" ", level=0)
|
||||
tree.write(self.xml_path, encoding='utf-8', xml_declaration=True)
|
||||
# Преобразуем дерево в строку
|
||||
rough_string = ET.tostring(root, encoding="utf-8")
|
||||
|
||||
# Парсим и форматируем с отступами
|
||||
reparsed = minidom.parseString(rough_string)
|
||||
pretty_xml = reparsed.toprettyxml(indent=" ")
|
||||
|
||||
# Записываем в файл
|
||||
with open(self.xml_path, "w", encoding="utf-8") as f:
|
||||
f.write(pretty_xml)
|
||||
|
||||
self.populate_tree()
|
||||
self.filter_tree()
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+11
-2
@@ -8,6 +8,7 @@ import os
|
||||
import re
|
||||
import xml.etree.ElementTree as ET
|
||||
from pathlib import Path
|
||||
from xml.dom import minidom
|
||||
import argparse
|
||||
|
||||
|
||||
@@ -214,8 +215,16 @@ def add_new_vars_to_xml(proj_path, xml_rel_path, output_path):
|
||||
added_count += 1
|
||||
|
||||
if added_count > 0:
|
||||
ET.indent(tree, space=" ", level=0)
|
||||
tree.write(xml_full_path, encoding="utf-8", xml_declaration=True)
|
||||
# Преобразуем дерево в строку
|
||||
rough_string = ET.tostring(root, encoding="utf-8")
|
||||
|
||||
# Парсим и форматируем с отступами
|
||||
reparsed = minidom.parseString(rough_string)
|
||||
pretty_xml = reparsed.toprettyxml(indent=" ")
|
||||
|
||||
# Записываем в файл
|
||||
with open(xml_full_path, "w", encoding="utf-8") as f:
|
||||
f.write(pretty_xml)
|
||||
print(f"[INFO] В XML добавлено новых переменных: {added_count}")
|
||||
return True
|
||||
else:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+10
-3
@@ -93,9 +93,16 @@ def parse_vars(filename, typedef_map=None):
|
||||
'static': var.findtext('static', 'false') == 'true',
|
||||
})
|
||||
|
||||
ET.indent(tree, space=" ", level=0)
|
||||
# Сохраняем изменения в XML-файл
|
||||
tree.write(filename, encoding='utf-8', xml_declaration=True)
|
||||
# Преобразуем дерево в строку
|
||||
rough_string = ET.tostring(root, encoding="utf-8")
|
||||
|
||||
# Парсим и форматируем с отступами
|
||||
reparsed = minidom.parseString(rough_string)
|
||||
pretty_xml = reparsed.toprettyxml(indent=" ")
|
||||
|
||||
# Записываем в файл
|
||||
with open(filename, "w", encoding="utf-8") as f:
|
||||
f.write(pretty_xml)
|
||||
|
||||
return vars_list
|
||||
|
||||
|
||||
+10
-3
@@ -18,7 +18,7 @@ from PySide6.QtWidgets import (
|
||||
QApplication, QWidget, QTableWidget, QTableWidgetItem,
|
||||
QCheckBox, QComboBox, QLineEdit, QVBoxLayout, QHBoxLayout, QPushButton,
|
||||
QCompleter, QAbstractItemView, QLabel, QMessageBox, QFileDialog, QTextEdit,
|
||||
QDialog, QTreeWidget, QTreeWidgetItem, QSizePolicy
|
||||
QDialog, QTreeWidget, QTreeWidgetItem, QSizePolicy, QHeaderView
|
||||
)
|
||||
from PySide6.QtGui import QTextCursor, QKeyEvent
|
||||
from PySide6.QtCore import Qt, QProcess, QObject, Signal, QSettings
|
||||
@@ -561,10 +561,17 @@ class VarEditor(QWidget):
|
||||
set_sub_elem_text(var_elem, 'extern', extern_val)
|
||||
set_sub_elem_text(var_elem, 'static', static_val)
|
||||
|
||||
# Преобразуем дерево в строку
|
||||
rough_string = ET.tostring(root, encoding="utf-8")
|
||||
|
||||
ET.indent(tree, space=" ", level=0)
|
||||
tree.write(self.xml_path, encoding='utf-8', xml_declaration=True)
|
||||
# Парсим и форматируем с отступами
|
||||
reparsed = minidom.parseString(rough_string)
|
||||
pretty_xml = reparsed.toprettyxml(indent=" ")
|
||||
|
||||
# Записываем в файл
|
||||
with open(self.xml_path, "w", encoding="utf-8") as f:
|
||||
f.write(pretty_xml)
|
||||
|
||||
except Exception as e:
|
||||
print(f"Ошибка при сохранении XML: {e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user