Newer
Older
# -*- coding: utf-8 -*-
import os
from PyQt5 import QtGui
from PyQt5.QtWidgets import (
QMainWindow, QApplication, QAction,
from view.DummyWindow import DummyWindow
from view.AboutWindow import AboutWindow
class ApplicationWindow(QMainWindow):
def __init__(self):
super(ApplicationWindow, self).__init__()
self.ui = loadUi(
os.path.join(os.path.dirname(__file__), "ui", "MainWindow.ui"),
self
)
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
self.basic_callback()
def open_dummy(self, title="Dummy"):
"""
Open a dummy dialog window.
"""
self.dummy = DummyWindow(
title=title if type(title) is str else "Dummy",
parent=self
)
self.dummy.show()
def open_about(self):
self.about = AboutWindow(parent=self)
self.about.show()
def basic_callback(self):
"""
Connect action to callback function.
"""
actions = {
# Menu action
"actionA_propos": self.open_about,
# ToolBar action
"actionOuvrir_une_tude": self.open_dummy,
"actionenregistrer_etude_en_cours": self.open_dummy,
"actionfermer_etude_en_cours": self.open_dummy,
"actionquitter_application": self.open_dummy,
"actionlancer_solveur": self.open_dummy,
"actioninterrompt_simulation_en_cours": self.open_dummy,
"actionafficher_listings_simulation": self.open_dummy,
"actionlancer_solveur": self.open_dummy,
"actionReseau": lambda : self.open_dummy("Networks"),
"actionGeometrie": lambda : self.open_dummy("Geomerty"),
"actionMaillage": lambda : self.open_dummy("Maillage"),
"actionlancer_mailleur_externe": lambda : self.open_dummy("Lancement mailleur externe"),
"actionCond_Limites": lambda : self.open_dummy("Condition Limites"),
"actionApp_Lat_raux": lambda : self.open_dummy("Apport Lateraux"),
"actionDeversements": lambda : self.open_dummy("Deversement"),
"actionTroncons": lambda : self.open_dummy("Tronçons"),
"actionFrottements": lambda : self.open_dummy("Frottements"),
"actionOuvrages": lambda : self.open_dummy("Ouvrages"),
}
for action in actions:
self.ui.findChild(QAction, action)\
.triggered.connect(actions[action])