From 12c1c827fb85cc4cd4023e7f87d118ac7ec1f1b2 Mon Sep 17 00:00:00 2001 From: Andrew Sazonov Date: Fri, 30 Aug 2024 08:37:52 +0200 Subject: [PATCH] Rename Backend --- examples/IntermediatePy/src/IntermediatePy.pyproject | 2 +- .../src/IntermediatePy/Gui/ApplicationWindow.qml | 4 ++-- .../Gui/Globals/{Backend.qml => BackendProxy.qml} | 4 ++-- .../src/IntermediatePy/Gui/Globals/References.qml | 1 - .../src/IntermediatePy/Gui/Globals/qmldir | 2 +- .../src/IntermediatePy/Gui/Pages/Project/Layout.qml | 4 ++-- .../Gui/Pages/Project/MainArea/Description.qml | 12 ++++++------ .../Pages/Project/Sidebar/Basic/Groups/Examples.qml | 2 +- .../Sidebar/Basic/Popups/ProjectDescription.qml | 12 ++++++------ .../src/IntermediatePy/Gui/Pages/Report/Layout.qml | 2 +- .../Gui/Pages/Report/MainArea/Summary.qml | 2 +- .../Gui/Pages/Report/Sidebar/Basic/Groups/Export.qml | 2 +- .../src/IntermediatePy/Gui/StatusBar.qml | 12 ++++++------ examples/IntermediatePy/src/IntermediatePy/main.qml | 2 +- 14 files changed, 31 insertions(+), 32 deletions(-) rename examples/IntermediatePy/src/IntermediatePy/Gui/Globals/{Backend.qml => BackendProxy.qml} (95%) diff --git a/examples/IntermediatePy/src/IntermediatePy.pyproject b/examples/IntermediatePy/src/IntermediatePy.pyproject index dd655d3..0087690 100644 --- a/examples/IntermediatePy/src/IntermediatePy.pyproject +++ b/examples/IntermediatePy/src/IntermediatePy.pyproject @@ -8,7 +8,7 @@ "IntermediatePy/Gui/StatusBar.qml", "IntermediatePy/Gui/Globals/qmldir", "IntermediatePy/Gui/Globals/ApplicationInfo.qml", - "IntermediatePy/Gui/Globals/Backend.qml", + "IntermediatePy/Gui/Globals/BackendProxy.qml", "IntermediatePy/Gui/Globals/References.qml", "IntermediatePy/Gui/Pages/Home/Content.qml", "IntermediatePy/Gui/Pages/Home/Popups/About.qml", diff --git a/examples/IntermediatePy/src/IntermediatePy/Gui/ApplicationWindow.qml b/examples/IntermediatePy/src/IntermediatePy/Gui/ApplicationWindow.qml index 23112e6..06ba15d 100644 --- a/examples/IntermediatePy/src/IntermediatePy/Gui/ApplicationWindow.qml +++ b/examples/IntermediatePy/src/IntermediatePy/Gui/ApplicationWindow.qml @@ -22,11 +22,11 @@ EaComponents.ApplicationWindow { appBarLeftButtons: [ EaElements.ToolButton { - enabled: Globals.Backend.project.created + enabled: Globals.BackendProxy.project.created highlighted: true fontIcon: 'save' ToolTip.text: qsTr('Save current state of the project') - onClicked: Globals.Backend.project.save() + onClicked: Globals.BackendProxy.project.save() } ] diff --git a/examples/IntermediatePy/src/IntermediatePy/Gui/Globals/Backend.qml b/examples/IntermediatePy/src/IntermediatePy/Gui/Globals/BackendProxy.qml similarity index 95% rename from examples/IntermediatePy/src/IntermediatePy/Gui/Globals/Backend.qml rename to examples/IntermediatePy/src/IntermediatePy/Gui/Globals/BackendProxy.qml index de25886..6d69d10 100644 --- a/examples/IntermediatePy/src/IntermediatePy/Gui/Globals/Backend.qml +++ b/examples/IntermediatePy/src/IntermediatePy/Gui/Globals/BackendProxy.qml @@ -12,6 +12,7 @@ import QtQuick // It is needed to run the GUI frontend via the qml runtime tool without any Python backend. import Logic + QtObject { //////////////// @@ -69,8 +70,7 @@ QtObject { property bool created: activeProxy.report.created onCreatedChanged: activeProxy.project.created = created - property string asHtml: activeProxy.report.asHtml - onAsHtmlChanged: activeProxy.report.asHtml = asHtml + readonly property string asHtml: activeProxy.report.asHtml } } diff --git a/examples/IntermediatePy/src/IntermediatePy/Gui/Globals/References.qml b/examples/IntermediatePy/src/IntermediatePy/Gui/Globals/References.qml index 2ccace1..0d9d781 100644 --- a/examples/IntermediatePy/src/IntermediatePy/Gui/Globals/References.qml +++ b/examples/IntermediatePy/src/IntermediatePy/Gui/Globals/References.qml @@ -10,7 +10,6 @@ import QtQuick // Initialisation of the reference dictionary. It is filled in later, when the required object is // created and its unique id is assigned and added here instead of 'null'. After that, any object // whose id is stored here can be accessed from any other qml file. - QtObject { // Populated in ApplicationWindows.qml diff --git a/examples/IntermediatePy/src/IntermediatePy/Gui/Globals/qmldir b/examples/IntermediatePy/src/IntermediatePy/Gui/Globals/qmldir index 43d50ac..de4dd47 100644 --- a/examples/IntermediatePy/src/IntermediatePy/Gui/Globals/qmldir +++ b/examples/IntermediatePy/src/IntermediatePy/Gui/Globals/qmldir @@ -1,5 +1,5 @@ module Globals singleton ApplicationInfo ApplicationInfo.qml -singleton Backend Backend.qml +singleton BackendProxy BackendProxy.qml singleton References References.qml diff --git a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/Layout.qml b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/Layout.qml index 58aa2a8..b0483f9 100644 --- a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/Layout.qml +++ b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/Layout.qml @@ -15,7 +15,7 @@ import Gui.Globals as Globals EaComponents.ContentPage { - defaultInfo: Globals.Backend.project.created ? + defaultInfo: Globals.BackendProxy.project.created ? '' : qsTr('No project defined') @@ -42,7 +42,7 @@ EaComponents.ContentPage { Loader { source: 'Sidebar/Text/Layout.qml' } ] - continueButton.text: Globals.Backend.project.created ? + continueButton.text: Globals.BackendProxy.project.created ? qsTr('Continue') : qsTr('Continue without project') diff --git a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/MainArea/Description.qml b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/MainArea/Description.qml index 78e7ac5..9a465d2 100644 --- a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/MainArea/Description.qml +++ b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/MainArea/Description.qml @@ -35,8 +35,8 @@ Rectangle { font.weight: Font.ExtraLight validator: RegularExpressionValidator { regularExpression: /^[a-zA-Z][a-zA-Z0-9_\-\.]{1,30}$/ } placeholderText: qsTr("Enter project name here") - text: Globals.Backend.project.name - onEditingFinished: Globals.Backend.project.name = text + text: Globals.BackendProxy.project.name + onEditingFinished: Globals.BackendProxy.project.name = text } // Project title @@ -53,8 +53,8 @@ Rectangle { EaElements.TextInput { width: Math.max(implicitWidth, 1) placeholderText: qsTr("Enter project description here") - text: Globals.Backend.project.info.description - onEditingFinished: Globals.Backend.project.editInfo('description', text) + text: Globals.BackendProxy.project.info.description + onEditingFinished: Globals.BackendProxy.project.editInfo('description', text) } EaElements.Label { @@ -63,7 +63,7 @@ Rectangle { } EaElements.Label { width: Math.max(implicitWidth, 1) - text: Globals.Backend.project.info.location + text: Globals.BackendProxy.project.info.location } EaElements.Label { @@ -72,7 +72,7 @@ Rectangle { } EaElements.Label { width: Math.max(implicitWidth, 1) - text: Globals.Backend.project.info.creationDate + text: Globals.BackendProxy.project.info.creationDate } } // Project info diff --git a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/Sidebar/Basic/Groups/Examples.qml b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/Sidebar/Basic/Groups/Examples.qml index 87e1070..af7062e 100644 --- a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/Sidebar/Basic/Groups/Examples.qml +++ b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/Sidebar/Basic/Groups/Examples.qml @@ -24,7 +24,7 @@ EaComponents.TableView { defaultInfoText: qsTr('No examples available') - model: Globals.Backend.project.examples + model: Globals.BackendProxy.project.examples // header header: EaComponents.TableViewHeader { diff --git a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/Sidebar/Basic/Popups/ProjectDescription.qml b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/Sidebar/Basic/Popups/ProjectDescription.qml index 81ee62b..bbe2d33 100644 --- a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/Sidebar/Basic/Popups/ProjectDescription.qml +++ b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Project/Sidebar/Basic/Popups/ProjectDescription.qml @@ -16,18 +16,18 @@ EaComponents.ProjectDescriptionDialog { visible: EaGlobals.Vars.showProjectDescriptionDialog onClosed: EaGlobals.Vars.showProjectDescriptionDialog = false - projectName: Globals.Backend.project.name - projectDescription: Globals.Backend.project.info.description + projectName: Globals.BackendProxy.project.name + projectDescription: Globals.BackendProxy.project.info.description onAccepted: { - Globals.Backend.project.name = projectName - Globals.Backend.project.editInfo('description', projectDescription) - Globals.Backend.project.create() + Globals.BackendProxy.project.name = projectName + Globals.BackendProxy.project.editInfo('description', projectDescription) + Globals.BackendProxy.project.create() Globals.References.applicationWindow.appBarCentralTabs.summaryButton.enabled = true } Component.onCompleted: { - projectLocation = Globals.Backend.project.info.location + projectLocation = Globals.BackendProxy.project.info.location } } diff --git a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Report/Layout.qml b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Report/Layout.qml index 173aca1..8e6ee8e 100644 --- a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Report/Layout.qml +++ b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Report/Layout.qml @@ -15,7 +15,7 @@ import Gui.Globals as Globals EaComponents.ContentPage { - defaultInfo: Globals.Backend.report.created ? + defaultInfo: Globals.BackendProxy.report.created ? '' : qsTr('No Summary Generated') diff --git a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Report/MainArea/Summary.qml b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Report/MainArea/Summary.qml index 3c7a53c..27e4245 100644 --- a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Report/MainArea/Summary.qml +++ b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Report/MainArea/Summary.qml @@ -46,7 +46,7 @@ Rectangle { padding: 2.5 * EaStyle.Sizes.fontPixelSize textFormat: TextEdit.RichText - text: Globals.Backend.report.asHtml + text: Globals.BackendProxy.report.asHtml } // Main text area diff --git a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Report/Sidebar/Basic/Groups/Export.qml b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Report/Sidebar/Basic/Groups/Export.qml index 9b1322a..01adcdd 100644 --- a/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Report/Sidebar/Basic/Groups/Export.qml +++ b/examples/IntermediatePy/src/IntermediatePy/Gui/Pages/Report/Sidebar/Basic/Groups/Export.qml @@ -17,7 +17,7 @@ import Gui.Globals as Globals Column { - property string projectLocation: Globals.Backend.project.info.location + + property string projectLocation: Globals.BackendProxy.project.info.location + EaLogic.Utils.osPathSep() + 'summary' diff --git a/examples/IntermediatePy/src/IntermediatePy/Gui/StatusBar.qml b/examples/IntermediatePy/src/IntermediatePy/Gui/StatusBar.qml index 12ab1e0..a32b9b2 100644 --- a/examples/IntermediatePy/src/IntermediatePy/Gui/StatusBar.qml +++ b/examples/IntermediatePy/src/IntermediatePy/Gui/StatusBar.qml @@ -19,42 +19,42 @@ EaElements.StatusBar { EaElements.StatusBarItem { keyIcon: 'archive' keyText: qsTr('Project') - valueText: Globals.Backend.status.project + valueText: Globals.BackendProxy.status.project ToolTip.text: qsTr('Current project') } EaElements.StatusBarItem { keyIcon: 'layer-group' keyText: qsTr('Models') - valueText: Globals.Backend.status.phasesCount + valueText: Globals.BackendProxy.status.phasesCount ToolTip.text: qsTr('Number of models added') } EaElements.StatusBarItem { keyIcon: 'microscope' keyText: qsTr('Experiments') - valueText: Globals.Backend.status.experimentsCount + valueText: Globals.BackendProxy.status.experimentsCount ToolTip.text: qsTr('Number of experiments added') } EaElements.StatusBarItem { keyIcon: 'calculator' keyText: qsTr('Calculator') - valueText: Globals.Backend.status.calculator + valueText: Globals.BackendProxy.status.calculator ToolTip.text: qsTr('Current calculation engine') } EaElements.StatusBarItem { keyIcon: 'level-down-alt' keyText: qsTr('Minimizer') - valueText: Globals.Backend.status.minimizer + valueText: Globals.BackendProxy.status.minimizer ToolTip.text: qsTr('Current minimization engine and method') } EaElements.StatusBarItem { keyIcon: 'th-list' keyText: qsTr('Parameters') - valueText: Globals.Backend.status.variables + valueText: Globals.BackendProxy.status.variables ToolTip.text: qsTr('Number of parameters: total, free and fixed') } diff --git a/examples/IntermediatePy/src/IntermediatePy/main.qml b/examples/IntermediatePy/src/IntermediatePy/main.qml index f5d5683..1c7c007 100644 --- a/examples/IntermediatePy/src/IntermediatePy/main.qml +++ b/examples/IntermediatePy/src/IntermediatePy/main.qml @@ -10,6 +10,6 @@ import Gui as Gui Gui.ApplicationWindow { - id: applicationWindow // Global access + id: applicationWindow // applicationWindow is globally accessible }