MainWindow, SolverRun: Add shortcut for solver run.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-07-04 13:47:48 +02:00
1 parent adc7736306
commit 39f6baf1a9
3 files changed
+21 -5

No files matched your search

+15 -3
View File
@@ -4,12 +4,16 @@ import os
from queue import Queue
from PyQt5 import QtGui
from PyQt5.QtGui import (
QKeySequence,
)
from PyQt5.QtCore import (
QTranslator, QEvent
)
from PyQt5.QtWidgets import (
QMainWindow, QApplication, QAction,
QFileDialog,
QFileDialog, QShortcut,
)
from PyQt5.uic import loadUi
@@ -84,7 +88,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
self
)
self.init_callback()
self.setup_sc()
self.setup_connection()
self.default_style()
self.trans = QTranslator(self)
@@ -108,7 +113,10 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
"""
self.findChild(QAction, action).setEnabled(enable)
def init_callback(self):
def setup_sc(self):
self._run_sc = QShortcut(QKeySequence("F5"), self)
def setup_connection(self):
"""Connect action to callback function
Returns:
@@ -157,6 +165,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
.triggered.connect(actions[action])
# action.triggered.connect(actions[action])
self._run_sc.activated.connect(self.run_solver)
def changeEvent(self, event):
if event.type() == QEvent.LanguageChange:
@@ -386,6 +395,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
params.show()
def run_solver(self):
if self.model is None:
return
run = SelectSolverWindow(
study = self.model,
config = self.conf,