About: Update about window and add VERSION file.

results
Pierre-Antoine Rouby 2023-07-28 09:56:47 +02:00
parent 21209fdb79
commit a22a760610
10 changed files with 131 additions and 32 deletions

View File

@ -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:
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:
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:

1
VERSION Normal file
View File

@ -0,0 +1 @@
git

View File

@ -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"

10
packages/version.sh Executable file
View File

@ -0,0 +1,10 @@
#! /bin/sh
# ./version BRANCH TAG COMMIT
if [ -z $2 ];
then
echo "$1-$3" > ../VERSION
else
echo "$2" > ../VERSION
fi

View File

@ -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

1
src/VERSION Symbolic link
View File

@ -0,0 +1 @@
../VERSION

View File

@ -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):
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

View File

@ -1,8 +1,28 @@
# -*- 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)

View File

@ -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,24 +15,19 @@
</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>
<property name="scaledContents">
<bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <widget class="QLabel" name="label_title">
<item>
<widget class="QLabel" name="label_2">
<property name="font"> <property name="font">
<font> <font>
<pointsize>16</pointsize> <pointsize>16</pointsize>
@ -41,18 +36,53 @@
</font> </font>
</property> </property>
<property name="text"> <property name="text">
<string>PamHyr</string> <string>About PAMHYR</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_copyright">
<property name="text"> <property name="text">
<string>Version en developpement:</string> <string>© Pierre-Antoine ROUBY - INRAE -2023</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> <item>
<widget class="QLabel" name="label_version">
<property name="text">
<string>Version: @version</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_license">
<property name="text">
<string>License: GPLv3+</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;a href=&quot;https://gitlab.irstea.fr/theophile.terraz/pamhyr&quot;&gt;Source code&lt;/a&gt;</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> </item>
</layout> </layout>
</item> </item>

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB