mirror of https://gitlab.com/pamhyr/pamhyr2
PamHyr: Add dummy and about windows.
parent
c7df106314
commit
3668085717
|
|
@ -7,14 +7,9 @@ from PyQt5.QtWidgets import QApplication
|
|||
from view.MainWindow import ApplicationWindow
|
||||
from model.Study import Study
|
||||
|
||||
class Application(ApplicationWindow):
|
||||
def __init__(self):
|
||||
super(Application, self).__init__()
|
||||
self.study = Study.new("dummy", "dummy.pkl")
|
||||
|
||||
def main():
|
||||
app = QApplication(sys.argv)
|
||||
application = Application()
|
||||
application = ApplicationWindow()
|
||||
application.show()
|
||||
sys.exit(app.exec_())
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
|
||||
from PyQt5.QtWidgets import (
|
||||
QMainWindow, QApplication, QDesktopWidget,
|
||||
QMdiArea, QMdiSubWindow, QDialog,
|
||||
|
|
@ -14,6 +16,10 @@ from PyQt5.uic import loadUi
|
|||
# loadUi(f"ui/{ui}.ui", self)
|
||||
|
||||
class ASubWindow(QDialog):
|
||||
def __init__(self, ui="error"):
|
||||
super(ASubWindow, self).__init__()
|
||||
loadUi(f"ui/{ui}.ui", self)
|
||||
def __init__(self, name="", ui="dummy", parent=None):
|
||||
super(ASubWindow, self).__init__(parent=parent)
|
||||
self.ui = loadUi(
|
||||
os.path.join(os.path.dirname(__file__), "ui", f"{ui}.ui"),
|
||||
self
|
||||
)
|
||||
self.name = name
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from view.ASubWindow import ASubWindow
|
||||
|
||||
class AboutWindow(ASubWindow):
|
||||
def __init__(self, title="About", parent=None):
|
||||
super(AboutWindow, self).__init__(ui="about", parent=parent)
|
||||
self.ui.setWindowTitle(title)
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from view.ASubWindow import ASubWindow
|
||||
|
||||
class DummyWindow(ASubWindow):
|
||||
def __init__(self, title="Dummy", parent=None):
|
||||
super(DummyWindow, self).__init__(ui="dummy", parent=parent)
|
||||
self.ui.setWindowTitle(title)
|
||||
|
|
@ -4,9 +4,11 @@ import os
|
|||
|
||||
from PyQt5 import QtGui
|
||||
from PyQt5.QtWidgets import (
|
||||
QMainWindow, QApplication,
|
||||
QMainWindow, QApplication, QAction,
|
||||
)
|
||||
from PyQt5.uic import loadUi
|
||||
from view.DummyWindow import DummyWindow
|
||||
from view.AboutWindow import AboutWindow
|
||||
|
||||
class ApplicationWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
|
|
@ -16,3 +18,50 @@ class ApplicationWindow(QMainWindow):
|
|||
self
|
||||
)
|
||||
self.showMaximized()
|
||||
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])
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>362</width>
|
||||
<height>98</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>341</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap>ressources/logoCemagref.gif</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>16</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>PamHyr</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Version en developpement:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Form</class>
|
||||
<widget class="QWidget" name="Form">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Reference in New Issue