diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5bb9624c..014dde47 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 00000000..5664e303
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+git
diff --git a/packages/linux.sh b/packages/linux.sh
index 1cd72d28..9924eb0b 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 00000000..aa769b83
--- /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 42c46ba0..c5d150df 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 00000000..6ff19de4
--- /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 478993cf..17ae4a07 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 9f84ad86..2ff5f3ce 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 6b4f6957..25d11617 100644
--- a/src/View/ui/about.ui
+++ b/src/View/ui/about.ui
@@ -6,8 +6,8 @@
0
0
- 362
- 98
+ 553
+ 262
@@ -15,44 +15,74 @@
-
-
+
-
-
+
- ressources/logoCemagref.gif
-
-
- true
+ ressources/Logo-INRAE.png
-
-
-
-
-
-
-
- 16
- 75
- true
-
-
-
- PamHyr
-
-
-
- -
-
-
- Version en developpement:
-
-
-
-
+
+
+
+ 16
+ 75
+ true
+
+
+
+ About PAMHYR
+
+
+
+ -
+
+
+ © Pierre-Antoine ROUBY - INRAE -2023
+
+
+
+ -
+
+
+ Version: @version
+
+
+
+ -
+
+
+ License: GPLv3+
+
+
+
+ -
+
+
+ <a href="https://gitlab.irstea.fr/theophile.terraz/pamhyr">Source code</a>
+
+
+ Qt::RichText
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 40
+
+
+
diff --git a/src/View/ui/ressources/Logo-INRAE.png b/src/View/ui/ressources/Logo-INRAE.png
new file mode 100644
index 00000000..0cd93142
Binary files /dev/null and b/src/View/ui/ressources/Logo-INRAE.png differ