убрано лишнее окно предупреждения о перезаписи
выровнен шрифт в таблице +exe надо как-то сделать парс массивов и подумать как лучше
This commit is contained in:
parent
a3850c2c8a
commit
f271b2e82c
BIN
DebugVarEdit.exe
Normal file
BIN
DebugVarEdit.exe
Normal file
Binary file not shown.
@ -23,7 +23,7 @@ from PySide2.QtWidgets import (
|
||||
QCompleter, QAbstractItemView, QLabel, QMessageBox, QFileDialog, QTextEdit,
|
||||
QDialog, QTreeWidget, QTreeWidgetItem, QSizePolicy, QHeaderView
|
||||
)
|
||||
from PySide2.QtGui import QTextCursor, QKeyEvent, QIcon
|
||||
from PySide2.QtGui import QTextCursor, QKeyEvent, QIcon, QFont
|
||||
from PySide2.QtCore import Qt, QProcess, QObject, Signal, QSettings
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ proj_path_title = "Путь к проекту:"
|
||||
makefile_path_title = "Пусть к makefile (относительно проекта)"
|
||||
output_path_title = "Папка для debug_vars.c:"
|
||||
scan_title = "Сканировать переменные"
|
||||
build_title = "Обновить файл"
|
||||
build_title = "Сгенерировать файл"
|
||||
add_vars_title = "Добавить переменные"
|
||||
open_output_title = "Открыть файл"
|
||||
|
||||
@ -348,13 +348,17 @@ class VarEditor(QWidget):
|
||||
self.makefile_path = path
|
||||
|
||||
def __browse_xml_output(self):
|
||||
file_path, _ = QFileDialog.getSaveFileName(
|
||||
self,
|
||||
"Выберите XML файл",
|
||||
filter="XML files (*.xml);;All Files (*)"
|
||||
)
|
||||
self.xml_output_edit.setText(file_path)
|
||||
self.xml_path = file_path
|
||||
dialog = QFileDialog(self, "Выберите или создайте XML-файл")
|
||||
dialog.setAcceptMode(QFileDialog.AcceptSave)
|
||||
dialog.setNameFilter("XML files (*.xml);;All Files (*)")
|
||||
dialog.setDefaultSuffix("xml")
|
||||
dialog.setOption(QFileDialog.DontConfirmOverwrite, True) # ⚠️ Не спрашивать про перезапись
|
||||
if dialog.exec_():
|
||||
file_path = dialog.selectedFiles()[0]
|
||||
if not file_path.endswith(".xml"):
|
||||
file_path += ".xml"
|
||||
self.xml_output_edit.setText(file_path)
|
||||
self.xml_path = file_path
|
||||
|
||||
def keyPressEvent(self, event: QKeyEvent):
|
||||
if event.key() == Qt.Key_Delete:
|
||||
|
@ -79,7 +79,8 @@ class VariableTableWidget(QTableWidget):
|
||||
filtered_vars = [v for v in vars_list if v.get('show_var', 'false') == 'true']
|
||||
self.setRowCount(len(filtered_vars))
|
||||
self.verticalHeader().setVisible(False)
|
||||
style_with_padding = "padding-left: 5px; padding-right: 5px; font-size: 14pt;" # регулируй отступы по горизонтали
|
||||
style_with_padding = "padding-left: 5px; padding-right: 5px; font-size: 14pt; font-family: 'Segoe UI';"
|
||||
|
||||
|
||||
|
||||
|
||||
@ -107,12 +108,11 @@ class VariableTableWidget(QTableWidget):
|
||||
self.setCellWidget(row, rows.name, name_edit)
|
||||
|
||||
# Origin Type (readonly)
|
||||
origin_edit = QLineEdit(var.get('type', ''))
|
||||
origin_edit.setReadOnly(True) # делает поле не редактируемым
|
||||
origin_edit.setEnabled(True) # включен, чтобы можно было копировать и получать текст
|
||||
origin_edit.setFocusPolicy(Qt.NoFocus) # не фокусируется при клике
|
||||
origin_edit.setStyleSheet(style_with_padding)
|
||||
self.setCellWidget(row, rows.type, origin_edit)
|
||||
origin_item = QTableWidgetItem(var.get('type', ''))
|
||||
origin_item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
|
||||
origin_item.setToolTip(var.get('type', '')) # Всплывающая подсказка
|
||||
origin_item.setForeground(QBrush(Qt.black))
|
||||
self.setItem(row, rows.type, origin_item)
|
||||
|
||||
# pt_type
|
||||
pt_combo = QComboBox()
|
||||
@ -194,7 +194,7 @@ class VariableTableWidget(QTableWidget):
|
||||
iq = self.cellWidget(row, rows.iq_type).currentText()
|
||||
ret = self.cellWidget(row, rows.ret_type).currentText()
|
||||
shortname = self.cellWidget(row, rows.short_name).text()
|
||||
origin_type = self.cellWidget(row, rows.type).text()
|
||||
origin_type = self.item(row, rows.type).text()
|
||||
|
||||
result.append({
|
||||
'show_var': True,
|
||||
|
@ -314,8 +314,9 @@ extern int zero_ADC[20];
|
||||
|
||||
|
||||
// Îïðåäåëåíèå ìàññèâà ñ óêàçàòåëÿìè íà ïåðåìåííûå äëÿ îòëàäêè
|
||||
int DebugVar_Qnt = 1;
|
||||
int DebugVar_Qnt = 2;
|
||||
#pragma DATA_SECTION(dbg_vars,".dbgvar_info")
|
||||
DebugVar_t dbg_vars[] = {\
|
||||
{(char *)&ADC0finishAddr, pt_uint8, t_iq7, pt_uint8, "asdasjjjjj" }, \
|
||||
{(char *)&project.cds_tk.count_elements_pbus, pt_uint16, t_iq_none, pt_uint16, "project.cd" }, \
|
||||
};
|
||||
|
4
vars.xml
4
vars.xml
@ -3592,8 +3592,8 @@
|
||||
<var name="project.cds_tk.count_elements_pbus">
|
||||
<show_var>true</show_var>
|
||||
<enable>true</enable>
|
||||
<shortname>project.cds_tk.count_elements_pbus</shortname>
|
||||
<pt_type>pt_uint16</pt_type>
|
||||
<shortname>project.cds_tk.count_elements=_pbus</shortname>
|
||||
<pt_type>pt_uint64</pt_type>
|
||||
<iq_type>t_iq_none</iq_type>
|
||||
<return_type>t_iq_none</return_type>
|
||||
<type>UInt16</type>
|
||||
|
Loading…
Reference in New Issue
Block a user