From 82e8413e56ef3360ac0359111593178aea7b56f4 Mon Sep 17 00:00:00 2001 From: Ad5001 Date: Fri, 29 Mar 2024 17:53:10 +0100 Subject: [PATCH] Creating IO JS module. --- LogarithmPlotter/i18n/lp_de.ts | 377 ++++++++++-------- LogarithmPlotter/i18n/lp_en.ts | 377 ++++++++++-------- LogarithmPlotter/i18n/lp_es.ts | 192 ++++----- LogarithmPlotter/i18n/lp_fr.ts | 377 ++++++++++-------- LogarithmPlotter/i18n/lp_hu.ts | 373 +++++++++-------- LogarithmPlotter/i18n/lp_nb_NO.ts | 233 ++++++----- LogarithmPlotter/i18n/lp_template.ts | 192 ++++----- LogarithmPlotter/logarithmplotter.py | 57 ++- .../LogarithmPlotter/LogarithmPlotter.qml | 156 ++------ .../eu/ad5001/LogarithmPlotter/Settings.qml | 10 +- .../eu/ad5001/LogarithmPlotter/js/autoload.js | 3 +- .../LogarithmPlotter/js/history/common.mjs | 3 + .../qml/eu/ad5001/LogarithmPlotter/js/io.mjs | 168 ++++++++ LogarithmPlotter/util/config.py | 2 +- LogarithmPlotter/util/helper.py | 61 +-- LogarithmPlotter/util/js.py | 52 +++ LogarithmPlotter/util/latex.py | 5 +- LogarithmPlotter/util/native.py | 25 +- LogarithmPlotter/util/update.py | 33 +- 19 files changed, 1472 insertions(+), 1224 deletions(-) create mode 100644 LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/io.mjs create mode 100644 LogarithmPlotter/util/js.py diff --git a/LogarithmPlotter/i18n/lp_de.ts b/LogarithmPlotter/i18n/lp_de.ts index 2aad151..407b284 100644 --- a/LogarithmPlotter/i18n/lp_de.ts +++ b/LogarithmPlotter/i18n/lp_de.ts @@ -4,8 +4,8 @@ About - + About LogarithmPlotter Über LogarithmPlotter @@ -202,13 +202,13 @@ CustomPropertyList - - + + + Create new %1 + Neues %1objekt erstellen - + Pick on graph Aufnehmen auf Graph @@ -260,31 +260,31 @@ EditorDialog Edit properties of %1 %2 - Eigenschaften von %1 %2 bearbeiten + Eigenschaften von %1 %2 bearbeiten Name - Name + Name Label content - Etikett + Etikett null - leer + leer name - Name + Name name + value - Name + Wert + Name + Wert + Create new %1 - + Neues %1objekt erstellen + + Neues %1objekt erstellen @@ -437,64 +437,52 @@ Diese Einstellungen können jederzeit über das Menü "Einstellungen" LogarithmPlotter - Objects - Objekte + Objekte - Settings - Einstellungen + Einstellungen - History - Verlauf + Verlauf - Saved plot to '%1'. - Gespeicherte Grafik auf '%1'. + Gespeicherte Grafik auf '%1'. - Loading file '%1'. - Laden der Datei '%1'. + Laden der Datei '%1'. - Unknown object type: %1. - Unbekannter Objekttyp: %1. + Unbekannter Objekttyp: %1. - Invalid file provided. - Ungültige Datei angegeben. + Ungültige Datei angegeben. - Could not save file: - Die Datei konnte nicht gespeichert werden: + Die Datei konnte nicht gespeichert werden: - Loaded file '%1'. - Geladene Datei '%1'. + Geladene Datei '%1'. - Copied plot screenshot to clipboard! - Grafik in die Zwischenablage kopiert! + Grafik in die Zwischenablage kopiert! - &Update - &Aktualisieren + &Aktualisieren - &Update LogarithmPlotter - LogarithmPlotter &aktualisieren + LogarithmPlotter &aktualisieren @@ -519,23 +507,23 @@ Diese Einstellungen können jederzeit über das Menü "Einstellungen" Hide %1 %2 - Ausblenden %1 %2 + Ausblenden %1 %2 Show %1 %2 - Anzeigen %1 %2 + Anzeigen %1 %2 Set %1 %2 position - Position von %1 %2 einstellen + Position von %1 %2 einstellen Delete %1 %2 - %1 %2 löschen + %1 %2 löschen Pick new color for %1 %2 - Neue Farbe für %1 %2 auswählen + Neue Farbe für %1 %2 auswählen @@ -575,7 +563,7 @@ Diese Einstellungen können jederzeit über das Menü "Einstellungen" Snap to grid - Am Gitter einrasten + Am Gitter einrasten @@ -603,7 +591,7 @@ Diese Einstellungen können jederzeit über das Menü "Einstellungen" Zeigereinstellungen ausblenden - + (no pick selected) (keine Auswahl ausgewählt) @@ -816,30 +804,30 @@ Diese Einstellungen können jederzeit über das Menü "Einstellungen" color %1 %2's color changed from %3 to %4. - %1 %2 wurde von %3 bis %4 umgefärbt. + %1 %2 wurde von %3 bis %4 umgefärbt. comment Ex: R+* (ℝ⁺*), N (ℕ), Z-* (ℤ⁻*), ]0;1[, {3;4;5} - Beispiel: R+* (ℝ⁺*), N (ℕ), Z-* (ℤ-*), ]0;1[, {3;4;5} + Beispiel: R+* (ℝ⁺*), N (ℕ), Z-* (ℤ-*), ]0;1[, {3;4;5} The following parameters are used when the definition domain is a non-continuous set. (Ex: ℕ, ℤ, sets like {0;3}...) - Die folgenden Parameter werden verwendet, wenn der Definitionsbereich eine nicht kontinuierliche Menge ist. (Beispiel: ℕ, ℤ, Mengen wie {0;3}...) + Die folgenden Parameter werden verwendet, wenn der Definitionsbereich eine nicht kontinuierliche Menge ist. (Beispiel: ℕ, ℤ, Mengen wie {0;3}...) Note: Specify the probability for each value. - Hinweis: Geben Sie die Wahrscheinlichkeit für jeden Wert an. + Hinweis: Geben Sie die Wahrscheinlichkeit für jeden Wert an. Note: Use %1[n] to refer to %1ₙ, %1[n+1] for %1ₙ₊₁... - Hinweis: Verwenden Sie %1[n], um sich auf %1ₙ zu beziehen, %1[n+1] für %1ₙ₊₁… + Hinweis: Verwenden Sie %1[n], um sich auf %1ₙ zu beziehen, %1[n+1] für %1ₙ₊₁… If you have latex enabled, you can use use latex markup in between $$ to create equations. - Wenn Sie Latex aktiviert haben, können Sie Latex-Auszeichnungen zwischen $$ verwenden, um Gleichungen zu erstellen. + Wenn Sie Latex aktiviert haben, können Sie Latex-Auszeichnungen zwischen $$ verwenden, um Gleichungen zu erstellen. @@ -858,25 +846,25 @@ Diese Einstellungen können jederzeit über das Menü "Einstellungen" create New %1 %2 created. - Neu %1 %2 erstellt. + Neu %1 %2 erstellt. delete %1 %2 deleted. - %1 %2 gelöscht. + %1 %2 gelöscht. editproperty %1 of %2 %3 changed from "%4" to "%5". - %1 von %2 %3 wurde von "%4" auf "%5" geändert. + %1 von %2 %3 wurde von "%4" auf "%5" geändert. %1 of %2 changed from %3 to %4. - %1 von %2 wurde von %3 auf %4 geändert. + %1 von %2 wurde von %3 auf %4 geändert. @@ -943,11 +931,11 @@ Diese Einstellungen können jederzeit über das Menü "Einstellungen" Function definition is not permitted. - Funktionsdefinition ist nicht erlaubt. + Funktionsdefinition ist nicht erlaubt. Expected variable for assignment. - Erwartete Variable für Zuweisung. + Erwartete Variable für Zuweisung. @@ -1041,7 +1029,7 @@ Diese Einstellungen können jederzeit über das Menü "Einstellungen" Zirkuläre Abhängigkeit entdeckt. Objekte %1 hängen von %2 ab. - + Error while parsing expression for property %1: %2 @@ -1052,7 +1040,7 @@ Evaluated expression: %3 Ausdruck analysiert: %3 - + Error while attempting to draw %1 %2: %3 @@ -1066,7 +1054,7 @@ Die letzte Änderung wurde rückgängig gemacht. expression - + LogarithmPlotter - Parsing error LogarithmPlotter - Analysefehler @@ -1083,7 +1071,7 @@ Evaluated expression: %3 Ausdruck analysiert: %3 - + LogarithmPlotter - Drawing error LogarithmPlotter - Fehler @@ -1092,63 +1080,126 @@ Ausdruck analysiert: %3 function Function - Funktion + Funktion Functions - Funktionen + Funktionen gainbode Bode Magnitude - Bode-Magnitude + Bode-Magnitude Bode Magnitudes - Bode-Magnituden + Bode-Magnituden low-pass - Tiefpass + Tiefpass high-pass - Hochpass + Hochpass historylib New %1 %2 created. - Neu %1 %2 erstellt. + Neu %1 %2 erstellt. %1 %2 deleted. - %1 %2 gelöscht. + %1 %2 gelöscht. %1 of %2 %3 changed from "%4" to "%5". - %1 von %2 %3 wurde von "%4" auf "%5" geändert. + %1 von %2 %3 wurde von "%4" auf "%5" geändert. %1 %2 shown. - %1 %2 angezeigt. + %1 %2 angezeigt. %1 %2 hidden. - %1 %2 ausgeblendet. + %1 %2 ausgeblendet. Name of %1 %2 changed to %3. - Der Name von %1 %2 wurde in %3 geändert. + Der Name von %1 %2 wurde in %3 geändert. + + + + io + + + Objects + Objekte + + + + Settings + Einstellungen + + + + History + Verlauf + + + + Saved plot to '%1'. + Gespeicherte Grafik auf '%1'. + + + + Loading file '%1'. + Laden der Datei '%1'. + + + + Unknown object type: %1. + Unbekannter Objekttyp: %1. + + + + Invalid file provided. + Ungültige Datei angegeben. + + + + Could not save file: + Die Datei konnte nicht gespeichert werden: + + + + Loaded file '%1'. + Geladene Datei '%1'. + + + + Copied plot screenshot to clipboard! + Grafik in die Zwischenablage kopiert! + + + + &Update + &Aktualisieren + + + + &Update LogarithmPlotter + LogarithmPlotter &aktualisieren latex - + No Latex installation found. If you already have a latex distribution installed, make sure it's installed on your path. Otherwise, you can download a Latex distribution like TeX Live at https://tug.org/texlive/. @@ -1157,12 +1208,12 @@ Wenn Sie bereits eine LaTeX-Distribution installiert haben, vergewissern Sie sic Andernfalls können Sie eine LaTeX-Distribution wie TeX Live unter https://tug.org/texlive/ herunterladen. - + DVIPNG was not found. Make sure you include it from your Latex distribution. DVIPNG wurde nicht gefunden. Stellen Sie sicher, dass Sie es aus Ihrer LaTeX-Distribution einbinden. - + An exception occured within the creation of the latex formula. Process '{}' ended with a non-zero return code {}: @@ -1175,7 +1226,7 @@ Der Prozess '{}' wurde mit einem Rückgabecode ungleich Null beendet { Bitte vergewissern Sie sich, dass Ihre LaTeX-Installation korrekt ist, und melden Sie einen Fehler, falls dies der Fall ist. - + An exception occured within the creation of the latex formula. Process '{}' took too long to finish: {} @@ -1186,317 +1237,297 @@ Der Prozess '{}' brauchte zu lange, um beendet zu werden: Bitte vergewissern Sie sich, dass Ihre LaTeX-Installation korrekt ist, und melden Sie einen Fehler, falls dies der Fall ist. - - main - - - Could not open file "{}": -{} - - - - - Could not open file: "{}" -File does not exist. - - - - - Built with PySide6 (Qt) v{} and python v{} - - - name %1 %2 renamed to %3. - %1 %2 umbenannt in %3. + %1 %2 umbenannt in %3. parameters above - ↑ Über + ↑ Über below - ↓ Unter + ↓ Unter left - ← Links + ← Links right - → Rechts + → Rechts above-left - ↖ Oben links + ↖ Oben links above-right - ↗ Oben rechts + ↗ Oben rechts below-left - ↙ Unten links + ↙ Unten links below-right - ↘ Unten rechts + ↘ Unten rechts center - >|< Zentrum + >|< Zentrum top - ↑ Über + ↑ Über bottom - ↓ Unter + ↓ Unter top-left - ↖ Oben links + ↖ Oben links top-right - ↗ Oben rechts + ↗ Oben rechts bottom-left - ↙ Unten links + ↙ Unten links bottom-right - ↘ Unten rechts + ↘ Unten rechts application - Anwendung + Anwendung function - Funktion + Funktion high - Hoch + Hoch low - Tief + Tief Next to target - Neben dem Ziel + Neben dem Ziel With label - Mit Etikett + Mit Etikett Hidden - Versteckt + Versteckt phasebode Bode Phase - Bode-Phase + Bode-Phase Bode Phases - Bode-Phasen + Bode-Phasen point Point - Punkt + Punkt Points - Punkte + Punkte position Position of %1 %2 set from "%3" to "%4". - %1 %2 wurde von "%3" nach "%4" verschoben. + %1 %2 wurde von "%3" nach "%4" verschoben. Position of %1 set from %2 to %3. - %1 wurde von %2 nach %3 verschoben. + %1 wurde von %2 nach %3 verschoben. prop expression - Ausdruck + Ausdruck definitionDomain - Definitionsbereich + Definitionsbereich destinationDomain - Reichweite + Reichweite labelPosition - Position des Etiketts + Position des Etiketts displayMode - Anzeigemodus + Anzeigemodus labelX - X-Position des Etiketts + X-Position des Etiketts drawPoints - Unentschiedene Punkte + Unentschiedene Punkte drawDashedLines - Gestrichelte Linien anzeigen + Gestrichelte Linien anzeigen om_0 - ω₀ + ω₀ pass - Pass + Pass gain - Größenordnung + Größenordnung omGraduation - Teilung auf ω zeigen + Teilung auf ω zeigen phase - Phase + Phase unit - Einheit + Einheit x - X + X y - Y + Y pointStyle - Punkt-Stil + Punkt-Stil probabilities - Wahrscheinlichkeiten + Wahrscheinlichkeiten text - Inhalt + Inhalt disableLatex - LaTeX-Rendering für diesen Text deaktivieren + LaTeX-Rendering für diesen Text deaktivieren targetElement - Zielobjekt + Zielobjekt approximate - Ungefähren Wert anzeigen + Ungefähren Wert anzeigen rounding - Rundung + Rundung displayStyle - Stil + Stil targetValuePosition - Wertposition des Ziels + Wertposition des Ziels defaultExpression - Standardausdruck + Standardausdruck baseValues - Initialisierungswerte + Initialisierungswerte color - Farbe + Farbe repartition Repartition - Verteilungsfunktion + Verteilungsfunktion Repartition functions - Verteilungsfunktionen + Verteilungsfunktionen sequence Sequence - Folge + Folge Sequences - Folgen + Folgen sommegainsbode Bode Magnitudes Sum - Bode-Magnituden Summe + Bode-Magnituden Summe sommephasesbode Bode Phases Sum - Bode-Phasen Summe + Bode-Phasen Summe text Text - Text + Text Texts - Texte + Texte @@ -1507,7 +1538,7 @@ File does not exist. Ein Aktualisierung für LogarithmPlotter (v{}) ist verfügbar. - + No update available. Keine Aktualisierung verfügbar. @@ -1525,37 +1556,37 @@ File does not exist. usage - - + + Usage: %1 Verwendung: %1 - - - + + + Usage: %1 or %2 Verwendung: %1 oder %2 - + integral(<from: number>, <to: number>, <f: ExecutableObject>) integral(<von: Zahl>, <bis: Zahl>, <f: ExecutableObject>) - + integral(<from: number>, <to: number>, <f: string>, <variable: string>) integral(<von: Zahl>, <bis: Zahl>, <f: String>, <Variablen: String>) - + derivative(<f: ExecutableObject>, <x: number>) derivative(<f: ExecutableObject>, <x: Zahl>) - + derivative(<f: string>, <variable: string>, <x: number>) derivative(<f: String>, <Variablen: String>, <x: Zahl>) @@ -1564,22 +1595,22 @@ File does not exist. visibility %1 %2 shown. - %1 %2 angezeigt. + %1 %2 angezeigt. %1 %2 hidden. - %1 %2 ausgeblendet. + %1 %2 ausgeblendet. xcursor X Cursor - X Zeiger + X Zeiger X Cursors - X Zeiger + X Zeiger diff --git a/LogarithmPlotter/i18n/lp_en.ts b/LogarithmPlotter/i18n/lp_en.ts index 591e2c2..f700aa6 100644 --- a/LogarithmPlotter/i18n/lp_en.ts +++ b/LogarithmPlotter/i18n/lp_en.ts @@ -4,8 +4,8 @@ About - + About LogarithmPlotter About LogarithmPlotter @@ -202,13 +202,13 @@ CustomPropertyList - - + + + Create new %1 + Create new %1 - + Pick on graph Pick on graph @@ -260,31 +260,31 @@ EditorDialog Edit properties of %1 %2 - Edit properties of %1 %2 + Edit properties of %1 %2 Name - Name + Name Label content - Label content + Label content null - null + null name - name + name name + value - name + value + name + value + Create new %1 - + Create new %1 + + Create new %1 @@ -437,64 +437,52 @@ These settings can be changed at any time from the "Settings" menu. LogarithmPlotter - Objects - Objects + Objects - Settings - Settings + Settings - History - History + History - Saved plot to '%1'. - Saved plot to '%1'. + Saved plot to '%1'. - Loading file '%1'. - Loading file '%1'. + Loading file '%1'. - Unknown object type: %1. - Unknown object type: %1. + Unknown object type: %1. - Invalid file provided. - Invalid file provided. + Invalid file provided. - Could not save file: - Could not save file: + Could not save file: - Loaded file '%1'. - Loaded file '%1'. + Loaded file '%1'. - Copied plot screenshot to clipboard! - Copied plot screenshot to clipboard! + Copied plot screenshot to clipboard! - &Update - &Update + &Update - &Update LogarithmPlotter - &Update LogarithmPlotter + &Update LogarithmPlotter @@ -519,23 +507,23 @@ These settings can be changed at any time from the "Settings" menu. Hide %1 %2 - Hide %1 %2 + Hide %1 %2 Show %1 %2 - Show %1 %2 + Show %1 %2 Set %1 %2 position - Set %1 %2 position + Set %1 %2 position Delete %1 %2 - Delete %1 %2 + Delete %1 %2 Pick new color for %1 %2 - Pick new color for %1 %2 + Pick new color for %1 %2 @@ -575,7 +563,7 @@ These settings can be changed at any time from the "Settings" menu. Snap to grid - Snap to grid + Snap to grid @@ -603,7 +591,7 @@ These settings can be changed at any time from the "Settings" menu.Hide picker settings - + (no pick selected) (no pick selected) @@ -816,30 +804,30 @@ These settings can be changed at any time from the "Settings" menu.color %1 %2's color changed from %3 to %4. - %1 %2's color changed from %3 to %4. + %1 %2's color changed from %3 to %4. comment Ex: R+* (ℝ⁺*), N (ℕ), Z-* (ℤ⁻*), ]0;1[, {3;4;5} - Ex: R+* (ℝ⁺*), N (ℕ), Z-* (ℤ⁻*), ]0;1[, {3;4;5} + Ex: R+* (ℝ⁺*), N (ℕ), Z-* (ℤ⁻*), ]0;1[, {3;4;5} The following parameters are used when the definition domain is a non-continuous set. (Ex: ℕ, ℤ, sets like {0;3}...) - The following parameters are used when the domain is a non-continuous set. (Ex: ℕ, ℤ, sets like {0;3}…) + The following parameters are used when the domain is a non-continuous set. (Ex: ℕ, ℤ, sets like {0;3}…) Note: Specify the probability for each value. - Note: Specify the probability for each value. + Note: Specify the probability for each value. Note: Use %1[n] to refer to %1ₙ, %1[n+1] for %1ₙ₊₁... - Note: Use %1[n] to refer to %1ₙ, %1[n+1] for %1ₙ₊₁… + Note: Use %1[n] to refer to %1ₙ, %1[n+1] for %1ₙ₊₁… If you have latex enabled, you can use use latex markup in between $$ to create equations. - If you have latex enabled, you can use use latex markup in between $$ to create equations. + If you have latex enabled, you can use use latex markup in between $$ to create equations. @@ -858,25 +846,25 @@ These settings can be changed at any time from the "Settings" menu.create New %1 %2 created. - New %1 %2 created. + New %1 %2 created. delete %1 %2 deleted. - %1 %2 deleted. + %1 %2 deleted. editproperty %1 of %2 %3 changed from "%4" to "%5". - %1 of %2 %3 changed from "%4" to "%5". + %1 of %2 %3 changed from "%4" to "%5". %1 of %2 changed from %3 to %4. - %1 of %2 changed from %3 to %4. + %1 of %2 changed from %3 to %4. @@ -943,11 +931,11 @@ These settings can be changed at any time from the "Settings" menu. Function definition is not permitted. - Function definition is not permitted. + Function definition is not permitted. Expected variable for assignment. - Expected variable for assignment. + Expected variable for assignment. @@ -1041,7 +1029,7 @@ These settings can be changed at any time from the "Settings" menu.Circular dependency detected. Objects %1 depend on %2. - + Error while parsing expression for property %1: %2 @@ -1052,7 +1040,7 @@ Evaluated expression: %3 Evaluated expression: %3 - + Error while attempting to draw %1 %2: %3 @@ -1066,7 +1054,7 @@ Undoing last change. expression - + LogarithmPlotter - Parsing error LogarithmPlotter - Parsing error @@ -1083,7 +1071,7 @@ Evaluated expression: %3 Evaluated expression: %3 - + LogarithmPlotter - Drawing error LogarithmPlotter - Drawing error @@ -1092,63 +1080,126 @@ Evaluated expression: %3 function Function - Function + Function Functions - Functions + Functions gainbode Bode Magnitude - Bode Magnitude + Bode Magnitude Bode Magnitudes - Bode Magnitudes + Bode Magnitudes low-pass - low-pass + low-pass high-pass - high-pass + high-pass historylib New %1 %2 created. - New %1 %2 created. + New %1 %2 created. %1 %2 deleted. - %1 %2 deleted. + %1 %2 deleted. %1 of %2 %3 changed from "%4" to "%5". - %1 of %2 %3 changed from "%4" to "%5". + %1 of %2 %3 changed from "%4" to "%5". %1 %2 shown. - %1 %2 shown. + %1 %2 shown. %1 %2 hidden. - %1 %2 hidden. + %1 %2 hidden. Name of %1 %2 changed to %3. - Name of %1 %2 changed to %3. + Name of %1 %2 changed to %3. + + + + io + + + Objects + Objects + + + + Settings + Settings + + + + History + History + + + + Saved plot to '%1'. + Saved plot to '%1'. + + + + Loading file '%1'. + Loading file '%1'. + + + + Unknown object type: %1. + Unknown object type: %1. + + + + Invalid file provided. + Invalid file provided. + + + + Could not save file: + Could not save file: + + + + Loaded file '%1'. + Loaded file '%1'. + + + + Copied plot screenshot to clipboard! + Copied plot screenshot to clipboard! + + + + &Update + &Update + + + + &Update LogarithmPlotter + &Update LogarithmPlotter latex - + No Latex installation found. If you already have a latex distribution installed, make sure it's installed on your path. Otherwise, you can download a Latex distribution like TeX Live at https://tug.org/texlive/. @@ -1157,12 +1208,12 @@ If you already have a LaTeX distribution installed, make sure it's installe Otherwise, you can download a LaTeX distribution like TeX Live at https://tug.org/texlive/. - + DVIPNG was not found. Make sure you include it from your Latex distribution. DVIPNG was not found. Make sure you include it from your LaTeX distribution. - + An exception occured within the creation of the latex formula. Process '{}' ended with a non-zero return code {}: @@ -1175,7 +1226,7 @@ Process '{}' ended with a non-zero return code {}: Please make sure your LaTeX installation is correct and report a bug if so. - + An exception occured within the creation of the latex formula. Process '{}' took too long to finish: {} @@ -1186,317 +1237,297 @@ Process '{}' took too long to finish: Please make sure your LaTeX installation is correct and report a bug if so. - - main - - - Could not open file "{}": -{} - - - - - Could not open file: "{}" -File does not exist. - - - - - Built with PySide6 (Qt) v{} and python v{} - - - name %1 %2 renamed to %3. - %1 %2 renamed to %3. + %1 %2 renamed to %3. parameters above - ↑ Above + ↑ Above below - ↓ Below + ↓ Below left - ← Left + ← Left right - → Right + → Right above-left - ↖ Above left + ↖ Above left above-right - ↗ Above right + ↗ Above right below-left - ↙ Below left + ↙ Below left below-right - ↘ Below right + ↘ Below right center - >|< Center + >|< Center top - ↑ Top + ↑ Top bottom - ↓ Bottom + ↓ Bottom top-left - ↖ Top left + ↖ Top left top-right - ↗ Top right + ↗ Top right bottom-left - ↙ Bottom left + ↙ Bottom left bottom-right - ↘ Bottom right + ↘ Bottom right application - Application + Application function - Function + Function high - High + High low - Low + Low Next to target - Next to target + Next to target With label - With label + With label Hidden - Hidden + Hidden phasebode Bode Phase - Bode Phase + Bode Phase Bode Phases - Bode Phases + Bode Phases point Point - Point + Point Points - Points + Points position Position of %1 %2 set from "%3" to "%4". - %1 %2 moved from "%3" to "%4". + %1 %2 moved from "%3" to "%4". Position of %1 set from %2 to %3. - %1 moved from %2 to %3. + %1 moved from %2 to %3. prop expression - Expression + Expression definitionDomain - Domain + Domain destinationDomain - Range + Range labelPosition - Label position + Label position displayMode - Display mode + Display mode labelX - Label's X position + Label's X position drawPoints - Show points + Show points drawDashedLines - Show dashed lines + Show dashed lines om_0 - ω₀ + ω₀ pass - Pass + Pass gain - Magnitude gain + Magnitude gain omGraduation - Show graduation on ω₀ + Show graduation on ω₀ phase - Phase + Phase unit - Unit to use + Unit to use x - X + X y - Y + Y pointStyle - Point style + Point style probabilities - Probabilities list + Probabilities list text - Content + Content disableLatex - Disable LaTeX rendering for this text + Disable LaTeX rendering for this text targetElement - Object to target + Object to target approximate - Show approximate value + Show approximate value rounding - Rounding + Rounding displayStyle - Display style + Display style targetValuePosition - Target's value position + Target's value position defaultExpression - Default expression + Default expression baseValues - Initialisation values + Initialisation values color - Color + Color repartition Repartition - Distribution + Distribution Repartition functions - Distribution functions + Distribution functions sequence Sequence - Sequence + Sequence Sequences - Sequences + Sequences sommegainsbode Bode Magnitudes Sum - Bode Magnitudes Sum + Bode Magnitudes Sum sommephasesbode Bode Phases Sum - Bode Phases Sum + Bode Phases Sum text Text - Text + Text Texts - Texts + Texts @@ -1507,7 +1538,7 @@ File does not exist. An update for LogarithmPlotter (v{}) is available. - + No update available. No update available. @@ -1525,37 +1556,37 @@ File does not exist. usage - - + + Usage: %1 Usage: %1 - - - + + + Usage: %1 or %2 Usage: %1 or %2 - + integral(<from: number>, <to: number>, <f: ExecutableObject>) integral(<from: number>, <to: number>, <f: ExecutableObject>) - + integral(<from: number>, <to: number>, <f: string>, <variable: string>) integral(<from: number>, <to: number>, <f: string>, <variable: string>) - + derivative(<f: ExecutableObject>, <x: number>) derivative(<f: ExecutableObject>, <x: number>) - + derivative(<f: string>, <variable: string>, <x: number>) derivative(<f: string>, <variable: string>, <x: number>) @@ -1564,22 +1595,22 @@ File does not exist. visibility %1 %2 shown. - %1 %2 shown. + %1 %2 shown. %1 %2 hidden. - %1 %2 hidden. + %1 %2 hidden. xcursor X Cursor - X Cursor + X Cursor X Cursors - X Cursors + X Cursors diff --git a/LogarithmPlotter/i18n/lp_es.ts b/LogarithmPlotter/i18n/lp_es.ts index a9a0f09..c8f4310 100644 --- a/LogarithmPlotter/i18n/lp_es.ts +++ b/LogarithmPlotter/i18n/lp_es.ts @@ -4,8 +4,8 @@ About - + About LogarithmPlotter Sobre LogarithmPlotter @@ -202,13 +202,13 @@ CustomPropertyList - - + + + Create new %1 - + Pick on graph @@ -402,69 +402,6 @@ These settings can be changed at any time from the "Settings" menu. - - LogarithmPlotter - - - Objects - - - - - Settings - - - - - History - - - - - Saved plot to '%1'. - - - - - Loading file '%1'. - - - - - Unknown object type: %1. - - - - - Invalid file provided. - - - - - Could not save file: - - - - - Loaded file '%1'. - - - - - Copied plot screenshot to clipboard! - - - - - &Update - - - - - &Update LogarithmPlotter - - - ObjectCreationGrid @@ -547,7 +484,7 @@ These settings can be changed at any time from the "Settings" menu. - + (no pick selected) @@ -922,7 +859,7 @@ These settings can be changed at any time from the "Settings" menu. - + Error while parsing expression for property %1: %2 @@ -930,7 +867,7 @@ Evaluated expression: %3 - + Error while attempting to draw %1 %2: %3 @@ -941,7 +878,7 @@ Undoing last change. expression - + LogarithmPlotter - Parsing error @@ -955,27 +892,90 @@ Evaluated expression: %3 - + LogarithmPlotter - Drawing error + + io + + + Objects + + + + + Settings + + + + + History + + + + + Saved plot to '%1'. + + + + + Loading file '%1'. + + + + + Unknown object type: %1. + + + + + Invalid file provided. + + + + + Could not save file: + + + + + Loaded file '%1'. + + + + + Copied plot screenshot to clipboard! + + + + + &Update + + + + + &Update LogarithmPlotter + + + latex - + No Latex installation found. If you already have a latex distribution installed, make sure it's installed on your path. Otherwise, you can download a Latex distribution like TeX Live at https://tug.org/texlive/. - + DVIPNG was not found. Make sure you include it from your Latex distribution. - + An exception occured within the creation of the latex formula. Process '{}' ended with a non-zero return code {}: @@ -984,7 +984,7 @@ Please make sure your latex installation is correct and report a bug if so. - + An exception occured within the creation of the latex formula. Process '{}' took too long to finish: {} @@ -992,26 +992,6 @@ Please make sure your latex installation is correct and report a bug if so. - - main - - - Could not open file "{}": -{} - - - - - Could not open file: "{}" -File does not exist. - - - - - Built with PySide6 (Qt) v{} and python v{} - - - update @@ -1020,7 +1000,7 @@ File does not exist. - + No update available. @@ -1038,36 +1018,36 @@ File does not exist. usage - - + + Usage: %1 - - - + + + Usage: %1 or %2 - + integral(<from: number>, <to: number>, <f: ExecutableObject>) - + integral(<from: number>, <to: number>, <f: string>, <variable: string>) - + derivative(<f: ExecutableObject>, <x: number>) - + derivative(<f: string>, <variable: string>, <x: number>) diff --git a/LogarithmPlotter/i18n/lp_fr.ts b/LogarithmPlotter/i18n/lp_fr.ts index 68b0f1a..d1c0f95 100644 --- a/LogarithmPlotter/i18n/lp_fr.ts +++ b/LogarithmPlotter/i18n/lp_fr.ts @@ -4,8 +4,8 @@ About - + About LogarithmPlotter À propos de LogarithmPlotter @@ -203,13 +203,13 @@ CustomPropertyList - - + + + Create new %1 + Créer un nouvel objet %1 - + Pick on graph Prendre la position sur le graphe @@ -261,32 +261,32 @@ EditorDialog Edit properties of %1 %2 - Changer les propriétés de %1 %2 + Changer les propriétés de %1 %2 Name - Nom + Nom Label content - Étiquette + Étiquette null - vide + vide name - nom + nom name + value - nom + valeur + nom + valeur + Create new %1 Traduction non litéralle pour éviter les problèmes de genre. - + Créer un nouvel objet %1 + + Créer un nouvel objet %1 @@ -445,64 +445,52 @@ These settings can always be changed at any time from the "Settings" m LogarithmPlotter - Objects - Objets + Objets - Settings - Paramètres + Paramètres - History - Historique + Historique - Saved plot to '%1'. - Graphe sauvegardé dans '%1'. + Graphe sauvegardé dans '%1'. - Loading file '%1'. - Chargement du fichier '%1'. + Chargement du fichier '%1'. - Unknown object type: %1. - Type d'objet inconnu : %1. + Type d'objet inconnu : %1. - Invalid file provided. - Fichier fourni invalide. + Fichier fourni invalide. - Could not save file: - Impossible de sauvegarder le fichier : + Impossible de sauvegarder le fichier : - Loaded file '%1'. - Fichier '%1' chargé. + Fichier '%1' chargé. - Copied plot screenshot to clipboard! - Image du graphe copiée dans le presse-papiers ! + Image du graphe copiée dans le presse-papiers ! - &Update - &Mise à jour + &Mise à jour - &Update LogarithmPlotter - &Mettre à jour LogarithmPlotter + &Mettre à jour LogarithmPlotter @@ -527,23 +515,23 @@ These settings can always be changed at any time from the "Settings" m Hide %1 %2 - Cacher l'objet %1 %2 + Cacher l'objet %1 %2 Show %1 %2 - Montrer l'objet %1 %2 + Montrer l'objet %1 %2 Set %1 %2 position - Définir la position de l'objet %1 %2 + Définir la position de l'objet %1 %2 Delete %1 %2 - Supprimer l'objet %1 %2 + Supprimer l'objet %1 %2 Pick new color for %1 %2 - Choisissez une nouvelle couleur pour %1 %2 + Choisissez une nouvelle couleur pour %1 %2 @@ -583,7 +571,7 @@ These settings can always be changed at any time from the "Settings" m Snap to grid - Placement sur la grille + Placement sur la grille @@ -611,7 +599,7 @@ These settings can always be changed at any time from the "Settings" m Cacher les paramètres du pointeur - + (no pick selected) (aucun axe sélectionné) @@ -824,31 +812,31 @@ These settings can always be changed at any time from the "Settings" m color %1 %2's color changed from %3 to %4. - %1 %2 a été re colorisé du %3 au %4. + %1 %2 a été re colorisé du %3 au %4. comment Ex: R+* (ℝ⁺*), N (ℕ), Z-* (ℤ⁻*), ]0;1[, {3;4;5} - Par exemple : R+* (ℝ⁺*), N (ℕ), Z-* (ℤ⁻*), ]0;1[, {3;4;5} + Par exemple : R+* (ℝ⁺*), N (ℕ), Z-* (ℤ⁻*), ]0;1[, {3;4;5} The following parameters are used when the definition domain is a non-continuous set. (Ex: ℕ, ℤ, sets like {0;3}...) - Les paramètres suivants sont utilisés lorsque le domaine de définition est un ensemble non-continu. (Ex : ℕ, ℤ, des ensembles comme {0;3}…) + Les paramètres suivants sont utilisés lorsque le domaine de définition est un ensemble non-continu. (Ex : ℕ, ℤ, des ensembles comme {0;3}…) Note: Specify the probability for each value. - Note : Spécifiez la probabilité pour chaque valeur. + Note : Spécifiez la probabilité pour chaque valeur. Note: Use %1[n] to refer to %1ₙ, %1[n+1] for %1ₙ₊₁... Note : Utilisez %1[n] pour faire référence à %1ₙ, %1[n+1] pour %1ₙ₊₁... - Note : Utilisez %1[n] pour faire référence à %1ₙ, %1[n+1] pour %1ₙ₊₁… + Note : Utilisez %1[n] pour faire référence à %1ₙ, %1[n+1] pour %1ₙ₊₁… If you have latex enabled, you can use use latex markup in between $$ to create equations. - Si vous avez activé le rendu latex, vous pouvez utiliser les balises latex entre $$ pour créer des équations. + Si vous avez activé le rendu latex, vous pouvez utiliser les balises latex entre $$ pour créer des équations. @@ -867,25 +855,25 @@ These settings can always be changed at any time from the "Settings" m create New %1 %2 created. - Nouvel objet %1 %2 créé. + Nouvel objet %1 %2 créé. delete %1 %2 deleted. - %1 %2 supprimé(e). + %1 %2 supprimé(e). editproperty %1 of %2 %3 changed from "%4" to "%5". - %1 de %2 %3 modifiée de "%4" à "%5". + %1 de %2 %3 modifiée de "%4" à "%5". %1 of %2 changed from %3 to %4. - %1 de %2 modifiée de %3 à %4. + %1 de %2 modifiée de %3 à %4. @@ -952,11 +940,11 @@ These settings can always be changed at any time from the "Settings" m Function definition is not permitted. - La définition de fonctions n'est pas autorisée. + La définition de fonctions n'est pas autorisée. Expected variable for assignment. - Une variable est attendue pour l'affectation. + Une variable est attendue pour l'affectation. @@ -1050,7 +1038,7 @@ These settings can always be changed at any time from the "Settings" m Dépendance circulaire détectée. Les objets %1 dépendent de %2. - + Error while parsing expression for property %1: %2 @@ -1061,7 +1049,7 @@ Evaluated expression: %3 Formule analysée : %3 - + Error while attempting to draw %1 %2: %3 @@ -1075,7 +1063,7 @@ La dernière modification a été annulée. expression - + LogarithmPlotter - Parsing error LogarithmPlotter - Erreur de syntaxe @@ -1092,7 +1080,7 @@ Evaluated expression: %3 Formule analysée : %3 - + LogarithmPlotter - Drawing error LogarithmPlotter - Erreur @@ -1101,63 +1089,126 @@ Formule analysée : %3 function Function - Fonction + Fonction Functions - Fonctions + Fonctions gainbode Bode Magnitude - Gain de Bode + Gain de Bode Bode Magnitudes - Gains de Bode + Gains de Bode low-pass - passe-bas + passe-bas high-pass - passe-haut + passe-haut historylib New %1 %2 created. - Nouvel objet %1 %2 créé. + Nouvel objet %1 %2 créé. %1 %2 deleted. - %1 %2 supprimé(e). + %1 %2 supprimé(e). %1 of %2 %3 changed from "%4" to "%5". - %1 de %2 %3 modifiée de "%4" à "%5". + %1 de %2 %3 modifiée de "%4" à "%5". %1 %2 shown. - %1 %2 affiché(e). + %1 %2 affiché(e). %1 %2 hidden. - %1 %2 cachée(e). + %1 %2 cachée(e). Name of %1 %2 changed to %3. - Le nom de %1 %2 a été changé en %3. + Le nom de %1 %2 a été changé en %3. + + + + io + + + Objects + Objets + + + + Settings + Paramètres + + + + History + Historique + + + + Saved plot to '%1'. + Graphe sauvegardé dans '%1'. + + + + Loading file '%1'. + Chargement du fichier '%1'. + + + + Unknown object type: %1. + Type d'objet inconnu : %1. + + + + Invalid file provided. + Fichier fourni invalide. + + + + Could not save file: + Impossible de sauvegarder le fichier : + + + + Loaded file '%1'. + Fichier '%1' chargé. + + + + Copied plot screenshot to clipboard! + Image du graphe copiée dans le presse-papiers ! + + + + &Update + &Mise à jour + + + + &Update LogarithmPlotter + &Mettre à jour LogarithmPlotter latex - + No Latex installation found. If you already have a latex distribution installed, make sure it's installed on your path. Otherwise, you can download a Latex distribution like TeX Live at https://tug.org/texlive/. @@ -1166,12 +1217,12 @@ Si vous avez déjà installé une distribution LaTeX, assurez-vous qu'elle Sinon, vous pouvez télécharger une distribution LaTeX comme TeX Live à l'adresse https://tug.org/texlive/. - + DVIPNG was not found. Make sure you include it from your Latex distribution. DVIPNG n'a pas été trouvé. Assurez-vous de l'inclure dans votre distribution LaTeX. - + An exception occured within the creation of the latex formula. Process '{}' ended with a non-zero return code {}: @@ -1184,7 +1235,7 @@ Le processus '{}' s'est terminé par un code de retour non nul {} Vérifiez que votre installation de LaTeX est correcte et signalez un bogue si c'est le cas. - + An exception occured within the creation of the latex formula. Process '{}' took too long to finish: {} @@ -1195,317 +1246,297 @@ Le processus '{}' a mis trop de temps à se terminer : Vérifiez que votre installation de LaTeX est correcte et signalez un bogue si c'est le cas. - - main - - - Could not open file "{}": -{} - - - - - Could not open file: "{}" -File does not exist. - - - - - Built with PySide6 (Qt) v{} and python v{} - - - name %1 %2 renamed to %3. - %1 %2 renommé(e) en %3. + %1 %2 renommé(e) en %3. parameters above - ↑ Au dessus + ↑ Au dessus below - ↓ En dessous + ↓ En dessous left - ← À gauche + ← À gauche right - → À droite + → À droite above-left - ↖ Au dessus à gauche + ↖ Au dessus à gauche above-right - ↗ Au dessus à droite + ↗ Au dessus à droite below-left - ↙ En dessous à gauche + ↙ En dessous à gauche below-right - ↘ En dessous à droite + ↘ En dessous à droite center - >|< Centré + >|< Centré top - ↑ Au dessus + ↑ Au dessus bottom - ↓ En dessous + ↓ En dessous top-left - ↖ Au dessus à gauche + ↖ Au dessus à gauche top-right - ↗ Au dessus à droite + ↗ Au dessus à droite bottom-left - ↙ En dessous à gauche + ↙ En dessous à gauche bottom-right - ↘ En dessous à droite + ↘ En dessous à droite application - Application + Application function - Fonction + Fonction high - Haut + Haut low - Bas + Bas Next to target - A côté de la cible + A côté de la cible With label - Avec l'étiquette + Avec l'étiquette Hidden - Caché + Caché phasebode Bode Phase - Phase de Bode + Phase de Bode Bode Phases - Phases de Bode + Phases de Bode point Point - Point + Point Points - Points + Points position Position of %1 %2 set from "%3" to "%4". - %1 %2 a été déplacé depuis "%3" vers "%4". + %1 %2 a été déplacé depuis "%3" vers "%4". Position of %1 set from %2 to %3. - %1 a été déplacé depuis %2 vers %3. + %1 a été déplacé depuis %2 vers %3. prop expression - Expression + Expression definitionDomain - Domaine de définition + Domaine de définition destinationDomain - Portée + Portée labelPosition - Position de l'étiquette + Position de l'étiquette displayMode - Mode d'affichage + Mode d'affichage labelX - Position en X de l'étiquette + Position en X de l'étiquette drawPoints - Afficher les points + Afficher les points drawDashedLines - Afficher les pointillés + Afficher les pointillés om_0 - ω₀ + ω₀ pass - Passe + Passe gain - Gain + Gain omGraduation - Afficher la graduation sur ω₀ + Afficher la graduation sur ω₀ phase - Phase + Phase unit - Unité de la phase + Unité de la phase x - X + X y - Y + Y pointStyle - Style du point + Style du point probabilities - Liste de probabilités + Liste de probabilités text - Contenu + Contenu disableLatex - Désactiver le rendu LaTeX pour ce texte + Désactiver le rendu LaTeX pour ce texte targetElement - Objet à cibler + Objet à cibler approximate - Afficher la valeur approximative + Afficher la valeur approximative rounding - Arrondi + Arrondi displayStyle - Style d'affichage + Style d'affichage targetValuePosition - Position de la valeur de la cible + Position de la valeur de la cible defaultExpression - Expression + Expression baseValues - Valeurs d'initialisation + Valeurs d'initialisation color - Couleur + Couleur repartition Repartition - Répartition + Répartition Repartition functions - Fonctions de répartition + Fonctions de répartition sequence Sequence - Suite + Suite Sequences - Suites + Suites sommegainsbode Bode Magnitudes Sum - Sommes des gains de Bode + Sommes des gains de Bode sommephasesbode Bode Phases Sum - Somme des phases de Bode + Somme des phases de Bode text Text - Texte + Texte Texts - Textes + Textes @@ -1516,7 +1547,7 @@ File does not exist. Une mise à jour de LogarithmPlotter (v{}) est disponible. - + No update available. À jour. @@ -1534,37 +1565,37 @@ File does not exist. usage - - + + Usage: %1 Emploi : %1 - - - + + + Usage: %1 or %2 Emploi : %1 ou %2 - + integral(<from: number>, <to: number>, <f: ExecutableObject>) integral(<de : nombre>, <à : nombre>, <f : Objet exécutable>) - + integral(<from: number>, <to: number>, <f: string>, <variable: string>) integral(<de : nombre>, <à : nombre>, <f : fonction chaîne>, <variable>) - + derivative(<f: ExecutableObject>, <x: number>) derivative(<f : Objet exécutable>, <x : nombre>) - + derivative(<f: string>, <variable: string>, <x: number>) derivative(<f : fonction chaîne>, <variable>, <x : nombre>) @@ -1573,22 +1604,22 @@ File does not exist. visibility %1 %2 shown. - %1 %2 affiché(e). + %1 %2 affiché(e). %1 %2 hidden. - %1 %2 cachée(e). + %1 %2 cachée(e). xcursor X Cursor - Curseur X + Curseur X X Cursors - Curseurs X + Curseurs X diff --git a/LogarithmPlotter/i18n/lp_hu.ts b/LogarithmPlotter/i18n/lp_hu.ts index 5a311df..9222b65 100644 --- a/LogarithmPlotter/i18n/lp_hu.ts +++ b/LogarithmPlotter/i18n/lp_hu.ts @@ -4,8 +4,8 @@ About - + About LogarithmPlotter LogarithmPlotter névjegye @@ -202,13 +202,13 @@ CustomPropertyList - - + + + Create new %1 + Új %1 létrehozása - + Pick on graph Ábra kijelölése @@ -260,31 +260,31 @@ EditorDialog Edit properties of %1 %2 - %1 %2 tulajdonságainak szerkesztése + %1 %2 tulajdonságainak szerkesztése Name - Név + Név Label content - Címke tartalom + Címke tartalom null - üres + üres name - név + név name + value - név + érték + név + érték + Create new %1 - + Új %1 létrehozása + + Új %1 létrehozása @@ -437,64 +437,52 @@ Ezek a beállítások bármikor módosíthatók a „Beállítások” menüben. LogarithmPlotter - Objects - Tárgyak + Tárgyak - Settings - Beállítások + Beállítások - History - Előzmények + Előzmények - Saved plot to '%1'. - Ábra mentve ide: „%1”. + Ábra mentve ide: „%1”. - Loading file '%1'. - A(z) „%1” fájl betöltése folyamatban van. + A(z) „%1” fájl betöltése folyamatban van. - Unknown object type: %1. - Ismeretlen objektumtípus: %1. + Ismeretlen objektumtípus: %1. - Invalid file provided. - A megadott fájl érvénytelen. + A megadott fájl érvénytelen. - Could not save file: - A fájl mentése nem sikerült: + A fájl mentése nem sikerült: - Loaded file '%1'. - A(z) „%1” fájl betöltve. + A(z) „%1” fájl betöltve. - Copied plot screenshot to clipboard! - Ábra képernyőkép vágólapra másolva! + Ábra képernyőkép vágólapra másolva! - &Update - &Frissítés + &Frissítés - &Update LogarithmPlotter - A LogarithmPlotter &frissítése + A LogarithmPlotter &frissítése @@ -519,23 +507,23 @@ Ezek a beállítások bármikor módosíthatók a „Beállítások” menüben. Hide %1 %2 - %1 %2 elrejtése + %1 %2 elrejtése Show %1 %2 - %1 %2 megjelenítése + %1 %2 megjelenítése Set %1 %2 position - %1 %2 helye beállítása + %1 %2 helye beállítása Delete %1 %2 - %1 %2 törlése + %1 %2 törlése Pick new color for %1 %2 - Válasszon új színt a következőhöz: %1 %2 + Válasszon új színt a következőhöz: %1 %2 @@ -575,7 +563,7 @@ Ezek a beállítások bármikor módosíthatók a „Beállítások” menüben. Snap to grid - Rácshoz illesztés + Rácshoz illesztés @@ -603,7 +591,7 @@ Ezek a beállítások bármikor módosíthatók a „Beállítások” menüben. Kijelölési beállítások elrejtése - + (no pick selected) (nincs kijelölés kiválasztva) @@ -816,30 +804,30 @@ Ezek a beállítások bármikor módosíthatók a „Beállítások” menüben. color %1 %2's color changed from %3 to %4. - %1 %2 színe %3-ról %4-re változott. + %1 %2 színe %3-ról %4-re változott. comment Ex: R+* (ℝ⁺*), N (ℕ), Z-* (ℤ⁻*), ]0;1[, {3;4;5} - Példák: R+* (ℝ⁺*), N (ℕ), Z-* (ℤ⁻*), ]0;1[, {3;4;5} + Példák: R+* (ℝ⁺*), N (ℕ), Z-* (ℤ⁻*), ]0;1[, {3;4;5} The following parameters are used when the definition domain is a non-continuous set. (Ex: ℕ, ℤ, sets like {0;3}...) - A következő paraméterek használatosak, ha a tartomány nem folytonos halmaz. (Példák: ℕ, ℤ, olyan halmazok, mint a {0;3}…) + A következő paraméterek használatosak, ha a tartomány nem folytonos halmaz. (Példák: ℕ, ℤ, olyan halmazok, mint a {0;3}…) Note: Specify the probability for each value. - Megjegyzés: Adja meg az egyes értékek valószínűségét. + Megjegyzés: Adja meg az egyes értékek valószínűségét. Note: Use %1[n] to refer to %1ₙ, %1[n+1] for %1ₙ₊₁... - Megjegyzés: A(z) %1[n] használatával hivatkozhat erre: %1ₙ, a(z) %1[n+1] használatával hivatkozhat erre: %1ₙ₊₁, … + Megjegyzés: A(z) %1[n] használatával hivatkozhat erre: %1ₙ, a(z) %1[n+1] használatával hivatkozhat erre: %1ₙ₊₁, … If you have latex enabled, you can use use latex markup in between $$ to create equations. - Ha a LaTeX engedélyezve van, a LaTeX-jelölés használható egyenletek létrehozására $$ között. + Ha a LaTeX engedélyezve van, a LaTeX-jelölés használható egyenletek létrehozására $$ között. @@ -858,25 +846,25 @@ Ezek a beállítások bármikor módosíthatók a „Beállítások” menüben. create New %1 %2 created. - Új %1 %2 létrehozva. + Új %1 %2 létrehozva. delete %1 %2 deleted. - %1 %2 törölve. + %1 %2 törölve. editproperty %1 of %2 %3 changed from "%4" to "%5". - %1/%2 %3 megváltozott. Régi érték: %4, új érték: %5. + %1/%2 %3 megváltozott. Régi érték: %4, új érték: %5. %1 of %2 changed from %3 to %4. - %1/%2 megváltozott. Régi érték: %3, új érték: %4. + %1/%2 megváltozott. Régi érték: %3, új érték: %4. @@ -943,11 +931,11 @@ Ezek a beállítások bármikor módosíthatók a „Beállítások” menüben. Function definition is not permitted. - A függvény meghatározása nem engedélyezett. + A függvény meghatározása nem engedélyezett. Expected variable for assignment. - A hozzárendeléshez várt változó. + A hozzárendeléshez várt változó. @@ -1041,7 +1029,7 @@ Ezek a beállítások bármikor módosíthatók a „Beállítások” menüben. Körkörös függőség észlelve. A(z) %1-objektumok a(z) %2-objektumtól függenek. - + Error while parsing expression for property %1: %2 @@ -1052,7 +1040,7 @@ Evaluated expression: %3 Kiértékelt kifejezés: %3 - + Error while attempting to draw %1 %2: %3 @@ -1066,7 +1054,7 @@ Az utolsó módosítás visszavonása. expression - + LogarithmPlotter - Parsing error LogarithmPlotter - Elemzési hiba @@ -1083,7 +1071,7 @@ Evaluated expression: %3 Kiértékelt kifejezés: %3 - + LogarithmPlotter - Drawing error LogarithmPlotter - Rajzolási hiba @@ -1092,59 +1080,122 @@ Kiértékelt kifejezés: %3 function Function - Függvény + Függvény Functions - Függvények + Függvények gainbode Bode Magnitude - Bode-nagyságrend + Bode-nagyságrend Bode Magnitudes - Bode-nagyságrendek + Bode-nagyságrendek low-pass - aluláteresztő + aluláteresztő high-pass - felüláteresztő + felüláteresztő historylib New %1 %2 created. - Új %1 %2 létrehozva. + Új %1 %2 létrehozva. %1 %2 deleted. - %1 %2 törölve. + %1 %2 törölve. %1 of %2 %3 changed from "%4" to "%5". - %1/%2 %3 megváltozott. Régi érték: %4, új érték: %5. + %1/%2 %3 megváltozott. Régi érték: %4, új érték: %5. %1 %2 shown. - %1 %2 megjelenítve. + %1 %2 megjelenítve. %1 %2 hidden. - %1 %2 rejtve. + %1 %2 rejtve. + + + + io + + + Objects + + + + + Settings + Beállítások + + + + History + Előzmények + + + + Saved plot to '%1'. + Ábra mentve ide: „%1”. + + + + Loading file '%1'. + A(z) „%1” fájl betöltése folyamatban van. + + + + Unknown object type: %1. + Ismeretlen objektumtípus: %1. + + + + Invalid file provided. + A megadott fájl érvénytelen. + + + + Could not save file: + A fájl mentése nem sikerült: + + + + Loaded file '%1'. + A(z) „%1” fájl betöltve. + + + + Copied plot screenshot to clipboard! + Ábra képernyőkép vágólapra másolva! + + + + &Update + &Frissítés + + + + &Update LogarithmPlotter + A LogarithmPlotter &frissítése latex - + No Latex installation found. If you already have a latex distribution installed, make sure it's installed on your path. Otherwise, you can download a Latex distribution like TeX Live at https://tug.org/texlive/. @@ -1153,12 +1204,12 @@ Ha már telepítve van egy LaTeX disztribúció, győződjön meg arról, hogy a Egyébként letölthet egy LaTeX disztribúciót, például a TeX Live-t a https://tug.org/texlive/ címről. - + DVIPNG was not found. Make sure you include it from your Latex distribution. DVIPNG nem található. Ügyeljen arra, hogy a LaTeX disztribúciójából tartalmazza. - + An exception occured within the creation of the latex formula. Process '{}' ended with a non-zero return code {}: @@ -1171,7 +1222,7 @@ A(z) „{}” folyamat nullától eltérő visszatérési kóddal ({}) végződ Kérjük, ellenőrizze, hogy a LaTeX telepítése helyes-e, és ha igen, jelentse a hibát. - + An exception occured within the creation of the latex formula. Process '{}' took too long to finish: {} @@ -1182,313 +1233,293 @@ A(z) „{}” folyamat túl sokáig tartott a befejezéshez: Kérjük, ellenőrizze, hogy a LaTeX telepítése helyes-e, és ha igen, jelentse a hibát. - - main - - - Could not open file "{}": -{} - - - - - Could not open file: "{}" -File does not exist. - - - - - Built with PySide6 (Qt) v{} and python v{} - - - name %1 %2 renamed to %3. - %1 %2 átnevezve erre: %3. + %1 %2 átnevezve erre: %3. parameters above - ↑ Felett + ↑ Felett below - ↓ Alatt + ↓ Alatt left - ← Balra + ← Balra right - → Jobbra + → Jobbra above-left - ↖ Felett, balra + ↖ Felett, balra above-right - ↗ Felett, jobbra + ↗ Felett, jobbra below-left - ↙ Alatt, balra + ↙ Alatt, balra below-right - ↘ Alatt, jobbra + ↘ Alatt, jobbra center - >|< Középre + >|< Középre top - ↑ Felső + ↑ Felső bottom - ↓ Alsó + ↓ Alsó top-left - ↖ Bal felső + ↖ Bal felső top-right - ↗ Jobb felső + ↗ Jobb felső bottom-left - ↙ Bal alsó + ↙ Bal alsó bottom-right - ↘ Jobb alsó + ↘ Jobb alsó application - Alkalmazás + Alkalmazás function - Függvény + Függvény high - Magas + Magas low - Alul + Alul Next to target - Cél mellé + Cél mellé With label - Címkével + Címkével Hidden - Rejtett + Rejtett phasebode Bode Phase - Bode-fázis + Bode-fázis Bode Phases - Bode-fázisok + Bode-fázisok point Point - Pont + Pont Points - Pontok + Pontok position Position of %1 %2 set from "%3" to "%4". - %1 %2 áthelyezve innen: „%3” ide: „%4”. + %1 %2 áthelyezve innen: „%3” ide: „%4”. Position of %1 set from %2 to %3. - %1 áthelyezve innen: %2 ide: %3. + %1 áthelyezve innen: %2 ide: %3. prop expression - Kifejezés + Kifejezés definitionDomain - Abszcissza tartomány + Abszcissza tartomány destinationDomain - Ordináta tartomány + Ordináta tartomány labelPosition - Címke helyzete + Címke helyzete displayMode - Megjelenítési mód + Megjelenítési mód labelX - Címke X helyzete + Címke X helyzete drawPoints - Pontok megjelenítése + Pontok megjelenítése drawDashedLines - Szaggatott vonalak megjelenítése + Szaggatott vonalak megjelenítése om_0 - ω₀ + ω₀ pass - Áteresztő + Áteresztő gain - Nagyságrend nyeresége + Nagyságrend nyeresége omGraduation - ω₀ érettségi megjelenítése + ω₀ érettségi megjelenítése phase - Fázis + Fázis unit - Egység használata + Egység használata x - X + X y - Y + Y pointStyle - Pontstílus + Pontstílus probabilities - Valószínűségek listája + Valószínűségek listája text - Tartalom + Tartalom disableLatex - LaTeX-megjelenítés letiltása ennél a szövegnél + LaTeX-megjelenítés letiltása ennél a szövegnél targetElement - Tárgycél + Tárgycél approximate - Hozzávetőleges érték megjelenítése + Hozzávetőleges érték megjelenítése rounding - Kerekítés + Kerekítés displayStyle - Megjelenítési stílus + Megjelenítési stílus targetValuePosition - Cél értékpozíciója + Cél értékpozíciója defaultExpression - Alapértelmezett kifejezés + Alapértelmezett kifejezés baseValues - Kezdeményezési értékek + Kezdeményezési értékek repartition Repartition - Elosztás + Elosztás Repartition functions - Elosztási függvények + Elosztási függvények sequence Sequence - Sorozat + Sorozat Sequences - Sorozatok + Sorozatok sommegainsbode Bode Magnitudes Sum - Bode-nagyságrendek összege + Bode-nagyságrendek összege sommephasesbode Bode Phases Sum - Bode-fázisok összege + Bode-fázisok összege text Text - Szöveg + Szöveg Texts - Szövegek + Szövegek @@ -1499,7 +1530,7 @@ File does not exist. Elérhető a Logaritmus-ábrázoló ({} verzió) frissítése. - + No update available. Nincs telepíthető frissítés. @@ -1517,37 +1548,37 @@ File does not exist. usage - - + + Usage: %1 Használat: %1 - - - + + + Usage: %1 or %2 Használat: %1 vagy %2 - + integral(<from: number>, <to: number>, <f: ExecutableObject>) integrál(<alsó korlát: szám>, <felső korlát: szám>, <függvény: végrehajtható objektum>) - + integral(<from: number>, <to: number>, <f: string>, <variable: string>) integrál(<alsó korlát: szám>, <felső korlát: szám>, <függvény: karakterlánc>, <változó: karakterlánc>) - + derivative(<f: ExecutableObject>, <x: number>) derivált(<függvény: VégrehajthatóObjektum>, <x: szám>) - + derivative(<f: string>, <variable: string>, <x: number>) derivált(<függvény: karakterlánc>, <változó: karakterlánc>, <x: szám>) @@ -1556,22 +1587,22 @@ File does not exist. visibility %1 %2 shown. - %1 %2 megjelenítve. + %1 %2 megjelenítve. %1 %2 hidden. - %1 %2 rejtve. + %1 %2 rejtve. xcursor X Cursor - X kurzor + X kurzor X Cursors - X kurzorok + X kurzorok diff --git a/LogarithmPlotter/i18n/lp_nb_NO.ts b/LogarithmPlotter/i18n/lp_nb_NO.ts index 98fa6fb..faeb53b 100644 --- a/LogarithmPlotter/i18n/lp_nb_NO.ts +++ b/LogarithmPlotter/i18n/lp_nb_NO.ts @@ -4,8 +4,8 @@ About - + About LogarithmPlotter Om @@ -202,13 +202,13 @@ CustomPropertyList - - + + + Create new %1 + Opprett nytt %1 - + Pick on graph @@ -260,31 +260,31 @@ EditorDialog Edit properties of %1 %2 - Rediger egenskaper for %1 %2 + Rediger egenskaper for %1 %2 Name - Navn + Navn Label content - Etikett-innhold + Etikett-innhold null - NULL + NULL name - navn + navn name + value - navn + veri + navn + veri + Create new %1 - + Opprett nytt %1 + + Opprett nytt %1 @@ -437,64 +437,52 @@ Disse innstillingene kan endres når som helst fra «Innstillinger»-menyen. LogarithmPlotter - Objects - Objekter + Objekter - Settings - Innstillinger + Innstillinger - History - Historikk + Historikk - Saved plot to '%1'. - Lagret plott i «%1». + Lagret plott i «%1». - Loading file '%1'. - Laster inn «%1»-fil. + Laster inn «%1»-fil. - Unknown object type: %1. - Ukjent objekttype: %1. + Ukjent objekttype: %1. - Invalid file provided. - Ugyldig fil angitt. + Ugyldig fil angitt. - Could not save file: - Kunne ikke lagre fil: + Kunne ikke lagre fil: - Loaded file '%1'. - Lastet inn filen «%1». + Lastet inn filen «%1». - Copied plot screenshot to clipboard! - Kopierte plott-skjermavbildning til utklippstavlen! + Kopierte plott-skjermavbildning til utklippstavlen! - &Update - &Oppdater + &Oppdater - &Update LogarithmPlotter - &Installer ny versjon av LogartimePlotter + &Installer ny versjon av LogartimePlotter @@ -519,11 +507,11 @@ Disse innstillingene kan endres når som helst fra «Innstillinger»-menyen. Hide %1 %2 - Skjul %1 %2 + Skjul %1 %2 Show %1 %2 - Vis %1 %2 + Vis %1 %2 Set %1 %2 position @@ -531,11 +519,11 @@ Disse innstillingene kan endres når som helst fra «Innstillinger»-menyen. Delete %1 %2 - Slett %1 %2 + Slett %1 %2 Pick new color for %1 %2 - Velg ny farge for %1 %2 + Velg ny farge for %1 %2 @@ -575,7 +563,7 @@ Disse innstillingene kan endres når som helst fra «Innstillinger»-menyen. Snap to grid - Fest til rutenett + Fest til rutenett @@ -603,7 +591,7 @@ Disse innstillingene kan endres når som helst fra «Innstillinger»-menyen. - + (no pick selected) @@ -999,7 +987,7 @@ Disse innstillingene kan endres når som helst fra «Innstillinger»-menyen. - + Error while parsing expression for property %1: %2 @@ -1007,7 +995,7 @@ Evaluated expression: %3 - + Error while attempting to draw %1 %2: %3 @@ -1018,7 +1006,7 @@ Undoing last change. expression - + LogarithmPlotter - Parsing error @@ -1032,7 +1020,7 @@ Evaluated expression: %3 - + LogarithmPlotter - Drawing error @@ -1041,71 +1029,134 @@ Evaluated expression: %3 function Function - Funksjon + Funksjon Functions - Funksjoner + Funksjoner gainbode Bode Magnitude - Bode-magnitude + Bode-magnitude Bode Magnitudes - Bode-magnituder + Bode-magnituder low-pass - lavpass + lavpass high-pass - høypass + høypass historylib New %1 %2 created. - Ny %1 %2 opprettet. + Ny %1 %2 opprettet. %1 %2 deleted. - %1 %2 slettet. + %1 %2 slettet. %1 of %2 %3 changed from "%4" to "%5". - %1 av %2 %3 endret fra «%4» til «%5». + %1 av %2 %3 endret fra «%4» til «%5». %1 %2 shown. - %1 %2 vist. + %1 %2 vist. %1 %2 hidden. - %1 %2 skjult. + %1 %2 skjult. + + + + io + + + Objects + Objekter + + + + Settings + Innstillinger + + + + History + Historikk + + + + Saved plot to '%1'. + Lagret plott i «%1». + + + + Loading file '%1'. + Laster inn «%1»-fil. + + + + Unknown object type: %1. + Ukjent objekttype: %1. + + + + Invalid file provided. + Ugyldig fil angitt. + + + + Could not save file: + Kunne ikke lagre fil: + + + + Loaded file '%1'. + Lastet inn filen «%1». + + + + Copied plot screenshot to clipboard! + Kopierte plott-skjermavbildning til utklippstavlen! + + + + &Update + &Oppdater + + + + &Update LogarithmPlotter + &Installer ny versjon av LogartimePlotter latex - + No Latex installation found. If you already have a latex distribution installed, make sure it's installed on your path. Otherwise, you can download a Latex distribution like TeX Live at https://tug.org/texlive/. - + DVIPNG was not found. Make sure you include it from your Latex distribution. - + An exception occured within the creation of the latex formula. Process '{}' ended with a non-zero return code {}: @@ -1114,7 +1165,7 @@ Please make sure your latex installation is correct and report a bug if so. - + An exception occured within the creation of the latex formula. Process '{}' took too long to finish: {} @@ -1122,64 +1173,44 @@ Please make sure your latex installation is correct and report a bug if so. - - main - - - Could not open file "{}": -{} - - - - - Could not open file: "{}" -File does not exist. - - - - - Built with PySide6 (Qt) v{} and python v{} - - - phasebode Bode Phase - Bode-fase + Bode-fase Bode Phases - Bode-faser + Bode-faser point Point - Punkt + Punkt Points - Punkter + Punkter repartition Repartition - Distribusjon + Distribusjon Repartition functions - Distribusjonsfunksjoner + Distribusjonsfunksjoner sequence Sequence - Følge + Følge Sequences @@ -1190,25 +1221,25 @@ File does not exist. sommegainsbode Bode Magnitudes Sum - Bode-magnitudesum + Bode-magnitudesum sommephasesbode Bode Phases Sum - Bode-fasesum + Bode-fasesum text Text - Tekst + Tekst Texts - Tekster + Tekster @@ -1219,7 +1250,7 @@ File does not exist. En ny versjon av LogartimePlotter (v{}) er tilgjengelig - + No update available. Ingen nye versjoner. @@ -1237,36 +1268,36 @@ File does not exist. usage - - + + Usage: %1 - - - + + + Usage: %1 or %2 - + integral(<from: number>, <to: number>, <f: ExecutableObject>) - + integral(<from: number>, <to: number>, <f: string>, <variable: string>) - + derivative(<f: ExecutableObject>, <x: number>) - + derivative(<f: string>, <variable: string>, <x: number>) diff --git a/LogarithmPlotter/i18n/lp_template.ts b/LogarithmPlotter/i18n/lp_template.ts index b88fc2e..3e4a80b 100644 --- a/LogarithmPlotter/i18n/lp_template.ts +++ b/LogarithmPlotter/i18n/lp_template.ts @@ -4,8 +4,8 @@ About - + About LogarithmPlotter @@ -202,13 +202,13 @@ CustomPropertyList - - + + + Create new %1 - + Pick on graph @@ -402,69 +402,6 @@ These settings can be changed at any time from the "Settings" menu. - - LogarithmPlotter - - - Objects - - - - - Settings - - - - - History - - - - - Saved plot to '%1'. - - - - - Loading file '%1'. - - - - - Unknown object type: %1. - - - - - Invalid file provided. - - - - - Could not save file: - - - - - Loaded file '%1'. - - - - - Copied plot screenshot to clipboard! - - - - - &Update - - - - - &Update LogarithmPlotter - - - ObjectCreationGrid @@ -547,7 +484,7 @@ These settings can be changed at any time from the "Settings" menu. - + (no pick selected) @@ -922,7 +859,7 @@ These settings can be changed at any time from the "Settings" menu. - + Error while parsing expression for property %1: %2 @@ -930,7 +867,7 @@ Evaluated expression: %3 - + Error while attempting to draw %1 %2: %3 @@ -941,7 +878,7 @@ Undoing last change. expression - + LogarithmPlotter - Parsing error @@ -955,27 +892,90 @@ Evaluated expression: %3 - + LogarithmPlotter - Drawing error + + io + + + Objects + + + + + Settings + + + + + History + + + + + Saved plot to '%1'. + + + + + Loading file '%1'. + + + + + Unknown object type: %1. + + + + + Invalid file provided. + + + + + Could not save file: + + + + + Loaded file '%1'. + + + + + Copied plot screenshot to clipboard! + + + + + &Update + + + + + &Update LogarithmPlotter + + + latex - + No Latex installation found. If you already have a latex distribution installed, make sure it's installed on your path. Otherwise, you can download a Latex distribution like TeX Live at https://tug.org/texlive/. - + DVIPNG was not found. Make sure you include it from your Latex distribution. - + An exception occured within the creation of the latex formula. Process '{}' ended with a non-zero return code {}: @@ -984,7 +984,7 @@ Please make sure your latex installation is correct and report a bug if so. - + An exception occured within the creation of the latex formula. Process '{}' took too long to finish: {} @@ -992,26 +992,6 @@ Please make sure your latex installation is correct and report a bug if so. - - main - - - Could not open file "{}": -{} - - - - - Could not open file: "{}" -File does not exist. - - - - - Built with PySide6 (Qt) v{} and python v{} - - - update @@ -1020,7 +1000,7 @@ File does not exist. - + No update available. @@ -1038,36 +1018,36 @@ File does not exist. usage - - + + Usage: %1 - - - + + + Usage: %1 or %2 - + integral(<from: number>, <to: number>, <f: ExecutableObject>) - + integral(<from: number>, <to: number>, <f: string>, <variable: string>) - + derivative(<f: ExecutableObject>, <x: number>) - + derivative(<f: string>, <variable: string>, <x: number>) diff --git a/LogarithmPlotter/logarithmplotter.py b/LogarithmPlotter/logarithmplotter.py index 5270534..d4fd4aa 100644 --- a/LogarithmPlotter/logarithmplotter.py +++ b/LogarithmPlotter/logarithmplotter.py @@ -41,15 +41,16 @@ chdir(path.dirname(path.realpath(__file__))) if path.realpath(path.join(getcwd(), "..")) not in sys_path: sys_path.append(path.realpath(path.join(getcwd(), ".."))) - from LogarithmPlotter import __VERSION__ from LogarithmPlotter.util import config, native from LogarithmPlotter.util.update import check_for_updates from LogarithmPlotter.util.helper import Helper from LogarithmPlotter.util.latex import Latex +from LogarithmPlotter.util.js import PyJSValue config.init() + def get_linux_theme(): des = { "KDE": "Fusion", @@ -62,9 +63,9 @@ def get_linux_theme(): else: # Android return "Material" - + + def run(): - if not 'QT_QUICK_CONTROLS_STYLE' in environ: environ["QT_QUICK_CONTROLS_STYLE"] = { "linux": get_linux_theme(), @@ -73,9 +74,9 @@ def run(): "cygwin": "Fusion", "darwin": "macOS" }[platform] - + dep_time = time() - print("Loaded dependencies in " + str((dep_time - start_time)*1000) + "ms.") + print("Loaded dependencies in " + str((dep_time - start_time) * 1000) + "ms.") icon_fallbacks = QIcon.fallbackSearchPaths(); base_icon_path = path.join(getcwd(), "qml", "eu", "ad5001", "LogarithmPlotter", "icons") @@ -85,47 +86,45 @@ def run(): icon_fallbacks.append(path.realpath(path.join(base_icon_path, "settings"))) icon_fallbacks.append(path.realpath(path.join(base_icon_path, "settings", "custom"))) QIcon.setFallbackSearchPaths(icon_fallbacks); - - QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) + + QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) app = QApplication(argv) app.setApplicationName("LogarithmPlotter") app.setDesktopFileName("eu.ad5001.LogarithmPlotter.desktop") app.setOrganizationName("Ad5001") app.styleHints().setShowShortcutsInContextMenus(True) app.setWindowIcon(QIcon(path.realpath(path.join(getcwd(), "logarithmplotter.svg")))) - + # Installing translators translator = QTranslator() # Check if lang is forced. - forcedlang = [p for p in argv if p[:7]=="--lang="] + forcedlang = [p for p in argv if p[:7] == "--lang="] locale = QLocale(forcedlang[0][7:]) if len(forcedlang) > 0 else QLocale() - if (translator.load(locale, "lp", "_", path.realpath(path.join(getcwd(), "i18n")))): + if translator.load(locale, "lp", "_", path.realpath(path.join(getcwd(), "i18n"))): app.installTranslator(translator); - + # Installing macOS file handler. macOSFileOpenHandler = None if platform == "darwin": macOSFileOpenHandler = native.MacOSFileOpenHandler() app.installEventFilter(macOSFileOpenHandler) - + engine = QQmlApplicationEngine() global tmpfile helper = Helper(pwd, tmpfile) latex = Latex(tempdir) - modules = engine.newObject() - engine.globalObject().setProperty('Modules', modules) - engine.globalObject().setProperty('Helper', engine.newQObject(helper)) - engine.globalObject().setProperty("Latex", engine.newQObject(latex)) - # engine.rootContext().setContextProperty("Helper", helper) - # engine.rootContext().setContextProperty("Latex", latex) + js_globals = PyJSValue(engine.globalObject()) + js_globals.Modules = engine.newObject() + js_globals.Helper = engine.newQObject(helper) + js_globals.Latex = engine.newQObject(latex) engine.rootContext().setContextProperty("TestBuild", "--test-build" in argv) engine.rootContext().setContextProperty("StartTime", dep_time) - - app.translate("About","About LogarithmPlotter") # FOR SOME REASON, if this isn't included, Qt refuses to load the QML file. + + app.translate("About", "About LogarithmPlotter") + # FOR SOME REASON, if this isn't included, Qt refuses to load the QML file. engine.addImportPath(path.realpath(path.join(getcwd(), "qml"))) engine.load(path.realpath(path.join(getcwd(), "qml", "eu", "ad5001", "LogarithmPlotter", "LogarithmPlotter.qml"))) - if not engine.rootObjects(): print("No root object", path.realpath(path.join(getcwd(), "qml"))) @@ -135,26 +134,26 @@ def run(): # Open the current diagram chdir(pwd) if len(argv) > 0 and path.exists(argv[-1]) and argv[-1].split('.')[-1] in ['lpf']: - engine.rootObjects()[0].loadDiagram(argv[-1]) + js_globals.Modules.IO.loadDiagram(argv[-1]) chdir(path.dirname(path.realpath(__file__))) - + if platform == "darwin": - macOSFileOpenHandler.init_graphics(engine.rootObjects()[0]) - + macOSFileOpenHandler.init_io(js_globals.Modules.IO) + # Check for LaTeX installation if LaTeX support is enabled if config.getSetting("enable_latex"): latex.check_latex_install() - + # Check for updates if config.getSetting("check_for_updates"): check_for_updates(__VERSION__, engine.rootObjects()[0]) - + exit_code = app.exec() - + tempdir.cleanup() config.save() exit(exit_code) + if __name__ == "__main__": run() - diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml index 3fb9697..388264c 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/LogarithmPlotter.qml @@ -86,19 +86,19 @@ ApplicationWindow { width: parent.width anchors.top: parent.top TabButton { - text: qsTr("Objects") + text: qsTranslate('io', "Objects") icon.name: 'polygon-add-nodes' icon.color: sysPalette.windowText //height: 24 } TabButton { - text: qsTr("Settings") + text: qsTranslate('io', "Settings") icon.name: 'preferences-system-symbolic' icon.color: sysPalette.windowText //height: 24 } TabButton { - text: qsTr("History") + text: qsTranslate('io', "History") icon.name: 'view-history' icon.color: sysPalette.windowText //height: 24 @@ -159,7 +159,7 @@ ApplicationWindow { property bool firstDrawDone: false - onPainted: if(!firstDrawDone) { + onPainted: if(!firstDrawDone) { firstDrawDone = true; console.info("First paint done in " + (new Date().getTime()-(StartTime*1000)) + "ms") if(TestBuild == true) { @@ -182,130 +182,6 @@ ApplicationWindow { } } - /*! - \qmlmethod void LogarithmPlotter::saveDiagram(string filename) - Saves the diagram to a certain \c filename. - */ - function saveDiagram(filename) { - if(['lpf'].indexOf(filename.split('.')[filename.split('.').length-1]) == -1) - filename += '.lpf' - settings.saveFilename = filename - var objs = {} - for(var objType in Modules.Objects.currentObjects){ - objs[objType] = [] - for(var obj of Modules.Objects.currentObjects[objType]) { - objs[objType].push(obj.export()) - } - } - Helper.write(filename, JSON.stringify({ - "xzoom": settings.xzoom, - "yzoom": settings.yzoom, - "xmin": settings.xmin, - "ymax": settings.ymax, - "xaxisstep": settings.xaxisstep, - "yaxisstep": settings.yaxisstep, - "xaxislabel": settings.xlabel, - "yaxislabel": settings.ylabel, - "logscalex": settings.logscalex, - "linewidth": settings.linewidth, - "showxgrad": settings.showxgrad, - "showygrad": settings.showygrad, - "textsize": settings.textsize, - "history": history.serialize(), - "width": root.width, - "height": root.height, - "objects": objs, - "type": "logplotv1" - })) - alert.show(qsTr("Saved plot to '%1'.").arg(filename.split("/").pop())) - history.saved = true - } - - /*! - \qmlmethod void LogarithmPlotter::saveDiagram(string filename) - Loads the diagram from a certain \c filename. - */ - function loadDiagram(filename) { - let basename = filename.split("/").pop() - alert.show(qsTr("Loading file '%1'.").arg(basename)) - let data = JSON.parse(Helper.load(filename)) - let error = ""; - if(Object.keys(data).includes("type") && data["type"] == "logplotv1") { - history.clear() - // Importing settings - settings.saveFilename = filename - settings.xzoom = data["xzoom"] - settings.yzoom = data["yzoom"] - settings.xmin = data["xmin"] - settings.ymax = data["ymax"] - settings.xaxisstep = data["xaxisstep"] - settings.yaxisstep = data["yaxisstep"] - settings.xlabel = data["xaxislabel"] - settings.ylabel = data["yaxislabel"] - settings.logscalex = data["logscalex"] - if("showxgrad" in data) - settings.showxgrad = data["showxgrad"] - if("showygrad" in data) - settings.textsize = data["showygrad"] - if("linewidth" in data) - settings.linewidth = data["linewidth"] - if("textsize" in data) - settings.textsize = data["textsize"] - root.height = data["height"] - root.width = data["width"] - - // Importing objects - Modules.Objects.currentObjects = {} - Modules.Object.keys(Objects.currentObjectsByName).forEach(key => { - delete Modules.Objects.currentObjectsByName[key]; - // Required to keep the same reference for the copy of the object used in expression variable detection. - // Another way would be to change the reference as well, but I feel like the code would be less clean. - }) - for(let objType in data['objects']) { - if(Object.keys(Modules.Objects.types).indexOf(objType) > -1) { - Modules.Objects.currentObjects[objType] = [] - for(let objData of data['objects'][objType]) { - let obj = new Modules.Objects.types[objType](...objData) - Modules.Objects.currentObjects[objType].push(obj) - Modules.Objects.currentObjectsByName[obj.name] = obj - } - } else { - error += qsTr("Unknown object type: %1.").arg(objType) + "\n"; - } - } - - // Updating object dependencies. - for(let objName in Modules.Objects.currentObjectsByName) - Modules.Objects.currentObjectsByName[objName].update() - - // Importing history - if("history" in data) - history.unserialize(...data["history"]) - - // Refreshing sidebar - if(sidebarSelector.currentIndex == 0) { - // For some reason, if we load a file while the tab is on object, - // we get stuck in a Qt-side loop? Qt bug or side-effect here, I don't know. - sidebarSelector.currentIndex = 1 - objectLists.update() - delayRefreshTimer.start() - } else { - objectLists.update() - } - } else { - error = qsTr("Invalid file provided.") - } - if(error != "") { - console.log(error) - alert.show(qsTr("Could not save file: ") + error) - // TODO: Error handling - return - } - drawCanvas.requestPaint() - alert.show(qsTr("Loaded file '%1'.").arg(basename)) - history.saved = true - } - Timer { id: delayRefreshTimer repeat: false @@ -327,6 +203,22 @@ ApplicationWindow { } } + /*! + \qmlmethod void LogarithmPlotter::updateObjectsLists() + Updates the objects lists when loading a file. + */ + function updateObjectsLists() { + if(sidebarSelector.currentIndex === 0) { + // For some reason, if we load a file while the tab is on object, + // we get stuck in a Qt-side loop? Qt bug or side-effect here, I don't know. + sidebarSelector.currentIndex = 1 + objectLists.update() + delayRefreshTimer.start() + } else { + objectLists.update() + } + } + /*! \qmlmethod void LogarithmPlotter::copyDiagramToClipboard() Copies the current diagram image to the clipboard. @@ -335,7 +227,7 @@ ApplicationWindow { var file = Helper.gettmpfile() drawCanvas.save(file) Helper.copyImageToClipboard() - alert.show(qsTr("Copied plot screenshot to clipboard!")) + alert.show(qsTranslate('io', "Copied plot screenshot to clipboard!")) } /*! @@ -350,11 +242,11 @@ ApplicationWindow { Menu { id: updateMenu - title: qsTr("&Update") + title: qsTranslate('io', "&Update") Action { - text: qsTr("&Update LogarithmPlotter") + text: qsTranslate('io', "&Update LogarithmPlotter") icon.name: 'update' - onTriggered: Qt.openUrlExternally("https://dev.apps.ad5001.eu/logarithmplotter") + onTriggered: Qt.openUrlExternally("https://apps.ad5001.eu/logarithmplotter/") } } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Settings.qml b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Settings.qml index b15caed..cf09695 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Settings.qml +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/Settings.qml @@ -127,6 +127,10 @@ ScrollView { */ property string saveFilename: "" + Component.onCompleted: { + Modules.IO.initialize(root, settings, alert) + } + Column { spacing: 10 width: parent.width @@ -138,9 +142,9 @@ ScrollView { var filePath = fdiag.currentFile.toString().substr(7) settings.saveFilename = filePath if(exportMode) { - root.saveDiagram(filePath) + Modules.IO.saveDiagram(filePath) } else { - root.loadDiagram(filePath) + Modules.IO.loadDiagram(filePath) if(xAxisLabel.find(settings.xlabel) == -1) xAxisLabel.model.append({text: settings.xlabel}) xAxisLabel.editText = settings.xlabel if(yAxisLabel.find(settings.ylabel) == -1) yAxisLabel.model.append({text: settings.ylabel}) @@ -442,7 +446,7 @@ ScrollView { if(settings.saveFilename == "") { saveAs() } else { - root.saveDiagram(settings.saveFilename) + Modules.IO.saveDiagram(settings.saveFilename) } } diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/autoload.js b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/autoload.js index 4c79c64..9f207a0 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/autoload.js +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/autoload.js @@ -5,4 +5,5 @@ .import "objs/autoload.mjs" as Autoload .import "math/latex.mjs" as Latex .import "history/common.mjs" as HistoryCommon -.import "canvas.mjs" as CanvasAPI \ No newline at end of file +.import "canvas.mjs" as CanvasAPI +.import "io.mjs" as IOAPI \ No newline at end of file diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/history/common.mjs b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/history/common.mjs index b662098..66d35fd 100644 --- a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/history/common.mjs +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/history/common.mjs @@ -34,7 +34,10 @@ class HistoryCommonAPI extends Module { undo() { this.history.undo() } redo() { this.history.redo() } + clear() { this.history.clear() } addToHistory(action) { this.history.addToHistory(action) } + unserialize(data) { this.history.unserialize(data) } + serialize() { return this.history.serialize() } } /** @type {HistoryCommonAPI} */ diff --git a/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/io.mjs b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/io.mjs new file mode 100644 index 0000000..fe87ad8 --- /dev/null +++ b/LogarithmPlotter/qml/eu/ad5001/LogarithmPlotter/js/io.mjs @@ -0,0 +1,168 @@ +/** + * 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 . + */ + +import {Module} from "./modules.mjs" + +class IOAPI extends Module { + + constructor() { + super('IO', [ + Modules.Objects, + Modules.History + ]) + /** + * Path of the currently opened file. Empty if no file is opened. + * @type {string} + */ + this.saveFileName = "" + } + + /** + * Initializes module with QML elements. + * @param {LogarithmPlotter} rootElement + * @param {Settings} settings + * @param {{show: function(string)}} alert + */ + initialize(rootElement, settings, alert) { + this.rootElement = rootElement + this.settings = settings + this.alert = alert + } + + /** + * Saves the diagram to a certain \c filename. + * @param {string} filename + */ + saveDiagram(filename) { + // Add extension if necessary + if(['lpf'].indexOf(filename.split('.')[filename.split('.').length-1]) === -1) + filename += '.lpf' + this.saveFilename = filename + let objs = {} + for(let objType in Modules.Objects.currentObjects){ + objs[objType] = [] + for(let obj of Modules.Objects.currentObjects[objType]) { + objs[objType].push(obj.export()) + } + } + let settings = { + "xzoom": this.settings.xzoom, + "yzoom": this.settings.yzoom, + "xmin": this.settings.xmin, + "ymax": this.settings.ymax, + "xaxisstep": this.settings.xaxisstep, + "yaxisstep": this.settings.yaxisstep, + "xaxislabel": this.settings.xlabel, + "yaxislabel": this.settings.ylabel, + "logscalex": this.settings.logscalex, + "linewidth": this.settings.linewidth, + "showxgrad": this.settings.showxgrad, + "showygrad": this.settings.showygrad, + "textsize": this.settings.textsize, + "history": Modules.History.serialize(), + "width": this.rootElement.width, + "height": this.rootElement.height, + "objects": objs, + "type": "logplotv1" + } + Helper.write(filename, JSON.stringify(settings)) + this.alert.show(qsTranslate('io', "Saved plot to '%1'.").arg(filename.split("/").pop())) + Modules.History.history.saved = true + } + + /** + * Loads the diagram from a certain \c filename. + * @param {string} filename + */ + loadDiagram(filename) { + let basename = filename.split("/").pop() + this.alert.show(qsTranslate('io', "Loading file '%1'.").arg(basename)) + let data = JSON.parse(Helper.load(filename)) + let error = ""; + if(Object.keys(data).includes("type") && data["type"] === "logplotv1") { + Modules.History.clear() + // Importing settings + this.settings.saveFilename = filename + this.settings.xzoom = data["xzoom"] + this.settings.yzoom = data["yzoom"] + this.settings.xmin = data["xmin"] + this.settings.ymax = data["ymax"] + this.settings.xaxisstep = data["xaxisstep"] + this.settings.yaxisstep = data["yaxisstep"] + this.settings.xlabel = data["xaxislabel"] + this.settings.ylabel = data["yaxislabel"] + this.settings.logscalex = data["logscalex"] + if("showxgrad" in data) + this.settings.showxgrad = data["showxgrad"] + if("showygrad" in data) + this.settings.textsize = data["showygrad"] + if("linewidth" in data) + this.settings.linewidth = data["linewidth"] + if("textsize" in data) + this.settings.textsize = data["textsize"] + this.rootElement.height = data["height"] + this.rootElement.width = data["width"] + + // Importing objects + Modules.Objects.currentObjects = {} + for(let key of Object.keys(Modules.Objects.currentObjectsByName)) { + delete Modules.Objects.currentObjectsByName[key]; + // Required to keep the same reference for the copy of the object used in expression variable detection. + // Another way would be to change the reference as well, but I feel like the code would be less clean. + } + for(let objType in data['objects']) { + if(Object.keys(Modules.Objects.types).indexOf(objType) > -1) { + Modules.Objects.currentObjects[objType] = [] + for(let objData of data['objects'][objType]) { + let obj = new Modules.Objects.types[objType](...objData) + Modules.Objects.currentObjects[objType].push(obj) + Modules.Objects.currentObjectsByName[obj.name] = obj + } + } else { + error += qsTranslate('io', "Unknown object type: %1.").arg(objType) + "\n"; + } + } + + // Updating object dependencies. + for(let objName in Modules.Objects.currentObjectsByName) + Modules.Objects.currentObjectsByName[objName].update() + + // Importing history + if("history" in data) + Modules.History.unserialize(...data["history"]) + + // Refreshing sidebar + this.rootElement.updateObjectsLists() + } else { + error = qsTranslate('io', "Invalid file provided.") + } + if(error !== "") { + console.log(error) + this.alert.show(qsTranslate('io', "Could not save file: ") + error) + // TODO: Error handling + return + } + Modules.Canvas.redraw() + this.alert.show(qsTranslate('io', "Loaded file '%1'.").arg(basename)) + Modules.History.history.saved = true + } + +} + +/** @type {IOAPI} */ +Modules.IO = Modules.IO || new IOAPI() diff --git a/LogarithmPlotter/util/config.py b/LogarithmPlotter/util/config.py index f19e000..bdd11b7 100644 --- a/LogarithmPlotter/util/config.py +++ b/LogarithmPlotter/util/config.py @@ -47,7 +47,7 @@ CONFIG_PATH = { CONFIG_FILE = path.join(CONFIG_PATH, "config.json") initialized = False -current_config= DEFAULT_SETTINGS +current_config = DEFAULT_SETTINGS def init(): diff --git a/LogarithmPlotter/util/helper.py b/LogarithmPlotter/util/helper.py index 127e587..e6e9dfb 100644 --- a/LogarithmPlotter/util/helper.py +++ b/LogarithmPlotter/util/helper.py @@ -31,11 +31,12 @@ from urllib.error import HTTPError, URLError from LogarithmPlotter import __VERSION__ from LogarithmPlotter.util import config + class ChangelogFetcher(QRunnable): def __init__(self, helper): QRunnable.__init__(self) self.helper = helper - + def run(self): msg_text = "Unknown changelog error." try: @@ -43,17 +44,19 @@ class ChangelogFetcher(QRunnable): r = urlopen("https://api.ad5001.eu/changelog/logarithmplotter/?version=" + __VERSION__) lines = r.readlines() r.close() - msg_text = "".join(map(lambda x: x.decode('utf-8'), lines)).strip() + msg_text = "".join(map(lambda x: x.decode('utf-8'), lines)).strip() except HTTPError as e: - msg_text = QCoreApplication.translate("changelog","Could not fetch changelog: Server error {}.").format(str(e.code)) + msg_text = QCoreApplication.translate("changelog", "Could not fetch changelog: Server error {}.").format( + str(e.code)) except URLError as e: - msg_text = QCoreApplication.translate("changelog","Could not fetch update: {}.").format(str(e.reason)) + msg_text = QCoreApplication.translate("changelog", "Could not fetch update: {}.").format(str(e.reason)) self.helper.gotChangelog.emit(msg_text) + class Helper(QObject): changelogFetched = Signal(str) gotChangelog = Signal(str) - + def __init__(self, cwd: str, tmpfile: str): QObject.__init__(self) self.cwd = cwd @@ -62,7 +65,7 @@ class Helper(QObject): def fetched(self, changelog: str): self.changelogFetched.emit(changelog) - + @Slot(str, str) def write(self, filename, filedata): chdir(self.cwd) @@ -70,17 +73,17 @@ class Helper(QObject): if filename.split(".")[-1] == "lpf": # Add header to file filedata = "LPFv1" + filedata - f = open(path.realpath(filename), 'w', -1, 'utf8') + f = open(path.realpath(filename), 'w', -1, 'utf8') f.write(filedata) f.close() chdir(path.dirname(path.realpath(__file__))) - + @Slot(str, result=str) def load(self, filename): chdir(self.cwd) data = '{}' if path.exists(path.realpath(filename)): - f = open(path.realpath(filename), 'r', -1, 'utf8') + f = open(path.realpath(filename), 'r', -1, 'utf8') data = f.read() f.close() try: @@ -94,10 +97,13 @@ class Helper(QObject): raise Exception(QCoreApplication.translate("This file was created by a more recent version of LogarithmPlotter and cannot be backloaded in LogarithmPlotter v{}.\nPlease update LogarithmPlotter to open this file.".format(__VERSION__))) else: raise Exception("Invalid LogarithmPlotter file.") - except Exception as e: # If file can't be loaded - QMessageBox.warning(None, 'LogarithmPlotter', QCoreApplication.translate('main','Could not open file "{}":\n{}').format(filename, e), QMessageBox.Ok) # Cannot parse file + except Exception as e: # If file can't be loaded + QMessageBox.warning(None, 'LogarithmPlotter', + QCoreApplication.translate('main', 'Could not open file "{}":\n{}').format(filename, + e), + QMessageBox.Ok) # Cannot parse file else: - QMessageBox.warning(None, 'LogarithmPlotter', QCoreApplication.translate('main','Could not open file: "{}"\nFile does not exist.').format(filename), QMessageBox.Ok) # Cannot parse file + QMessageBox.warning(None, 'LogarithmPlotter', QCoreApplication.translate('main', 'Could not open file: "{}"\nFile does not exist.').format(filename), QMessageBox.Ok) # Cannot parse file try: chdir(path.dirname(path.realpath(__file__))) except NotADirectoryError as e: @@ -105,60 +111,62 @@ class Helper(QObject): # See more at https://git.ad5001.eu/Ad5001/LogarithmPlotter/issues/1 pass return data - + @Slot(result=str) def gettmpfile(self): return self.tmpfile - + @Slot() def copyImageToClipboard(self): clipboard = QApplication.clipboard() clipboard.setImage(QImage(self.tmpfile)) - + @Slot(result=str) def getVersion(self): return __VERSION__ - + @Slot(str, result=str) def getSetting(self, namespace): return config.getSetting(namespace) - + @Slot(str, result=int) def getSettingInt(self, namespace): return config.getSetting(namespace) - + @Slot(str, result=bool) def getSettingBool(self, namespace): return config.getSetting(namespace) - + @Slot(str, str) def setSetting(self, namespace, value): return config.setSetting(namespace, value) - + @Slot(str, bool) def setSettingBool(self, namespace, value): return config.setSetting(namespace, value) - + @Slot(str, int) def setSettingInt(self, namespace, value): return config.setSetting(namespace, value) - + @Slot(str) def setLanguage(self, new_lang): config.setSetting("language", new_lang) - + @Slot(result=str) def getDebugInfos(self): """ Returns the version info about Qt, PySide6 & Python """ - return QCoreApplication.translate('main',"Built with PySide6 (Qt) v{} and python v{}").format(PySide6_version, sys_version.split("\n")[0]) - + return QCoreApplication.translate('main', "Built with PySide6 (Qt) v{} and python v{}").format(PySide6_version, + sys_version.split( + "\n")[0]) + @Slot() def fetchChangelog(self): changelog_cache_path = path.join(path.dirname(path.realpath(__file__)), "CHANGELOG.md") print(changelog_cache_path) - if path.exists(changelog_cache_path): + if path.exists(changelog_cache_path): # We have a cached version of the changelog, for env that don't have access to the internet. f = open(changelog_cache_path); self.changelogFetched.emit("".join(f.readlines()).strip()) @@ -167,4 +175,3 @@ class Helper(QObject): # Fetch it from the internet. runnable = ChangelogFetcher(self) QThreadPool.globalInstance().start(runnable) - diff --git a/LogarithmPlotter/util/js.py b/LogarithmPlotter/util/js.py new file mode 100644 index 0000000..4514a42 --- /dev/null +++ b/LogarithmPlotter/util/js.py @@ -0,0 +1,52 @@ +""" + * 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 . +""" + +from PySide6.QtQml import QJSValue + + +class PyJSValue: + """ + Wrapper to provide easy way to interact with JavaScript values in Python directly. + """ + def __init__(self, js_value: QJSValue, parent: QJSValue = None): + self.qjs_value = js_value + self._parent = parent + + def __getattr__(self, item): + return PyJSValue(self.qjs_value.property(item), self.qjs_value) + + def __setattr__(self, key, value): + if key in ['qjs_value', '_parent']: + # Fallback + object.__setattr__(self, key, value) + elif isinstance(value, PyJSValue): + # Set property + self.qjs_value.setProperty(key, value.qjs_value) + else: + print('Setting', key, value) + self.qjs_value.setProperty(key, value) + + def __call__(self, *args, **kwargs): + if self.qjs_value.isCallable(): + if self._parent is None: + return self.qjs_value.call(args) + else: + return self.qjs_value.callWithInstance(self._parent, args) + else: + raise ValueError('Cannot call non-function JS value.') + diff --git a/LogarithmPlotter/util/latex.py b/LogarithmPlotter/util/latex.py index d519e18..c670e1e 100644 --- a/LogarithmPlotter/util/latex.py +++ b/LogarithmPlotter/util/latex.py @@ -160,10 +160,7 @@ class Latex(QObject): QCoreApplication.translate("latex", "An exception occured within the creation of the latex formula.\nProcess '{}' ended with a non-zero return code {}:\n\n{}\nPlease make sure your latex installation is correct and report a bug if so.") .format(" ".join(process), proc.returncode, str(out, 'utf8') + "\n" + str(err, 'utf8'))) - raise Exception( - " ".join(process) + " process exited with return code " + str(proc.returncode) + ":\n" + str(out, - 'utf8') + "\n" + str( - err, 'utf8')) + raise Exception("{0} process exited with return code {1}:\n{2}\n{3}".format(" ".join(process), str(proc.returncode), str(out, 'utf8'), str(err, 'utf8'))) except TimeoutExpired as e: # Process timed out proc.kill() diff --git a/LogarithmPlotter/util/native.py b/LogarithmPlotter/util/native.py index 01d9022..7e32119 100644 --- a/LogarithmPlotter/util/native.py +++ b/LogarithmPlotter/util/native.py @@ -20,29 +20,30 @@ from PySide6.QtCore import QObject, QEvent + # On macOS, opening a file through finder can only be fetched through the -# QFileOpenEvent and NOT throught command line parameters. +# QFileOpenEvent and NOT through command line parameters. class MacOSFileOpenHandler(QObject): def __init__(self): - self.initilized = False - self.mainwindow = None + self.initialized = False + self.io_module = None self.opened_file = "" QObject.__init__(self) - - def init_graphics(self, mainwindow): - self.mainwindow = mainwindow - self.initilized = True + + def init_io(self, io_modules): + self.io_module = io_modules + self.initialized = True if self.opened_file != "": self.open_file() - + def open_file(self): - self.mainwindow.loadDiagram(self.opened_file) - + self.io_module.loadDiagram(self.opened_file) + def eventFilter(self, obj, event): if event.type() == QEvent.FileOpen: - print("Got file", event.file(), self.initilized) + print("Got file", event.file(), self.initialized) self.opened_file = event.file() - if self.initilized: + if self.initialized: self.open_file() return True else: diff --git a/LogarithmPlotter/util/update.py b/LogarithmPlotter/util/update.py index 25400ce..dbacbfe 100644 --- a/LogarithmPlotter/util/update.py +++ b/LogarithmPlotter/util/update.py @@ -21,9 +21,11 @@ from urllib.request import urlopen from urllib.error import HTTPError, URLError from sys import argv + class UpdateInformation(QObject): got_update_info = Signal(bool, str, bool) + class UpdateCheckerRunnable(QRunnable): def __init__(self, current_version, callback): QRunnable.__init__(self) @@ -40,44 +42,51 @@ class UpdateCheckerRunnable(QRunnable): lines = r.readlines() r.close() # Parsing version - version = "".join(map(chr, lines[0])).strip() # Converts byte to string. + version = "".join(map(chr, lines[0])).strip() # Converts byte to string. version_tuple = version.split(".") is_version_newer = False if "dev" in self.current_version: # We're on a dev version - current_version_tuple = self.current_version.split(".")[:-1] # Removing the dev0+git bit. - is_version_newer = version_tuple >= current_version_tuple # If equals, that means we got out of testing phase. + current_version_tuple = self.current_version.split(".")[:-1] # Removing the dev0+git bit. + is_version_newer = version_tuple >= current_version_tuple # If equals, that means we got out of testing phase. else: current_version_tuple = self.current_version.split(".") is_version_newer = version_tuple > current_version_tuple if is_version_newer: - msg_text = QCoreApplication.translate("update","An update for LogarithPlotter (v{}) is available.").format(version) + msg_text = QCoreApplication.translate("update", + "An update for LogarithPlotter (v{}) is available.").format( + version) update_available = True else: show_alert = False - msg_text = QCoreApplication.translate("update","No update available.") - + msg_text = QCoreApplication.translate("update", "No update available.") + except HTTPError as e: - msg_text = QCoreApplication.translate("update","Could not fetch update information: Server error {}.").format(str(e.code)) + msg_text = QCoreApplication.translate("update", + "Could not fetch update information: Server error {}.").format( + str(e.code)) except URLError as e: - msg_text = QCoreApplication.translate("update","Could not fetch update information: {}.").format(str(e.reason)) - self.callback.got_update_info.emit(show_alert, msg_text,update_available) + msg_text = QCoreApplication.translate("update", "Could not fetch update information: {}.").format( + str(e.reason)) + self.callback.got_update_info.emit(show_alert, msg_text, update_available) + def check_for_updates(current_version, window): """ Checks for updates in the background, and sends an alert with information. """ if "--no-check-for-updates" in argv: - return # + return + def cb(show_alert, msg_text, update_available): pass if show_alert: window.showAlert(msg_text) if update_available: window.showUpdateMenu() - + update_info = UpdateInformation() update_info.got_update_info.connect(cb) - + runnable = UpdateCheckerRunnable(current_version, update_info) QThreadPool.globalInstance().start(runnable)