From 9b9ef8ee4bd7dabb4e5bda25bbca1d0a1cb7ea01 Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby <pierre-antoine.rouby@inrae.fr> Date: Wed, 5 Jul 2023 15:06:28 +0200 Subject: [PATCH] NewStudy: Add additional infomation into creation/edit windows. --- src/View/Study/Window.py | 12 ++- src/View/ui/NewStudy.ui | 182 +++++++++++++++++++++++---------------- 2 files changed, 120 insertions(+), 74 deletions(-) diff --git a/src/View/Study/Window.py b/src/View/Study/Window.py index 6d313199..a90ed549 100644 --- a/src/View/Study/Window.py +++ b/src/View/Study/Window.py @@ -3,10 +3,13 @@ from Model.Study import Study from View.ASubWindow import ASubWindow +from PyQt5.QtCore import QCoreApplication + from PyQt5.QtWidgets import ( QRadioButton, QLabel, QDateTimeEdit, ) +_translate = QCoreApplication.translate class NewStudyWindow(ASubWindow): def __init__(self, study=None, title="New Study", parent=None): @@ -14,13 +17,20 @@ class NewStudyWindow(ASubWindow): self.ui.setWindowTitle(title) self.parent = parent - self.study = study if not self.study is None: self.set_line_edit_text("lineEdit_name", self.study.name) self.set_text_edit_text("textEdit_description", self.study.description) self.set_datetime_edit("dateTimeEdit_date", self.study.date) + + self.find(QLabel, "label_creation_date_data").setText( + self.study.creation_date.isoformat(sep=" ") + ) + self.find(QLabel, "label_last_modification_data").setText( + self.study.last_save_date.isoformat(sep=" ") + ) + if self.study.time_system == "date": self.set_radio_button("radioButton_date", True) self.find(QLabel, "label_date").setEnabled(True) diff --git a/src/View/ui/NewStudy.ui b/src/View/ui/NewStudy.ui index 95100b5c..a7892389 100644 --- a/src/View/ui/NewStudy.ui +++ b/src/View/ui/NewStudy.ui @@ -13,98 +13,134 @@ <property name="windowTitle"> <string>Dialog</string> </property> - <layout class="QGridLayout" name="gridLayout"> + <layout class="QGridLayout" name="gridLayout_3"> <item row="0" column="0"> - <widget class="QLabel" name="label"> - <property name="text"> - <string>Name</string> - </property> - </widget> - </item> - <item row="0" column="1" colspan="2"> - <widget class="QLineEdit" name="lineEdit_name"> - <property name="text"> - <string>MyNewStudy</string> - </property> - </widget> - </item> - <item row="1" column="0" colspan="2"> - <widget class="QLabel" name="label_3"> - <property name="text"> - <string>Time system</string> - </property> - </widget> - </item> - <item row="1" column="2"> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QRadioButton" name="radioButton_time"> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> <property name="text"> - <string>Time</string> + <string>Name</string> </property> - <property name="checked"> - <bool>true</bool> + </widget> + </item> + <item row="0" column="1" colspan="2"> + <widget class="QLineEdit" name="lineEdit_name"> + <property name="text"> + <string>MyNewStudy</string> + </property> + </widget> + </item> + <item row="1" column="0" colspan="2"> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Time system</string> </property> </widget> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> + <item row="1" column="2"> + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QRadioButton" name="radioButton_date"> + <widget class="QRadioButton" name="radioButton_time"> <property name="text"> - <string>Date</string> + <string>Time</string> </property> - </widget> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Vertical</enum> + <property name="checked"> + <bool>true</bool> </property> </widget> </item> <item> - <widget class="QLabel" name="label_date"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="text"> - <string>Staring date</string> - </property> - </widget> - </item> - <item> - <widget class="QDateTimeEdit" name="dateTimeEdit_date"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="displayFormat"> - <string>dd/MM/yyyy HH:mm:ss</string> - </property> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QRadioButton" name="radioButton_date"> + <property name="text"> + <string>Date</string> + </property> + </widget> + </item> + <item> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_date"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Staring date</string> + </property> + </widget> + </item> + <item> + <widget class="QDateTimeEdit" name="dateTimeEdit_date"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="displayFormat"> + <string>dd/MM/yyyy HH:mm:ss</string> + </property> + </widget> + </item> + </layout> </item> </layout> </item> + <item row="2" column="0" colspan="2"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Description</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <widget class="QTextEdit" name="textEdit_description"> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="tabChangesFocus"> + <bool>false</bool> + </property> + </widget> + </item> </layout> </item> - <item row="2" column="0" colspan="2"> - <widget class="QLabel" name="label_2"> - <property name="text"> - <string>Description</string> - </property> - </widget> - </item> - <item row="2" column="2"> - <widget class="QTextEdit" name="textEdit_description"> - <property name="autoFillBackground"> - <bool>false</bool> - </property> - <property name="tabChangesFocus"> - <bool>false</bool> - </property> - </widget> + <item row="1" column="0"> + <layout class="QGridLayout" name="gridLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="label_creation_date"> + <property name="text"> + <string>Creation date :</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLabel" name="label_creation_date_data"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_last_modification"> + <property name="text"> + <string>Last modification :</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QLabel" name="label_last_modification_data"> + <property name="text"> + <string/> + </property> + </widget> + </item> + </layout> </item> - <item row="3" column="0" colspan="3"> + <item row="2" column="0"> <widget class="QDialogButtonBox" name="buttonBox"> <property name="orientation"> <enum>Qt::Horizontal</enum> -- GitLab