добавлена кнопка для открытия выходного файла

+ exe
This commit is contained in:
Razvalyaev 2025-07-09 15:56:18 +03:00
parent 4962276760
commit f881132fa8
2 changed files with 24 additions and 0 deletions

Binary file not shown.

View File

@ -161,6 +161,9 @@ class VarEditor(QWidget):
self.btn_add_vars = QPushButton("Add Variables") self.btn_add_vars = QPushButton("Add Variables")
self.btn_add_vars.clicked.connect(self.__open_variable_selector) self.btn_add_vars.clicked.connect(self.__open_variable_selector)
# Кнопка открыть output-файл с выбором программы
btn_open_output = QPushButton("Открыть Output File...")
btn_open_output.clicked.connect(self.__open_output_file_with_program)
# Таблица # Таблица
self.table = VariableTableWidget() self.table = VariableTableWidget()
# Основной layout # Основной layout
@ -173,6 +176,7 @@ class VarEditor(QWidget):
layout.addWidget(self.btn_add_vars) layout.addWidget(self.btn_add_vars)
layout.addLayout(source_output_layout) layout.addLayout(source_output_layout)
layout.addWidget(btn_save) layout.addWidget(btn_save)
layout.addWidget(btn_open_output)
self.setLayout(layout) self.setLayout(layout)
@ -564,6 +568,26 @@ class VarEditor(QWidget):
except Exception as e: except Exception as e:
print(f"Ошибка при сохранении XML: {e}") print(f"Ошибка при сохранении XML: {e}")
def __open_output_file_with_program(self):
output_path = self.get_output_path()
if not output_path:
QMessageBox.warning(self, "Ошибка", "Путь к output-файлу не задан.")
return
output_file = os.path.join(output_path, "debug_vars.c")
if not os.path.isfile(output_file):
QMessageBox.warning(self, "Ошибка", f"Файл не найден:\n{output_file}")
return
try:
# Открыть стандартное окно Windows "Открыть с помощью..."
subprocess.run([
"rundll32.exe",
"shell32.dll,OpenAs_RunDLL",
output_file
], shell=False)
except Exception as e:
QMessageBox.critical(self, "Ошибка", f"Не удалось открыть диалог 'Открыть с помощью':\n{e}")