Commit 39f6baf1 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

MainWindow, SolverRun: Add shortcut for solver run.

Showing with 21 additions and 5 deletions
+21 -5
...@@ -174,4 +174,4 @@ class CheckListWindow(ASubMainWindow, ListedSubWindow): ...@@ -174,4 +174,4 @@ class CheckListWindow(ASubMainWindow, ListedSubWindow):
def accept(self): def accept(self):
self._parent.solver_log(self._solver) self._parent.solver_log(self._solver)
self.end() #self.end()
...@@ -4,12 +4,16 @@ import os ...@@ -4,12 +4,16 @@ import os
from queue import Queue from queue import Queue
from PyQt5 import QtGui from PyQt5 import QtGui
from PyQt5.QtGui import (
QKeySequence,
)
from PyQt5.QtCore import ( from PyQt5.QtCore import (
QTranslator, QEvent QTranslator, QEvent
) )
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QMainWindow, QApplication, QAction, QMainWindow, QApplication, QAction,
QFileDialog, QFileDialog, QShortcut,
) )
from PyQt5.uic import loadUi from PyQt5.uic import loadUi
...@@ -84,7 +88,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): ...@@ -84,7 +88,8 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
self self
) )
self.init_callback() self.setup_sc()
self.setup_connection()
self.default_style() self.default_style()
self.trans = QTranslator(self) self.trans = QTranslator(self)
...@@ -108,7 +113,10 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): ...@@ -108,7 +113,10 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
""" """
self.findChild(QAction, action).setEnabled(enable) 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 """Connect action to callback function
Returns: Returns:
...@@ -157,6 +165,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): ...@@ -157,6 +165,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
.triggered.connect(actions[action]) .triggered.connect(actions[action])
# action.triggered.connect(actions[action]) # action.triggered.connect(actions[action])
self._run_sc.activated.connect(self.run_solver)
def changeEvent(self, event): def changeEvent(self, event):
if event.type() == QEvent.LanguageChange: if event.type() == QEvent.LanguageChange:
...@@ -386,6 +395,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): ...@@ -386,6 +395,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
params.show() params.show()
def run_solver(self): def run_solver(self):
if self.model is None:
return
run = SelectSolverWindow( run = SelectSolverWindow(
study = self.model, study = self.model,
config = self.conf, config = self.conf,
......
...@@ -63,7 +63,11 @@ ...@@ -63,7 +63,11 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string>Ok</string> <string>Run</string>
</property>
<property name="icon">
<iconset>
<normaloff>ressources/player_play.png</normaloff>ressources/player_play.png</iconset>
</property> </property>
</widget> </widget>
</item> </item>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment