diff --git a/src/model/Study.py b/src/model/Study.py index 06a6c2caf07624e231ee444b6264945da9088a5a..47977bb81352953b58e852f40f38e2deeef66360 100644 --- a/src/model/Study.py +++ b/src/model/Study.py @@ -13,7 +13,6 @@ class Study(Serializable): # Study general information self.name = "" self.description = "" - self.solver = "" self.creation_date = datetime.now() self.last_modification_date = datetime.now() @@ -27,9 +26,8 @@ class Study(Serializable): return cls() @classmethod - def new(cls, name, description, solver): + def new(cls, name, description): me = cls() me.name = name me.description = description - me.solver = solver return me diff --git a/src/view/MainWindow.py b/src/view/MainWindow.py index 18521df40c891e94f74d2330832e543102e3749f..0e1e032b72bb0c3bb99c23f3c893d9e1c49509fa 100644 --- a/src/view/MainWindow.py +++ b/src/view/MainWindow.py @@ -23,7 +23,7 @@ no_model_action = [ ] model_action = [ - "action_menu_close", "action_menu_save_maille", "action_menu_save", + "action_menu_close", "action_menu_edit", "action_menu_save", "action_menu_save_as", "action_toolBar_close", "action_toolBar_save", ] @@ -83,6 +83,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow): # Menu action "action_menu_config": self.open_configure, "action_menu_new": self.open_new_study, + "action_menu_edit": self.open_edit_study, "action_menu_open": self.open_model, "action_menu_save": self.save_study, "action_menu_save_as": self.save_as_study, @@ -255,6 +256,17 @@ class ApplicationWindow(QMainWindow, ListedSubWindow): self.new_study = NewStudyWindow(parent=self) self.new_study.show() + def open_edit_study(self): + """Open dialog to set new study + + Returns: + Nothing + """ + if not self.model is None: + self.new_study = NewStudyWindow(study=self.model, parent=self) + self.new_study.show() + + # TODO: Delete me ! ############### # DUMMY STUFF # diff --git a/src/view/NewStudyWindow.py b/src/view/NewStudyWindow.py index 28719fa4b62a662c1dd690746abd9315778ca0d2..7de5cf0b4c0a7f53e5f04c861fed2dffddf6d9b9 100644 --- a/src/view/NewStudyWindow.py +++ b/src/view/NewStudyWindow.py @@ -4,19 +4,25 @@ from model.Study import Study from view.ASubWindow import ASubWindow class NewStudyWindow(ASubWindow): - def __init__(self, title="New Study", parent=None): + def __init__(self, study=None, title="New Study", parent=None): super(NewStudyWindow, self).__init__(name=title, ui="NewStudy", parent=parent) self.ui.setWindowTitle(title) self.parent = parent + self.study = study + + if not self.study is None: + self.set_line_edit_text("lineEdit_name", study.name) + self.set_text_edit_text("textEdit_description", study.description) + def accept(self): name = self.get_line_edit_text("lineEdit_name") description = self.get_text_edit_text("textEdit_description") - if self.get_radio_button("radioButton_mage"): - solver = "mage" - else: - solver = "rubarbe" - self.parent.set_model(Study.new(name, description, solver)) - self.close() + if self.study is None: + self.parent.set_model(Study.new(name, description)) + else: + self.study.name = name + self.study.description = description + self.done(True) diff --git a/src/view/ui/MainWindow.ui b/src/view/ui/MainWindow.ui index da74b97218cd7b23f23606a434dec2e14c099104..9c8d862d35d961df17ad039c9fc73f691771bfa9 100644 --- a/src/view/ui/MainWindow.ui +++ b/src/view/ui/MainWindow.ui @@ -85,7 +85,7 @@ <addaction name="separator"/> <addaction name="action_menu_close"/> <addaction name="separator"/> - <addaction name="action_menu_save_maille"/> + <addaction name="action_menu_edit"/> <addaction name="action_menu_save"/> <addaction name="action_menu_save_as"/> <addaction name="action_menu_archive"/> @@ -896,6 +896,18 @@ <string>Ouvrir l'éditeur des ouvrages (seuils, vannes, etc.), singularités et pompes</string> </property> </action> + <action name="action_menu_edit"> + <property name="icon"> + <iconset> + <normaloff>ressources/edit.png</normaloff>ressources/edit.png</iconset> + </property> + <property name="text"> + <string>Éditer l'étude</string> + </property> + <property name="toolTip"> + <string>Éditer l'étude</string> + </property> + </action> </widget> <resources/> <connections> diff --git a/src/view/ui/NewStudy.ui b/src/view/ui/NewStudy.ui index 254d51c334b954c29c7db192eed6ad98cd02cf3c..f8047cecd8e22b8e4c634d653d97ef19fee64655 100644 --- a/src/view/ui/NewStudy.ui +++ b/src/view/ui/NewStudy.ui @@ -13,7 +13,7 @@ <property name="windowTitle"> <string>Dialog</string> </property> - <widget class="QWidget" name=""> + <widget class="QWidget" name="layoutWidget"> <property name="geometry"> <rect> <x>10</x> @@ -34,16 +34,6 @@ </property> </widget> </item> - <item row="1" column="1"> - <widget class="QTextEdit" name="textEdit_description"> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="tabChangesFocus"> - <bool>false</bool> - </property> - </widget> - </item> <item row="1" column="0"> <widget class="QLabel" name="label_2"> <property name="text"> @@ -58,37 +48,16 @@ </property> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Solver</string> + <item row="1" column="1"> + <widget class="QTextEdit" name="textEdit_description"> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="tabChangesFocus"> + <bool>false</bool> </property> </widget> </item> - <item row="2" column="1"> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QRadioButton" name="radioButton_mage"> - <property name="text"> - <string>Mage</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="radioButton_rubarbe"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Rubarbe</string> - </property> - </widget> - </item> - </layout> - </item> </layout> </item> </layout>