diff --git a/LogarithmPlotter/__init__.py b/LogarithmPlotter/__init__.py
new file mode 100644
index 0000000..9301af8
--- /dev/null
+++ b/LogarithmPlotter/__init__.py
@@ -0,0 +1,128 @@
+"""
+ * LogarithmPlotter - Create graphs with logarithm scales.
+ * Copyright (C) 2021 Ad5001
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+"""
+
+from PySide2.QtWidgets import QApplication, QFileDialog
+from PySide2.QtQml import QQmlApplicationEngine, qmlRegisterType
+from PySide2.QtCore import Qt, QObject, Signal, Slot, Property
+from PySide2.QtGui import QIcon, QImage
+from PySide2 import __version__ as PySide2_version
+
+import os
+import tempfile
+from platform import release as os_release
+from json import dumps
+from sys import platform, argv, version as sys_version
+import webbrowser
+
+__VERSION__ = "0.0.1.dev0"
+
+tempfile = tempfile.mkstemp(suffix='.png')[1]
+
+def get_linux_theme():
+ des = {
+ "KDE": "Flat",
+ "gnome": "default",
+ "lxqt": "fusion",
+ "mate": "fusion",
+ }
+ if "XDG_SESSION_DESKTOP" in os.environ:
+ return des[os.environ["XDG_SESSION_DESKTOP"]] if os.environ["XDG_SESSION_DESKTOP"] in des else "fusion"
+ else:
+ # Android
+ return "Material"
+
+class Helper(QObject):
+
+ @Slot(str, str)
+ def write(self, filename, filedata):
+ if os.path.exists(os.path.dirname(os.path.realpath(filename))):
+ f = open(os.path.realpath(filename), 'w', -1, 'utf8')
+ f.write(filedata)
+ f.close()
+
+ @Slot(str, result=str)
+ def load(self, filename):
+ if os.path.exists(os.path.realpath(filename)):
+ f = open(os.path.realpath(filename), 'r', -1, 'utf8')
+ data = f.read()
+ f.close()
+ return data
+ return '{}'
+
+ @Slot(result=str)
+ def gettmpfile(self):
+ global tempfile
+ return tempfile
+
+ @Slot()
+ def copyImageToClipboard(self):
+ global tempfile
+ clipboard = QApplication.clipboard()
+ clipboard.setImage(QImage(tempfile))
+
+ @Slot(result=str)
+ def getVersion(self):
+ return __VERSION__
+
+ @Slot(result=str)
+ def getDebugInfos(self):
+ """
+ Returns the version info about Qt, PySide2 & Python
+ """
+ return "Built with PySide2 (Qt) v{} and python v{}".format(PySide2_version, sys_version.split("\n")[0])
+
+ @Slot(str)
+ def openUrl(self, url):
+ webbrowser.open(url)
+
+def run():
+ pwd = os.getcwd()
+ os.chdir(os.path.dirname(os.path.realpath(__file__)))
+
+ os.environ["QT_QUICK_CONTROLS_STYLE"] = {
+ "linux": get_linux_theme(),
+ "freebsd": get_linux_theme(),
+ "win32": "universal" if os_release == "10" else "fusion",
+ "cygwin": "fusion",
+ "darwin": "imagine"
+ }[platform]
+
+ app = QApplication(argv)
+ app.setApplicationName("LogarithmPlotter")
+ app.setOrganizationName("Ad5001")
+ app.setWindowIcon(QIcon(os.path.realpath(os.path.join(os.getcwd(), "..", "logplotter.svg"))))
+ engine = QQmlApplicationEngine()
+ helper = Helper()
+ engine.rootContext().setContextProperty("Helper", helper)
+
+ engine.addImportPath(os.path.realpath(os.path.join(os.getcwd(), "qml")))
+ engine.load(os.path.realpath(os.path.join(os.getcwd(), "qml", "LogGraph.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__)))
+
+ if not engine.rootObjects():
+ print("No root object")
+ exit(-1)
+ app.exec_()
+
+ os.remove(tempfile)
+
diff --git a/LogarithmPlotter/__main__.py b/LogarithmPlotter/__main__.py
new file mode 100644
index 0000000..0482757
--- /dev/null
+++ b/LogarithmPlotter/__main__.py
@@ -0,0 +1,4 @@
+from .run import run
+
+if __name__ == "__main__":
+ run()
diff --git a/qml/About.qml b/LogarithmPlotter/qml/About.qml
similarity index 100%
rename from qml/About.qml
rename to LogarithmPlotter/qml/About.qml
diff --git a/qml/AppMenuBar.qml b/LogarithmPlotter/qml/AppMenuBar.qml
similarity index 100%
rename from qml/AppMenuBar.qml
rename to LogarithmPlotter/qml/AppMenuBar.qml
diff --git a/qml/ComboBoxSetting.qml b/LogarithmPlotter/qml/ComboBoxSetting.qml
similarity index 100%
rename from qml/ComboBoxSetting.qml
rename to LogarithmPlotter/qml/ComboBoxSetting.qml
diff --git a/qml/FileDialog.qml b/LogarithmPlotter/qml/FileDialog.qml
similarity index 100%
rename from qml/FileDialog.qml
rename to LogarithmPlotter/qml/FileDialog.qml
diff --git a/qml/History.qml b/LogarithmPlotter/qml/History.qml
similarity index 100%
rename from qml/History.qml
rename to LogarithmPlotter/qml/History.qml
diff --git a/qml/HistoryBrowser.qml b/LogarithmPlotter/qml/HistoryBrowser.qml
similarity index 100%
rename from qml/HistoryBrowser.qml
rename to LogarithmPlotter/qml/HistoryBrowser.qml
diff --git a/qml/Icon.qml b/LogarithmPlotter/qml/Icon.qml
similarity index 100%
rename from qml/Icon.qml
rename to LogarithmPlotter/qml/Icon.qml
diff --git a/qml/ListSetting.qml b/LogarithmPlotter/qml/ListSetting.qml
similarity index 100%
rename from qml/ListSetting.qml
rename to LogarithmPlotter/qml/ListSetting.qml
diff --git a/qml/LogGraph.qml b/LogarithmPlotter/qml/LogGraph.qml
similarity index 100%
rename from qml/LogGraph.qml
rename to LogarithmPlotter/qml/LogGraph.qml
diff --git a/qml/LogGraphCanvas.qml b/LogarithmPlotter/qml/LogGraphCanvas.qml
similarity index 100%
rename from qml/LogGraphCanvas.qml
rename to LogarithmPlotter/qml/LogGraphCanvas.qml
diff --git a/qml/ObjectLists.qml b/LogarithmPlotter/qml/ObjectLists.qml
similarity index 100%
rename from qml/ObjectLists.qml
rename to LogarithmPlotter/qml/ObjectLists.qml
diff --git a/qml/Settings.qml b/LogarithmPlotter/qml/Settings.qml
similarity index 100%
rename from qml/Settings.qml
rename to LogarithmPlotter/qml/Settings.qml
diff --git a/qml/TextSetting.qml b/LogarithmPlotter/qml/TextSetting.qml
similarity index 95%
rename from qml/TextSetting.qml
rename to LogarithmPlotter/qml/TextSetting.qml
index eaa012b..96c932e 100644
--- a/qml/TextSetting.qml
+++ b/LogarithmPlotter/qml/TextSetting.qml
@@ -108,12 +108,11 @@ Item {
"α","β","γ","δ","ε","ζ","η","θ","κ","λ",
"μ","ξ","ρ","ς","σ","τ","φ","χ","ψ","ω",
"Γ","Δ","Θ","Λ","Ξ","Π","Σ","Φ","Ψ","Ω",
- "∞","≠","≥","≤","∧","∨","∩","∪","⊂","⊃",
- "⊕","⊗","∈","∀","∃","∂"," "," "," "," ",
+ "∞","∂"," "," "," "," "," "," "," "," ",
"¹","²","³","⁴","⁵","⁶","⁷","⁸","⁹","⁰",
"₁","₂","₃","₄","₅","₆","₇","₈","₉","₀",
"ₐ","ₑ","ₒ","ₓ","ₔ","ₕ","ₖ","ₗ","ₘ","ₙ",
- "ₚ","ₛ","ₜ","₊","₋","₌","₍","₎"," "," "
+ "ₚ","ₛ","ₜ"," "," "," "," "," "," "," "
]
Repeater {
diff --git a/qml/icons/Function.svg b/LogarithmPlotter/qml/icons/Function.svg
similarity index 98%
rename from qml/icons/Function.svg
rename to LogarithmPlotter/qml/icons/Function.svg
index 70d533c..2dbb7cf 100644
--- a/qml/icons/Function.svg
+++ b/LogarithmPlotter/qml/icons/Function.svg
@@ -13,7 +13,7 @@
version="1.1"
id="SVGRoot"
sodipodi:docname="Function.svg"
- inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
diff --git a/qml/icons/settings/custom/arrow.svg b/LogarithmPlotter/qml/icons/settings/custom/arrow.svg
similarity index 97%
rename from qml/icons/settings/custom/arrow.svg
rename to LogarithmPlotter/qml/icons/settings/custom/arrow.svg
index 626814d..9d4345d 100644
--- a/qml/icons/settings/custom/arrow.svg
+++ b/LogarithmPlotter/qml/icons/settings/custom/arrow.svg
@@ -13,7 +13,7 @@
version="1.1"
id="SVGRoot"
sodipodi:docname="arrow.svg"
- inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
+
diff --git a/linux/debian/changelog b/linux/debian/changelog
new file mode 100644
index 0000000..8172695
--- /dev/null
+++ b/linux/debian/changelog
@@ -0,0 +1,5 @@
+logarithmplotter (0.0.1.dev0) UNRELEASED; urgency=medium
+
+ * Initial release.
+
+ -- Ad5001 Mon, 06 Jun 2021 08:48:28 +0200
diff --git a/linux/debian/compat b/linux/debian/compat
new file mode 100644
index 0000000..b4de394
--- /dev/null
+++ b/linux/debian/compat
@@ -0,0 +1 @@
+11
diff --git a/linux/debian/control b/linux/debian/control
new file mode 100644
index 0000000..ca07e0b
--- /dev/null
+++ b/linux/debian/control
@@ -0,0 +1,12 @@
+Package: logarithmplotter
+Source: logarithmplotter
+Version: 0.0.1.dev0
+Architecture: all
+Maintainer: Ad5001
+Depends: python3, python3-pip, qt5-default (>= 5.14.0), qml-module-qtquick-controls2 (>= 5.14.0), qml-module-qtmultimedia (>= 5.14.0), qml-module-qtgraphicaleffects (>= 5.14.0), qml-module-qtquick2 (>= 5.14.0), qml-module-qtqml-models2 (>= 5.14.0), qml-module-qtquick-controls (>= 5.14.0), python3-pyside2.qtcore (>= 5.14.0), python3-pyside2.qtqml (>= 5.14.0), python3-pyside2.qtgui (>= 5.14.0), python3-pyside2.qtquick (>= 5.14.0), python3-pyside2.qtwidgets (>= 5.14.0), python3-pyside2.qtmultimedia (>= 5.14.0), python3-pyside2.qtnetwork (>= 5.14.0)
+Build-Depends: debhelper (>=11~), dh-python, dpkg-dev (>= 1.16.1~), python-setuptools, python3-all-dev (>=3.6)
+Section: science
+Priority: optional
+Homepage: https://apps.ad5001.eu/logarithmplotter
+Installed-Size: 174
+Description: Create graphs with logarithm scales.
diff --git a/linux/debian/copyright b/linux/debian/copyright
new file mode 100644
index 0000000..0752f06
--- /dev/null
+++ b/linux/debian/copyright
@@ -0,0 +1,8 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: logarithmplotter
+Upstream-Contact: Ad5001
+
+Files: *
+Copyright: 2020, Ad5001
+License: GPL-3
+
diff --git a/linux/debian/depends b/linux/debian/depends
new file mode 100644
index 0000000..1494f2e
--- /dev/null
+++ b/linux/debian/depends
@@ -0,0 +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)
diff --git a/linux/debian/install b/linux/debian/install
new file mode 100644
index 0000000..a93c044
--- /dev/null
+++ b/linux/debian/install
@@ -0,0 +1 @@
+logarithmplotter usr/bin/
diff --git a/linux/debian/recommends b/linux/debian/recommends
new file mode 100644
index 0000000..e69de29
diff --git a/linux/debian/rules b/linux/debian/rules
new file mode 100644
index 0000000..1323e7c
--- /dev/null
+++ b/linux/debian/rules
@@ -0,0 +1,6 @@
+#!/usr/bin/make -f
+
+export PYBUILD_NAME = logarithmplotter
+
+%:
+ dh $@ --with python3 --buildsystem=pybuild
diff --git a/linux/install_after_setup.sh b/linux/install_after_setup.sh
new file mode 100644
index 0000000..4dd63ab
--- /dev/null
+++ b/linux/install_after_setup.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+APPROOT="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
+echo "Adding desktop file..."
+mkdir -p ~/.local/share/applications
+sed "s+ROOTFOLDER+$APPROOT/+g" "$APPROOT/linux/logarithmplotter.desktop" > ~/.local/share/applications/logarithmplotter.desktop
+echo "Installing mime-type..."
+mkdir -p ~/.local/share/applications
+sed "s+ROOTFOLDER+$APPROOT/+g" "$APPROOT/linux/x-logarithm-plotter-old.xml" > ~/.local/share/mime/packages/x-logarithm-plotter.xml
+mkdir -p ~/.local/share/icons/hicolor/scalable/mimetypes
+cp "$APPROOT/logplotterfile.svg" ~/.local/share/icons/hicolor/scalable/mimetypes/application-x-logarithm-plotter.svg
+update-mime-database ~/.local/share/mime/
+update-icon-caches ~/.local/share/icons/hicolor
diff --git a/linux/install_local.sh b/linux/install_local.sh
index 7271387..e095e89 100644
--- a/linux/install_local.sh
+++ b/linux/install_local.sh
@@ -2,10 +2,10 @@
APPROOT="$(cd -P "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
echo "Adding desktop file..."
mkdir -p ~/.local/share/applications
-sed "s+/home/ad5001/Apps/LogarithmPlotter/+$APPROOT/+g" "$APPROOT/linux/logplotter.desktop" > ~/.local/share/applications/logplotter.desktop
+sed "s+ROOTFOLDER+$APPROOT/+g" "$APPROOT/linux/logplotter.desktop" > ~/.local/share/applications/logarithmplotter.desktop
echo "Installing mime-type..."
mkdir -p ~/.local/share/applications
-sed "s+/home/ad5001/Apps/LogarithmPlotter/+$APPROOT/+g" "$APPROOT/linux/x-logarithm-plotter.xml" > ~/.local/share/mime/packages/x-logarithm-plotter.xml
+sed "s+ROOTFOLDER+$APPROOT/+g" "$APPROOT/linux/x-logarithm-plotter-old.xml" > ~/.local/share/mime/packages/x-logarithm-plotter.xml
mkdir -p ~/.local/share/icons/hicolor/scalable/mimetypes
cp "$APPROOT/logplotterfile.svg" ~/.local/share/icons/hicolor/scalable/mimetypes/application-x-logarithm-plotter.svg
update-mime-database ~/.local/share/mime/
diff --git a/linux/logarithmplotter.desktop b/linux/logarithmplotter.desktop
new file mode 100644
index 0000000..18875d1
--- /dev/null
+++ b/linux/logarithmplotter.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Version=1.0
+Type=Application
+Name=LogarithmPlotter
+Comment=Plotter to make BODE diagrams, sequences and repartition functions.
+Exec=/usr/bin/logarithmplotter %F
+Icon=logplotter
+MimeType=application/x-logarithm-plotter;
+Terminal=false
+StartupNotify=false
+Categories=Graphics;Science;Math;
diff --git a/linux/logplotter.desktop b/linux/logplotter.desktop
index 71bd6df..790a057 100644
--- a/linux/logplotter.desktop
+++ b/linux/logplotter.desktop
@@ -3,8 +3,8 @@ Version=1.0
Type=Application
Name=LogarithmPlotter
Comment=Plotter to make BODE diagrams, sequences and repartition functions.
-Exec=/usr/bin/python3 /home/ad5001/Apps/LogarithmPlotter/run.py %F
-Icon=/home/ad5001/Apps/LogarithmPlotter/logplotter.svg
+Exec=/usr/bin/python3 ROOTFOLDER/run.py %F
+Icon=ROOTFOLDER/logplotter.svg
MimeType=application/x-logarithm-plotter;
Terminal=false
StartupNotify=false
diff --git a/linux/x-logarithm-plotter-old.xml b/linux/x-logarithm-plotter-old.xml
new file mode 100644
index 0000000..ed4f8f1
--- /dev/null
+++ b/linux/x-logarithm-plotter-old.xml
@@ -0,0 +1,12 @@
+
+
+
+ Logarithm Plot File
+ Fichier Graphe Logarithmique
+
+
+
+
+
+
+
diff --git a/linux/x-logarithm-plotter.xml b/linux/x-logarithm-plotter.xml
index fc32e06..130255a 100644
--- a/linux/x-logarithm-plotter.xml
+++ b/linux/x-logarithm-plotter.xml
@@ -3,7 +3,7 @@
Logarithm Plot File
Fichier Graphe Logarithmique
-
+
diff --git a/logplotter.svg b/logplotter.svg
index f62dd55..89b2b1b 100644
--- a/logplotter.svg
+++ b/logplotter.svg
@@ -13,9 +13,9 @@
version="1.1"
id="SVGRoot"
sodipodi:docname="logplotter.svg"
- inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
Logarithm Plotter Icon v1.0
+ id="title836">LogarithmPlotter Icon v1.0
image/svg+xml
- Logarithm Plotter Icon v1.0
+ LogarithmPlotter Icon v1.0
2021
diff --git a/logplotterfile.svg b/logplotterfile.svg
index 1f80b85..580277f 100644
--- a/logplotterfile.svg
+++ b/logplotterfile.svg
@@ -14,9 +14,9 @@
version="1.1"
id="SVGRoot"
sodipodi:docname="logplotterfile.svg"
- inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)">
+ inkscape:version="1.0.1 (3bc2e813f5, 2021-09-07)">
Logarithm Plotter Icon
+ id="title849">LogarithmPlotter Icon
image/svg+xml
- Logarithm Plotter File Icon
+ LogarithmPlotter File Icon
2021
diff --git a/package-linux.sh b/package-linux.sh
new file mode 100644
index 0000000..b518dd3
--- /dev/null
+++ b/package-linux.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+python3 setup.py --command-packages=stdeb.command sdist_dsc --package accountfree --copyright-file linux/debian/copyright --suite hirsute --recommends "$(cat linux/debian/recommends)" --depends "$(cat linux/debian/depends)" --section science bdist_deb
diff --git a/run.py b/run.py
index 7a63050..0d8c282 100644
--- a/run.py
+++ b/run.py
@@ -1,126 +1,8 @@
-"""
- * LogarithmPlotter - Create graphs with logarithm scales.
- * Copyright (C) 2021 Ad5001
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
-"""
-from PySide2.QtWidgets import QApplication, QFileDialog
-from PySide2.QtQml import QQmlApplicationEngine, qmlRegisterType
-from PySide2.QtCore import Qt, QObject, Signal, Slot, Property
-from PySide2.QtGui import QIcon, QImage
-from PySide2 import __version__ as PySide2_version
+def run():
+ import LogarithmPlotter
+ LogarithmPlotter.run()
-import os
-import tempfile
-from platform import release as os_release
-from json import dumps
-from sys import platform, argv, version as sys_version
-import webbrowser
-
-
-pwd = os.getcwd()
-os.chdir(os.path.dirname(os.path.realpath(__file__)))
-
-__VERSION__ = "0.0.1.dev0"
-
-tempfile = tempfile.mkstemp(suffix='.png')[1]
-
-def get_linux_theme():
- des = {
- "KDE": "Flat",
- "gnome": "default",
- "lxqt": "fusion",
- "mate": "fusion",
- }
- if "XDG_SESSION_DESKTOP" in os.environ:
- return des[os.environ["XDG_SESSION_DESKTOP"]] if os.environ["XDG_SESSION_DESKTOP"] in des else "fusion"
- else:
- # Android
- return "Material"
-os.environ["QT_QUICK_CONTROLS_STYLE"] = {
- "linux": get_linux_theme(),
- "freebsd": get_linux_theme(),
- "win32": "universal" if os_release == "10" else "fusion",
- "cygwin": "fusion",
- "darwin": "imagine"
-}[platform]
-
-class Helper(QObject):
- @Slot(str, str)
- def write(self, filename, filedata):
- if os.path.exists(os.path.dirname(os.path.realpath(filename))):
- f = open(os.path.realpath(filename), 'w', -1, 'utf8')
- f.write(filedata)
- f.close()
-
- @Slot(str, result=str)
- def load(self, filename):
- if os.path.exists(os.path.realpath(filename)):
- f = open(os.path.realpath(filename), 'r', -1, 'utf8')
- data = f.read()
- f.close()
- return data
- return '{}'
-
- @Slot(result=str)
- def gettmpfile(self):
- global tempfile
- return tempfile
-
- @Slot()
- def copyImageToClipboard(self):
- global tempfile
- clipboard = QApplication.clipboard()
- clipboard.setImage(QImage(tempfile))
-
- @Slot(result=str)
- def getVersion(self):
- return __VERSION__
-
- @Slot(result=str)
- def getDebugInfos(self):
- """
- Returns the version info about Qt, PySide2 & Python
- """
- return "Built with PySide2 (Qt) v{} and python v{}".format(PySide2_version, sys_version.split("\n")[0])
-
- @Slot(str)
- def openUrl(self, url):
- webbrowser.open(url)
-
-
-app = QApplication(argv)
-app.setApplicationName("LogarithmPlotter")
-app.setOrganizationName("Ad5001")
-app.setWindowIcon(QIcon(os.path.realpath(os.path.join(os.getcwd(), "logplotter.svg"))))
-engine = QQmlApplicationEngine()
-helper = Helper()
-engine.rootContext().setContextProperty("Helper", helper)
-
-engine.addImportPath(os.path.realpath(os.path.join(os.getcwd(), "qml")))
-engine.load(os.path.realpath(os.path.join(os.getcwd(), "qml", "LogGraph.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__)))
-
-if not engine.rootObjects():
- print("No root object")
- exit(-1)
-app.exec_()
-
-os.remove(tempfile)
+if __name__ == "__main__":
+ run()
+
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..24957a5
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,98 @@
+"""
+ * LogarithmPlotter - Create graphs with logarithm scales.
+ * Copyright (C) 2021 Ad5001
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+"""
+
+import setuptools
+import os
+import sys
+
+current_dir = os.path.realpath(os.path.dirname(os.path.realpath(__file__)))
+
+from LogarithmPlotter import __VERSION__ as pkg_version
+
+CLASSIFIERS = """
+Environment :: Graphic
+Environment :: X11 Applications :: Qt
+License :: OSI Approved :: GNU General Public License v3 (GPLv3)
+Natural Language :: English
+Development Status :: 4 - Beta
+Operating System :: MacOS :: MacOS X
+Operating System :: Microsoft :: Windows
+Operating System :: POSIX
+Operating System :: POSIX :: BSD
+Operating System :: POSIX :: Linux
+Programming Language :: Python :: 3.8
+Programming Language :: Python :: 3.9
+Programming Language :: Python :: Implementation :: CPython
+Topic :: Utilities
+Topic :: Scientific/Engineering
+""".strip().splitlines()
+
+def read_file(file_name):
+ f = open(file_name, 'r', -1)
+ data = f.read()
+ f.close()
+ return data
+
+def package_data():
+ pkg_data = []
+ for d,folders,files in os.walk("LogarithmPlotter/qml"):
+ d = d[17:]
+ pkg_data += [os.path.join(d, f) for f in files]
+ print("Pkgdata", pkg_data)
+ return pkg_data
+
+data_files = []
+if sys.platform == 'linux':
+ data_files.append(('/usr/share/applications/', ['linux/logarithmplotter.desktop']))
+ data_files.append(('/usr/share/mime/packages/', ['linux/x-logarithm-plotter.xml']))
+ data_files.append(('/usr/share/icons/hicolor/scalable/mimetypes/', ['linux/application-x-logarithm-plotter.svg']))
+ data_files.append(('/usr/share/icons/hicolor/scalable/apps/', ['logplotter.svg']))
+
+setuptools.setup(
+ install_requires=["PySide2"],
+ python_requires='>=3.8',
+
+ name='logarithmplotter',
+ version=pkg_version,
+
+ description='Browse and use online services, free of account',
+ long_description=read_file("README.md"),
+ keywords='logarithm plotter graph creator bode diagram',
+
+ author='Ad5001',
+ author_email='mail@ad5001.eu',
+
+ license=('GPLv3'),
+ url='https://apps.ad5001.eu/logarithmplotter',
+
+ classifiers=CLASSIFIERS,
+ zip_safe=False,
+ packages=["LogarithmPlotter"],
+
+ package_data={
+ 'LogarithmPlotter':package_data(),
+ },
+ include_package_data=True,
+ data_files = data_files,
+ entry_points={
+ 'console_scripts': [
+ 'logarithmplotter = LogarithmPlotter:run',
+ ],
+ }
+)
+