diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5bb9624c30f69760de83143da06e4dc64a7d7bbd..014dde4744428a75c3536d69e01ec2a1225cda48 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,8 +10,14 @@ stages: build: stage: build + tags: + - linux script: - - echo "TODO build pamhyr" + - cd packages + - ./version.sh "$CI_COMMIT_BRANCH" "$CI_COMMIT_TAG" "$CI_COMMIT_SHORT_SHA" + artifacts: + paths: + - VERSION build-lang: stage: build @@ -45,6 +51,8 @@ linux-package: needs: - job: build-lang artifacts: true + - job: build + artifacts: true rules: - if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG artifacts: @@ -62,6 +70,8 @@ windows-package: needs: - job: build-lang artifacts: true + - job: build + artifacts: true rules: - if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG artifacts: diff --git a/VERSION b/VERSION new file mode 100644 index 0000000000000000000000000000000000000000..5664e303b5dc2e9ef8e14a0845d9486ec1920afd --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +git diff --git a/packages/linux.sh b/packages/linux.sh index 1cd72d28d5e304c806bc4c7ede828ea1def1e3b3..9924eb0bb575f07523a269742f5d7f3929e82f41 100755 --- a/packages/linux.sh +++ b/packages/linux.sh @@ -35,6 +35,7 @@ cp -r ../src/View/ui/*.ui dist/pamhyr/View/ui/ mkdir -p dist/pamhyr/lang cp -r ../src/lang/*.qm dist/pamhyr/lang/ +cp ../VERSION dist/pamhyr/ echo " *** MAKE SRC PACKAGE" diff --git a/packages/version.sh b/packages/version.sh new file mode 100755 index 0000000000000000000000000000000000000000..aa769b8399228a8d91a6e9a7228a2c20262f1d03 --- /dev/null +++ b/packages/version.sh @@ -0,0 +1,10 @@ +#! /bin/sh + +# ./version BRANCH TAG COMMIT + +if [ -z $2 ]; +then + echo "$1-$3" > ../VERSION +else + echo "$2" > ../VERSION +fi diff --git a/packages/windows.bat b/packages/windows.bat index 42c46ba09cc6353cc13eb22fcf2095854c86cb62..c5d150dffd9a9c3616cde26d9df6800eefe3275f 100644 --- a/packages/windows.bat +++ b/packages/windows.bat @@ -15,6 +15,7 @@ copy /y ..\src\View\ui\ressources\ dist\pamhyr\View\ui\ressources copy /y ..\src\View\ui\Widgets\*.ui dist\pamhyr\View\ui\Widgets copy /y ..\src\View\ui\*.ui dist\pamhyr\View\ui\ copy /y ..\src\lang\*.qm dist\pamhyr\lang\ +copy /y ..\VERSION dist\pamhyr\ rem Make installer "C:\Program Files (x86)\NSIS\makensis.exe" pamhyr.nsi diff --git a/src/VERSION b/src/VERSION new file mode 120000 index 0000000000000000000000000000000000000000..6ff19de4b804f2eca2b2d72657dd908c216b6537 --- /dev/null +++ b/src/VERSION @@ -0,0 +1 @@ +../VERSION \ No newline at end of file diff --git a/src/View/ASubWindow.py b/src/View/ASubWindow.py index 478993cf81b6e37fea77e523bc01c56850c7943c..17ae4a07a33697f00fb92caab7fd2a233ab4cbee 100644 --- a/src/View/ASubWindow.py +++ b/src/View/ASubWindow.py @@ -19,6 +19,7 @@ from PyQt5.QtWidgets import ( QRadioButton, QComboBox, QFileDialog, QMessageBox, QTableView, QAction, QDateTimeEdit, QWidget, QPlainTextEdit, + QLabel, ) from PyQt5.QtCore import ( QTime, QDateTime, @@ -130,6 +131,30 @@ class ASubWindowFeatures(object): return qtype + def get_label_text(self, name:str): + """Get text of label component + + Args: + label: The label component name + + Returns: + Text + """ + return self.find(QLabel, name).text() + + def set_label_text(self, name:str, text:str): + """Set text of label component + + Args: + text_edit: The label component name + text: The text + + Returns: + Nothing + """ + self.find(QLabel, name).setText(text) + + def set_line_edit_text(self, name:str, text:str): """Set text of line edit component diff --git a/src/View/About/Window.py b/src/View/About/Window.py index 9f84ad8674d044dd2b14883669b6a7b936194527..2ff5f3ce758a8e4b0f8244966fef8a1f41c3dc51 100644 --- a/src/View/About/Window.py +++ b/src/View/About/Window.py @@ -1,8 +1,28 @@ # -*- coding: utf-8 -*- +import os +import logging + from View.ASubWindow import ASubWindow +logger = logging.getLogger() + class AboutWindow(ASubWindow): def __init__(self, title="About", parent=None): super(AboutWindow, self).__init__(name=title, ui="about", parent=parent) self.ui.setWindowTitle(title) + + with open( + os.path.abspath( + os.path.join( + os.path.dirname(__file__), + "..", "..", "VERSION" + ) + ), "r" + ) as f: + version = f.readline() + logger.info(version) + + label = self.get_label_text("label_version") + label = label.replace("@version", version.strip()) + self.set_label_text("label_version", label) diff --git a/src/View/ui/about.ui b/src/View/ui/about.ui index 6b4f695782947c63f3a0e29ecc762a93cf61f19e..25d11617189f50f02a0298859ce244973cfaf8eb 100644 --- a/src/View/ui/about.ui +++ b/src/View/ui/about.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>362</width> - <height>98</height> + <width>553</width> + <height>262</height> </rect> </property> <property name="windowTitle"> @@ -15,44 +15,74 @@ </property> <layout class="QGridLayout" name="gridLayout"> <item row="0" column="0"> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QLabel" name="label"> + <widget class="QLabel" name="label_logo"> <property name="text"> <string/> </property> <property name="pixmap"> - <pixmap>ressources/logoCemagref.gif</pixmap> + <pixmap>ressources/Logo-INRAE.png</pixmap> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_title"> + <property name="font"> + <font> + <pointsize>16</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>About PAMHYR</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_copyright"> + <property name="text"> + <string>© Pierre-Antoine ROUBY - INRAE -2023</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_version"> + <property name="text"> + <string>Version: @version</string> </property> - <property name="scaledContents"> - <bool>true</bool> + </widget> + </item> + <item> + <widget class="QLabel" name="label_license"> + <property name="text"> + <string>License: GPLv3+</string> </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> + <widget class="QLabel" name="label"> + <property name="text"> + <string><a href="https://gitlab.irstea.fr/theophile.terraz/pamhyr">Source code</a></string> + </property> + <property name="textFormat"> + <enum>Qt::RichText</enum> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> </item> </layout> </item> diff --git a/src/View/ui/ressources/Logo-INRAE.png b/src/View/ui/ressources/Logo-INRAE.png new file mode 100644 index 0000000000000000000000000000000000000000..0cd93142e9ad2127cf167eac4acf97afed6be74b Binary files /dev/null and b/src/View/ui/ressources/Logo-INRAE.png differ