Actualización de la interfaz de la calculadora híbrida con ajustes en la geometría de la ventana y el sistema de autocompletado. Se añade una nueva opción para copiar información de depuración al portapapeles, mejorando la accesibilidad de datos. Se optimiza el historial de cálculos y se realizan mejoras en la gestión de variables simbólicas en el motor algebraico.
This commit is contained in:
parent
4010de2c12
commit
aaddfbc3fa
|
@ -1,4 +1,5 @@
|
||||||
|
|
||||||
$$Brix = \frac{Brix_{syrup} \cdot \delta_{syrup} + (Brix_{water} \cdot \delta_{water} \cdot Rateo)}{\delta_{syrup} + \delta_{water} \cdot Rateo}$$
|
$$Brix = \frac{Brix_{syrup} \cdot \delta_{syrup} + (Brix_{water} \cdot \delta_{water} \cdot Rateo)}{\delta_{syrup} + \delta_{water} \cdot Rateo}$$
|
||||||
|
Brix=9.5
|
||||||
|
Rateo=?
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
{
|
{
|
||||||
"window_geometry": {
|
"window_geometry": {
|
||||||
"x": 332,
|
"x": 119,
|
||||||
"y": 170,
|
"y": 143,
|
||||||
"width": 1353,
|
"width": 1220,
|
||||||
"height": 700
|
"height": 700
|
||||||
},
|
},
|
||||||
"debug_mode": false,
|
"debug_mode": false,
|
||||||
"latex_panel_visible": true,
|
"latex_panel_visible": true,
|
||||||
"sash_pos_x": 450,
|
"sash_pos_x": 450,
|
||||||
"splitter_sizes": [
|
"splitter_sizes": [
|
||||||
357,
|
300,
|
||||||
472
|
396
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -25,7 +25,8 @@ from PySide6.QtCore import (
|
||||||
from PySide6.QtGui import (
|
from PySide6.QtGui import (
|
||||||
QFont, QTextCursor, QTextCharFormat, QColor, QIcon,
|
QFont, QTextCursor, QTextCharFormat, QColor, QIcon,
|
||||||
QSyntaxHighlighter, QTextDocument, QKeySequence,
|
QSyntaxHighlighter, QTextDocument, QKeySequence,
|
||||||
QShortcut, QFontMetrics, QPalette, QTextOption, QAction
|
QShortcut, QFontMetrics, QPalette, QTextOption, QAction,
|
||||||
|
QClipboard
|
||||||
)
|
)
|
||||||
from PySide6.QtWebEngineWidgets import QWebEngineView
|
from PySide6.QtWebEngineWidgets import QWebEngineView
|
||||||
from PySide6.QtWebEngineCore import QWebEngineSettings
|
from PySide6.QtWebEngineCore import QWebEngineSettings
|
||||||
|
@ -834,6 +835,13 @@ class HybridCalculatorPySide6(QMainWindow):
|
||||||
latex_status_action.triggered.connect(self._show_latex_panel_status)
|
latex_status_action.triggered.connect(self._show_latex_panel_status)
|
||||||
diag_menu.addAction(latex_status_action)
|
diag_menu.addAction(latex_status_action)
|
||||||
|
|
||||||
|
diag_menu.addSeparator()
|
||||||
|
|
||||||
|
copy_debug_action = QAction("📋 Copiar Debug al Portapapeles", self)
|
||||||
|
copy_debug_action.setShortcut(QKeySequence("Ctrl+Shift+C"))
|
||||||
|
copy_debug_action.triggered.connect(self._copy_debug_to_clipboard)
|
||||||
|
diag_menu.addAction(copy_debug_action)
|
||||||
|
|
||||||
# Menú Tipos
|
# Menú Tipos
|
||||||
types_menu = menubar.addMenu("Tipos")
|
types_menu = menubar.addMenu("Tipos")
|
||||||
|
|
||||||
|
@ -2046,7 +2054,62 @@ PARA SOLUCIONAR:
|
||||||
|
|
||||||
self._show_info_dialog("Estado Panel LaTeX", status_message)
|
self._show_info_dialog("Estado Panel LaTeX", status_message)
|
||||||
|
|
||||||
# ========== UTILIDADES ==========
|
def _copy_debug_to_clipboard(self):
|
||||||
|
"""Copia información de debug completa al portapapeles"""
|
||||||
|
try:
|
||||||
|
# Obtener contenido de entrada
|
||||||
|
input_content = self.input_text.toPlainText()
|
||||||
|
|
||||||
|
# Obtener contenido de salida (texto plano)
|
||||||
|
output_content = self.output_text.toPlainText()
|
||||||
|
|
||||||
|
# Obtener información del sistema
|
||||||
|
context_info = self.engine.get_context_info()
|
||||||
|
|
||||||
|
# Obtener ecuaciones LaTeX si están disponibles
|
||||||
|
latex_equations = ""
|
||||||
|
if hasattr(self, '_latex_equations') and self._latex_equations:
|
||||||
|
latex_equations = "\\n".join([
|
||||||
|
f"[{eq['type']}] {eq['content']}"
|
||||||
|
for eq in self._latex_equations
|
||||||
|
])
|
||||||
|
|
||||||
|
# Crear reporte de debug completo
|
||||||
|
debug_report = f"""=== REPORTE DEBUG CALCULADORA MAV ===
|
||||||
|
Timestamp: {time.strftime('%Y-%m-%d %H:%M:%S')}
|
||||||
|
|
||||||
|
=== ENTRADA ===
|
||||||
|
{input_content}
|
||||||
|
|
||||||
|
=== SALIDA ===
|
||||||
|
{output_content}
|
||||||
|
|
||||||
|
=== INFORMACIÓN DEL SISTEMA ===
|
||||||
|
Ecuaciones en sistema: {context_info.get('equations', 0)}
|
||||||
|
Variables definidas: {context_info.get('variables', 0)}
|
||||||
|
Variables activas: {', '.join(context_info.get('variable_names', []))}
|
||||||
|
|
||||||
|
=== PANEL LATEX ===
|
||||||
|
Ecuaciones LaTeX: {len(self._latex_equations) if hasattr(self, '_latex_equations') else 0}
|
||||||
|
{latex_equations}
|
||||||
|
|
||||||
|
=== CONFIGURACIÓN ===
|
||||||
|
WebEngine disponible: {self.latex_panel._webview_available}
|
||||||
|
MathJax listo: {getattr(self.latex_panel, '_mathjax_ready', False)}
|
||||||
|
Panel LaTeX visible: {self.latex_panel_visible}
|
||||||
|
|
||||||
|
=== FIN REPORTE ==="""
|
||||||
|
|
||||||
|
# Copiar al portapapeles
|
||||||
|
clipboard = QApplication.clipboard()
|
||||||
|
clipboard.setText(debug_report)
|
||||||
|
|
||||||
|
# Mostrar confirmación
|
||||||
|
self._update_status("📋 Información de debug copiada al portapapeles", 3000)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
self.logger.error(f"Error copiando debug: {e}")
|
||||||
|
QMessageBox.critical(self, "Error", f"Error copiando debug al portapapeles:\\n{e}")
|
||||||
|
|
||||||
def _obtener_ayuda(self, input_str: str) -> Optional[str]:
|
def _obtener_ayuda(self, input_str: str) -> Optional[str]:
|
||||||
"""Obtiene ayuda usando helpers dinámicos"""
|
"""Obtiene ayuda usando helpers dinámicos"""
|
||||||
|
|
|
@ -618,9 +618,10 @@ class PureAlgebraicEngine:
|
||||||
|
|
||||||
return Eq(var_symbol, final_value)
|
return Eq(var_symbol, final_value)
|
||||||
else:
|
else:
|
||||||
# Hay variables con valores simbólicos, mostrar la relación algebraica
|
# Hay variables con valores simbólicos, intentar resolver lo máximo posible
|
||||||
# Ejemplo: t = x - 5 (donde x = t + 5, es simbólico)
|
# Aplicar resolución iterativa parcial
|
||||||
result_eq = Eq(var_symbol, solution_value)
|
resolved_solution = self._resolve_iteratively(solution_value)
|
||||||
|
result_eq = Eq(var_symbol, resolved_solution)
|
||||||
return result_eq
|
return result_eq
|
||||||
else:
|
else:
|
||||||
# No hay variables sin resolver, intentar resolver completamente
|
# No hay variables sin resolver, intentar resolver completamente
|
||||||
|
|
Loading…
Reference in New Issue