Commit a22a7606 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

About: Update about window and add VERSION file.

Showing with 130 additions and 31 deletions
+130 -31
...@@ -10,8 +10,14 @@ stages: ...@@ -10,8 +10,14 @@ stages:
build: build:
stage: build stage: build
tags:
- linux
script: script:
- echo "TODO build pamhyr" - cd packages
- ./version.sh "$CI_COMMIT_BRANCH" "$CI_COMMIT_TAG" "$CI_COMMIT_SHORT_SHA"
artifacts:
paths:
- VERSION
build-lang: build-lang:
stage: build stage: build
...@@ -45,6 +51,8 @@ linux-package: ...@@ -45,6 +51,8 @@ linux-package:
needs: needs:
- job: build-lang - job: build-lang
artifacts: true artifacts: true
- job: build
artifacts: true
rules: rules:
- if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG - if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
artifacts: artifacts:
...@@ -62,6 +70,8 @@ windows-package: ...@@ -62,6 +70,8 @@ windows-package:
needs: needs:
- job: build-lang - job: build-lang
artifacts: true artifacts: true
- job: build
artifacts: true
rules: rules:
- if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG - if: $CI_COMMIT_BRANCH == 'master' || $CI_COMMIT_TAG
artifacts: artifacts:
......
VERSION 0 → 100644
git
...@@ -35,6 +35,7 @@ cp -r ../src/View/ui/*.ui dist/pamhyr/View/ui/ ...@@ -35,6 +35,7 @@ cp -r ../src/View/ui/*.ui dist/pamhyr/View/ui/
mkdir -p dist/pamhyr/lang mkdir -p dist/pamhyr/lang
cp -r ../src/lang/*.qm dist/pamhyr/lang/ cp -r ../src/lang/*.qm dist/pamhyr/lang/
cp ../VERSION dist/pamhyr/
echo " *** MAKE SRC PACKAGE" echo " *** MAKE SRC PACKAGE"
......
#! /bin/sh
# ./version BRANCH TAG COMMIT
if [ -z $2 ];
then
echo "$1-$3" > ../VERSION
else
echo "$2" > ../VERSION
fi
...@@ -15,6 +15,7 @@ copy /y ..\src\View\ui\ressources\ dist\pamhyr\View\ui\ressources ...@@ -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\Widgets\*.ui dist\pamhyr\View\ui\Widgets
copy /y ..\src\View\ui\*.ui dist\pamhyr\View\ui\ copy /y ..\src\View\ui\*.ui dist\pamhyr\View\ui\
copy /y ..\src\lang\*.qm dist\pamhyr\lang\ copy /y ..\src\lang\*.qm dist\pamhyr\lang\
copy /y ..\VERSION dist\pamhyr\
rem Make installer rem Make installer
"C:\Program Files (x86)\NSIS\makensis.exe" pamhyr.nsi "C:\Program Files (x86)\NSIS\makensis.exe" pamhyr.nsi
src/VERSION 0 → 120000
../VERSION
\ No newline at end of file
...@@ -19,6 +19,7 @@ from PyQt5.QtWidgets import ( ...@@ -19,6 +19,7 @@ from PyQt5.QtWidgets import (
QRadioButton, QComboBox, QFileDialog, QRadioButton, QComboBox, QFileDialog,
QMessageBox, QTableView, QAction, QMessageBox, QTableView, QAction,
QDateTimeEdit, QWidget, QPlainTextEdit, QDateTimeEdit, QWidget, QPlainTextEdit,
QLabel,
) )
from PyQt5.QtCore import ( from PyQt5.QtCore import (
QTime, QDateTime, QTime, QDateTime,
...@@ -130,6 +131,30 @@ class ASubWindowFeatures(object): ...@@ -130,6 +131,30 @@ class ASubWindowFeatures(object):
return qtype 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): def set_line_edit_text(self, name:str, text:str):
"""Set text of line edit component """Set text of line edit component
......
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os
import logging
from View.ASubWindow import ASubWindow from View.ASubWindow import ASubWindow
logger = logging.getLogger()
class AboutWindow(ASubWindow): class AboutWindow(ASubWindow):
def __init__(self, title="About", parent=None): def __init__(self, title="About", parent=None):
super(AboutWindow, self).__init__(name=title, ui="about", parent=parent) super(AboutWindow, self).__init__(name=title, ui="about", parent=parent)
self.ui.setWindowTitle(title) 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)
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>362</width> <width>553</width>
<height>98</height> <height>262</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -15,44 +15,74 @@ ...@@ -15,44 +15,74 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label_logo">
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="pixmap"> <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>
<property name="scaledContents"> </widget>
<bool>true</bool> </item>
<item>
<widget class="QLabel" name="label_license">
<property name="text">
<string>License: GPLv3+</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <widget class="QLabel" name="label">
<item> <property name="text">
<widget class="QLabel" name="label_2"> <string>&lt;a href=&quot;https://gitlab.irstea.fr/theophile.terraz/pamhyr&quot;&gt;Source code&lt;/a&gt;</string>
<property name="font"> </property>
<font> <property name="textFormat">
<pointsize>16</pointsize> <enum>Qt::RichText</enum>
<weight>75</weight> </property>
<bold>true</bold> </widget>
</font> </item>
</property> <item>
<property name="text"> <spacer name="verticalSpacer">
<string>PamHyr</string> <property name="orientation">
</property> <enum>Qt::Vertical</enum>
</widget> </property>
</item> <property name="sizeHint" stdset="0">
<item> <size>
<widget class="QLabel" name="label_3"> <width>20</width>
<property name="text"> <height>40</height>
<string>Version en developpement:</string> </size>
</property> </property>
</widget> </spacer>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>
......
src/View/ui/ressources/Logo-INRAE.png

8.43 KB

Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment