Rewirring paths to improve import names and such.

This commit is contained in:
Adsooi 2024-10-27 00:45:04 +02:00
parent f52ee65c56
commit e6de739d0c
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
22 changed files with 79 additions and 45 deletions

View file

@ -22,7 +22,7 @@ import { babel } from "@rollup/plugin-babel"
import cleanup from "rollup-plugin-cleanup"
const src = "./src/index.mjs"
const dest = "../build/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/index.mjs"
const dest = "../build/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Common/index.mjs"
export default {
input: src,

View file

@ -20,7 +20,7 @@ import QtQuick
import Qt.labs.platform as Native
//import QtQuick.Controls 2.15
import eu.ad5001.MixedMenu 1.1
import "js/index.mjs" as JS
import eu.ad5001.LogarithmPlotter.Common
/*!

View file

@ -0,0 +1,3 @@
module eu.ad5001.LogarithmPlotter.Common
JS 1.0 index.mjs

View file

@ -24,7 +24,7 @@ import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
/*!
\qmltype HistoryBrowser
\qmltype Browser
\inqmlmodule eu.ad5001.LogarithmPlotter.History
\brief Tab of the drawer that allows to navigate through the undo and redo history.
@ -95,7 +95,7 @@ Item {
Repeater {
model: historyBrowser.redoCount
HistoryItem {
SingleItem {
id: redoButton
width: historyBrowser.actionWidth
//height: actionHeight
@ -147,7 +147,7 @@ Item {
model: historyBrowser.undoCount
HistoryItem {
SingleItem {
id: undoButton
width: historyBrowser.actionWidth
//height: actionHeight

View file

@ -22,7 +22,7 @@ import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
/*!
\qmltype HistoryItem
\qmltype SingleItem
\inqmlmodule eu.ad5001.LogarithmPlotter.History
\brief Item representing an history action.

View file

@ -1,4 +1,4 @@
module eu.ad5001.LogarithmPlotter.History
HistoryBrowser 1.0 HistoryBrowser.qml
HistoryItem 1.0 HistoryItem.qml
Browser 1.0 Browser.qml
SingleItem 1.0 SingleItem.qml

View file

@ -23,10 +23,11 @@ import QtQuick.Layouts 1.12
import QtQuick
// Auto loading all modules.
import "js/index.mjs" as JS
import eu.ad5001.LogarithmPlotter.Common
import eu.ad5001.LogarithmPlotter.History 1.0
import eu.ad5001.LogarithmPlotter.History 1.0 as History
import eu.ad5001.LogarithmPlotter.ObjectLists 1.0
import eu.ad5001.LogarithmPlotter.Overlay 1.0 as Overlay
import eu.ad5001.LogarithmPlotter.Popup 1.0 as Popup
/*!
@ -120,16 +121,16 @@ ApplicationWindow {
ObjectLists {
id: objectLists
onChanged: drawCanvas.requestPaint()
onChanged: Modules.Canvas.requestPaint()
}
Settings {
id: settings
canvas: drawCanvas
onChanged: drawCanvas.requestPaint()
onChanged: Modules.Canvas.requestPaint()
}
HistoryBrowser {
History.Browser {
id: historyBrowser
}
}
@ -154,18 +155,24 @@ ApplicationWindow {
}
}
ViewPositionChangeOverlay {
Overlay.ViewPositionChange {
id: viewPositionChanger
anchors.fill: parent
canvas: parent
settingsInstance: settings
}
PickLocationOverlay {
Overlay.PickLocation {
id: positionPicker
anchors.fill: parent
canvas: parent
}
// Overlay.Loading {
// id: loadingOverlay
// anchors.fill: parent
// canvas: parent
// }
}
Timer {

View file

@ -20,7 +20,7 @@ import QtQuick
import QtQuick.Controls
import Qt.labs.platform as Native
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "../../js/index.mjs" as JS
import eu.ad5001.LogarithmPlotter.Common
/*!
\qmltype CustomPropertyList

View file

@ -18,11 +18,10 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Dialogs as D
import Qt.labs.platform as Native
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import eu.ad5001.LogarithmPlotter.Popup 1.0 as Popup
import "../../js/index.mjs" as JS
import eu.ad5001.LogarithmPlotter.Common
/*!
\qmltype Dialog

View file

@ -19,7 +19,7 @@
import QtQuick
import QtQuick.Controls
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "../js/index.mjs" as JS
import eu.ad5001.LogarithmPlotter.Common
/*!

View file

@ -21,7 +21,7 @@ import QtQuick.Dialogs
import QtQuick.Controls
import QtQuick.Window
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "../js/index.mjs" as JS
import eu.ad5001.LogarithmPlotter.Common
/*!

View file

@ -0,0 +1,19 @@
/**
* LogarithmPlotter - 2D plotter software to make BODE plots, sequences and distribution functions.
* Copyright (C) 2021-2024 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 <https://www.gnu.org/licenses/>.
*/
import QtQuick

View file

@ -18,12 +18,12 @@
import QtQuick
import QtQuick.Controls
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "js/index.mjs" as JS
import eu.ad5001.LogarithmPlotter.Setting as Setting
import eu.ad5001.LogarithmPlotter.Common
/*!
\qmltype PickLocationOverlay
\inqmlmodule eu.ad5001.LogarithmPlotter
\qmltype PickLocation
\inqmlmodule eu.ad5001.LogarithmPlotter.Overlay
\brief Overlay used to pick a new location for an object.
Provides an overlay over the canvas that can be shown when the user clicks the "Set position" button
@ -32,11 +32,13 @@ import "js/index.mjs" as JS
\sa LogarithmPlotter, LogGraphCanvas
*/
Item {
Rectangle {
id: pickerRoot
visible: false
clip: true
color: sysPalette.window
opacity: 0.35
/*!
\qmlsignal PickLocationOverlay::picked(var obj)
@ -96,11 +98,6 @@ Item {
*/
readonly property bool userPickY: pickY && pickYCheckbox.checked
Rectangle {
color: sysPalette.window
opacity: 0.35
anchors.fill: parent
}
MouseArea {
id: picker

View file

@ -19,7 +19,7 @@
import QtQuick
/*!
\qmltype ViewPositionChangeOverlay
\qmltype ViewPositionChange.Overlay
\inqmlmodule eu.ad5001.LogarithmPlotter
\brief Overlay used allow the user to drag the canvas' position and change the zoom level.

View file

@ -0,0 +1,4 @@
module eu.ad5001.LogarithmPlotter.Overlay
PickLocation 1.0 PickLocation.qml
ViewPositionChange 1.0 ViewPositionChange.qml

View file

@ -20,7 +20,7 @@ import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import "../js/index.mjs" as JS
import eu.ad5001.LogarithmPlotter.Common
/*!
\qmltype Preferences

View file

@ -20,7 +20,7 @@ import QtQuick.Controls
import QtQuick
import Qt.labs.platform as Native
import eu.ad5001.LogarithmPlotter.Popup 1.0 as P
import "../js/index.mjs" as JS
import eu.ad5001.LogarithmPlotter.Common
/*!

View file

@ -20,7 +20,7 @@ import QtQuick
import QtQuick.Controls
import eu.ad5001.LogarithmPlotter.Setting 1.0 as Setting
import eu.ad5001.LogarithmPlotter.Popup 1.0 as Popup
import "js/index.mjs" as JS
import eu.ad5001.LogarithmPlotter.Common
/*!
\qmltype Settings

View file

@ -2,6 +2,4 @@ module eu.ad5001.LogarithmPlotter
AppMenuBar 1.0 AppMenuBar.qml
LogGraphCanvas 1.0 LogGraphCanvas.qml
PickLocationOverlay 1.0 PickLocationOverlay.qml
Settings 1.0 Settings.qml
ViewPositionChangeOverlay 1.0 ViewPositionChangeOverlay.qml

View file

@ -181,7 +181,6 @@ class Latex(QObject):
"""
markup_hash, render_hash, export_path = self.create_export_path(latex_markup, font_size, color)
if self.latexSupported and not path.exists(export_path + ".png"):
print("Rendering", latex_markup)
# Generating file
latex_path = path.join(self.tempdir, str(markup_hash))
# If the formula is just recolored or the font is just changed, no need to recreate the DVI.

View file

@ -100,6 +100,7 @@ class PyPromise(QObject):
Starts the thread that will run the promise.
"""
if not self._started: # Avoid getting started twice.
print("Starting", self._runner.args)
QThreadPool.globalInstance().start(self._runner)
self._started = True
@ -153,6 +154,7 @@ class PyPromise(QObject):
def _fulfill(self, data):
self._state = "fulfilled"
no_return = [None, QJSValue.SpecialValue.UndefinedValue]
print("Finished", self._runner.args)
for i in range(len(self._fulfills)):
try:
result = self._fulfills[i](data)

View file

@ -22,6 +22,10 @@
DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$DIR/.." || exit 1
BUILD_DIR="build/runtime-pyside6"
BUILD_QML_DIR="$BUILD_DIR/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter"
box() {
len=${#1}
echo "┌─$(printf '─%.0s' $(seq 1 "$len"))─┐"
@ -30,20 +34,22 @@ box() {
}
rm -rf build
mkdir -p build/runtime-pyside6
mkdir -p "$BUILD_DIR"
# Copy python
box "Copying pyside6 python runtime..."
cp -r runtime-pyside6/{setup.py,LogarithmPlotter} build/runtime-pyside6
cp -r runtime-pyside6/{setup.py,LogarithmPlotter} "$BUILD_DIR"
box "Building ecmascript modules..."
mkdir -p build/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js
cd common && (npm run build || exit) && cd ..
mkdir -p "$BUILD_QML_DIR/js"
cd common && \
(npm run build || exit) && \
cd ..
box "Building translations..."
cd assets/i18n/ && (bash release.sh || exit) && cd ../../
mkdir -p build/runtime-pyside6/LogarithmPlotter/i18n && cp assets/i18n/*.qm build/runtime-pyside6/LogarithmPlotter/i18n/
mkdir -p "$BUILD_DIR/LogarithmPlotter/i18n" && cp assets/i18n/*.qm "$BUILD_DIR/LogarithmPlotter/i18n/"
box "Building icons..."
cp -r assets/icons build/runtime-pyside6/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/
cp assets/logarithmplotter.svg build/runtime-pyside6/LogarithmPlotter/
cp -r assets/icons "$BUILD_QML_DIR"
cp assets/logarithmplotter.svg "$BUILD_DIR/LogarithmPlotter/"