Updating build, providing CI, fixing a few bugs

This commit is contained in:
Ad5001 2021-07-11 16:18:01 +02:00
parent a852a1232f
commit c828b4fba8
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
7 changed files with 70 additions and 9 deletions

44
.drone/.drone.yml Normal file
View file

@ -0,0 +1,44 @@
kind: pipeline
name: build-test
platform:
os: linux
arch: amd64
steps:
- name: Linux test
image: ad5001/ubuntu-pyside2-xvfb:hirsute-5.15.2
commands:
- xvfb-run python3 run.py --test-build
- xvfb-run python3 run.py --test-build ./.drone/test1.lpf
- xvfb-run python3 run.py --test-build ./.drone/test2.lpf
when:
event: [ push, tag ]
- name: Windows test
image: ad5001/ubuntu-pyside2-xvfb-wine:win7-5.15.2
commands:
- # For some reason, launching GUI apps with wine, even with xvfb-run, fails.
- #xvfb-run python run.py --test-build
- #xvfb-run python run.py --test-build ./.drone/test1.lpf
- #xvfb-run python run.py --test-build ./.drone/test2.lpf
when:
event: [ push, tag ]
- name: Linux packaging
image: ad5001/accountfree-build-img:hirsute-5.15.2
commands:
- bash package-linux.sh
when:
event: [ push, tag ]
- name: Windows building
image: ad5001/accountfree-build-img-wine:win7-5.15.2
commands:
- bash build-wine.sh
- bash package-wine.sh
when:
event: [ push, tag ]

View file

@ -109,13 +109,13 @@ def run():
engine = QQmlApplicationEngine()
helper = Helper()
engine.rootContext().setContextProperty("Helper", helper)
engine.rootContext().setContextProperty("TestBuild", "--test-build" in argv)
engine.addImportPath(os.path.realpath(os.path.join(os.getcwd(), "qml")))
engine.load(os.path.realpath(os.path.join(os.getcwd(), "qml", "LogGraph.qml")))
engine.load(os.path.realpath(os.path.join(os.getcwd(), "qml", "LogarithmPlotter.qml")))
os.chdir(pwd)
if len(argv) > 0 and os.path.exists(argv[-1]) and argv[-1].split('.')[-1] in ['json', 'lgg', 'lpf']:
print(argv[-1])
engine.rootObjects()[0].loadDiagram(argv[-1])
os.chdir(os.path.dirname(os.path.realpath(__file__)))

View file

@ -125,6 +125,11 @@ ApplicationWindow {
textsize: settings.textsize
showxgrad: settings.showxgrad
showygrad: settings.showygrad
onPainted: if(TestBuild == true) {
console.log("Plot drawn in canvas, terminating test of build in 100ms.")
testBuildTimer.start()
}
}
function saveDiagram(filename) {
@ -161,6 +166,7 @@ ApplicationWindow {
}
function loadDiagram(filename) {
console.log("Loading file '" + filename + "'.")
var data = JSON.parse(Helper.load(filename))
var error = "";
if(Object.keys(data).includes("type") && data["type"] == "logplotv1") {
@ -216,8 +222,11 @@ ApplicationWindow {
error = "Invalid file provided."
}
if(error != "") {
console.log(error)
// TODO: Error handling
}
drawCanvas.requestPaint()
console.log("Loaded file '" + filename + "'.")
}
Timer {
@ -227,6 +236,13 @@ ApplicationWindow {
onTriggered: sidebarSelector.currentIndex = 0
}
Timer {
id: testBuildTimer
repeat: false
interval: 100
onTriggered: Qt.quit() // Quit after paint on test build
}
function copyDiagramToClipboard() {
var file = Helper.gettmpfile()
drawCanvas.save(file)

View file

@ -1300,7 +1300,7 @@ class Text extends DrawableObject {
constructor(name = null, visible = true, color = null, labelContent = 'null',
x = 1, y = 0, labelPosition = 'center', text = 'New text') {
if(name == null) name = "tex" + getNewName('t')
if(name == null) name = getNewName('t')
super(name, visible, color, labelContent)
this.type = 'Point'
if(typeof x == 'number' || typeof x == 'string') x = new MathLib.Expression(x.toString())

View file

@ -259,7 +259,7 @@ function makeExpressionReadable(str) {
[/(\d|\))×/g, '$1'],
//[/×(\d|\()/g, '$1'],
[/\(([^)(+.\/-]+)\)/g, "$1"],
[/integral\((.+), ?(.+), ?("|')(.+)("|'), ?("|')(.+)("|')\)/g, function(match, a, b, p1, body, p2, p3, by, p4) {
[/integral\((.+),\s?(.+),\s?("|')(.+)("|'),\s?("|')(.+)("|')\)/g, function(match, a, b, p1, body, p2, p3, by, p4) {
if(a.length < b.length) {
return `${textsub(a)}${textsup(b)} ${body} d${by}`
} else {

View file

@ -1,4 +1,4 @@
# LogarithmPlotter
# ![icon](https://git.ad5001.eu/Ad5001/LogarithmicPlotter/raw/branch/master/logplotter.svg) LogarithmPlotter
Create graphs with logarithm scales, namely BODE diagrams.
@ -9,11 +9,12 @@ You can simply run LogarithmPlotter using `python3 run.py`.
## Install
### Generate installers:
You can generate installers from AccountFree after installing all the dependencies:
You can generate installers from AccountFree after installing all the dependencies:
For all builds, you need [Python 3](https://python.org) with [PySide2](https://pypi.org/project/PySide2/) installable with `pip install PySide2`.
- Windows installer:
- You need `pyinstaller`. You can install it using `pip install pyinstaller`.
- Run the `build-windows.bat` script (or `build-wine.sh` if you're cross-compiling with wine on Linux) to build an exe for LogarithmPlotter.
- You also [NSIS](https://nsis.sourceforge.io/Main_Page) (Linux users can install the `nsis` package).
- You also need [NSIS](https://nsis.sourceforge.io/Main_Page) (Linux users can install the [nsis](https://pkgs.org/download/nsis) package).
- Run the `package-windows.bat` script (or `package.wine.sh`if you're cross-compiling on Linux). You will find a logarithmplotter-setup.exe installer in the dist/accountfree/ folder.
- MacOS Archive creator installer:
- You need `pyinstaller`. You can install it using `pip install pyinstaller`.

View file

@ -1 +1 @@
python3-pip, qt5-default (>= 5.12.0), qml-module-qtquick-controls2 (>= 5.12.0), qml-module-qtmultimedia (>= 5.12.0), qml-module-qtgraphicaleffects (>= 5.12.0), qml-module-qtquick2 (>= 5.12.0), qml-module-qtqml-models2 (>= 5.12.0), qml-module-qtquick-controls (>= 5.12.0), python3-pyside2.qtcore (>= 5.12.0), python3-pyside2.qtqml (>= 5.12.0), python3-pyside2.qtgui (>= 5.12.0), python3-pyside2.qtquick (>= 5.12.0), python3-pyside2.qtwidgets (>= 5.12.0), python3-pyside2.qtmultimedia (>= 5.12.0), python3-pyside2.qtnetwork (>= 5.12.0)
python3-pip, qt5-default (>= 5.15.0), qml-module-qtquick-controls2 (>= 5.15.0), qml-module-qtmultimedia (>= 5.15.0), qml-module-qtgraphicaleffects (>= 5.15.0), qml-module-qtquick2 (>= 5.15.0), qml-module-qtqml-models2 (>= 5.15.0), qml-module-qtquick-controls (>= 5.15.0), python3-pyside2.qtcore (>= 5.15.0), python3-pyside2.qtqml (>= 5.15.0), python3-pyside2.qtgui (>= 5.15.0), python3-pyside2.qtquick (>= 5.15.0), python3-pyside2.qtwidgets (>= 5.15.0), python3-pyside2.qtmultimedia (>= 5.15.0), python3-pyside2.qtnetwork (>= 5.15.0)