First utility, for seminar certificates
This commit is contained in:
+55
@@ -0,0 +1,55 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
workspace:
|
||||
path: /drone/src
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: git.argideli.com/quertex/docker-win-pyinstaller:latest
|
||||
pull: always
|
||||
commands:
|
||||
# prepare output directory
|
||||
- mkdir -p /drone/src/out/
|
||||
- mkdir -p /drone/src/dist/
|
||||
# add dependancies
|
||||
- pacman -Sy --noconfirm --needed wget libunwind lib32-gnutls python3 python-pip gcc-fortran base-devel python-numpy python-pandas gcc-libs gnutls wine-staging
|
||||
# linux build
|
||||
- cd /drone/src/
|
||||
- python -m venv --system-site-packages venv
|
||||
- source venv/bin/activate
|
||||
- pip3 list
|
||||
- pip3 config --user set global.progress_bar off
|
||||
- pip3 install --ignore-installed -r requirements.txt
|
||||
- pyinstaller --onefile --name akmi-utils.bin -y --distpath --distpath /drone/src/out/ /drone/src/widget.py
|
||||
- deactivate
|
||||
- cp -v out/akmi-utils.bin dist/
|
||||
# clean up
|
||||
- rm -rf venv
|
||||
- rm -rf /drone/src/out
|
||||
- mkdir -p /drone/src/out/
|
||||
# windows build
|
||||
- wine c:/python/python.exe -m pip config --user set global.progress_bar off
|
||||
- wine c:/python/python.exe -m pip install --prefer-binary -r z:/drone/src/requirements.txt
|
||||
- wine c:/python/Scripts/pyinstaller.exe --onefile --name akmi-utils -y --distpath z:/drone/src/out z:/drone/src/widget.py
|
||||
- cp -v out/akmi-utils.exe dist/
|
||||
|
||||
- name: gitea_release
|
||||
image: plugins/gitea-release
|
||||
settings:
|
||||
base_url: https://git.argideli.com
|
||||
api_key:
|
||||
from_secret: gitea_token
|
||||
files: /drone/src/dist/*
|
||||
checksum:
|
||||
- md5
|
||||
- sha256
|
||||
- crc32
|
||||
when:
|
||||
event:
|
||||
exclude:
|
||||
- push
|
||||
|
||||
image_pull_secrets:
|
||||
- docker_token
|
||||
+164
@@ -0,0 +1,164 @@
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
.qtcreator
|
||||
.qtcreator/
|
||||
.qtcreator/*
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"files": [
|
||||
"widget.py",
|
||||
"form.ui",
|
||||
"resources.qrc"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 13.0.0, 2024-07-10T17:06:00. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{8d3a2c20-1759-4bd6-a39b-3dc9c8562369}</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
<value type="qlonglong">0</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
|
||||
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
|
||||
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
|
||||
<value type="QString" key="language">Cpp</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
|
||||
<value type="QString" key="language">QmlJS</value>
|
||||
<valuemap type="QVariantMap" key="value">
|
||||
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="EditorConfiguration.CodeStyle.Count">2</value>
|
||||
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
|
||||
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.IndentSize">4</value>
|
||||
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
|
||||
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
|
||||
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
|
||||
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
|
||||
<value type="int" key="EditorConfiguration.PreferAfterWhitespaceComments">0</value>
|
||||
<value type="bool" key="EditorConfiguration.PreferSingleLineComments">false</value>
|
||||
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
|
||||
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
|
||||
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">2</value>
|
||||
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
|
||||
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
|
||||
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
|
||||
<value type="int" key="EditorConfiguration.TabSize">8</value>
|
||||
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
|
||||
<value type="bool" key="EditorConfiguration.UseIndenter">false</value>
|
||||
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
|
||||
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
|
||||
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
|
||||
<value type="QString" key="EditorConfiguration.ignoreFileTypes">*.md, *.MD, Makefile</value>
|
||||
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
|
||||
<value type="bool" key="EditorConfiguration.skipTrailingWhitespace">true</value>
|
||||
<value type="bool" key="EditorConfiguration.tintMarginArea">true</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.PluginSettings</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<valuemap type="QVariantMap" key="AutoTest.ActiveFrameworks">
|
||||
<value type="bool" key="AutoTest.Framework.Boost">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.CTest">false</value>
|
||||
<value type="bool" key="AutoTest.Framework.Catch">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.GTest">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.QtQuickTest">true</value>
|
||||
<value type="bool" key="AutoTest.Framework.QtTest">true</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="AutoTest.CheckStates"/>
|
||||
<value type="int" key="AutoTest.RunAfterBuild">0</value>
|
||||
<value type="bool" key="AutoTest.UseGlobal">true</value>
|
||||
<valuemap type="QVariantMap" key="ClangTools">
|
||||
<value type="bool" key="ClangTools.AnalyzeOpenFiles">true</value>
|
||||
<value type="bool" key="ClangTools.BuildBeforeAnalysis">true</value>
|
||||
<value type="QString" key="ClangTools.DiagnosticConfig">Builtin.DefaultTidyAndClazy</value>
|
||||
<value type="int" key="ClangTools.ParallelJobs">2</value>
|
||||
<value type="bool" key="ClangTools.PreferConfigFile">true</value>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedDirs"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SelectedFiles"/>
|
||||
<valuelist type="QVariantList" key="ClangTools.SuppressedDiagnostics"/>
|
||||
<value type="bool" key="ClangTools.UseGlobalSettings">true</value>
|
||||
</valuemap>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Target.0</variable>
|
||||
<valuemap type="QVariantMap">
|
||||
<value type="QString" key="DeviceType">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Python 3.11.9</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Python 3.11.9</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{adc63998-eebe-4010-b009-0871c43b50e7}</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/argiris/QT_Creator/AKMI_utils/.qtcreator/Python_3_11_9venv</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Python.PysideBuildStep</value>
|
||||
<value type="QString" key="Python.PySideProjectTool">/home/argiris/QT_Creator/AKMI_utils/.qtcreator/Python_3_11_9venv/bin/pyside6-project</value>
|
||||
<value type="QString" key="Python.PySideUic">/home/argiris/QT_Creator/AKMI_utils/.qtcreator/Python_3_11_9venv/bin/pyside6-uic</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Build</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
|
||||
</valuemap>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Clean</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.CustomParsers"/>
|
||||
<value type="bool" key="ProjectExplorer.BuildConfiguration.ParseStandardOutput">false</value>
|
||||
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Python 3.11.9 Virtual Environment</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Python.PySideBuildConfiguration</value>
|
||||
<value type="QString" key="python">/home/argiris/QT_Creator/AKMI_utils/.qtcreator/Python_3_11_9venv/bin/python</value>
|
||||
<value type="QString" key="venv">/home/argiris/QT_Creator/AKMI_utils/.qtcreator/Python_3_11_9venv</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<value type="qlonglong" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
|
||||
</valuemap>
|
||||
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
|
||||
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
|
||||
<value type="bool" key="Analyzer.Perf.Settings.UseGlobalSettings">true</value>
|
||||
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
|
||||
<value type="int" key="Analyzer.Valgrind.Callgrind.CostFormat">0</value>
|
||||
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
|
||||
<valuelist type="QVariantList" key="CustomOutputParsers"/>
|
||||
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||
<value type="bool" key="PE.EnvironmentAspect.PrintOnRun">false</value>
|
||||
<value type="QString" key="PerfRecordArgsId">-e cpu-cycles --call-graph dwarf,4096 -F 250</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">widget.py</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">PythonEditor.RunConfiguration./home/argiris/QT_Creator/AKMI_utils/widget.py</value>
|
||||
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey">/home/argiris/QT_Creator/AKMI_utils/widget.py</value>
|
||||
<value type="bool" key="ProjectExplorer.RunConfiguration.Customized">true</value>
|
||||
<value type="QString" key="PythonEditor.RunConfiguation.Script">/home/argiris/QT_Creator/AKMI_utils/widget.py</value>
|
||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
|
||||
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/argiris/QT_Creator/AKMI_utils</value>
|
||||
<value type="QString" key="RunConfiguration.X11Forwarding">:0</value>
|
||||
</valuemap>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
|
||||
</valuemap>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.TargetCount</variable>
|
||||
<value type="qlonglong">1</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>Version</variable>
|
||||
<value type="int">22</value>
|
||||
</data>
|
||||
</qtcreator>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,142 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Widget</class>
|
||||
<widget class="QWidget" name="Widget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>742</width>
|
||||
<height>336</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Widget</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="file_selector">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>140</y>
|
||||
<width>151</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Επιλογή Αρχείου CSV</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>20</y>
|
||||
<width>61</width>
|
||||
<height>61</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="resources.qrc">:/images/logo.png</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>240</x>
|
||||
<y>10</y>
|
||||
<width>431</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>26</pointsize>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>AKMI Certificate creator</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>140</y>
|
||||
<width>531</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p>Το αρχείο που έχουμε επιλέξει</p></body></html></string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Επιλέξτε το αρχείο δεδομένων σε μορφή .csv</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="create_button">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>310</x>
|
||||
<y>290</y>
|
||||
<width>111</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Δημιουργία pdf</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="file_template">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>190</y>
|
||||
<width>151</width>
|
||||
<height>34</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Επιλογή Αρχείου PDF</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>180</x>
|
||||
<y>190</y>
|
||||
<width>561</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string><html><head/><body><p>Το αρχείο που έχουμε επιλέξει</p></body></html></string>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Επιλέξτε το PDF αρχείο του προτύπου</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="resources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
+310719
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
chardet==5.2.0
|
||||
pillow==10.4.0
|
||||
PyPDF2==3.0.1
|
||||
PySide6==6.7.2
|
||||
PySide6_Addons==6.7.2
|
||||
PySide6_Essentials==6.7.2
|
||||
python-dateutil==2.9.0.post0
|
||||
pytz==2024.1
|
||||
reportlab==4.2.2
|
||||
shiboken6==6.7.2
|
||||
six==1.16.0
|
||||
tzdata==2024.1
|
||||
@@ -0,0 +1,13 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>images/logo.png</file>
|
||||
<file>FONTS/NotoSans-MediumItalic.ttf</file>
|
||||
<file>FONTS/NotoSans-Medium.ttf</file>
|
||||
<file>FONTS/NotoSans-SemiCondensedMediumItalic.ttf</file>
|
||||
<file>FONTS/NotoSans-SemiCondensedMedium.ttf</file>
|
||||
<file>FONTS/NotoSans-SemiCondensed.ttf</file>
|
||||
<file>FONTS/NotoSans-Black.ttf</file>
|
||||
<file>FONTS/NotoSans-Bold.ttf</file>
|
||||
<file>FONTS/NotoSans-Regular.ttf</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
################################################################################
|
||||
## Form generated from reading UI file 'form.ui'
|
||||
##
|
||||
## Created by: Qt User Interface Compiler version 6.7.2
|
||||
##
|
||||
## WARNING! All changes made in this file will be lost when recompiling UI file!
|
||||
################################################################################
|
||||
|
||||
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
|
||||
QMetaObject, QObject, QPoint, QRect,
|
||||
QSize, QTime, QUrl, Qt)
|
||||
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
|
||||
QFont, QFontDatabase, QGradient, QIcon,
|
||||
QImage, QKeySequence, QLinearGradient, QPainter,
|
||||
QPalette, QPixmap, QRadialGradient, QTransform)
|
||||
from PySide6.QtWidgets import (QApplication, QLabel, QPushButton, QSizePolicy,
|
||||
QWidget)
|
||||
import rc_resources
|
||||
|
||||
class Ui_Widget(object):
|
||||
def setupUi(self, Widget):
|
||||
if not Widget.objectName():
|
||||
Widget.setObjectName(u"Widget")
|
||||
Widget.setEnabled(True)
|
||||
Widget.resize(742, 336)
|
||||
self.file_selector = QPushButton(Widget)
|
||||
self.file_selector.setObjectName(u"file_selector")
|
||||
self.file_selector.setGeometry(QRect(20, 140, 151, 34))
|
||||
self.label = QLabel(Widget)
|
||||
self.label.setObjectName(u"label")
|
||||
self.label.setGeometry(QRect(150, 20, 61, 61))
|
||||
self.label.setPixmap(QPixmap(u":/images/logo.png"))
|
||||
self.label.setScaledContents(True)
|
||||
self.label_2 = QLabel(Widget)
|
||||
self.label_2.setObjectName(u"label_2")
|
||||
self.label_2.setGeometry(QRect(240, 10, 431, 81))
|
||||
font = QFont()
|
||||
font.setPointSize(26)
|
||||
font.setBold(True)
|
||||
self.label_2.setFont(font)
|
||||
self.label_3 = QLabel(Widget)
|
||||
self.label_3.setObjectName(u"label_3")
|
||||
self.label_3.setGeometry(QRect(180, 140, 531, 31))
|
||||
self.label_3.setAutoFillBackground(False)
|
||||
self.create_button = QPushButton(Widget)
|
||||
self.create_button.setObjectName(u"create_button")
|
||||
self.create_button.setEnabled(False)
|
||||
self.create_button.setGeometry(QRect(310, 290, 111, 34))
|
||||
self.file_template = QPushButton(Widget)
|
||||
self.file_template.setObjectName(u"file_template")
|
||||
self.file_template.setGeometry(QRect(20, 190, 151, 34))
|
||||
self.label_4 = QLabel(Widget)
|
||||
self.label_4.setObjectName(u"label_4")
|
||||
self.label_4.setGeometry(QRect(180, 190, 561, 31))
|
||||
self.label_4.setAutoFillBackground(False)
|
||||
|
||||
self.retranslateUi(Widget)
|
||||
|
||||
QMetaObject.connectSlotsByName(Widget)
|
||||
# setupUi
|
||||
|
||||
def retranslateUi(self, Widget):
|
||||
Widget.setWindowTitle(QCoreApplication.translate("Widget", u"Widget", None))
|
||||
self.file_selector.setText(QCoreApplication.translate("Widget", u"\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae \u0391\u03c1\u03c7\u03b5\u03af\u03bf\u03c5 CSV", None))
|
||||
self.label.setText("")
|
||||
self.label_2.setText(QCoreApplication.translate("Widget", u"AKMI Certificate creator", None))
|
||||
#if QT_CONFIG(whatsthis)
|
||||
self.label_3.setWhatsThis(QCoreApplication.translate("Widget", u"<html><head/><body><p>\u03a4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \u03c0\u03bf\u03c5 \u03ad\u03c7\u03bf\u03c5\u03bc\u03b5 \u03b5\u03c0\u03b9\u03bb\u03ad\u03be\u03b5\u03b9</p></body></html>", None))
|
||||
#endif // QT_CONFIG(whatsthis)
|
||||
self.label_3.setText(QCoreApplication.translate("Widget", u"\u0395\u03c0\u03b9\u03bb\u03ad\u03be\u03c4\u03b5 \u03c4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \u03b4\u03b5\u03b4\u03bf\u03bc\u03ad\u03bd\u03c9\u03bd \u03c3\u03b5 \u03bc\u03bf\u03c1\u03c6\u03ae .csv", None))
|
||||
self.create_button.setText(QCoreApplication.translate("Widget", u"\u0394\u03b7\u03bc\u03b9\u03bf\u03c5\u03c1\u03b3\u03af\u03b1 pdf", None))
|
||||
self.file_template.setText(QCoreApplication.translate("Widget", u"\u0395\u03c0\u03b9\u03bb\u03bf\u03b3\u03ae \u0391\u03c1\u03c7\u03b5\u03af\u03bf\u03c5 PDF", None))
|
||||
#if QT_CONFIG(whatsthis)
|
||||
self.label_4.setWhatsThis(QCoreApplication.translate("Widget", u"<html><head/><body><p>\u03a4\u03bf \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \u03c0\u03bf\u03c5 \u03ad\u03c7\u03bf\u03c5\u03bc\u03b5 \u03b5\u03c0\u03b9\u03bb\u03ad\u03be\u03b5\u03b9</p></body></html>", None))
|
||||
#endif // QT_CONFIG(whatsthis)
|
||||
self.label_4.setText(QCoreApplication.translate("Widget", u"\u0395\u03c0\u03b9\u03bb\u03ad\u03be\u03c4\u03b5 \u03c4\u03bf PDF \u03b1\u03c1\u03c7\u03b5\u03af\u03bf \u03c4\u03bf\u03c5 \u03c0\u03c1\u03bf\u03c4\u03cd\u03c0\u03bf\u03c5", None))
|
||||
# retranslateUi
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
# This Python file uses the following encoding: utf-8
|
||||
import os
|
||||
import io
|
||||
import sys
|
||||
import csv
|
||||
import shutil
|
||||
from PyPDF2 import PdfReader, PdfWriter
|
||||
from reportlab.pdfgen import canvas
|
||||
from reportlab.lib.pagesizes import A4
|
||||
from reportlab.pdfbase import pdfmetrics
|
||||
from reportlab.pdfbase.ttfonts import TTFont
|
||||
from PySide6.QtWidgets import QApplication, QWidget, QFileDialog
|
||||
from PySide6.QtCore import QFile, QIODevice
|
||||
|
||||
# Important:
|
||||
# You need to run the following command to generate the ui_form.py file
|
||||
# pyside6-uic form.ui -o ui_form.py, or
|
||||
# pyside2-uic form.ui -o ui_form.py
|
||||
from ui_form import Ui_Widget
|
||||
|
||||
import rc_files
|
||||
|
||||
|
||||
class Widget(QWidget):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.ui = Ui_Widget()
|
||||
self.ui.setupUi(self)
|
||||
self.ui.file_selector.clicked.connect(self.file_selector)
|
||||
self.ui.file_template.clicked.connect(self.file_template)
|
||||
self.ui.create_button.clicked.connect(self.create_button)
|
||||
self.selected_file = False
|
||||
self.selected_template = False
|
||||
self.filepath_template = ""
|
||||
self.filepath = ""
|
||||
self.img_dir = os.path.join(os.path.dirname(__file__), "images")
|
||||
self.font_dir = os.path.join(os.path.dirname(__file__), "FONTS")
|
||||
|
||||
def qrc_to_bytes(self, filename):
|
||||
file = QFile(filename)
|
||||
if not file.open(QIODevice.ReadOnly):
|
||||
raise RuntimeError(file.errorString())
|
||||
return
|
||||
f = io.BytesIO(file.readAll().data())
|
||||
return f
|
||||
|
||||
def enable_create(self):
|
||||
if self.selected_file and self.selected_template:
|
||||
self.ui.create_button.setEnabled(True)
|
||||
|
||||
def file_selector(self):
|
||||
self.filepath = QFileDialog.getOpenFileName(self, "Επιλογή Αρχείου")
|
||||
if self.filepath[0]:
|
||||
ext = os.path.splitext(self.filepath[0])[-1].lower()
|
||||
if ext != ".csv":
|
||||
self.ui.label_3.setText("Το αρχείο πρέπει να είναι της μορφής .csv")
|
||||
self.selected_file = False
|
||||
else:
|
||||
self.ui.label_3.setText("{}".format(self.filepath[0]))
|
||||
self.selected_file = True
|
||||
self.in_file = self.filepath[0]
|
||||
self.file_path = os.path.dirname(self.filepath[0])
|
||||
self.enable_create()
|
||||
|
||||
def file_template(self):
|
||||
self.filepath_template = QFileDialog.getOpenFileName(self, "Επιλογή Αρχείου")
|
||||
if self.filepath_template[0]:
|
||||
ext = os.path.splitext(self.filepath_template[0])[-1].lower()
|
||||
if ext != ".pdf":
|
||||
self.ui.label_4.setText("Το αρχείο πρέπει να είναι της μορφής .pdf")
|
||||
self.selected_template = False
|
||||
else:
|
||||
self.ui.label_4.setText("{}".format(self.filepath_template[0]))
|
||||
self.selected_template = True
|
||||
self.in_template = self.filepath_template[0]
|
||||
self.template_path = os.path.dirname(self.filepath_template[0])
|
||||
self.enable_create()
|
||||
|
||||
def create_button(self):
|
||||
with open(self.in_file) as fin:
|
||||
csvin = csv.DictReader(fin)
|
||||
self.create_certificates(csvin)
|
||||
|
||||
def create_certificates(self, csv_dict):
|
||||
count = 0
|
||||
shutil.copyfile(
|
||||
"{}".format(self.filepath_template[0]),
|
||||
"{}/RESULT.pdf".format(self.file_path),
|
||||
)
|
||||
for in_row in csv_dict:
|
||||
count += 1
|
||||
packet = io.BytesIO()
|
||||
pdfmetrics.registerFont(
|
||||
TTFont("NotoMedium", self.qrc_to_bytes(":/FONTS/NotoSans-Medium.ttf"))
|
||||
)
|
||||
pdfmetrics.registerFont(
|
||||
TTFont(
|
||||
"NotoSemiMedium",
|
||||
self.qrc_to_bytes(":/FONTS/NotoSans-SemiCondensedMedium.ttf"),
|
||||
)
|
||||
)
|
||||
# pdfmetrics.registerFont(TTFont('NotoRegular', '{}/NotoSans-Regular.ttf'.format(self.font_dir)))
|
||||
# pdfmetrics.registerFont(TTFont('NotoBold', '{}/NotoSans-Bold.ttf'.format(self.font_dir)))
|
||||
# pdfmetrics.registerFont(TTFont('NotoSemi', '{}/NotoSans-SemiCondensed.ttf'.format(self.font_dir)))
|
||||
# pdfmetrics.registerFont(TTFont('NotoSemiMedium', '{}/NotoSans-SemiCondensedMedium.ttf'.format(self.font_dir)))
|
||||
|
||||
can = canvas.Canvas(packet, pagesize=A4)
|
||||
can.setFont("NotoMedium", 22)
|
||||
x = can._pagesize[0] / 2
|
||||
can.drawString(x, 315, "{} {}".format(in_row["SURNAME"], in_row["NAME"]))
|
||||
can.setFont("NotoSemiMedium", 18)
|
||||
can.drawString(x, 250, "{}".format(in_row["DEPARTMENT"]))
|
||||
can.save()
|
||||
|
||||
packet.seek(0)
|
||||
new_pdf = PdfReader(packet)
|
||||
|
||||
existing_pdf = PdfReader(open("{}/RESULT.pdf".format(self.file_path), "rb"))
|
||||
output = PdfWriter()
|
||||
|
||||
for page in existing_pdf.pages:
|
||||
output.add_page(page)
|
||||
page = existing_pdf.pages[0]
|
||||
page.merge_page(new_pdf.pages[0])
|
||||
output.add_page(page)
|
||||
|
||||
outputStream = open("{}/RESULT.pdf".format(self.file_path), "wb")
|
||||
output.write(outputStream)
|
||||
outputStream.close()
|
||||
self.ui.label_4.setText(
|
||||
"Το αρχείο PDF δημιουργήθηκε εντός του φακέλου του .csv"
|
||||
)
|
||||
self.ui.create_button.setEnabled(False)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QApplication(sys.argv)
|
||||
widget = Widget()
|
||||
widget.show()
|
||||
sys.exit(app.exec())
|
||||
Reference in New Issue
Block a user