Debug: Add debug python repl.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-07-04 15:34:35 +02:00
1 parent 29986079f3
commit 0aeb2f2530
4 files changed
+181 -1

No files matched your search

+31 -1
View File
@@ -13,7 +13,7 @@ from PyQt5.QtCore import (
)
from PyQt5.QtWidgets import (
QMainWindow, QApplication, QAction,
QFileDialog, QShortcut,
QFileDialog, QShortcut, QMenu, QToolBar,
)
from PyQt5.uic import loadUi
@@ -34,6 +34,7 @@ from View.Sections.Window import SectionsWindow
from View.SolverParameters.Window import SolverParametersWindow
from View.RunSolver.Window import SelectSolverWindow, SolverLogWindow
from View.CheckList.Window import CheckListWindow
from View.Debug.Window import ReplWindow
from Model.Study import Study
@@ -91,6 +92,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
self.setup_sc()
self.setup_connection()
self.default_style()
self.setup_debug_mode(init = True)
self.trans = QTranslator(self)
#self.ui.retranslateUi()
@@ -183,6 +185,22 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
# Maximise window
self.showMaximized()
def setup_debug_mode(self, init = False):
menu = self.findChild(QMenu, "menu_help")
if init:
self.debug_action = QAction("Debug", self)
self.debug_action.setStatusTip("Debug")
self.debug_action.triggered.connect(self.open_debug)
if self.conf.debug:
menu.addAction(self.debug_action)
else:
if self.conf.debug:
menu.addAction(self.debug_action)
else:
menu.removeAction(self.debug_action)
#########
# MODEL #
#########
@@ -423,6 +441,18 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
)
sol.show()
#########
# DEBUG #
#########
def open_debug(self):
repl = ReplWindow(
study = self.model,
config = self.conf,
parent = self
)
repl.show()
# TODO: Delete me !
###############
# DUMMY STUFF #