From 778de3c8d31996cb7b8ed9dbd5487d3c1216c9fe Mon Sep 17 00:00:00 2001 From: Piotr Rozyczko Date: Thu, 25 May 2023 14:18:48 +0200 Subject: [PATCH 01/40] some fixes related to model add/remove --- .../Gui/Pages/Sample/SurfactantTable.qml | 4 ++-- EasyReflectometryApp/Logic/Proxies/Fitter.py | 3 ++- .../Logic/Proxies/Material.py | 1 + EasyReflectometryApp/Logic/Proxies/Model.py | 23 +++++++++++++++---- .../Logic/Proxies/Simulation.py | 4 +++- EasyReflectometryApp/Logic/PyQmlProxy.py | 5 ++-- 6 files changed, 28 insertions(+), 12 deletions(-) diff --git a/EasyReflectometryApp/Gui/Pages/Sample/SurfactantTable.qml b/EasyReflectometryApp/Gui/Pages/Sample/SurfactantTable.qml index a69c110d..0b82ee4e 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/SurfactantTable.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/SurfactantTable.qml @@ -69,7 +69,7 @@ EaComponents.TableView { width: EaStyle.Sizes.fontPixelSize * 4.5 headerText: "Solvation" enabled: model.solvation_enabled == "True" - text: (isNaN(surfactantModel.solvation)) ? '--' : surfactantModel.solvation.toFixed(2) + text: (isNaN(surfactantModel.solvation)) ? '--' : surfactantModel.solvation onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersSolvation(text) } @@ -79,7 +79,7 @@ EaComponents.TableView { width: EaStyle.Sizes.fontPixelSize * 4.0 headerText: "APM/Å2" enabled: model.apm_enabled == "True" - text: (isNaN(surfactantModel.apm)) ? '--' : surfactantModel.apm.toFixed(2) + text: (isNaN(surfactantModel.apm)) ? '--' : surfactantModel.apm onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentItemApm(text) } diff --git a/EasyReflectometryApp/Logic/Proxies/Fitter.py b/EasyReflectometryApp/Logic/Proxies/Fitter.py index 03b4b919..7a1d579a 100644 --- a/EasyReflectometryApp/Logic/Proxies/Fitter.py +++ b/EasyReflectometryApp/Logic/Proxies/Fitter.py @@ -185,6 +185,7 @@ def stop_fit(self): self._fitter_thread.stop() def _onSampleChanged(self): - self.sampleChanged.emit() + print(">>> Sample changed") + self.sampleChanged.emit() # this signal has no slots! \ No newline at end of file diff --git a/EasyReflectometryApp/Logic/Proxies/Material.py b/EasyReflectometryApp/Logic/Proxies/Material.py index 38fd527f..6e25d654 100644 --- a/EasyReflectometryApp/Logic/Proxies/Material.py +++ b/EasyReflectometryApp/Logic/Proxies/Material.py @@ -75,6 +75,7 @@ def _setMaterialsAsXml(self): """ Sets the _materials_as_xml object. """ + print(">>> _setMaterialsAsXml") self._materials_as_xml = dicttoxml(self.materialsAsObj).decode() self.materialsAsXmlChanged.emit() diff --git a/EasyReflectometryApp/Logic/Proxies/Model.py b/EasyReflectometryApp/Logic/Proxies/Model.py index defabcc8..cb9911f3 100644 --- a/EasyReflectometryApp/Logic/Proxies/Model.py +++ b/EasyReflectometryApp/Logic/Proxies/Model.py @@ -102,10 +102,10 @@ def modelColor(self): @Property(str, notify=modelsAsXmlChanged) def modelsAsXml(self): - print('>>> itemsAsXml') return self._models_as_xml def _setModelsAsXml(self): + print('>>> _setModelsAsXml') self._models_as_xml = dicttoxml(self.modelsAsObj).decode() self.modelsAsXmlChanged.emit() @@ -137,7 +137,6 @@ def itemsAsObj(self): @Property(str, notify=itemsAsXmlChanged) def itemsAsXml(self): - print('>>> itemsAsXml') return self._items_as_xml def _setItemsAsXml(self): @@ -160,7 +159,6 @@ def layersAsObj(self): @Property(str, notify=layersAsXmlChanged) def layersAsXml(self): - print('>>> layersAsXml') return self._layers_as_xml def _setLayersAsXml(self): @@ -294,19 +292,25 @@ def currentModelIndex(self): @currentModelIndex.setter def currentModelIndex(self, new_index: int): + print('>>> currentModelIndex: ', new_index) if self._current_model_index == new_index or new_index == -1: return + print('>>> currentModelIndex new_index: ', new_index) + if new_index >= len(self._model): + return self._current_model_index = new_index self._onItemsChanged() self._onLayersChanged() self.modelsNameChanged.emit() - self.parent.sampleChanged.emit() # # # # Actions # # # def _onItemsChanged(self): + print('>>> _onItemsChanged') + if self.currentModelIndex >= len(self._model): + return for i in self._model[self.currentModelIndex].structure: for j in i.layers: if i.type == 'Surfactant Layer': @@ -317,6 +321,9 @@ def _onItemsChanged(self): self._setModelsAsXml() def _onLayersChanged(self): + print('>>> _onLayersChanged') + if self.currentModelIndex >= len(self._model): + return for i in self._model[self.currentModelIndex].structure: for j in i.layers: if i.type == 'Surfactant Layer': @@ -401,6 +408,9 @@ def removeModels(self, i: str): """ self._model.remove_model(int(i)) del self._colors[int(i)] + # watch out for gremlins + if self.currentModelIndex == int(i): + self.currentModelIndex = 0 self.modelsNameChanged.emit() self.parent.sampleChanged.emit() @@ -411,6 +421,7 @@ def setCurrentModelsName(self, name): :param sld: New name :type sld: str """ + print('>>> setCurrentModelsName: ', name) if self._model[self.currentModelIndex].name == name: return self._model[self.currentModelIndex].name = name @@ -419,7 +430,9 @@ def setCurrentModelsName(self, name): @Property(str, notify=modelsNameChanged) def currentModelsName(self): - return self._model[self.currentModelIndex].name + if self.currentModelIndex >= len(self._model): + return '' + return self._model[self.currentModelIndex].name # # Items diff --git a/EasyReflectometryApp/Logic/Proxies/Simulation.py b/EasyReflectometryApp/Logic/Proxies/Simulation.py index c2f111f6..16e18824 100644 --- a/EasyReflectometryApp/Logic/Proxies/Simulation.py +++ b/EasyReflectometryApp/Logic/Proxies/Simulation.py @@ -147,9 +147,11 @@ def _setExperimentalData(self): # self.parent._project_proxy.projectInfoChanged.emit() def _onCalculatedDataChanged(self): + print('>>> _onCalculatedDataChanged') self._updateCalculatedData() def _onSimulationParametersChanged(self): + print('>>> _onSimulationParametersChanged') self.calculatedDataChanged.emit() # # # @@ -157,7 +159,7 @@ def _onSimulationParametersChanged(self): # # # def _updateCalculatedData(self): - + print('>>> _updateCalculatedData') # if not self.experimentLoaded:# and not self.experimentSkipped: # return diff --git a/EasyReflectometryApp/Logic/PyQmlProxy.py b/EasyReflectometryApp/Logic/PyQmlProxy.py index 5e54547d..981f4f76 100644 --- a/EasyReflectometryApp/Logic/PyQmlProxy.py +++ b/EasyReflectometryApp/Logic/PyQmlProxy.py @@ -64,11 +64,10 @@ def __init__(self, parent=None): self.sampleChanged.connect(self._material_proxy._setMaterialsAsXml) self.sampleChanged.connect(self._model_proxy._onLayersChanged) self.sampleChanged.connect(self._model_proxy._onItemsChanged) - self.sampleChanged.connect( - self._simulation_proxy._onSimulationParametersChanged) + self.sampleChanged.connect(self._parameter_proxy._onParametersChanged) self.layersChanged.connect(self._fitter_proxy._onSampleChanged) - self.sampleChanged.connect(self._simulation_proxy._onCalculatedDataChanged) + self.sampleChanged.connect(self._simulation_proxy._onCalculatedDataChanged) # calls _updateCalculatedData self.sampleChanged.connect(self._undoredo_proxy.undoRedoChanged) # Screen recorder From 1390393a6e841c151eb7e07c73f36541acb04849 Mon Sep 17 00:00:00 2001 From: Piotr Rozyczko Date: Tue, 30 May 2023 12:30:29 +0200 Subject: [PATCH 02/40] xmltodict -> XMLSerializer + other assorted fixes --- .../Gui/Components/AnalysisFitables.qml | 2 +- .../Gui/Components/ApplicationWindow.qml | 2 +- .../Gui/Pages/Sample/MultiLayerTable.qml | 3 +- .../Gui/Pages/Sample/SideBarAdvanced.qml | 4 +- .../Gui/Pages/Sample/SideBarBasic.qml | 8 ++-- EasyReflectometryApp/Logic/Proxies/Fitter.py | 2 - .../Logic/Proxies/Material.py | 5 +-- EasyReflectometryApp/Logic/Proxies/Model.py | 40 ++++++++++++------- .../Logic/Proxies/Parameter.py | 11 +++-- EasyReflectometryApp/Logic/Proxies/State.py | 9 ++--- EasyReflectometryApp/Logic/PyQmlProxy.py | 4 ++ 11 files changed, 52 insertions(+), 38 deletions(-) diff --git a/EasyReflectometryApp/Gui/Components/AnalysisFitables.qml b/EasyReflectometryApp/Gui/Components/AnalysisFitables.qml index 30fedc20..a5259b12 100644 --- a/EasyReflectometryApp/Gui/Components/AnalysisFitables.qml +++ b/EasyReflectometryApp/Gui/Components/AnalysisFitables.qml @@ -25,7 +25,7 @@ EaComponents.TableView { //xml: ExGlobals.Constants.proxy.fitablesListAsXml xml: ExGlobals.Constants.proxy.parameter.parametersAsXml - query: "/root/item" + query: "/data/item" XmlRole { name: "id"; query: "id/string()" } XmlRole { name: "number"; query: "number/number()" } diff --git a/EasyReflectometryApp/Gui/Components/ApplicationWindow.qml b/EasyReflectometryApp/Gui/Components/ApplicationWindow.qml index d9974502..90dbfe46 100644 --- a/EasyReflectometryApp/Gui/Components/ApplicationWindow.qml +++ b/EasyReflectometryApp/Gui/Components/ApplicationWindow.qml @@ -335,7 +335,7 @@ EaComponents.ApplicationWindow { model: XmlListModel { xml: ExGlobals.Constants.proxy.state.statusModelAsXml - query: "/root/item" + query: "/data/item" XmlRole { name: "label"; query: "label/string()" } XmlRole { name: "value"; query: "value/string()" } diff --git a/EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml b/EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml index 16fd5bf6..b59bcf63 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml @@ -17,7 +17,8 @@ EaComponents.TableView { property int layersIndex: ExGlobals.Constants.proxy.model.currentLayersIndex + 1 xml: ExGlobals.Constants.proxy.model.layersAsXml - query: `/root/item[${itemsTable.currentIndex + 1}]/layers/item` + // query: `/root/item[${itemsTable.currentIndex + 1}]/layers/item` + query: `/data/item/layers` XmlRole { name: "thick"; query: "thickness/value/number()" } XmlRole { name: "rough"; query: "roughness/value/number()" } diff --git a/EasyReflectometryApp/Gui/Pages/Sample/SideBarAdvanced.qml b/EasyReflectometryApp/Gui/Pages/Sample/SideBarAdvanced.qml index 0cc00e70..f6e770fb 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/SideBarAdvanced.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/SideBarAdvanced.qml @@ -123,7 +123,7 @@ EaComponents.SideBarColumn { textRole: ExGlobals.Variables.iconifiedNames ? "iconified_label" : "label" model: XmlListModel { xml: ExGlobals.Constants.proxy.parameter.parametersAsXml - query: "/root/item" + query: "/data/item" XmlRole { name: "label"; query: "label/string()" } onXmlChanged: dependentParCurrentIndex = dependentPar.currentIndex } @@ -160,7 +160,7 @@ EaComponents.SideBarColumn { textRole: ExGlobals.Variables.iconifiedNames ? "iconified_label" : "label" model: XmlListModel { xml: ExGlobals.Constants.proxy.parameter.parametersAsXml - query: "/root/item" + query: "/data/item" XmlRole { name: "label"; query: "label/string()" } // XmlRole { name: "iconified_label"; query: "iconified_label_with_index/string()" } onXmlChanged: independentParCurrentIndex = independentPar.currentIndex diff --git a/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml b/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml index f1f87857..5c6bc416 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml @@ -34,7 +34,7 @@ EaComponents.SideBarColumn { property int materialsIndex: ExGlobals.Constants.proxy.material.currentMaterialsIndex + 1 xml: ExGlobals.Constants.proxy.material.materialsAsXml - query: "/root/item" + query: "/data/item" XmlRole { name: "color"; query: "color/string()" } XmlRole { name: "label"; query: "name/string()" } @@ -176,7 +176,8 @@ EaComponents.SideBarColumn { // property int itemsIndex: ExGlobals.Constants.proxy.model.currentItemsIndex + 1 xml: ExGlobals.Constants.proxy.model.modelsAsXml - query: "/root/item" + // query: "/root/item" + query: "/data/item" XmlRole { name: "color"; query: "color/string()" } XmlRole { name: "label"; query: "name/string()" } @@ -292,7 +293,8 @@ EaComponents.SideBarColumn { property int itemsIndex: ExGlobals.Constants.proxy.model.currentItemsIndex + 1 xml: ExGlobals.Constants.proxy.model.itemsAsXml - query: "/root/item" + // query: "/root/item" + query: "/data/item" XmlRole { name: "label"; query: "name/string()" } XmlRole { name: "type"; query: "type/string()" } diff --git a/EasyReflectometryApp/Logic/Proxies/Fitter.py b/EasyReflectometryApp/Logic/Proxies/Fitter.py index 7a1d579a..39b38d3c 100644 --- a/EasyReflectometryApp/Logic/Proxies/Fitter.py +++ b/EasyReflectometryApp/Logic/Proxies/Fitter.py @@ -1,8 +1,6 @@ __author__ = 'github.com/arm61' import sys -from dicttoxml import dicttoxml -from distutils.util import strtobool from PySide2.QtCore import Signal, QThread, QObject, Property, Slot diff --git a/EasyReflectometryApp/Logic/Proxies/Material.py b/EasyReflectometryApp/Logic/Proxies/Material.py index 6e25d654..6d452c22 100644 --- a/EasyReflectometryApp/Logic/Proxies/Material.py +++ b/EasyReflectometryApp/Logic/Proxies/Material.py @@ -1,12 +1,11 @@ __author__ = 'github.com/arm61' -from dicttoxml import dicttoxml - from matplotlib import cm, colors from PySide2.QtCore import QObject, Signal, Property, Slot from easyCore import borg +from easyCore.Utils.io.xml import XMLSerializer from EasyReflectometry.sample.material import Material from EasyReflectometry.sample.materials import Materials @@ -76,7 +75,7 @@ def _setMaterialsAsXml(self): Sets the _materials_as_xml object. """ print(">>> _setMaterialsAsXml") - self._materials_as_xml = dicttoxml(self.materialsAsObj).decode() + self._materials_as_xml = XMLSerializer().encode({"item":self.materialsAsObj}, data_only=True) self.materialsAsXmlChanged.emit() @Property(list, notify=materialsChanged) diff --git a/EasyReflectometryApp/Logic/Proxies/Model.py b/EasyReflectometryApp/Logic/Proxies/Model.py index cb9911f3..bd689794 100644 --- a/EasyReflectometryApp/Logic/Proxies/Model.py +++ b/EasyReflectometryApp/Logic/Proxies/Model.py @@ -1,11 +1,11 @@ __author__ = 'github.com/arm61' from ast import Mult -from dicttoxml import dicttoxml from PySide2.QtCore import QObject, Signal, Property, Slot from easyCore import np, borg +from easyCore.Utils.io.xml import XMLSerializer from easyCore.Utils.UndoRedo import property_stack_deco from EasyReflectometry.sample.layer import Layer @@ -106,7 +106,7 @@ def modelsAsXml(self): def _setModelsAsXml(self): print('>>> _setModelsAsXml') - self._models_as_xml = dicttoxml(self.modelsAsObj).decode() + self._models_as_xml = XMLSerializer().encode({"item":self.modelsAsObj}, data_only=True) self.modelsAsXmlChanged.emit() @Property(list, notify=modelsNameChanged) @@ -129,6 +129,8 @@ def itemsNamesConstrain(self): @property def itemsAsObj(self): _items_as_obj = [] + if self.currentModelIndex >= len(self._model): + return [] for i in self._model[self.currentModelIndex].structure: dictionary = {'name': i.name} dictionary['type'] = i.type @@ -140,7 +142,7 @@ def itemsAsXml(self): return self._items_as_xml def _setItemsAsXml(self): - self._items_as_xml = dicttoxml(self.itemsAsObj).decode() + self._items_as_xml = XMLSerializer().encode({"item":self.itemsAsObj}, data_only=True) self.itemsAsXmlChanged.emit() @property @@ -162,7 +164,7 @@ def layersAsXml(self): return self._layers_as_xml def _setLayersAsXml(self): - self._layers_as_xml = dicttoxml(self.layersAsObj).decode() + self._layers_as_xml = XMLSerializer().encode({"item":self.layersAsObj}, data_only=True) self.layersAsXmlChanged.emit() @Property(int, notify=itemsIndexChanged) @@ -179,6 +181,8 @@ def currentItemsIndex(self, new_index: int): @Property(int, notify=modelChanged) def currentItemsRepetitions(self): + if self.currentItemsIndex >= len(self._model[self.currentModelIndex].structure): + return 1 if self._model[self.currentModelIndex].structure[ self.currentItemsIndex].type != 'Repeating Multi-layer': return 1 @@ -198,6 +202,9 @@ def currentItemsRepetitions(self, new_repetitions: int): @Property(str, notify=modelChanged) def currentItemsType(self): + # sometimes in the process of removing an item, the model is not yet updated + if self.currentItemsIndex >= len(self._model[self.currentModelIndex].structure): + return '' return self._model[self.currentModelIndex].structure[self.currentItemsIndex].type @currentItemsType.setter @@ -409,10 +416,12 @@ def removeModels(self, i: str): self._model.remove_model(int(i)) del self._colors[int(i)] # watch out for gremlins - if self.currentModelIndex == int(i): - self.currentModelIndex = 0 - self.modelsNameChanged.emit() - self.parent.sampleChanged.emit() + # if self.currentModelIndex == int(i): + # self.currentModelIndex = 0 + # Are these two really necessary? + # self.modelsNameChanged.emit() + # self.parent.sampleChanged.emit() + self.itemsNameChanged.emit() # firing _onParametersChanged @Slot(str) def setCurrentModelsName(self, name): @@ -597,7 +606,10 @@ def setCurrentItemsName(self, name): @Property(str, notify=itemsNameChanged) def currentItemsName(self): - return self._model[self.currentModelIndex].structure[self.currentItemsIndex].name + # sometimes in the process of removing an item, the model is not yet updated + if self.currentItemsIndex >= len(self._model[self.currentModelIndex].structure): + return '' + return self._model[self.currentModelIndex].structure[self.currentItemsIndex].name # # Layers @@ -710,6 +722,7 @@ def removeLayers(self, i: str): :param i: Index of the layer :type i: str """ + print(">>> Removing layer: ", i) self._model[self.currentModelIndex].structure[0].layers[0].thickness.enabled = True self._model[self.currentModelIndex].structure[0].layers[0].roughness.enabled = True self._model[self.currentModelIndex].structure[-1].layers[-1].thickness.enabled = True @@ -827,17 +840,16 @@ def currentSurfactantSolventRoughness(self, x): self._model[self.currentModelIndex].structure[self.currentItemsIndex].constrain_solvent_roughness(solvent.roughness) self.parent.layersChanged.emit() - - # # # - # Calculations + # # # + # Calculations # # # def getPureModelReflectometry(self, x): return self._pure.interface.fit_func(x, self._pure.uid) - + def getPureModelSld(self): return self._pure.interface.sld_profile(self._pure.uid) def resetModel(self): self._structure = self._defaultStructure() - self._model = Models.from_pars(self._defaultModel(structure=self._structure, interface=self.parent._interface)) \ No newline at end of file + self._model = Models.from_pars(self._defaultModel(structure=self._structure, interface=self.parent._interface)) diff --git a/EasyReflectometryApp/Logic/Proxies/Parameter.py b/EasyReflectometryApp/Logic/Proxies/Parameter.py index 70e8528d..88938686 100644 --- a/EasyReflectometryApp/Logic/Proxies/Parameter.py +++ b/EasyReflectometryApp/Logic/Proxies/Parameter.py @@ -1,11 +1,10 @@ __author__ = 'github.com/arm61' from typing import Union -from dicttoxml import dicttoxml from distutils.util import strtobool from PySide2.QtCore import QObject, Signal, Property, Slot from easyCore.Fitting.Constraints import ObjConstraint, NumericConstraint, FunctionalConstraint - +from easyCore.Utils.io.xml import XMLSerializer from easyCore import borg from easyCore import np from easyCore.Utils.classTools import generatePath @@ -88,8 +87,7 @@ def parametersAsXml(self): return self._parameters_as_xml def _setParametersAsXml(self): - self._parameters_as_xml = dicttoxml(self._parameters_as_obj, - attr_type=False).decode() + self._parameters_as_xml = XMLSerializer().encode({"item":self._parameters_as_obj}, data_only=True) self.parametersAsXmlChanged.emit() @Slot(str) @@ -279,8 +277,9 @@ def constraintsList(self): @Property(str, notify=parametersAsObjChanged) def constraintsAsXml(self): - xml = dicttoxml(self.constraintsList(), attr_type=False) - xml = xml.decode() + # xml = dicttoxml(self.constraintsList(), attr_type=False) + xml = XMLSerializer().encode({"item":self.constraintsList()}, data_only=True) + # xml = xml.decode() return xml @Slot(int) diff --git a/EasyReflectometryApp/Logic/Proxies/State.py b/EasyReflectometryApp/Logic/Proxies/State.py index 063ade84..c06b8696 100644 --- a/EasyReflectometryApp/Logic/Proxies/State.py +++ b/EasyReflectometryApp/Logic/Proxies/State.py @@ -1,11 +1,9 @@ __author__ = 'github.com/arm61' -from dicttoxml import dicttoxml - from PySide2.QtCore import QObject, Signal, Property, Slot from easyCore import np - +from easyCore.Utils.io.xml import XMLSerializer class StateProxy(QObject): @@ -64,8 +62,9 @@ def statusModelAsXml(self): "value": f'{self.parent._fitter_proxy.eFitter.easy_f.current_engine.name} ({self.parent._minimizer_proxy._current_minimizer_method_name})' }] - xml = dicttoxml(model, attr_type=False) - xml = xml.decode() + # xml = dicttoxml(model, attr_type=False) + # xml = xml.decode() + xml = XMLSerializer().encode({"item":model}, data_only=True) return xml # # # diff --git a/EasyReflectometryApp/Logic/PyQmlProxy.py b/EasyReflectometryApp/Logic/PyQmlProxy.py index 981f4f76..86f95745 100644 --- a/EasyReflectometryApp/Logic/PyQmlProxy.py +++ b/EasyReflectometryApp/Logic/PyQmlProxy.py @@ -49,9 +49,13 @@ def __init__(self, parent=None): # Sample Connections self.layersMaterialsChanged.connect(self._model_proxy._onLayersChanged) self.layersSelectionChanged.connect(self._model_proxy._onLayersChanged) + + self.layersChanged.connect(self._model_proxy._onLayersChanged) self.layersChanged.connect(self._parameter_proxy._onParametersChanged) self.layersChanged.connect(self._simulation_proxy._onCalculatedDataChanged) + + self._material_proxy.materialsChanged.connect(self._parameter_proxy._onParametersChanged) self._model_proxy.itemsNameChanged.connect(self._parameter_proxy._onParametersChanged) self.itemsChanged.connect(self._model_proxy._onItemsChanged) From 2c1e9b3ac48325f0090702b6865e92693b4aa481 Mon Sep 17 00:00:00 2001 From: Piotr Rozyczko Date: Wed, 31 May 2023 14:34:23 +0200 Subject: [PATCH 03/40] experiment-less analysis now allows for calculator change --- EasyReflectometryApp/Logic/Proxies/Calculator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EasyReflectometryApp/Logic/Proxies/Calculator.py b/EasyReflectometryApp/Logic/Proxies/Calculator.py index a6528225..6cbb6a22 100644 --- a/EasyReflectometryApp/Logic/Proxies/Calculator.py +++ b/EasyReflectometryApp/Logic/Proxies/Calculator.py @@ -35,7 +35,7 @@ def currentCalculatorIndex(self, new_index: int): return new_name = self.calculatorNames[new_index] - model = self.parent._model_proxy.currentModelIndex + model = self.parent._model_proxy._model[self.parent._model_proxy.currentModelIndex] if self.parent._data_proxy.experimentLoaded: model = self.parent._data_proxy._data[self.parent._data_proxy.currentDataIndex].model From 5c39e445deaa4f90071219d9884cb45231c71356 Mon Sep 17 00:00:00 2001 From: Piotr Rozyczko Date: Wed, 31 May 2023 15:06:08 +0200 Subject: [PATCH 04/40] Allow experiment-less projects to be loaded --- EasyReflectometryApp/Logic/Proxies/Project.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/EasyReflectometryApp/Logic/Proxies/Project.py b/EasyReflectometryApp/Logic/Proxies/Project.py index 5ba0808a..d0bb793d 100644 --- a/EasyReflectometryApp/Logic/Proxies/Project.py +++ b/EasyReflectometryApp/Logic/Proxies/Project.py @@ -237,8 +237,10 @@ def _loadProject(self): for layer in structure.layers: self.parent._material_proxy._materials.append(layer.material) model.interface = self.parent._interface - for material in Materials.from_dict(descr['materials_not_in_model']): - self.parent._material_proxy._materials.append(material) + mats = descr['materials_not_in_model'] + if mats['data']: + for material in Materials.from_dict(mats): + self.parent._material_proxy._materials.append(material) # experiment if 'experiments' in descr: From 9b966df982996e52e3e1cc00d2eceb72f57dadb5 Mon Sep 17 00:00:00 2001 From: Piotr Rozyczko Date: Tue, 6 Jun 2023 11:27:45 +0200 Subject: [PATCH 05/40] Fixed project info layout --- .../Gui/Pages/Project/MainContentDescription.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/EasyReflectometryApp/Gui/Pages/Project/MainContentDescription.qml b/EasyReflectometryApp/Gui/Pages/Project/MainContentDescription.qml index f4ace3e8..61f78ee4 100644 --- a/EasyReflectometryApp/Gui/Pages/Project/MainContentDescription.qml +++ b/EasyReflectometryApp/Gui/Pages/Project/MainContentDescription.qml @@ -52,10 +52,10 @@ Rectangle { text: ExGlobals.Constants.proxy.project.currentProjectPath } - EaElements.Label { - text: ExGlobals.Constants.proxy.project.projectInfoAsJson.samples + //EaElements.Label { + // text: ExGlobals.Constants.proxy.project.projectInfoAsJson.samples //onEditingFinished: ExGlobals.Constants.proxy.editProjectInfo("samples", text) - } + //} EaElements.Label { font.bold: true From 1d8bf807338927336a48de4e7f35b30069f760eb Mon Sep 17 00:00:00 2001 From: Piotr Rozyczko Date: Tue, 6 Jun 2023 12:06:57 +0200 Subject: [PATCH 06/40] make sure model view is updated on project reset. Normally, this would be another slot in the main proxy, but we are introducing race condition for the projectInfoChanged signal and it's better to explicitly call the updater. --- EasyReflectometryApp/Logic/Proxies/Project.py | 1 + 1 file changed, 1 insertion(+) diff --git a/EasyReflectometryApp/Logic/Proxies/Project.py b/EasyReflectometryApp/Logic/Proxies/Project.py index d0bb793d..6321808f 100644 --- a/EasyReflectometryApp/Logic/Proxies/Project.py +++ b/EasyReflectometryApp/Logic/Proxies/Project.py @@ -341,6 +341,7 @@ def saveReport(self, filepath): def resetProject(self): self._project_created = False self._project_info = self._defaultProjectInfo() + self.parent._model_proxy._setModelsAsXml() self.projectInfoChanged.emit() @Slot(str, float, float) From 42cc624b247fea914697655ca6d169850a233636 Mon Sep 17 00:00:00 2001 From: Andrew McCluskey Date: Thu, 10 Aug 2023 13:35:27 +0200 Subject: [PATCH 07/40] Update INSTALLATION.md --- INSTALLATION.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/INSTALLATION.md b/INSTALLATION.md index e0469a28..b059de0f 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -19,13 +19,13 @@ If the relevant EasyReflectometry installation does not work on your system, the git clone https://github.com/easyScience/EasyReflectometryApp ``` 3. Go to **EasyReflectometryApp** directory -4. Create virtual environment for **EasyReflectometryApp** and install its dependences using **poetry** +4. Create virtual environment for **EasyReflectometryApp** and install it and its dependences using **pip** ``` - poetry install + pip install . ``` 5. Launch **EasyReflectometry** application using **poetry** ``` - poetry run EasyReflectometry + python EasyReflectometryApp/main.py ``` -It is also possible to install [poetry within a conda](https://anaconda.org/conda-forge/poetry) environment [if you really need to](https://xkcd.com/1987/), but this is not recommended. \ No newline at end of file +It is also possible to install [poetry within a conda](https://anaconda.org/conda-forge/poetry) environment [if you really need to](https://xkcd.com/1987/), but this is not recommended. From bdbac5155b74e3afef0f20b66d49f0ed9807cf56 Mon Sep 17 00:00:00 2001 From: rozyczko Date: Mon, 14 Aug 2023 15:05:35 +0200 Subject: [PATCH 08/40] Fixed proper display of layers --- EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml | 7 +++---- EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml | 1 - EasyReflectometryApp/Logic/Proxies/Model.py | 1 - 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml b/EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml index b59bcf63..daaad653 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml @@ -17,8 +17,7 @@ EaComponents.TableView { property int layersIndex: ExGlobals.Constants.proxy.model.currentLayersIndex + 1 xml: ExGlobals.Constants.proxy.model.layersAsXml - // query: `/root/item[${itemsTable.currentIndex + 1}]/layers/item` - query: `/data/item/layers` + query: `/data/item[${itemsTable.currentIndex + 1}]/layers` XmlRole { name: "thick"; query: "thickness/value/number()" } XmlRole { name: "rough"; query: "roughness/value/number()" } @@ -60,7 +59,7 @@ EaComponents.TableView { horizontalAlignment: Text.AlignHCenter width: EaStyle.Sizes.fontPixelSize * 10.0 headerText: "Thickness/Å" - enabled: model.thick_enabled == "true" + enabled: model.thick_enabled == "True" text: (isNaN(layersModel.thick)) ? '--' : layersModel.thick.toFixed(2) onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersThickness(text) } @@ -70,7 +69,7 @@ EaComponents.TableView { horizontalAlignment: Text.AlignHCenter width: EaStyle.Sizes.fontPixelSize * 10.0 headerText: "Upper Roughness/Å" - enabled: model.rough_enabled == "true" + enabled: model.rough_enabled == "True" text: (isNaN(layersModel.rough)) ? '--' : layersModel.rough.toFixed(2) onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersRoughness(text) } diff --git a/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml b/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml index 5c6bc416..9ded876c 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml @@ -293,7 +293,6 @@ EaComponents.SideBarColumn { property int itemsIndex: ExGlobals.Constants.proxy.model.currentItemsIndex + 1 xml: ExGlobals.Constants.proxy.model.itemsAsXml - // query: "/root/item" query: "/data/item" XmlRole { name: "label"; query: "name/string()" } diff --git a/EasyReflectometryApp/Logic/Proxies/Model.py b/EasyReflectometryApp/Logic/Proxies/Model.py index bd689794..7a896730 100644 --- a/EasyReflectometryApp/Logic/Proxies/Model.py +++ b/EasyReflectometryApp/Logic/Proxies/Model.py @@ -328,7 +328,6 @@ def _onItemsChanged(self): self._setModelsAsXml() def _onLayersChanged(self): - print('>>> _onLayersChanged') if self.currentModelIndex >= len(self._model): return for i in self._model[self.currentModelIndex].structure: From 1e56b9e3790e3ca3c41a8e7e7b62394a1191d9c7 Mon Sep 17 00:00:00 2001 From: Piotr Rozyczko Date: Wed, 29 Nov 2023 08:48:00 +0100 Subject: [PATCH 09/40] Update ROADMAP.md added example project files task --- ROADMAP.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ROADMAP.md b/ROADMAP.md index e06f6c31..af009238 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -86,6 +86,8 @@ This includes adding functionality for a ORSO model definition file (to be defin Short video tutorials to accompany example projects. These can be hosted on YouTube or similar and linked to from easyreflectometry.org. +Also, create example project files based on existing notebooks. See: https://github.com/easyScience/EasyReflectometryApp/issues/159 + - [Create video tutorials to match the examples]() ### Mixed area models From cec6c96dbd0df1743bcb59eeb3509af7f954c013 Mon Sep 17 00:00:00 2001 From: rozyczko Date: Wed, 6 Dec 2023 11:09:43 +0100 Subject: [PATCH 10/40] updates after meeting with Jos --- ROADMAP.md | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index af009238..090343e7 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -7,34 +7,34 @@ Certain tasks may depend on other Easy-family projects (in particular EasyCore) ```mermaid gantt - title EasyReflectometry Roadmap Nov 2022-Jan 2027 + title EasyReflectometry Roadmap Nov 2023-Jan 2027 dateFormat YYYY-MM axisFormat %Y-%m todaymarker off section General - User experience enhancement :a1, 2022-12, 24w - Resolution smearing :a2, 2023-04, 8w - File IO :a3, after a1, 16w - Video Tutorials :a4, after d3, 16w + Improved GUI :a1, 2023-12, 24w + Resolution smearing :a2, after a1, 8w + Video Tutorials :a3, after a1, 8w + File IO :a4, after c2, 16w Ready for real users: milestone, m1, after a3, 2min section New functionality - Mixed area models :b1, after m1, 20w - ESS integration :b2, after c2, 20w - Bayesian analysis :b3, after b2, 30w - Ready for first ESS instruments :milestone, m2, after b2, 2min + Mixed area models :b1, after m1, 10w + Bayesian analysis :b3, 2025-01, 30w + ESS integration :b2, after b3, 10w + Ready for first ESS instruments :milestone, m2, 2025-11, 2min ESS Start of User Operation :milestone, m3, 2026-11, 2min section Hard Condensed Matter - Magnetism support :c1, after m1, 52w - Spin asymmetry and polarisation analysis :c2, after c1, 40w + Magnetism support :c1, after m1, 40w + Spin asymmetry and polarisation analysis :c2, after m2, 30w section Item Library - Bilayer item :d1, 2023-01, 8w - Material gradient :d2, after a2, 8w - Mixed surfactant layer :d3, after b1, 8w - Bilayer with embedded protein :d4, after c1, 16w + # Bilayer item :d1, 2024-01, 8w + Material gradient :d2, after b1, 7w + Mixed surfactant layer :d3, after d2, 8w + Bilayer with embedded protein :d4, 2025-07, 16w Mixed bilayer item :d5, after c2, 8w ``` @@ -45,15 +45,15 @@ Issues that are general to EasyReflectometry (i.e. those related to interaction ## Epics details -### User experience enhancement +### Improved GUI / User experience enhancement The aim of this epic is to improve the user experience in EasyReflectometry. Currently, there are a performance issues and user-unfriendly interfaces that should be improved. This has the additional benefit of reducing technical debt. This includes work such as improving visualisations and adding code signing. +- [Move to the new EasyApp structure](https://github.com/easyScience/EasyReflectometryApp/issues/160) - [Improve the project information page](https://github.com/easyScience/EasyReflectometryApp/issues/103) -- [Slow UI changes](https://github.com/easyScience/EasyReflectometryApp/issues/102) - [Improve constraint UI for multiple contrasts](https://github.com/easyScience/EasyReflectometryApp/issues/101) - [Plotting multiple datasets and models](https://github.com/easyScience/EasyReflectometryApp/issues/85) - [Scale and background lines break rq^4 plotting](https://github.com/easyScience/EasyReflectometryApp/issues/108) @@ -61,9 +61,7 @@ This includes work such as improving visualisations and adding code signing. - [Add examples](https://github.com/easyScience/EasyReflectometryApp/issues/77) - [Can't run installer version on linux - glibc mismatch?](https://github.com/easyScience/EasyReflectometryApp/issues/38) - [Fitter options](https://github.com/easyScience/EasyReflectometryApp/issues/32) -- [Model description in the summary page](https://github.com/easyScience/EasyReflectometryApp/issues/28) -- [Clearing the workspace doesn't reset the model name](https://github.com/easyScience/EasyReflectometryApp/issues/124) -- [Rq^4 checkbox is inverted in the Experiment pane](https://github.com/easyScience/EasyReflectometryApp/issues/125) + ### Resolution smearing From f64e4a1d704702f95ad6f6819e4ed24bf0d9dd0f Mon Sep 17 00:00:00 2001 From: rozyczko Date: Wed, 6 Dec 2023 14:12:00 +0100 Subject: [PATCH 11/40] more effort at the start of 2024 --- ROADMAP.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index 090343e7..f128fd24 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -14,10 +14,11 @@ gantt section General Improved GUI :a1, 2023-12, 24w - Resolution smearing :a2, after a1, 8w - Video Tutorials :a3, after a1, 8w + # Resolution smearing :a2, after a1, 8w + Resolution smearing :a2, 2024-01, 8w + Video Tutorials :a3, after a2, 8w File IO :a4, after c2, 16w - Ready for real users: milestone, m1, after a3, 2min + Ready for real users: milestone, m1, after a1, 2min section New functionality Mixed area models :b1, after m1, 10w From 144b1c5ed8933be16889a3f403cbac57c514db97 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Wed, 17 Jan 2024 08:34:54 +0100 Subject: [PATCH 12/40] easyreflectometrylib v0.0.3 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 50f2be8e..d0bff662 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ dependencies = [ 'darkdetect>=0.3.1', 'pyobjc-framework-cocoa>=7.1; platform_system == "Darwin"', 'matplotlib==3.4.2', - 'EasyReflectometryLib @ git+https://github.com/easyScience/EasyReflectometryLib.git@develop', + 'EasyReflectometryLib>=0.0.3', 'easyApp @ git+https://github.com/easyScience/easyApp.git@develop', 'toml>=0.10.2' ] From 1b222e8f80a3db1b50c3e9e79b3ab6f19e24c9e7 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Wed, 17 Jan 2024 10:10:40 +0100 Subject: [PATCH 13/40] use version 0.0.7-beta for development --- CHANGELOG.md | 3 +++ pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15f1c23b..f5c3ce14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # CHANGELOG +### Changes 0.0.7-beta + + ### Changes 0.0.6 - Enable plotting of reflectometry data with a logarithmic q-axes [6c26411](https://github.com/easyScience/EasyReflectometryApp/commit/6c26411c5a4d4f412ce475b16d64e0c46a040e55) diff --git a/pyproject.toml b/pyproject.toml index d0bff662..21f06f69 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "hatchling.build" # Note that while the project is called EasyReflectometryApp # the application itself is EasyReflectometry. name = "EasyReflectometry" -version = "0.0.6-beta" +version = "0.0.7-beta" description = "Making reflectometry data analysis and modelling easy." authors = [ {name = "Andrew R. McCluskey", email = "andrew.mccluskey@ess.eu"}, From 1fc33d6454e16be8a1e22671d6c3a4025267891b Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Wed, 17 Jan 2024 10:13:10 +0100 Subject: [PATCH 14/40] remove version pinning --- pyproject.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 21f06f69..0abfba0b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,7 +31,7 @@ dependencies = [ 'pyobjc-core>=7.1; platform_system == "Darwin"', 'darkdetect>=0.3.1', 'pyobjc-framework-cocoa>=7.1; platform_system == "Darwin"', - 'matplotlib==3.4.2', + 'matplotlib>=3.4.2', 'EasyReflectometryLib>=0.0.3', 'easyApp @ git+https://github.com/easyScience/easyApp.git@develop', 'toml>=0.10.2' @@ -41,17 +41,17 @@ dependencies = [ # These optional dependencies are for building the # application as a part of a Github Action. ci = [ - 'pyinstaller==4.5.1', + 'pyinstaller>=4.5.1', 'pywin32-ctypes>=0.2.0; platform_system == "win32"', 'pypiwin32>=223; platform_system == "win32"', 'pefile>=2022.5.30; platform_system == "win32"', 'dephell_licenses>=0.1.7', - 'scipy==1.6.1' + 'scipy>=1.6.1' ] docs = [ - 'sphinx==4.5.0', - 'pydata-sphinx-theme==0.4.3', - 'myst_parser==0.18.1' + 'sphinx>=4.5.0', + 'pydata-sphinx-theme>=0.4.3', + 'myst_parser>=0.18.1' ] [project.urls] From 3e85ed0f45be20667708d0ae9e7d5dc3dbc83ce1 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Wed, 17 Jan 2024 10:54:32 +0100 Subject: [PATCH 15/40] revert change --- CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5c3ce14..15f1c23b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,5 @@ # CHANGELOG -### Changes 0.0.7-beta - - ### Changes 0.0.6 - Enable plotting of reflectometry data with a logarithmic q-axes [6c26411](https://github.com/easyScience/EasyReflectometryApp/commit/6c26411c5a4d4f412ce475b16d64e0c46a040e55) From c69d97276fe78701f431d2e80e5982f266dda312 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Wed, 17 Jan 2024 12:11:11 +0100 Subject: [PATCH 16/40] require python 3.9 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0abfba0b..c12d2fe3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ classifiers = [ "Topic :: Scientific/Engineering", "Development Status :: 3 - Alpha" ] -requires-python = ">=3.8,<3.11" +requires-python = ">=3.9, <3.10" dependencies = [ 'pyobjc-core>=7.1; platform_system == "Darwin"', 'darkdetect>=0.3.1', From fa9ae47360b6bc95b27a4de7d21a2156b7b82764 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Thu, 18 Jan 2024 06:28:45 +0100 Subject: [PATCH 17/40] pinning scipy and pyinstaller to minor version --- pyproject.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index c12d2fe3..fd123210 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -28,25 +28,25 @@ classifiers = [ ] requires-python = ">=3.9, <3.10" dependencies = [ - 'pyobjc-core>=7.1; platform_system == "Darwin"', 'darkdetect>=0.3.1', - 'pyobjc-framework-cocoa>=7.1; platform_system == "Darwin"', - 'matplotlib>=3.4.2', 'EasyReflectometryLib>=0.0.3', 'easyApp @ git+https://github.com/easyScience/easyApp.git@develop', - 'toml>=0.10.2' + 'matplotlib>=3.4.2', + 'toml>=0.10.2', + 'pyobjc-core>=7.1; platform_system == "Darwin"', + 'pyobjc-framework-cocoa>=7.1; platform_system == "Darwin"' ] [project.optional-dependencies] # These optional dependencies are for building the # application as a part of a Github Action. ci = [ - 'pyinstaller>=4.5.1', + 'pyinstaller^6.3.0', + 'scipy^=1.11.4' + 'dephell_licenses>=0.1.7', 'pywin32-ctypes>=0.2.0; platform_system == "win32"', 'pypiwin32>=223; platform_system == "win32"', 'pefile>=2022.5.30; platform_system == "win32"', - 'dephell_licenses>=0.1.7', - 'scipy>=1.6.1' ] docs = [ 'sphinx>=4.5.0', From 7b17819fb4e7368f4e6d5e8a6cebabfb716e2bd4 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Thu, 18 Jan 2024 06:39:39 +0100 Subject: [PATCH 18/40] alphabetic sorting and fix syntax error --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fd123210..8e003fb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -42,16 +42,16 @@ dependencies = [ # application as a part of a Github Action. ci = [ 'pyinstaller^6.3.0', - 'scipy^=1.11.4' + 'scipy^=1.11.4', 'dephell_licenses>=0.1.7', 'pywin32-ctypes>=0.2.0; platform_system == "win32"', 'pypiwin32>=223; platform_system == "win32"', - 'pefile>=2022.5.30; platform_system == "win32"', + 'pefile>=2022.5.30; platform_system == "win32"' ] docs = [ - 'sphinx>=4.5.0', - 'pydata-sphinx-theme>=0.4.3', 'myst_parser>=0.18.1' + 'pydata-sphinx-theme>=0.4.3', + 'sphinx>=4.5.0', ] [project.urls] From 04b372eca525a28b2e31797e013d145ce230f9ec Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Thu, 18 Jan 2024 06:51:09 +0100 Subject: [PATCH 19/40] version pinning syntax --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8e003fb1..b9ea7586 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,17 +41,17 @@ dependencies = [ # These optional dependencies are for building the # application as a part of a Github Action. ci = [ - 'pyinstaller^6.3.0', - 'scipy^=1.11.4', + 'pyinstaller==6.3.*', + 'scipy==1.11.*', 'dephell_licenses>=0.1.7', 'pywin32-ctypes>=0.2.0; platform_system == "win32"', 'pypiwin32>=223; platform_system == "win32"', 'pefile>=2022.5.30; platform_system == "win32"' ] docs = [ - 'myst_parser>=0.18.1' + 'myst_parser>=0.18.1', 'pydata-sphinx-theme>=0.4.3', - 'sphinx>=4.5.0', + 'sphinx>=4.5.0' ] [project.urls] From 64043c016e3b8191e11cf878c28244def2730948 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Tue, 30 Jan 2024 11:49:21 +0100 Subject: [PATCH 20/40] updating version to new dev cycle --- CHANGELOG.md | 2 ++ pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d09e42a5..eff1a2b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # CHANGELOG +### Changes 0.0.8 + ### Changes 0.0.7 - No end-user related changes diff --git a/pyproject.toml b/pyproject.toml index b9ea7586..ff69c16d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "hatchling.build" # Note that while the project is called EasyReflectometryApp # the application itself is EasyReflectometry. name = "EasyReflectometry" -version = "0.0.7-beta" +version = "0.0.8-dev" description = "Making reflectometry data analysis and modelling easy." authors = [ {name = "Andrew R. McCluskey", email = "andrew.mccluskey@ess.eu"}, From 905c42b61f0e29c9733f5f7645c7c3efc122cbb9 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Sat, 10 Feb 2024 11:55:53 +0100 Subject: [PATCH 21/40] moved layer specifc gui part to dir --- .../Pages/Sample/Layers/MultilayerGroup.qml | 71 ++++++++ .../Gui/Pages/Sample/Layers/MultilayerRow.qml | 44 +++++ .../MultilayerTable.qml} | 0 .../Layers/RepeatingMultilayerGroup.qml | 90 ++++++++++ .../Pages/Sample/Layers/SurfactantGroup.qml | 162 ++++++++++++++++++ .../Gui/Pages/Sample/Layers/qmldir | 7 + .../Gui/Pages/Sample/SideBarBasic.qml | 103 ++--------- .../Gui/Pages/Sample/SurfactantGroup.qml | 53 ------ .../Gui/Pages/Sample/SurfactantTable.qml | 108 ------------ EasyReflectometryApp/Gui/Pages/Sample/qmldir | 3 - 10 files changed, 384 insertions(+), 257 deletions(-) create mode 100644 EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml create mode 100644 EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerRow.qml rename EasyReflectometryApp/Gui/Pages/Sample/{MultiLayerTable.qml => Layers/MultilayerTable.qml} (100%) create mode 100644 EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml create mode 100644 EasyReflectometryApp/Gui/Pages/Sample/Layers/SurfactantGroup.qml create mode 100644 EasyReflectometryApp/Gui/Pages/Sample/Layers/qmldir delete mode 100644 EasyReflectometryApp/Gui/Pages/Sample/SurfactantGroup.qml delete mode 100644 EasyReflectometryApp/Gui/Pages/Sample/SurfactantTable.qml diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml new file mode 100644 index 00000000..e321a342 --- /dev/null +++ b/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml @@ -0,0 +1,71 @@ +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Dialogs 1.3 as Dialogs1 +import QtQuick.XmlListModel 2.13 + +// import easyApp.Gui.Globals 1.0 as EaGlobals +// import easyApp.Gui.Style 1.0 as EaStyle +import easyApp.Gui.Elements 1.0 as EaElements +// import easyApp.Gui.Components 1.0 as EaComponents +// import easyApp.Gui.Logic 1.0 as EaLogic + +import Gui.Globals 1.0 as ExGlobals +// import Gui.Components 1.0 as ExComponents +// import Gui.Pages.Sample 1.0 as ExSample +import Gui.Pages.Sample.Layers 1.0 as ExLayers + +EaElements.GroupBox { + // When an item in the above table is selected, this box will become enabled. + // Allowing different parameters and layers to be defined for the item. + id: multilayerGroup + title: qsTr(ExGlobals.Constants.proxy.model.currentItemsName + " editor") + enabled: (itemsTable.model.count > 0) ? true : false //When a layer is selected + collapsible: false + last: true + + ExLayers.MultilayerTable{ + id: layersTable + } + + ExLayers.MultilayerRow{ + id: layersRow + } + + + // Row { + // // visible: (currentItemsType == 'Repeating Multi-layer') || (currentItemsType == 'Multi-layer') ? true : false + // spacing: EaStyle.Sizes.fontPixelSize + + // EaElements.SideBarButton { + // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 + // enabled: true + // fontIcon: "plus-circle" + // text: qsTr("Add layer") + // onClicked: ExGlobals.Constants.proxy.model.addNewLayers() + // } + + // EaElements.SideBarButton { + // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 + // enabled: (layersTable.model.count > 0) ? true : false //when item is selected + // fontIcon: "clone" + // text: qsTr("Duplicate layer") + // onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers() + // } + + // EaElements.SideBarButton { + // width: EaStyle.Sizes.tableRowHeight + // enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected + // fontIcon: "arrow-up" + // ToolTip.text: qsTr("Move layer up") + // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp() + // } + + // EaElements.SideBarButton { + // width: EaStyle.Sizes.tableRowHeight + // enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false + // fontIcon: "arrow-down" + // ToolTip.text: qsTr("Move layer down") + // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown() + // } + // } +} \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerRow.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerRow.qml new file mode 100644 index 00000000..bb2f5eed --- /dev/null +++ b/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerRow.qml @@ -0,0 +1,44 @@ +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.XmlListModel 2.13 + +import easyApp.Gui.Elements 1.0 as EaElements +import easyApp.Gui.Style 1.0 as EaStyle + +import Gui.Globals 1.0 as ExGlobals + +Row { + spacing: EaStyle.Sizes.fontPixelSize + + EaElements.SideBarButton { + width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 + enabled: true + fontIcon: "plus-circle" + text: qsTr("Add layer") + onClicked: ExGlobals.Constants.proxy.model.addNewLayers() + } + + EaElements.SideBarButton { + width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 + enabled: (layersTable.model.count > 0) ? true : false //when item is selected + fontIcon: "clone" + text: qsTr("Duplicate layer") + onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers() + } + + EaElements.SideBarButton { + width: EaStyle.Sizes.tableRowHeight + enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected + fontIcon: "arrow-up" + ToolTip.text: qsTr("Move layer up") + onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp() + } + + EaElements.SideBarButton { + width: EaStyle.Sizes.tableRowHeight + enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false + fontIcon: "arrow-down" + ToolTip.text: qsTr("Move layer down") + onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown() + } +} \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerTable.qml similarity index 100% rename from EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml rename to EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerTable.qml diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml new file mode 100644 index 00000000..8be72b77 --- /dev/null +++ b/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml @@ -0,0 +1,90 @@ +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.Dialogs 1.3 as Dialogs1 +import QtQuick.XmlListModel 2.13 + +// import easyApp.Gui.Globals 1.0 as EaGlobals +import easyApp.Gui.Style 1.0 as EaStyle +import easyApp.Gui.Elements 1.0 as EaElements +import easyApp.Gui.Components 1.0 as EaComponents +// import easyApp.Gui.Logic 1.0 as EaLogic + +import Gui.Globals 1.0 as ExGlobals +// import Gui.Components 1.0 as ExComponents +// import Gui.Pages.Sample 1.0 as ExSample +import Gui.Pages.Sample.Layers 1.0 as ExLayers + +EaElements.GroupBox { + id: repeatingMultilayerGroup + title: qsTr(ExGlobals.Constants.proxy.model.currentItemsName + " editor") + enabled: (itemsTable.model.count > 0) ? true : false //When a layer is selected + collapsible: false + last: true + Row { + // visible: (currentItemsType == 'Repeating Multi-layer') ? true : false + spacing: EaStyle.Sizes.fontPixelSize * 0.5 + + // This integer defines how many repetitions of the layer structure should be + // used. + EaComponents.TableViewLabel{ + horizontalAlignment: Text.AlignRight + width: labelWidth() * 2.1 + ToolTip.text: qsTr("To create some repeating multilayer structure") + text: qsTr("Number of repetitions:") + } + EaElements.SpinBox { + id: repsSpinBox + editable: true + from: 1 + to: 9999 + value: ExGlobals.Constants.proxy.model.currentItemsRepetitions + onValueChanged: { + ExGlobals.Constants.proxy.model.currentItemsRepetitions = value + } + } + } + + ExLayers.MultilayerTable{ + id: layersTable + } + + ExLayers.MultilayerRow{ + id: layersRow + } + + // Row { + // spacing: EaStyle.Sizes.fontPixelSize + + // EaElements.SideBarButton { + // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 + // enabled: true + // fontIcon: "plus-circle" + // text: qsTr("Add layer") + // onClicked: ExGlobals.Constants.proxy.model.addNewLayers() + // } + + // EaElements.SideBarButton { + // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 + // enabled: (layersTable.model.count > 0) ? true : false //when item is selected + // fontIcon: "clone" + // text: qsTr("Duplicate layer") + // onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers() + // } + + // EaElements.SideBarButton { + // width: EaStyle.Sizes.tableRowHeight + // enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected + // fontIcon: "arrow-up" + // ToolTip.text: qsTr("Move layer up") + // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp() + // } + + // EaElements.SideBarButton { + // width: EaStyle.Sizes.tableRowHeight + // enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false + // fontIcon: "arrow-down" + // ToolTip.text: qsTr("Move layer down") + // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown() + // } + // } +} \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/SurfactantGroup.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/SurfactantGroup.qml new file mode 100644 index 00000000..b33e9059 --- /dev/null +++ b/EasyReflectometryApp/Gui/Pages/Sample/Layers/SurfactantGroup.qml @@ -0,0 +1,162 @@ +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.XmlListModel 2.13 + +import easyApp.Gui.Components 1.0 as EaComponents +import easyApp.Gui.Elements 1.0 as EaElements +import easyApp.Gui.Style 1.0 as EaStyle + +import Gui.Globals 1.0 as ExGlobals + + +EaElements.GroupBox { + id: surfactantGroup + title: qsTr(ExGlobals.Constants.proxy.model.currentItemsName + " editor") + enabled: (itemsTable.model.count > 0) ? true : false //When a layer is selected + collapsible: false + last: true + + EaComponents.TableView { + id: surfactantTable + + // Table model + + model: XmlListModel { + property int layersIndex: ExGlobals.Constants.proxy.model.currentLayersIndex + 1 + + xml: ExGlobals.Constants.proxy.model.layersAsXml + query: `/root/item[${itemsTable.currentIndex + 1}]/layers/item` + + XmlRole { name: "formula"; query: "chemical_structure/string()" } + XmlRole { name: "thick"; query: "thickness/value/number()" } + XmlRole { name: "thick_enabled"; query: "thickness/enabled/string()" } + XmlRole { name: "rough"; query: "roughness/value/number()" } + XmlRole { name: "rough_enabled"; query: "roughness/enabled/string()" } + XmlRole { name: "apm"; query: "area_per_molecule/value/number()" } + XmlRole { name: "apm_enabled"; query: "area_per_molecule/enabled/string()" } + XmlRole { name: "solvation"; query: "solvation/value/number()" } + XmlRole { name: "solvation_enabled"; query: "solvation/enabled/string()" } + XmlRole { name: "solvent"; query: "solvent/name/string()"} + } + + // Table rows + + delegate: EaComponents.TableViewDelegate { + property var surfactantModel: model + + EaComponents.TableViewTextInput { + horizontalAlignment: Text.AlignHCenter + width: EaStyle.Sizes.sideBarContentWidth - (thickLabel.width + roughLabel.width + solvLabel.width + apmLabel.width + solvMatLabel.width + 6 * EaStyle.Sizes.tableColumnSpacing) + headerText: "Formula" + text: surfactantModel.formula + onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersChemStructure(text) + } + + EaComponents.TableViewTextInput { + id: thickLabel + horizontalAlignment: Text.AlignHCenter + width: EaStyle.Sizes.fontPixelSize * 5.5 + headerText: "Thickness/Å" + enabled: model.thick_enabled == "True" + text: (isNaN(surfactantModel.thick)) ? '--' : surfactantModel.thick.toFixed(2) + onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersThickness(text) + } + + EaComponents.TableViewTextInput { + id: roughLabel + horizontalAlignment: Text.AlignHCenter + width: EaStyle.Sizes.fontPixelSize * 6.0 + headerText: "Roughness/Å" + enabled: model.rough_enabled == "True" + text: (isNaN(surfactantModel.rough)) ? '--' : surfactantModel.rough.toFixed(2) + onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersRoughness(text) + } + + EaComponents.TableViewTextInput { + id: solvLabel + horizontalAlignment: Text.AlignHCenter + width: EaStyle.Sizes.fontPixelSize * 4.5 + headerText: "Solvation" + enabled: model.solvation_enabled == "True" + text: (isNaN(surfactantModel.solvation)) ? '--' : surfactantModel.solvation + onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersSolvation(text) + } + + EaComponents.TableViewTextInput { + id: apmLabel + horizontalAlignment: Text.AlignHCenter + width: EaStyle.Sizes.fontPixelSize * 4.0 + headerText: "APM/Å2" + enabled: model.apm_enabled == "True" + text: (isNaN(surfactantModel.apm)) ? '--' : surfactantModel.apm + onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentItemApm(text) + } + + EaComponents.TableViewComboBox{ + id: solvMatLabel + horizontalAlignment: Text.AlignLeft + width: EaStyle.Sizes.fontPixelSize * 6.5 + headerText: "Solvent" + onActivated: { + ExGlobals.Constants.proxy.model.setCurrentLayersSolvent(currentIndex) + } + model: ExGlobals.Constants.proxy.material.materialsName + onModelChanged: { + currentIndex = indexOfValue(surfactantModel.solvent) + } + Component.onCompleted: { + currentIndex = indexOfValue(surfactantModel.solvent) + } + } + } + + onCurrentIndexChanged: { + ExGlobals.Constants.proxy.model.currentLayersIndex = surfactantTable.currentIndex + } + + } + + EaElements.GroupBox { + spacing: EaStyle.Sizes.fontPixelSize * 0.5 + collapsible: true + collapsed: true + + title: qsTr('Chemical Constraints') + Row { + EaElements.CheckBox { + checked: false + id: apm_check + text: qsTr("Area-per-molecule") + ToolTip.text: qsTr("Checking this box will ensure that the area-per-molecule of the head and tail layers is the same") + onCheckedChanged: ExGlobals.Constants.proxy.model.constrainApm = checked + } + EaElements.CheckBox { + checked: false + id: conformal + text: qsTr("Conformal roughness") + ToolTip.text: qsTr("Checking this box will ensure that the interfacial roughness is the same for all interfaces of the surfactant") + onCheckedChanged: ExGlobals.Constants.proxy.model.conformalRoughness = checked + } + } + + Row { + EaElements.CheckBox { + checked: false + id: solvent_rough + text: qsTr("Constrain roughness to item") + enabled: conformal.checked + ToolTip.text: qsTr("Checking this box allows another item to be selected and the conformal roughness will be constrained to this") + onCheckedChanged: checked ? ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(solvent_rough_item.currentText) : ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(null) + } + EaElements.ComboBox { + id: solvent_rough_item + enabled: solvent_rough.checked + onActivated: { + ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(null) + ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(currentText) + } + model: ExGlobals.Constants.proxy.model.itemsNamesConstrain + } + } + } +} \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/qmldir b/EasyReflectometryApp/Gui/Pages/Sample/Layers/qmldir new file mode 100644 index 00000000..63f11082 --- /dev/null +++ b/EasyReflectometryApp/Gui/Pages/Sample/Layers/qmldir @@ -0,0 +1,7 @@ +module Layers + +MultilayerGroup 1.0 MultilayerGroup.qml +MultilayerTable 1.0 MultilayerTable.qml +MultilayerRow 1.0 MultilayerRow.qml +RepeatingMultilayerGroup 1.0 RepeatingMultilayerGroup.qml +SurfactantGroup 1.0 SurfactantGroup.qml diff --git a/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml b/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml index 9ded876c..84decf39 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml @@ -12,6 +12,7 @@ import easyApp.Gui.Logic 1.0 as EaLogic import Gui.Globals 1.0 as ExGlobals import Gui.Components 1.0 as ExComponents import Gui.Pages.Sample 1.0 as ExSample +import Gui.Pages.Sample.Layers 1.0 as ExLayers EaComponents.SideBarColumn { @@ -416,103 +417,19 @@ EaComponents.SideBarColumn { }*/ } - EaElements.GroupBox { - // When an item in the above table is selected, this box will become enabled. - // Allowing different parameters and layers to be defined for the item. - id: layersGroup - title: qsTr(ExGlobals.Constants.proxy.model.currentItemsName + " editor") - enabled: (itemsTable.model.count > 0) ? true : false //When a layer is selected - collapsible: false - last: true - Row { - visible: (currentItemsType == 'Repeating Multi-layer') ? true : false - spacing: EaStyle.Sizes.fontPixelSize * 0.5 - - // This integer defines how many repetitions of the layer structure should be - // used. - EaComponents.TableViewLabel{ - horizontalAlignment: Text.AlignRight - width: labelWidth() * 2.1 - ToolTip.text: qsTr("To create some repeating multilayer structure") - text: qsTr("Number of repetitions:") - } - EaElements.SpinBox { - id: repsSpinBox - editable: true - from: 1 - to: 9999 - value: ExGlobals.Constants.proxy.model.currentItemsRepetitions - onValueChanged: { - ExGlobals.Constants.proxy.model.currentItemsRepetitions = value - } - } - } - ExSample.SurfactantTable{ - id: surfactantTable - visible: (currentItemsType == 'Surfactant Layer') ? true : false - } - - ExSample.SurfactantGroup{ - visible: (currentItemsType == 'Surfactant Layer') ? true : false - } - - ExSample.MultiLayerTable{ - id: layersTable - visible: (currentItemsType == 'Repeating Multi-layer') || (currentItemsType == 'Multi-layer') ? true : false - } - - Row { - visible: (currentItemsType == 'Repeating Multi-layer') || (currentItemsType == 'Multi-layer') ? true : false - spacing: EaStyle.Sizes.fontPixelSize - - EaElements.SideBarButton { - width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 - enabled: true - fontIcon: "plus-circle" - text: qsTr("Add layer") - onClicked: ExGlobals.Constants.proxy.model.addNewLayers() - } - - EaElements.SideBarButton { - width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 - enabled: (layersTable.model.count > 0) ? true : false //when item is selected - fontIcon: "clone" - text: qsTr("Duplicate layer") - onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers() - } - - EaElements.SideBarButton { - width: EaStyle.Sizes.tableRowHeight - enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected - fontIcon: "arrow-up" - ToolTip.text: qsTr("Move layer up") - onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp() - } - - EaElements.SideBarButton { - width: EaStyle.Sizes.tableRowHeight - enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false - fontIcon: "arrow-down" - ToolTip.text: qsTr("Move layer down") - onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown() - } - } - - /*Row { - spacing: EaStyle.Sizes.fontPixelSize + ExLayers.MultilayerGroup { + visible: (currentItemsType == 'Multi-layer') ? true : false + } - EaElements.SideBarButton { - // In future this button will allow the use of custom (python) components. - // This will require a flexible table structure above I think and may not be - // possible. - enabled: false //not yet implemented - fontIcon: "puzzle-piece" - text: qsTr("Add a custom component") - } - }*/ + ExLayers.RepeatingMultilayerGroup { + visible: (currentItemsType == 'Repeating Multi-layer') ? true : false + } + ExLayers.SurfactantGroup { + visible: (currentItemsType == 'Surfactant Layer') ? true : false } + // Logic function labelWidth() { diff --git a/EasyReflectometryApp/Gui/Pages/Sample/SurfactantGroup.qml b/EasyReflectometryApp/Gui/Pages/Sample/SurfactantGroup.qml deleted file mode 100644 index a6fda6cd..00000000 --- a/EasyReflectometryApp/Gui/Pages/Sample/SurfactantGroup.qml +++ /dev/null @@ -1,53 +0,0 @@ -import QtQuick 2.14 -import QtQuick.Controls 2.14 -import QtQuick.XmlListModel 2.13 - -import easyApp.Gui.Components 1.0 as EaComponents -import easyApp.Gui.Elements 1.0 as EaElements -import easyApp.Gui.Style 1.0 as EaStyle - -import Gui.Globals 1.0 as ExGlobals - -EaElements.GroupBox { - spacing: EaStyle.Sizes.fontPixelSize * 0.5 - collapsible: true - collapsed: true - - title: qsTr('Chemical Constraints') - Row { - EaElements.CheckBox { - checked: false - id: apm_check - text: qsTr("Area-per-molecule") - ToolTip.text: qsTr("Checking this box will ensure that the area-per-molecule of the head and tail layers is the same") - onCheckedChanged: ExGlobals.Constants.proxy.model.constrainApm = checked - } - EaElements.CheckBox { - checked: false - id: conformal - text: qsTr("Conformal roughness") - ToolTip.text: qsTr("Checking this box will ensure that the interfacial roughness is the same for all interfaces of the surfactant") - onCheckedChanged: ExGlobals.Constants.proxy.model.conformalRoughness = checked - } - } - - Row { - EaElements.CheckBox { - checked: false - id: solvent_rough - text: qsTr("Constrain roughness to item") - enabled: conformal.checked - ToolTip.text: qsTr("Checking this box allows another item to be selected and the conformal roughness will be constrained to this") - onCheckedChanged: checked ? ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(solvent_rough_item.currentText) : ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(null) - } - EaElements.ComboBox { - id: solvent_rough_item - enabled: solvent_rough.checked - onActivated: { - ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(null) - ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(currentText) - } - model: ExGlobals.Constants.proxy.model.itemsNamesConstrain - } - } -} \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/SurfactantTable.qml b/EasyReflectometryApp/Gui/Pages/Sample/SurfactantTable.qml deleted file mode 100644 index 0b82ee4e..00000000 --- a/EasyReflectometryApp/Gui/Pages/Sample/SurfactantTable.qml +++ /dev/null @@ -1,108 +0,0 @@ -import QtQuick 2.14 -import QtQuick.Controls 2.14 -import QtQuick.XmlListModel 2.13 - -import easyApp.Gui.Components 1.0 as EaComponents -import easyApp.Gui.Style 1.0 as EaStyle - -import Gui.Globals 1.0 as ExGlobals - -EaComponents.TableView { - id: surfactantTable - - // Table model - - model: XmlListModel { - property int layersIndex: ExGlobals.Constants.proxy.model.currentLayersIndex + 1 - - xml: ExGlobals.Constants.proxy.model.layersAsXml - query: `/root/item[${itemsTable.currentIndex + 1}]/layers/item` - - XmlRole { name: "formula"; query: "chemical_structure/string()" } - XmlRole { name: "thick"; query: "thickness/value/number()" } - XmlRole { name: "thick_enabled"; query: "thickness/enabled/string()" } - XmlRole { name: "rough"; query: "roughness/value/number()" } - XmlRole { name: "rough_enabled"; query: "roughness/enabled/string()" } - XmlRole { name: "apm"; query: "area_per_molecule/value/number()" } - XmlRole { name: "apm_enabled"; query: "area_per_molecule/enabled/string()" } - XmlRole { name: "solvation"; query: "solvation/value/number()" } - XmlRole { name: "solvation_enabled"; query: "solvation/enabled/string()" } - XmlRole { name: "solvent"; query: "solvent/name/string()"} - } - - // Table rows - - delegate: EaComponents.TableViewDelegate { - property var surfactantModel: model - - EaComponents.TableViewTextInput { - horizontalAlignment: Text.AlignHCenter - width: EaStyle.Sizes.sideBarContentWidth - (thickLabel.width + roughLabel.width + solvLabel.width + apmLabel.width + solvMatLabel.width + 6 * EaStyle.Sizes.tableColumnSpacing) - headerText: "Formula" - text: surfactantModel.formula - onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersChemStructure(text) - } - - EaComponents.TableViewTextInput { - id: thickLabel - horizontalAlignment: Text.AlignHCenter - width: EaStyle.Sizes.fontPixelSize * 5.5 - headerText: "Thickness/Å" - enabled: model.thick_enabled == "True" - text: (isNaN(surfactantModel.thick)) ? '--' : surfactantModel.thick.toFixed(2) - onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersThickness(text) - } - - EaComponents.TableViewTextInput { - id: roughLabel - horizontalAlignment: Text.AlignHCenter - width: EaStyle.Sizes.fontPixelSize * 6.0 - headerText: "Roughness/Å" - enabled: model.rough_enabled == "True" - text: (isNaN(surfactantModel.rough)) ? '--' : surfactantModel.rough.toFixed(2) - onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersRoughness(text) - } - - EaComponents.TableViewTextInput { - id: solvLabel - horizontalAlignment: Text.AlignHCenter - width: EaStyle.Sizes.fontPixelSize * 4.5 - headerText: "Solvation" - enabled: model.solvation_enabled == "True" - text: (isNaN(surfactantModel.solvation)) ? '--' : surfactantModel.solvation - onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersSolvation(text) - } - - EaComponents.TableViewTextInput { - id: apmLabel - horizontalAlignment: Text.AlignHCenter - width: EaStyle.Sizes.fontPixelSize * 4.0 - headerText: "APM/Å2" - enabled: model.apm_enabled == "True" - text: (isNaN(surfactantModel.apm)) ? '--' : surfactantModel.apm - onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentItemApm(text) - } - - EaComponents.TableViewComboBox{ - id: solvMatLabel - horizontalAlignment: Text.AlignLeft - width: EaStyle.Sizes.fontPixelSize * 6.5 - headerText: "Solvent" - onActivated: { - ExGlobals.Constants.proxy.model.setCurrentLayersSolvent(currentIndex) - } - model: ExGlobals.Constants.proxy.material.materialsName - onModelChanged: { - currentIndex = indexOfValue(surfactantModel.solvent) - } - Component.onCompleted: { - currentIndex = indexOfValue(surfactantModel.solvent) - } - } - } - - onCurrentIndexChanged: { - ExGlobals.Constants.proxy.model.currentLayersIndex = surfactantTable.currentIndex - } - -} \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/qmldir b/EasyReflectometryApp/Gui/Pages/Sample/qmldir index e21be421..969175d1 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/qmldir +++ b/EasyReflectometryApp/Gui/Pages/Sample/qmldir @@ -4,6 +4,3 @@ MainContentModelView 1.0 MainContentModelView.qml SideBarAdvanced 1.0 SideBarAdvanced.qml SideBarBasic 1.0 SideBarBasic.qml -MultiLayerTable 1.0 MultiLayerTable.qml -SurfactantTable 1.0 SurfactantTable.qml -SurfactantGroup 1.0 SurfactantGroup.qml \ No newline at end of file From 475d5efb0966f01e495f85a090ce0a3ca24414f1 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Sat, 10 Feb 2024 16:58:57 +0100 Subject: [PATCH 22/40] code cleaning --- .../Pages/Sample/Layers/MultilayerGroup.qml | 46 ------------------- .../Layers/RepeatingMultilayerGroup.qml | 43 ----------------- .../Gui/Pages/Sample/SideBarBasic.qml | 10 ++-- 3 files changed, 3 insertions(+), 96 deletions(-) diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml index e321a342..fffb06e2 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml @@ -3,15 +3,9 @@ import QtQuick.Controls 2.14 import QtQuick.Dialogs 1.3 as Dialogs1 import QtQuick.XmlListModel 2.13 -// import easyApp.Gui.Globals 1.0 as EaGlobals -// import easyApp.Gui.Style 1.0 as EaStyle import easyApp.Gui.Elements 1.0 as EaElements -// import easyApp.Gui.Components 1.0 as EaComponents -// import easyApp.Gui.Logic 1.0 as EaLogic import Gui.Globals 1.0 as ExGlobals -// import Gui.Components 1.0 as ExComponents -// import Gui.Pages.Sample 1.0 as ExSample import Gui.Pages.Sample.Layers 1.0 as ExLayers EaElements.GroupBox { @@ -24,48 +18,8 @@ EaElements.GroupBox { last: true ExLayers.MultilayerTable{ - id: layersTable } ExLayers.MultilayerRow{ - id: layersRow } - - - // Row { - // // visible: (currentItemsType == 'Repeating Multi-layer') || (currentItemsType == 'Multi-layer') ? true : false - // spacing: EaStyle.Sizes.fontPixelSize - - // EaElements.SideBarButton { - // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 - // enabled: true - // fontIcon: "plus-circle" - // text: qsTr("Add layer") - // onClicked: ExGlobals.Constants.proxy.model.addNewLayers() - // } - - // EaElements.SideBarButton { - // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 - // enabled: (layersTable.model.count > 0) ? true : false //when item is selected - // fontIcon: "clone" - // text: qsTr("Duplicate layer") - // onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers() - // } - - // EaElements.SideBarButton { - // width: EaStyle.Sizes.tableRowHeight - // enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected - // fontIcon: "arrow-up" - // ToolTip.text: qsTr("Move layer up") - // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp() - // } - - // EaElements.SideBarButton { - // width: EaStyle.Sizes.tableRowHeight - // enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false - // fontIcon: "arrow-down" - // ToolTip.text: qsTr("Move layer down") - // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown() - // } - // } } \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml index 8be72b77..00582aa7 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml @@ -3,15 +3,11 @@ import QtQuick.Controls 2.14 import QtQuick.Dialogs 1.3 as Dialogs1 import QtQuick.XmlListModel 2.13 -// import easyApp.Gui.Globals 1.0 as EaGlobals import easyApp.Gui.Style 1.0 as EaStyle import easyApp.Gui.Elements 1.0 as EaElements import easyApp.Gui.Components 1.0 as EaComponents -// import easyApp.Gui.Logic 1.0 as EaLogic import Gui.Globals 1.0 as ExGlobals -// import Gui.Components 1.0 as ExComponents -// import Gui.Pages.Sample 1.0 as ExSample import Gui.Pages.Sample.Layers 1.0 as ExLayers EaElements.GroupBox { @@ -21,7 +17,6 @@ EaElements.GroupBox { collapsible: false last: true Row { - // visible: (currentItemsType == 'Repeating Multi-layer') ? true : false spacing: EaStyle.Sizes.fontPixelSize * 0.5 // This integer defines how many repetitions of the layer structure should be @@ -45,46 +40,8 @@ EaElements.GroupBox { } ExLayers.MultilayerTable{ - id: layersTable } ExLayers.MultilayerRow{ - id: layersRow } - - // Row { - // spacing: EaStyle.Sizes.fontPixelSize - - // EaElements.SideBarButton { - // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 - // enabled: true - // fontIcon: "plus-circle" - // text: qsTr("Add layer") - // onClicked: ExGlobals.Constants.proxy.model.addNewLayers() - // } - - // EaElements.SideBarButton { - // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 - // enabled: (layersTable.model.count > 0) ? true : false //when item is selected - // fontIcon: "clone" - // text: qsTr("Duplicate layer") - // onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers() - // } - - // EaElements.SideBarButton { - // width: EaStyle.Sizes.tableRowHeight - // enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected - // fontIcon: "arrow-up" - // ToolTip.text: qsTr("Move layer up") - // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp() - // } - - // EaElements.SideBarButton { - // width: EaStyle.Sizes.tableRowHeight - // enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false - // fontIcon: "arrow-down" - // ToolTip.text: qsTr("Move layer down") - // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown() - // } - // } } \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml b/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml index 84decf39..7e30fb0c 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml @@ -3,15 +3,11 @@ import QtQuick.Controls 2.14 import QtQuick.Dialogs 1.3 as Dialogs1 import QtQuick.XmlListModel 2.13 -import easyApp.Gui.Globals 1.0 as EaGlobals import easyApp.Gui.Style 1.0 as EaStyle import easyApp.Gui.Elements 1.0 as EaElements import easyApp.Gui.Components 1.0 as EaComponents -import easyApp.Gui.Logic 1.0 as EaLogic import Gui.Globals 1.0 as ExGlobals -import Gui.Components 1.0 as ExComponents -import Gui.Pages.Sample 1.0 as ExSample import Gui.Pages.Sample.Layers 1.0 as ExLayers EaComponents.SideBarColumn { @@ -226,7 +222,7 @@ EaComponents.SideBarColumn { ExGlobals.Constants.proxy.model.currentModelIndex = modelTable.currentIndex itemsTable.currentIndex = 0 layersTable.currentIndex = 0 - } + } } Row { spacing: EaStyle.Sizes.fontPixelSize @@ -349,7 +345,7 @@ EaComponents.SideBarColumn { onCurrentIndexChanged: { ExGlobals.Constants.proxy.model.currentItemsIndex = itemsTable.currentIndex currentItemsType = ExGlobals.Constants.proxy.model.currentItemsType - repsSpinBox.value = ExGlobals.Constants.proxy.model.currentItemsRepetitions +repsSpinBox.value = ExGlobals.Constants.proxy.model.currentItemsRepetitions } onModelChanged: currentIndex = 0 @@ -423,7 +419,7 @@ EaComponents.SideBarColumn { ExLayers.RepeatingMultilayerGroup { visible: (currentItemsType == 'Repeating Multi-layer') ? true : false - } + } ExLayers.SurfactantGroup { visible: (currentItemsType == 'Surfactant Layer') ? true : false From 693be26afee371afe5afe4f604658da2f4b8234d Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Sat, 10 Feb 2024 17:04:05 +0100 Subject: [PATCH 23/40] Revert "code cleaning" This reverts commit 475d5efb0966f01e495f85a090ce0a3ca24414f1. --- .../Pages/Sample/Layers/MultilayerGroup.qml | 46 +++++++++++++++++++ .../Layers/RepeatingMultilayerGroup.qml | 43 +++++++++++++++++ .../Gui/Pages/Sample/SideBarBasic.qml | 10 ++-- 3 files changed, 96 insertions(+), 3 deletions(-) diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml index fffb06e2..e321a342 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml @@ -3,9 +3,15 @@ import QtQuick.Controls 2.14 import QtQuick.Dialogs 1.3 as Dialogs1 import QtQuick.XmlListModel 2.13 +// import easyApp.Gui.Globals 1.0 as EaGlobals +// import easyApp.Gui.Style 1.0 as EaStyle import easyApp.Gui.Elements 1.0 as EaElements +// import easyApp.Gui.Components 1.0 as EaComponents +// import easyApp.Gui.Logic 1.0 as EaLogic import Gui.Globals 1.0 as ExGlobals +// import Gui.Components 1.0 as ExComponents +// import Gui.Pages.Sample 1.0 as ExSample import Gui.Pages.Sample.Layers 1.0 as ExLayers EaElements.GroupBox { @@ -18,8 +24,48 @@ EaElements.GroupBox { last: true ExLayers.MultilayerTable{ + id: layersTable } ExLayers.MultilayerRow{ + id: layersRow } + + + // Row { + // // visible: (currentItemsType == 'Repeating Multi-layer') || (currentItemsType == 'Multi-layer') ? true : false + // spacing: EaStyle.Sizes.fontPixelSize + + // EaElements.SideBarButton { + // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 + // enabled: true + // fontIcon: "plus-circle" + // text: qsTr("Add layer") + // onClicked: ExGlobals.Constants.proxy.model.addNewLayers() + // } + + // EaElements.SideBarButton { + // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 + // enabled: (layersTable.model.count > 0) ? true : false //when item is selected + // fontIcon: "clone" + // text: qsTr("Duplicate layer") + // onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers() + // } + + // EaElements.SideBarButton { + // width: EaStyle.Sizes.tableRowHeight + // enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected + // fontIcon: "arrow-up" + // ToolTip.text: qsTr("Move layer up") + // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp() + // } + + // EaElements.SideBarButton { + // width: EaStyle.Sizes.tableRowHeight + // enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false + // fontIcon: "arrow-down" + // ToolTip.text: qsTr("Move layer down") + // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown() + // } + // } } \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml index 00582aa7..8be72b77 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml @@ -3,11 +3,15 @@ import QtQuick.Controls 2.14 import QtQuick.Dialogs 1.3 as Dialogs1 import QtQuick.XmlListModel 2.13 +// import easyApp.Gui.Globals 1.0 as EaGlobals import easyApp.Gui.Style 1.0 as EaStyle import easyApp.Gui.Elements 1.0 as EaElements import easyApp.Gui.Components 1.0 as EaComponents +// import easyApp.Gui.Logic 1.0 as EaLogic import Gui.Globals 1.0 as ExGlobals +// import Gui.Components 1.0 as ExComponents +// import Gui.Pages.Sample 1.0 as ExSample import Gui.Pages.Sample.Layers 1.0 as ExLayers EaElements.GroupBox { @@ -17,6 +21,7 @@ EaElements.GroupBox { collapsible: false last: true Row { + // visible: (currentItemsType == 'Repeating Multi-layer') ? true : false spacing: EaStyle.Sizes.fontPixelSize * 0.5 // This integer defines how many repetitions of the layer structure should be @@ -40,8 +45,46 @@ EaElements.GroupBox { } ExLayers.MultilayerTable{ + id: layersTable } ExLayers.MultilayerRow{ + id: layersRow } + + // Row { + // spacing: EaStyle.Sizes.fontPixelSize + + // EaElements.SideBarButton { + // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 + // enabled: true + // fontIcon: "plus-circle" + // text: qsTr("Add layer") + // onClicked: ExGlobals.Constants.proxy.model.addNewLayers() + // } + + // EaElements.SideBarButton { + // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 + // enabled: (layersTable.model.count > 0) ? true : false //when item is selected + // fontIcon: "clone" + // text: qsTr("Duplicate layer") + // onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers() + // } + + // EaElements.SideBarButton { + // width: EaStyle.Sizes.tableRowHeight + // enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected + // fontIcon: "arrow-up" + // ToolTip.text: qsTr("Move layer up") + // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp() + // } + + // EaElements.SideBarButton { + // width: EaStyle.Sizes.tableRowHeight + // enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false + // fontIcon: "arrow-down" + // ToolTip.text: qsTr("Move layer down") + // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown() + // } + // } } \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml b/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml index 7e30fb0c..84decf39 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml @@ -3,11 +3,15 @@ import QtQuick.Controls 2.14 import QtQuick.Dialogs 1.3 as Dialogs1 import QtQuick.XmlListModel 2.13 +import easyApp.Gui.Globals 1.0 as EaGlobals import easyApp.Gui.Style 1.0 as EaStyle import easyApp.Gui.Elements 1.0 as EaElements import easyApp.Gui.Components 1.0 as EaComponents +import easyApp.Gui.Logic 1.0 as EaLogic import Gui.Globals 1.0 as ExGlobals +import Gui.Components 1.0 as ExComponents +import Gui.Pages.Sample 1.0 as ExSample import Gui.Pages.Sample.Layers 1.0 as ExLayers EaComponents.SideBarColumn { @@ -222,7 +226,7 @@ EaComponents.SideBarColumn { ExGlobals.Constants.proxy.model.currentModelIndex = modelTable.currentIndex itemsTable.currentIndex = 0 layersTable.currentIndex = 0 - } + } } Row { spacing: EaStyle.Sizes.fontPixelSize @@ -345,7 +349,7 @@ EaComponents.SideBarColumn { onCurrentIndexChanged: { ExGlobals.Constants.proxy.model.currentItemsIndex = itemsTable.currentIndex currentItemsType = ExGlobals.Constants.proxy.model.currentItemsType -repsSpinBox.value = ExGlobals.Constants.proxy.model.currentItemsRepetitions + repsSpinBox.value = ExGlobals.Constants.proxy.model.currentItemsRepetitions } onModelChanged: currentIndex = 0 @@ -419,7 +423,7 @@ repsSpinBox.value = ExGlobals.Constants.proxy.model.currentItemsRepetitions ExLayers.RepeatingMultilayerGroup { visible: (currentItemsType == 'Repeating Multi-layer') ? true : false - } + } ExLayers.SurfactantGroup { visible: (currentItemsType == 'Surfactant Layer') ? true : false From 5c132082412e1844878fc55b943441d9ae234963 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Sat, 10 Feb 2024 17:04:35 +0100 Subject: [PATCH 24/40] Revert "moved layer specifc gui part to dir" This reverts commit 905c42b61f0e29c9733f5f7645c7c3efc122cbb9. --- .../Pages/Sample/Layers/MultilayerGroup.qml | 71 -------- .../Gui/Pages/Sample/Layers/MultilayerRow.qml | 44 ----- .../Layers/RepeatingMultilayerGroup.qml | 90 ---------- .../Pages/Sample/Layers/SurfactantGroup.qml | 162 ------------------ .../Gui/Pages/Sample/Layers/qmldir | 7 - ...ultilayerTable.qml => MultiLayerTable.qml} | 0 .../Gui/Pages/Sample/SideBarBasic.qml | 103 +++++++++-- .../Gui/Pages/Sample/SurfactantGroup.qml | 53 ++++++ .../Gui/Pages/Sample/SurfactantTable.qml | 108 ++++++++++++ EasyReflectometryApp/Gui/Pages/Sample/qmldir | 3 + 10 files changed, 257 insertions(+), 384 deletions(-) delete mode 100644 EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml delete mode 100644 EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerRow.qml delete mode 100644 EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml delete mode 100644 EasyReflectometryApp/Gui/Pages/Sample/Layers/SurfactantGroup.qml delete mode 100644 EasyReflectometryApp/Gui/Pages/Sample/Layers/qmldir rename EasyReflectometryApp/Gui/Pages/Sample/{Layers/MultilayerTable.qml => MultiLayerTable.qml} (100%) create mode 100644 EasyReflectometryApp/Gui/Pages/Sample/SurfactantGroup.qml create mode 100644 EasyReflectometryApp/Gui/Pages/Sample/SurfactantTable.qml diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml deleted file mode 100644 index e321a342..00000000 --- a/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerGroup.qml +++ /dev/null @@ -1,71 +0,0 @@ -import QtQuick 2.14 -import QtQuick.Controls 2.14 -import QtQuick.Dialogs 1.3 as Dialogs1 -import QtQuick.XmlListModel 2.13 - -// import easyApp.Gui.Globals 1.0 as EaGlobals -// import easyApp.Gui.Style 1.0 as EaStyle -import easyApp.Gui.Elements 1.0 as EaElements -// import easyApp.Gui.Components 1.0 as EaComponents -// import easyApp.Gui.Logic 1.0 as EaLogic - -import Gui.Globals 1.0 as ExGlobals -// import Gui.Components 1.0 as ExComponents -// import Gui.Pages.Sample 1.0 as ExSample -import Gui.Pages.Sample.Layers 1.0 as ExLayers - -EaElements.GroupBox { - // When an item in the above table is selected, this box will become enabled. - // Allowing different parameters and layers to be defined for the item. - id: multilayerGroup - title: qsTr(ExGlobals.Constants.proxy.model.currentItemsName + " editor") - enabled: (itemsTable.model.count > 0) ? true : false //When a layer is selected - collapsible: false - last: true - - ExLayers.MultilayerTable{ - id: layersTable - } - - ExLayers.MultilayerRow{ - id: layersRow - } - - - // Row { - // // visible: (currentItemsType == 'Repeating Multi-layer') || (currentItemsType == 'Multi-layer') ? true : false - // spacing: EaStyle.Sizes.fontPixelSize - - // EaElements.SideBarButton { - // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 - // enabled: true - // fontIcon: "plus-circle" - // text: qsTr("Add layer") - // onClicked: ExGlobals.Constants.proxy.model.addNewLayers() - // } - - // EaElements.SideBarButton { - // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 - // enabled: (layersTable.model.count > 0) ? true : false //when item is selected - // fontIcon: "clone" - // text: qsTr("Duplicate layer") - // onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers() - // } - - // EaElements.SideBarButton { - // width: EaStyle.Sizes.tableRowHeight - // enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected - // fontIcon: "arrow-up" - // ToolTip.text: qsTr("Move layer up") - // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp() - // } - - // EaElements.SideBarButton { - // width: EaStyle.Sizes.tableRowHeight - // enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false - // fontIcon: "arrow-down" - // ToolTip.text: qsTr("Move layer down") - // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown() - // } - // } -} \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerRow.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerRow.qml deleted file mode 100644 index bb2f5eed..00000000 --- a/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerRow.qml +++ /dev/null @@ -1,44 +0,0 @@ -import QtQuick 2.14 -import QtQuick.Controls 2.14 -import QtQuick.XmlListModel 2.13 - -import easyApp.Gui.Elements 1.0 as EaElements -import easyApp.Gui.Style 1.0 as EaStyle - -import Gui.Globals 1.0 as ExGlobals - -Row { - spacing: EaStyle.Sizes.fontPixelSize - - EaElements.SideBarButton { - width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 - enabled: true - fontIcon: "plus-circle" - text: qsTr("Add layer") - onClicked: ExGlobals.Constants.proxy.model.addNewLayers() - } - - EaElements.SideBarButton { - width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 - enabled: (layersTable.model.count > 0) ? true : false //when item is selected - fontIcon: "clone" - text: qsTr("Duplicate layer") - onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers() - } - - EaElements.SideBarButton { - width: EaStyle.Sizes.tableRowHeight - enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected - fontIcon: "arrow-up" - ToolTip.text: qsTr("Move layer up") - onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp() - } - - EaElements.SideBarButton { - width: EaStyle.Sizes.tableRowHeight - enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false - fontIcon: "arrow-down" - ToolTip.text: qsTr("Move layer down") - onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown() - } -} \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml deleted file mode 100644 index 8be72b77..00000000 --- a/EasyReflectometryApp/Gui/Pages/Sample/Layers/RepeatingMultilayerGroup.qml +++ /dev/null @@ -1,90 +0,0 @@ -import QtQuick 2.14 -import QtQuick.Controls 2.14 -import QtQuick.Dialogs 1.3 as Dialogs1 -import QtQuick.XmlListModel 2.13 - -// import easyApp.Gui.Globals 1.0 as EaGlobals -import easyApp.Gui.Style 1.0 as EaStyle -import easyApp.Gui.Elements 1.0 as EaElements -import easyApp.Gui.Components 1.0 as EaComponents -// import easyApp.Gui.Logic 1.0 as EaLogic - -import Gui.Globals 1.0 as ExGlobals -// import Gui.Components 1.0 as ExComponents -// import Gui.Pages.Sample 1.0 as ExSample -import Gui.Pages.Sample.Layers 1.0 as ExLayers - -EaElements.GroupBox { - id: repeatingMultilayerGroup - title: qsTr(ExGlobals.Constants.proxy.model.currentItemsName + " editor") - enabled: (itemsTable.model.count > 0) ? true : false //When a layer is selected - collapsible: false - last: true - Row { - // visible: (currentItemsType == 'Repeating Multi-layer') ? true : false - spacing: EaStyle.Sizes.fontPixelSize * 0.5 - - // This integer defines how many repetitions of the layer structure should be - // used. - EaComponents.TableViewLabel{ - horizontalAlignment: Text.AlignRight - width: labelWidth() * 2.1 - ToolTip.text: qsTr("To create some repeating multilayer structure") - text: qsTr("Number of repetitions:") - } - EaElements.SpinBox { - id: repsSpinBox - editable: true - from: 1 - to: 9999 - value: ExGlobals.Constants.proxy.model.currentItemsRepetitions - onValueChanged: { - ExGlobals.Constants.proxy.model.currentItemsRepetitions = value - } - } - } - - ExLayers.MultilayerTable{ - id: layersTable - } - - ExLayers.MultilayerRow{ - id: layersRow - } - - // Row { - // spacing: EaStyle.Sizes.fontPixelSize - - // EaElements.SideBarButton { - // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 - // enabled: true - // fontIcon: "plus-circle" - // text: qsTr("Add layer") - // onClicked: ExGlobals.Constants.proxy.model.addNewLayers() - // } - - // EaElements.SideBarButton { - // width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 - // enabled: (layersTable.model.count > 0) ? true : false //when item is selected - // fontIcon: "clone" - // text: qsTr("Duplicate layer") - // onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers() - // } - - // EaElements.SideBarButton { - // width: EaStyle.Sizes.tableRowHeight - // enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected - // fontIcon: "arrow-up" - // ToolTip.text: qsTr("Move layer up") - // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp() - // } - - // EaElements.SideBarButton { - // width: EaStyle.Sizes.tableRowHeight - // enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false - // fontIcon: "arrow-down" - // ToolTip.text: qsTr("Move layer down") - // onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown() - // } - // } -} \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/SurfactantGroup.qml b/EasyReflectometryApp/Gui/Pages/Sample/Layers/SurfactantGroup.qml deleted file mode 100644 index b33e9059..00000000 --- a/EasyReflectometryApp/Gui/Pages/Sample/Layers/SurfactantGroup.qml +++ /dev/null @@ -1,162 +0,0 @@ -import QtQuick 2.14 -import QtQuick.Controls 2.14 -import QtQuick.XmlListModel 2.13 - -import easyApp.Gui.Components 1.0 as EaComponents -import easyApp.Gui.Elements 1.0 as EaElements -import easyApp.Gui.Style 1.0 as EaStyle - -import Gui.Globals 1.0 as ExGlobals - - -EaElements.GroupBox { - id: surfactantGroup - title: qsTr(ExGlobals.Constants.proxy.model.currentItemsName + " editor") - enabled: (itemsTable.model.count > 0) ? true : false //When a layer is selected - collapsible: false - last: true - - EaComponents.TableView { - id: surfactantTable - - // Table model - - model: XmlListModel { - property int layersIndex: ExGlobals.Constants.proxy.model.currentLayersIndex + 1 - - xml: ExGlobals.Constants.proxy.model.layersAsXml - query: `/root/item[${itemsTable.currentIndex + 1}]/layers/item` - - XmlRole { name: "formula"; query: "chemical_structure/string()" } - XmlRole { name: "thick"; query: "thickness/value/number()" } - XmlRole { name: "thick_enabled"; query: "thickness/enabled/string()" } - XmlRole { name: "rough"; query: "roughness/value/number()" } - XmlRole { name: "rough_enabled"; query: "roughness/enabled/string()" } - XmlRole { name: "apm"; query: "area_per_molecule/value/number()" } - XmlRole { name: "apm_enabled"; query: "area_per_molecule/enabled/string()" } - XmlRole { name: "solvation"; query: "solvation/value/number()" } - XmlRole { name: "solvation_enabled"; query: "solvation/enabled/string()" } - XmlRole { name: "solvent"; query: "solvent/name/string()"} - } - - // Table rows - - delegate: EaComponents.TableViewDelegate { - property var surfactantModel: model - - EaComponents.TableViewTextInput { - horizontalAlignment: Text.AlignHCenter - width: EaStyle.Sizes.sideBarContentWidth - (thickLabel.width + roughLabel.width + solvLabel.width + apmLabel.width + solvMatLabel.width + 6 * EaStyle.Sizes.tableColumnSpacing) - headerText: "Formula" - text: surfactantModel.formula - onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersChemStructure(text) - } - - EaComponents.TableViewTextInput { - id: thickLabel - horizontalAlignment: Text.AlignHCenter - width: EaStyle.Sizes.fontPixelSize * 5.5 - headerText: "Thickness/Å" - enabled: model.thick_enabled == "True" - text: (isNaN(surfactantModel.thick)) ? '--' : surfactantModel.thick.toFixed(2) - onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersThickness(text) - } - - EaComponents.TableViewTextInput { - id: roughLabel - horizontalAlignment: Text.AlignHCenter - width: EaStyle.Sizes.fontPixelSize * 6.0 - headerText: "Roughness/Å" - enabled: model.rough_enabled == "True" - text: (isNaN(surfactantModel.rough)) ? '--' : surfactantModel.rough.toFixed(2) - onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersRoughness(text) - } - - EaComponents.TableViewTextInput { - id: solvLabel - horizontalAlignment: Text.AlignHCenter - width: EaStyle.Sizes.fontPixelSize * 4.5 - headerText: "Solvation" - enabled: model.solvation_enabled == "True" - text: (isNaN(surfactantModel.solvation)) ? '--' : surfactantModel.solvation - onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersSolvation(text) - } - - EaComponents.TableViewTextInput { - id: apmLabel - horizontalAlignment: Text.AlignHCenter - width: EaStyle.Sizes.fontPixelSize * 4.0 - headerText: "APM/Å2" - enabled: model.apm_enabled == "True" - text: (isNaN(surfactantModel.apm)) ? '--' : surfactantModel.apm - onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentItemApm(text) - } - - EaComponents.TableViewComboBox{ - id: solvMatLabel - horizontalAlignment: Text.AlignLeft - width: EaStyle.Sizes.fontPixelSize * 6.5 - headerText: "Solvent" - onActivated: { - ExGlobals.Constants.proxy.model.setCurrentLayersSolvent(currentIndex) - } - model: ExGlobals.Constants.proxy.material.materialsName - onModelChanged: { - currentIndex = indexOfValue(surfactantModel.solvent) - } - Component.onCompleted: { - currentIndex = indexOfValue(surfactantModel.solvent) - } - } - } - - onCurrentIndexChanged: { - ExGlobals.Constants.proxy.model.currentLayersIndex = surfactantTable.currentIndex - } - - } - - EaElements.GroupBox { - spacing: EaStyle.Sizes.fontPixelSize * 0.5 - collapsible: true - collapsed: true - - title: qsTr('Chemical Constraints') - Row { - EaElements.CheckBox { - checked: false - id: apm_check - text: qsTr("Area-per-molecule") - ToolTip.text: qsTr("Checking this box will ensure that the area-per-molecule of the head and tail layers is the same") - onCheckedChanged: ExGlobals.Constants.proxy.model.constrainApm = checked - } - EaElements.CheckBox { - checked: false - id: conformal - text: qsTr("Conformal roughness") - ToolTip.text: qsTr("Checking this box will ensure that the interfacial roughness is the same for all interfaces of the surfactant") - onCheckedChanged: ExGlobals.Constants.proxy.model.conformalRoughness = checked - } - } - - Row { - EaElements.CheckBox { - checked: false - id: solvent_rough - text: qsTr("Constrain roughness to item") - enabled: conformal.checked - ToolTip.text: qsTr("Checking this box allows another item to be selected and the conformal roughness will be constrained to this") - onCheckedChanged: checked ? ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(solvent_rough_item.currentText) : ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(null) - } - EaElements.ComboBox { - id: solvent_rough_item - enabled: solvent_rough.checked - onActivated: { - ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(null) - ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(currentText) - } - model: ExGlobals.Constants.proxy.model.itemsNamesConstrain - } - } - } -} \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/qmldir b/EasyReflectometryApp/Gui/Pages/Sample/Layers/qmldir deleted file mode 100644 index 63f11082..00000000 --- a/EasyReflectometryApp/Gui/Pages/Sample/Layers/qmldir +++ /dev/null @@ -1,7 +0,0 @@ -module Layers - -MultilayerGroup 1.0 MultilayerGroup.qml -MultilayerTable 1.0 MultilayerTable.qml -MultilayerRow 1.0 MultilayerRow.qml -RepeatingMultilayerGroup 1.0 RepeatingMultilayerGroup.qml -SurfactantGroup 1.0 SurfactantGroup.qml diff --git a/EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerTable.qml b/EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml similarity index 100% rename from EasyReflectometryApp/Gui/Pages/Sample/Layers/MultilayerTable.qml rename to EasyReflectometryApp/Gui/Pages/Sample/MultiLayerTable.qml diff --git a/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml b/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml index 84decf39..9ded876c 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml +++ b/EasyReflectometryApp/Gui/Pages/Sample/SideBarBasic.qml @@ -12,7 +12,6 @@ import easyApp.Gui.Logic 1.0 as EaLogic import Gui.Globals 1.0 as ExGlobals import Gui.Components 1.0 as ExComponents import Gui.Pages.Sample 1.0 as ExSample -import Gui.Pages.Sample.Layers 1.0 as ExLayers EaComponents.SideBarColumn { @@ -417,18 +416,102 @@ EaComponents.SideBarColumn { }*/ } - ExLayers.MultilayerGroup { - visible: (currentItemsType == 'Multi-layer') ? true : false - } + EaElements.GroupBox { + // When an item in the above table is selected, this box will become enabled. + // Allowing different parameters and layers to be defined for the item. + id: layersGroup + title: qsTr(ExGlobals.Constants.proxy.model.currentItemsName + " editor") + enabled: (itemsTable.model.count > 0) ? true : false //When a layer is selected + collapsible: false + last: true + Row { + visible: (currentItemsType == 'Repeating Multi-layer') ? true : false + spacing: EaStyle.Sizes.fontPixelSize * 0.5 + + // This integer defines how many repetitions of the layer structure should be + // used. + EaComponents.TableViewLabel{ + horizontalAlignment: Text.AlignRight + width: labelWidth() * 2.1 + ToolTip.text: qsTr("To create some repeating multilayer structure") + text: qsTr("Number of repetitions:") + } + EaElements.SpinBox { + id: repsSpinBox + editable: true + from: 1 + to: 9999 + value: ExGlobals.Constants.proxy.model.currentItemsRepetitions + onValueChanged: { + ExGlobals.Constants.proxy.model.currentItemsRepetitions = value + } + } + } + ExSample.SurfactantTable{ + id: surfactantTable + visible: (currentItemsType == 'Surfactant Layer') ? true : false + } - ExLayers.RepeatingMultilayerGroup { - visible: (currentItemsType == 'Repeating Multi-layer') ? true : false - } + ExSample.SurfactantGroup{ + visible: (currentItemsType == 'Surfactant Layer') ? true : false + } - ExLayers.SurfactantGroup { - visible: (currentItemsType == 'Surfactant Layer') ? true : false - } + ExSample.MultiLayerTable{ + id: layersTable + visible: (currentItemsType == 'Repeating Multi-layer') || (currentItemsType == 'Multi-layer') ? true : false + } + Row { + visible: (currentItemsType == 'Repeating Multi-layer') || (currentItemsType == 'Multi-layer') ? true : false + spacing: EaStyle.Sizes.fontPixelSize + + EaElements.SideBarButton { + width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 + enabled: true + fontIcon: "plus-circle" + text: qsTr("Add layer") + onClicked: ExGlobals.Constants.proxy.model.addNewLayers() + } + + EaElements.SideBarButton { + width: (EaStyle.Sizes.sideBarContentWidth - (2 * (EaStyle.Sizes.tableRowHeight + EaStyle.Sizes.fontPixelSize)) - EaStyle.Sizes.fontPixelSize) / 2 + enabled: (layersTable.model.count > 0) ? true : false //when item is selected + fontIcon: "clone" + text: qsTr("Duplicate layer") + onClicked: ExGlobals.Constants.proxy.model.duplicateSelectedLayers() + } + + EaElements.SideBarButton { + width: EaStyle.Sizes.tableRowHeight + enabled: (layersTable.model.count > 0 && layersTable.currentIndex != 0) ? true : false//When item is selected + fontIcon: "arrow-up" + ToolTip.text: qsTr("Move layer up") + onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersUp() + } + + EaElements.SideBarButton { + width: EaStyle.Sizes.tableRowHeight + enabled: (layersTable.model.count > 0 && layersTable.currentIndex + 1 != layersTable.model.count) ? true : false + fontIcon: "arrow-down" + ToolTip.text: qsTr("Move layer down") + onClicked: ExGlobals.Constants.proxy.model.moveSelectedLayersDown() + } + } + + /*Row { + spacing: EaStyle.Sizes.fontPixelSize + + EaElements.SideBarButton { + // In future this button will allow the use of custom (python) components. + // This will require a flexible table structure above I think and may not be + // possible. + enabled: false //not yet implemented + fontIcon: "puzzle-piece" + text: qsTr("Add a custom component") + } + }*/ + + } // Logic diff --git a/EasyReflectometryApp/Gui/Pages/Sample/SurfactantGroup.qml b/EasyReflectometryApp/Gui/Pages/Sample/SurfactantGroup.qml new file mode 100644 index 00000000..a6fda6cd --- /dev/null +++ b/EasyReflectometryApp/Gui/Pages/Sample/SurfactantGroup.qml @@ -0,0 +1,53 @@ +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.XmlListModel 2.13 + +import easyApp.Gui.Components 1.0 as EaComponents +import easyApp.Gui.Elements 1.0 as EaElements +import easyApp.Gui.Style 1.0 as EaStyle + +import Gui.Globals 1.0 as ExGlobals + +EaElements.GroupBox { + spacing: EaStyle.Sizes.fontPixelSize * 0.5 + collapsible: true + collapsed: true + + title: qsTr('Chemical Constraints') + Row { + EaElements.CheckBox { + checked: false + id: apm_check + text: qsTr("Area-per-molecule") + ToolTip.text: qsTr("Checking this box will ensure that the area-per-molecule of the head and tail layers is the same") + onCheckedChanged: ExGlobals.Constants.proxy.model.constrainApm = checked + } + EaElements.CheckBox { + checked: false + id: conformal + text: qsTr("Conformal roughness") + ToolTip.text: qsTr("Checking this box will ensure that the interfacial roughness is the same for all interfaces of the surfactant") + onCheckedChanged: ExGlobals.Constants.proxy.model.conformalRoughness = checked + } + } + + Row { + EaElements.CheckBox { + checked: false + id: solvent_rough + text: qsTr("Constrain roughness to item") + enabled: conformal.checked + ToolTip.text: qsTr("Checking this box allows another item to be selected and the conformal roughness will be constrained to this") + onCheckedChanged: checked ? ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(solvent_rough_item.currentText) : ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(null) + } + EaElements.ComboBox { + id: solvent_rough_item + enabled: solvent_rough.checked + onActivated: { + ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(null) + ExGlobals.Constants.proxy.model.currentSurfactantSolventRoughness(currentText) + } + model: ExGlobals.Constants.proxy.model.itemsNamesConstrain + } + } +} \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/SurfactantTable.qml b/EasyReflectometryApp/Gui/Pages/Sample/SurfactantTable.qml new file mode 100644 index 00000000..0b82ee4e --- /dev/null +++ b/EasyReflectometryApp/Gui/Pages/Sample/SurfactantTable.qml @@ -0,0 +1,108 @@ +import QtQuick 2.14 +import QtQuick.Controls 2.14 +import QtQuick.XmlListModel 2.13 + +import easyApp.Gui.Components 1.0 as EaComponents +import easyApp.Gui.Style 1.0 as EaStyle + +import Gui.Globals 1.0 as ExGlobals + +EaComponents.TableView { + id: surfactantTable + + // Table model + + model: XmlListModel { + property int layersIndex: ExGlobals.Constants.proxy.model.currentLayersIndex + 1 + + xml: ExGlobals.Constants.proxy.model.layersAsXml + query: `/root/item[${itemsTable.currentIndex + 1}]/layers/item` + + XmlRole { name: "formula"; query: "chemical_structure/string()" } + XmlRole { name: "thick"; query: "thickness/value/number()" } + XmlRole { name: "thick_enabled"; query: "thickness/enabled/string()" } + XmlRole { name: "rough"; query: "roughness/value/number()" } + XmlRole { name: "rough_enabled"; query: "roughness/enabled/string()" } + XmlRole { name: "apm"; query: "area_per_molecule/value/number()" } + XmlRole { name: "apm_enabled"; query: "area_per_molecule/enabled/string()" } + XmlRole { name: "solvation"; query: "solvation/value/number()" } + XmlRole { name: "solvation_enabled"; query: "solvation/enabled/string()" } + XmlRole { name: "solvent"; query: "solvent/name/string()"} + } + + // Table rows + + delegate: EaComponents.TableViewDelegate { + property var surfactantModel: model + + EaComponents.TableViewTextInput { + horizontalAlignment: Text.AlignHCenter + width: EaStyle.Sizes.sideBarContentWidth - (thickLabel.width + roughLabel.width + solvLabel.width + apmLabel.width + solvMatLabel.width + 6 * EaStyle.Sizes.tableColumnSpacing) + headerText: "Formula" + text: surfactantModel.formula + onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersChemStructure(text) + } + + EaComponents.TableViewTextInput { + id: thickLabel + horizontalAlignment: Text.AlignHCenter + width: EaStyle.Sizes.fontPixelSize * 5.5 + headerText: "Thickness/Å" + enabled: model.thick_enabled == "True" + text: (isNaN(surfactantModel.thick)) ? '--' : surfactantModel.thick.toFixed(2) + onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersThickness(text) + } + + EaComponents.TableViewTextInput { + id: roughLabel + horizontalAlignment: Text.AlignHCenter + width: EaStyle.Sizes.fontPixelSize * 6.0 + headerText: "Roughness/Å" + enabled: model.rough_enabled == "True" + text: (isNaN(surfactantModel.rough)) ? '--' : surfactantModel.rough.toFixed(2) + onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersRoughness(text) + } + + EaComponents.TableViewTextInput { + id: solvLabel + horizontalAlignment: Text.AlignHCenter + width: EaStyle.Sizes.fontPixelSize * 4.5 + headerText: "Solvation" + enabled: model.solvation_enabled == "True" + text: (isNaN(surfactantModel.solvation)) ? '--' : surfactantModel.solvation + onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentLayersSolvation(text) + } + + EaComponents.TableViewTextInput { + id: apmLabel + horizontalAlignment: Text.AlignHCenter + width: EaStyle.Sizes.fontPixelSize * 4.0 + headerText: "APM/Å2" + enabled: model.apm_enabled == "True" + text: (isNaN(surfactantModel.apm)) ? '--' : surfactantModel.apm + onEditingFinished: ExGlobals.Constants.proxy.model.setCurrentItemApm(text) + } + + EaComponents.TableViewComboBox{ + id: solvMatLabel + horizontalAlignment: Text.AlignLeft + width: EaStyle.Sizes.fontPixelSize * 6.5 + headerText: "Solvent" + onActivated: { + ExGlobals.Constants.proxy.model.setCurrentLayersSolvent(currentIndex) + } + model: ExGlobals.Constants.proxy.material.materialsName + onModelChanged: { + currentIndex = indexOfValue(surfactantModel.solvent) + } + Component.onCompleted: { + currentIndex = indexOfValue(surfactantModel.solvent) + } + } + } + + onCurrentIndexChanged: { + ExGlobals.Constants.proxy.model.currentLayersIndex = surfactantTable.currentIndex + } + +} \ No newline at end of file diff --git a/EasyReflectometryApp/Gui/Pages/Sample/qmldir b/EasyReflectometryApp/Gui/Pages/Sample/qmldir index 969175d1..e21be421 100644 --- a/EasyReflectometryApp/Gui/Pages/Sample/qmldir +++ b/EasyReflectometryApp/Gui/Pages/Sample/qmldir @@ -4,3 +4,6 @@ MainContentModelView 1.0 MainContentModelView.qml SideBarAdvanced 1.0 SideBarAdvanced.qml SideBarBasic 1.0 SideBarBasic.qml +MultiLayerTable 1.0 MultiLayerTable.qml +SurfactantTable 1.0 SurfactantTable.qml +SurfactantGroup 1.0 SurfactantGroup.qml \ No newline at end of file From f30f2ae6ae6e1c994065da529432b2d16eeeb252 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Mon, 11 Mar 2024 08:09:07 +0100 Subject: [PATCH 25/40] update pyinstaller --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f5ed9f52..6dfde883 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,7 +43,7 @@ dependencies = [ # These optional dependencies are for building the # application as a part of a Github Action. ci = [ - 'pyinstaller==6.4.*', + 'pyinstaller==6.5.*', 'scipy==1.12.*', 'dephell_licenses>=0.1.7', 'pywin32-ctypes>=0.2.0; platform_system == "win32"', From 9c1c6e79e44edaae079d6d25b57063706a552200 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Mon, 11 Mar 2024 09:17:01 +0100 Subject: [PATCH 26/40] dont autoexclude _multiprocessing --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6dfde883..fcf20eb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -156,7 +156,8 @@ missing_pyside2_plugins = { macos = [], ubuntu = ['Qt/plugins/xcbglintegrations' missing_other_libraries = {macos = [], ubuntu = [], windows = ['libs/libiomp5md.dll', 'libs/opengl32.dll'] } auto_exclude = { macos = ['_tkinter'], ubuntu = ['_tkinter'], windows = [''], all = [ 'lib2to3', '_bisect', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', - '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', '_multiprocessing', + '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', + # '_multiprocessing', '_opcode', '_queue', '_opcode', '_uuid', '_win32sysloader', 'grp', 'readline', 'termios' ] } manual_exclude = [ 'mfc*', 'msvcp*', 'VCRUNTIME*', '*Qt*3D*', '*Qt*Bluetooth*', '*Qt*Bodymovin*', '*Qt*Gamepad*', '*Qt*Location*', From 936e706b973bc30ccaac067cdce83dbb5d1b66a0 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Mon, 11 Mar 2024 09:49:07 +0100 Subject: [PATCH 27/40] no auto exclude --- pyproject.toml | 98 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 79 insertions(+), 19 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fcf20eb1..7bfad8fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,18 +97,38 @@ source = ['EasyReflectometryApp'] [ci.icon] dir = ['Gui', 'Resources', 'Logo'] file_name = 'App' -file_ext = { macos = '.icns', ubuntu = '.png', windows = '.ico' } +file_ext = { + macos = '.icns', + ubuntu = '.png', + windows = '.ico' + } [ci.setup] build_dir_suffix = 'Setup' repository_dir_suffix = 'Repos' -os = { macos = 'macOS', ubuntu = 'Linux', windows = 'Windows' } -arch = { macos = 'x86-64', ubuntu = 'x86-64', windows = 'x86-32' } -file_ext = { macos = '.app', ubuntu = '', windows = '.exe' } +os = { + macos = 'macOS', + ubuntu = 'Linux', + windows = 'Windows' + } +arch = { + macos = 'x86-64', + ubuntu = 'x86-64', + windows = 'x86-32' + } +file_ext = { + macos = '.app', + ubuntu = '', + windows = '.exe' + } maintenance_tool_suffix = 'MaintenanceTool' maintenance_file = 'signedmaintenancetool.exe' license_file = 'LICENSE.md' -installation_dir_shortcut = { macos = '@ApplicationsDir@', ubuntu = '@HomeDir@', windows = '@ApplicationsDirX86@' } +installation_dir_shortcut = { + macos = '@ApplicationsDir@', + ubuntu = '@HomeDir@', + windows = '@ApplicationsDirX86@' + } changelog_file = 'CHANGELOG.md' [ci.setup.build] @@ -143,22 +163,62 @@ version = '4.6.1' https_mirrors = ['download.qt.io', 'ftp.fau.de/qtproject', 'mirrors.dotsrc.org/qtproject'] base_path = 'official_releases/qt-installer-framework' file_name_base = 'QtInstallerFramework' -file_platform = { macos = 'macOS-x64', ubuntu = 'linux-x64', windows = 'windows-x64' } -file_ext = { macos = 'dmg', ubuntu = 'run', windows = 'exe' } -installation_path = { macOS = '/Users/runner/Qt', Linux = '/home/runner/Qt', Windows = 'C:\Qt' } +file_platform = { + macos = 'macOS-x64', + ubuntu = 'linux-x64', + windows = 'windows-x64' + } +file_ext = { + macos = 'dmg', + ubuntu = 'run', + windows = 'exe' + } +installation_path = { + macOS = '/Users/runner/Qt', + Linux = '/home/runner/Qt', + Windows = 'C:\Qt' + } [ci.pyinstaller] -separator = { macos = ':', ubuntu = ':', windows = ';' } -dir_suffix = { macos = '.app', ubuntu = '', windows = '' } -content_suffix = { macos = 'Contents/MacOS/', ubuntu = '', windows = '' } -missing_pyside2_files = { macos = ['libshiboken2.abi3.*.dylib'], ubuntu = [], windows = ['shiboken2.abi3.dll', 'MSVCP140.dll'] } -missing_pyside2_plugins = { macos = [], ubuntu = ['Qt/plugins/xcbglintegrations'], windows = [] } # EGL and GLX plugins -missing_other_libraries = {macos = [], ubuntu = [], windows = ['libs/libiomp5md.dll', 'libs/opengl32.dll'] } -auto_exclude = { macos = ['_tkinter'], ubuntu = ['_tkinter'], windows = [''], all = [ 'lib2to3', '_bisect', - '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', - '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', - # '_multiprocessing', - '_opcode', '_queue', '_opcode', '_uuid', '_win32sysloader', 'grp', 'readline', 'termios' ] } +separator = { + macos = ':', + ubuntu = ':', + windows = ';' + } +dir_suffix = { + macos = '.app', + ubuntu = '', + windows = '' + } +content_suffix = { + macos = 'Contents/MacOS/', + ubuntu = '', + windows = '' + } +missing_pyside2_files = { + macos = ['libshiboken2.abi3.*.dylib'], + ubuntu = [], + windows = ['shiboken2.abi3.dll', 'MSVCP140.dll'] + } +missing_pyside2_plugins = { + macos = [], + ubuntu = ['Qt/plugins/xcbglintegrations'], + windows = [] + } # EGL and GLX plugins +missing_other_libraries = { + macos = [], + ubuntu = [], + windows = ['libs/libiomp5md.dll', 'libs/opengl32.dll'] + } +#auto_exclude = { +# macos = ['_tkinter'], +# ubuntu = ['_tkinter'], +# windows = [''], +# all = [ 'lib2to3', '_bisect', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', +# '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', +# # '_multiprocessing', +# '_opcode', '_queue', '_opcode', '_uuid', '_win32sysloader', 'grp', 'readline', 'termios' ] +# } manual_exclude = [ 'mfc*', 'msvcp*', 'VCRUNTIME*', '*Qt*3D*', '*Qt*Bluetooth*', '*Qt*Bodymovin*', '*Qt*Gamepad*', '*Qt*Location*', '*Qt*Nfc*', '*Qt*Purchasing*', '*Qt*QuickParticles*', '*Qt*QuickShapes*', '*Qt*RemoteObjects*', From 113e0e0cbf592b238c94948bc4050f8fb92385de Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Mon, 11 Mar 2024 09:54:00 +0100 Subject: [PATCH 28/40] comment out auto_exclude --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 7bfad8fd..1723bbc0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -210,7 +210,7 @@ missing_other_libraries = { ubuntu = [], windows = ['libs/libiomp5md.dll', 'libs/opengl32.dll'] } -#auto_exclude = { +# auto_exclude = { # macos = ['_tkinter'], # ubuntu = ['_tkinter'], # windows = [''], From 9d1166b87f5a0403685058d367ba720a6187ef6f Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Mon, 11 Mar 2024 09:59:00 +0100 Subject: [PATCH 29/40] syntax --- pyproject.toml | 112 +++++++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 70 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 1723bbc0..9a92c50f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,38 +97,28 @@ source = ['EasyReflectometryApp'] [ci.icon] dir = ['Gui', 'Resources', 'Logo'] file_name = 'App' -file_ext = { - macos = '.icns', - ubuntu = '.png', - windows = '.ico' - } +file_ext = { macos = '.icns', + ubuntu = '.png', + windows = '.ico' } [ci.setup] build_dir_suffix = 'Setup' repository_dir_suffix = 'Repos' -os = { - macos = 'macOS', - ubuntu = 'Linux', - windows = 'Windows' - } -arch = { - macos = 'x86-64', - ubuntu = 'x86-64', - windows = 'x86-32' - } -file_ext = { - macos = '.app', - ubuntu = '', - windows = '.exe' - } +os = { macos = 'macOS', + ubuntu = 'Linux', + windows = 'Windows' } +arch = { macos = 'x86-64', + ubuntu = 'x86-64', + windows = 'x86-32' } +file_ext = { macos = '.app', + ubuntu = '', + windows = '.exe' } maintenance_tool_suffix = 'MaintenanceTool' maintenance_file = 'signedmaintenancetool.exe' license_file = 'LICENSE.md' -installation_dir_shortcut = { - macos = '@ApplicationsDir@', - ubuntu = '@HomeDir@', - windows = '@ApplicationsDirX86@' - } +installation_dir_shortcut = { macos = '@ApplicationsDir@', + ubuntu = '@HomeDir@', + windows = '@ApplicationsDirX86@'} changelog_file = 'CHANGELOG.md' [ci.setup.build] @@ -163,53 +153,35 @@ version = '4.6.1' https_mirrors = ['download.qt.io', 'ftp.fau.de/qtproject', 'mirrors.dotsrc.org/qtproject'] base_path = 'official_releases/qt-installer-framework' file_name_base = 'QtInstallerFramework' -file_platform = { - macos = 'macOS-x64', - ubuntu = 'linux-x64', - windows = 'windows-x64' - } -file_ext = { - macos = 'dmg', - ubuntu = 'run', - windows = 'exe' - } -installation_path = { - macOS = '/Users/runner/Qt', - Linux = '/home/runner/Qt', - Windows = 'C:\Qt' - } +file_platform = { macos = 'macOS-x64', + ubuntu = 'linux-x64', + windows = 'windows-x64' } +file_ext = { macos = 'dmg', + ubuntu = 'run', + windows = 'exe' } +installation_path = { macOS = '/Users/runner/Qt', + Linux = '/home/runner/Qt', + Windows = 'C:\Qt' } [ci.pyinstaller] -separator = { - macos = ':', - ubuntu = ':', - windows = ';' - } -dir_suffix = { - macos = '.app', - ubuntu = '', - windows = '' - } -content_suffix = { - macos = 'Contents/MacOS/', - ubuntu = '', - windows = '' - } -missing_pyside2_files = { - macos = ['libshiboken2.abi3.*.dylib'], - ubuntu = [], - windows = ['shiboken2.abi3.dll', 'MSVCP140.dll'] - } -missing_pyside2_plugins = { - macos = [], - ubuntu = ['Qt/plugins/xcbglintegrations'], - windows = [] - } # EGL and GLX plugins -missing_other_libraries = { - macos = [], - ubuntu = [], - windows = ['libs/libiomp5md.dll', 'libs/opengl32.dll'] - } +separator = { macos = ':', + ubuntu = ':', + windows = ';' } +dir_suffix = { macos = '.app', + ubuntu = '', + windows = ''} +content_suffix = { macos = 'Contents/MacOS/', + ubuntu = '', + windows = '' } +missing_pyside2_files = { macos = ['libshiboken2.abi3.*.dylib'], + ubuntu = [], + windows = ['shiboken2.abi3.dll', 'MSVCP140.dll'] } +missing_pyside2_plugins = { macos = [], + ubuntu = ['Qt/plugins/xcbglintegrations'], + windows = [] } # EGL and GLX plugins +missing_other_libraries = { macos = [], + ubuntu = [], + windows = ['libs/libiomp5md.dll', 'libs/opengl32.dll'] } # auto_exclude = { # macos = ['_tkinter'], # ubuntu = ['_tkinter'], From bf257c76bd7a62af4bbc2803b0dd4d0a0549dca4 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Mon, 11 Mar 2024 11:12:33 +0100 Subject: [PATCH 30/40] Revert "no auto exclude" This reverts commit 936e706b973bc30ccaac067cdce83dbb5d1b66a0. --- pyproject.toml | 70 ++++++++++++++------------------------------------ 1 file changed, 19 insertions(+), 51 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 9a92c50f..fcf20eb1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,28 +97,18 @@ source = ['EasyReflectometryApp'] [ci.icon] dir = ['Gui', 'Resources', 'Logo'] file_name = 'App' -file_ext = { macos = '.icns', - ubuntu = '.png', - windows = '.ico' } +file_ext = { macos = '.icns', ubuntu = '.png', windows = '.ico' } [ci.setup] build_dir_suffix = 'Setup' repository_dir_suffix = 'Repos' -os = { macos = 'macOS', - ubuntu = 'Linux', - windows = 'Windows' } -arch = { macos = 'x86-64', - ubuntu = 'x86-64', - windows = 'x86-32' } -file_ext = { macos = '.app', - ubuntu = '', - windows = '.exe' } +os = { macos = 'macOS', ubuntu = 'Linux', windows = 'Windows' } +arch = { macos = 'x86-64', ubuntu = 'x86-64', windows = 'x86-32' } +file_ext = { macos = '.app', ubuntu = '', windows = '.exe' } maintenance_tool_suffix = 'MaintenanceTool' maintenance_file = 'signedmaintenancetool.exe' license_file = 'LICENSE.md' -installation_dir_shortcut = { macos = '@ApplicationsDir@', - ubuntu = '@HomeDir@', - windows = '@ApplicationsDirX86@'} +installation_dir_shortcut = { macos = '@ApplicationsDir@', ubuntu = '@HomeDir@', windows = '@ApplicationsDirX86@' } changelog_file = 'CHANGELOG.md' [ci.setup.build] @@ -153,44 +143,22 @@ version = '4.6.1' https_mirrors = ['download.qt.io', 'ftp.fau.de/qtproject', 'mirrors.dotsrc.org/qtproject'] base_path = 'official_releases/qt-installer-framework' file_name_base = 'QtInstallerFramework' -file_platform = { macos = 'macOS-x64', - ubuntu = 'linux-x64', - windows = 'windows-x64' } -file_ext = { macos = 'dmg', - ubuntu = 'run', - windows = 'exe' } -installation_path = { macOS = '/Users/runner/Qt', - Linux = '/home/runner/Qt', - Windows = 'C:\Qt' } +file_platform = { macos = 'macOS-x64', ubuntu = 'linux-x64', windows = 'windows-x64' } +file_ext = { macos = 'dmg', ubuntu = 'run', windows = 'exe' } +installation_path = { macOS = '/Users/runner/Qt', Linux = '/home/runner/Qt', Windows = 'C:\Qt' } [ci.pyinstaller] -separator = { macos = ':', - ubuntu = ':', - windows = ';' } -dir_suffix = { macos = '.app', - ubuntu = '', - windows = ''} -content_suffix = { macos = 'Contents/MacOS/', - ubuntu = '', - windows = '' } -missing_pyside2_files = { macos = ['libshiboken2.abi3.*.dylib'], - ubuntu = [], - windows = ['shiboken2.abi3.dll', 'MSVCP140.dll'] } -missing_pyside2_plugins = { macos = [], - ubuntu = ['Qt/plugins/xcbglintegrations'], - windows = [] } # EGL and GLX plugins -missing_other_libraries = { macos = [], - ubuntu = [], - windows = ['libs/libiomp5md.dll', 'libs/opengl32.dll'] } -# auto_exclude = { -# macos = ['_tkinter'], -# ubuntu = ['_tkinter'], -# windows = [''], -# all = [ 'lib2to3', '_bisect', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', -# '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', -# # '_multiprocessing', -# '_opcode', '_queue', '_opcode', '_uuid', '_win32sysloader', 'grp', 'readline', 'termios' ] -# } +separator = { macos = ':', ubuntu = ':', windows = ';' } +dir_suffix = { macos = '.app', ubuntu = '', windows = '' } +content_suffix = { macos = 'Contents/MacOS/', ubuntu = '', windows = '' } +missing_pyside2_files = { macos = ['libshiboken2.abi3.*.dylib'], ubuntu = [], windows = ['shiboken2.abi3.dll', 'MSVCP140.dll'] } +missing_pyside2_plugins = { macos = [], ubuntu = ['Qt/plugins/xcbglintegrations'], windows = [] } # EGL and GLX plugins +missing_other_libraries = {macos = [], ubuntu = [], windows = ['libs/libiomp5md.dll', 'libs/opengl32.dll'] } +auto_exclude = { macos = ['_tkinter'], ubuntu = ['_tkinter'], windows = [''], all = [ 'lib2to3', '_bisect', + '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', + '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', + # '_multiprocessing', + '_opcode', '_queue', '_opcode', '_uuid', '_win32sysloader', 'grp', 'readline', 'termios' ] } manual_exclude = [ 'mfc*', 'msvcp*', 'VCRUNTIME*', '*Qt*3D*', '*Qt*Bluetooth*', '*Qt*Bodymovin*', '*Qt*Gamepad*', '*Qt*Location*', '*Qt*Nfc*', '*Qt*Purchasing*', '*Qt*QuickParticles*', '*Qt*QuickShapes*', '*Qt*RemoteObjects*', From 9301eb025057131d22d3f790f9f868468773787c Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Mon, 11 Mar 2024 11:24:02 +0100 Subject: [PATCH 31/40] no autoexclude --- pyproject.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fcf20eb1..bd0d035f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -154,11 +154,11 @@ content_suffix = { macos = 'Contents/MacOS/', ubuntu = '', windows = '' } missing_pyside2_files = { macos = ['libshiboken2.abi3.*.dylib'], ubuntu = [], windows = ['shiboken2.abi3.dll', 'MSVCP140.dll'] } missing_pyside2_plugins = { macos = [], ubuntu = ['Qt/plugins/xcbglintegrations'], windows = [] } # EGL and GLX plugins missing_other_libraries = {macos = [], ubuntu = [], windows = ['libs/libiomp5md.dll', 'libs/opengl32.dll'] } -auto_exclude = { macos = ['_tkinter'], ubuntu = ['_tkinter'], windows = [''], all = [ 'lib2to3', '_bisect', - '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', - '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', - # '_multiprocessing', - '_opcode', '_queue', '_opcode', '_uuid', '_win32sysloader', 'grp', 'readline', 'termios' ] } +#auto_exclude = { macos = ['_tkinter'], ubuntu = ['_tkinter'], windows = [''], all = [ 'lib2to3', '_bisect', +# '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', +# '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', +# # '_multiprocessing', +# '_opcode', '_queue', '_opcode', '_uuid', '_win32sysloader', 'grp', 'readline', 'termios' ] } manual_exclude = [ 'mfc*', 'msvcp*', 'VCRUNTIME*', '*Qt*3D*', '*Qt*Bluetooth*', '*Qt*Bodymovin*', '*Qt*Gamepad*', '*Qt*Location*', '*Qt*Nfc*', '*Qt*Purchasing*', '*Qt*QuickParticles*', '*Qt*QuickShapes*', '*Qt*RemoteObjects*', From 2a2e2135ed566237e4c8839d41a11d6e33a5e23b Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Mon, 11 Mar 2024 11:30:23 +0100 Subject: [PATCH 32/40] auto_exclude --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index bd0d035f..88994d02 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -154,7 +154,7 @@ content_suffix = { macos = 'Contents/MacOS/', ubuntu = '', windows = '' } missing_pyside2_files = { macos = ['libshiboken2.abi3.*.dylib'], ubuntu = [], windows = ['shiboken2.abi3.dll', 'MSVCP140.dll'] } missing_pyside2_plugins = { macos = [], ubuntu = ['Qt/plugins/xcbglintegrations'], windows = [] } # EGL and GLX plugins missing_other_libraries = {macos = [], ubuntu = [], windows = ['libs/libiomp5md.dll', 'libs/opengl32.dll'] } -#auto_exclude = { macos = ['_tkinter'], ubuntu = ['_tkinter'], windows = [''], all = [ 'lib2to3', '_bisect', +auto_exclude = { macos = ['_tkinter'], ubuntu = ['_tkinter'], windows = [''], all = [''] } # 'lib2to3', '_bisect', # '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', # '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', # # '_multiprocessing', From cdca6f2b48b84d99d4362c9b2957b44f4b65afaa Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Mon, 11 Mar 2024 11:44:39 +0100 Subject: [PATCH 33/40] only multiprocess is excluded --- pyproject.toml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 88994d02..746dead6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -154,11 +154,11 @@ content_suffix = { macos = 'Contents/MacOS/', ubuntu = '', windows = '' } missing_pyside2_files = { macos = ['libshiboken2.abi3.*.dylib'], ubuntu = [], windows = ['shiboken2.abi3.dll', 'MSVCP140.dll'] } missing_pyside2_plugins = { macos = [], ubuntu = ['Qt/plugins/xcbglintegrations'], windows = [] } # EGL and GLX plugins missing_other_libraries = {macos = [], ubuntu = [], windows = ['libs/libiomp5md.dll', 'libs/opengl32.dll'] } -auto_exclude = { macos = ['_tkinter'], ubuntu = ['_tkinter'], windows = [''], all = [''] } # 'lib2to3', '_bisect', -# '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', -# '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', +auto_exclude = { macos = ['_tkinter'], ubuntu = ['_tkinter'], windows = [''], all = 'lib2to3', '_bisect', + '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', + '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', # # '_multiprocessing', -# '_opcode', '_queue', '_opcode', '_uuid', '_win32sysloader', 'grp', 'readline', 'termios' ] } + '_opcode', '_queue', '_opcode', '_uuid', '_win32sysloader', 'grp', 'readline', 'termios' ] } manual_exclude = [ 'mfc*', 'msvcp*', 'VCRUNTIME*', '*Qt*3D*', '*Qt*Bluetooth*', '*Qt*Bodymovin*', '*Qt*Gamepad*', '*Qt*Location*', '*Qt*Nfc*', '*Qt*Purchasing*', '*Qt*QuickParticles*', '*Qt*QuickShapes*', '*Qt*RemoteObjects*', From ce5b350510c6b6197a4632d72b95b6b986dbe5c7 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Mon, 11 Mar 2024 11:47:05 +0100 Subject: [PATCH 34/40] syntax --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 746dead6..e9451255 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -154,7 +154,7 @@ content_suffix = { macos = 'Contents/MacOS/', ubuntu = '', windows = '' } missing_pyside2_files = { macos = ['libshiboken2.abi3.*.dylib'], ubuntu = [], windows = ['shiboken2.abi3.dll', 'MSVCP140.dll'] } missing_pyside2_plugins = { macos = [], ubuntu = ['Qt/plugins/xcbglintegrations'], windows = [] } # EGL and GLX plugins missing_other_libraries = {macos = [], ubuntu = [], windows = ['libs/libiomp5md.dll', 'libs/opengl32.dll'] } -auto_exclude = { macos = ['_tkinter'], ubuntu = ['_tkinter'], windows = [''], all = 'lib2to3', '_bisect', +auto_exclude = { macos = ['_tkinter'], ubuntu = ['_tkinter'], windows = [''], all = [ 'lib2to3', '_bisect', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', # # '_multiprocessing', From a5b27dc1fbd2e25af5a39d8ca599ff6c5e5eb5a4 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Mon, 11 Mar 2024 12:43:10 +0100 Subject: [PATCH 35/40] also test for windows --- .github/workflows/macos-windows-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/macos-windows-build.yml b/.github/workflows/macos-windows-build.yml index 633b012f..45be46bb 100644 --- a/.github/workflows/macos-windows-build.yml +++ b/.github/workflows/macos-windows-build.yml @@ -82,7 +82,6 @@ jobs: run: python ${{ env.SCRIPTS_PATH }}/InstallApp.py - name: Run app in testmode and quit - if: runner.os == 'macOS' run: python ${{ env.SCRIPTS_PATH }}/RunApp.py --testmode - name: Create zip archive of offline app installer From b492390772db043fb50bc12d4f3a46bdd5afc52e Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Mon, 11 Mar 2024 14:14:01 +0100 Subject: [PATCH 36/40] code cleaning --- .github/workflows/macos-windows-build.yml | 11 +++++++---- pyproject.toml | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/macos-windows-build.yml b/.github/workflows/macos-windows-build.yml index 45be46bb..c6fbe3e3 100644 --- a/.github/workflows/macos-windows-build.yml +++ b/.github/workflows/macos-windows-build.yml @@ -1,7 +1,10 @@ -# This pipeline -# - build executeable for MacOS -# - build executeable for Windows -# - for main executeables are deployed +# This pipeline +# EITHER +# - create installer for MacOS +# OR +# - create installer for Windows +# - test installer +# - for main executeables are deployed # -- offline installers to GitHub releases # -- online installers FTP server diff --git a/pyproject.toml b/pyproject.toml index e9451255..a26896c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -157,7 +157,6 @@ missing_other_libraries = {macos = [], ubuntu = [], windows = ['libs/libiomp5md. auto_exclude = { macos = ['_tkinter'], ubuntu = ['_tkinter'], windows = [''], all = [ 'lib2to3', '_bisect', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_curses', '_elementtree', '_hashlib', '_heapq', '_multibytecodec', -# # '_multiprocessing', '_opcode', '_queue', '_opcode', '_uuid', '_win32sysloader', 'grp', 'readline', 'termios' ] } manual_exclude = [ 'mfc*', 'msvcp*', 'VCRUNTIME*', '*Qt*3D*', '*Qt*Bluetooth*', '*Qt*Bodymovin*', '*Qt*Gamepad*', '*Qt*Location*', From 479665de6ea2fe86ab1ad0846c8e3b9692d29097 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Tue, 12 Mar 2024 06:35:37 +0100 Subject: [PATCH 37/40] timer --- .../Gui/Components/UserTutorialsController.qml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/EasyReflectometryApp/Gui/Components/UserTutorialsController.qml b/EasyReflectometryApp/Gui/Components/UserTutorialsController.qml index 081b6d67..9ff63196 100644 --- a/EasyReflectometryApp/Gui/Components/UserTutorialsController.qml +++ b/EasyReflectometryApp/Gui/Components/UserTutorialsController.qml @@ -15,10 +15,24 @@ EaElements.RemoteController { visible: false audioEnabled: false + // Timer for Creating delay + Timer { + id: timer + } + function delay(delayTime, cb) { + timer.interval = delayTime; + timer.repeat = false; + timer.triggered.connect(cb); + timer.start(); + } + Component.onCompleted: { if (EaGlobals.Variables.isTestMode) { - print('*** TEST MODE ***') - Qt.quit() + print('*** TEST MODE START ***') + delay(30000, function() { + print('*** TEST MODE 30 s DELAYED END ***') + Qt.quit() + }) // runTestTutorialTimer.start() } } From f8a90f79c84478577404efcee876676c43404a9b Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Tue, 12 Mar 2024 06:36:33 +0100 Subject: [PATCH 38/40] timer --- tools/Scripts/RunApp.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/Scripts/RunApp.py b/tools/Scripts/RunApp.py index b13002ba..05901391 100644 --- a/tools/Scripts/RunApp.py +++ b/tools/Scripts/RunApp.py @@ -3,9 +3,10 @@ import os, sys import Functions, Config - +import time CONFIG = Config.Config() +DELAYED_QUIT = 30 def appExePath() -> str: """ @@ -24,6 +25,7 @@ def runApp(): """ Functions.printNeutralMessage(f'Installed application exe path: {appExePath()}') try: + time_start = time.time() message = f'run {CONFIG.app_name}' if len(sys.argv) == 1: Functions.run(appExePath()) @@ -35,7 +37,13 @@ def runApp(): Functions.printFailMessage(message, exception) sys.exit(1) else: - Functions.printSuccessMessage(message) + time_end = time.time() + if time_end - time_start > DELAYED_QUIT: + message = f'Application {CONFIG.app_name} is running' + Functions.printSuccessMessage(message) + else: + Functions.printFailMessage(f"Application ran for less the {DELAYED_QUIT} sec. Probably import error.") + sys.exit(1) if __name__ == "__main__": runApp() From a20f2b02cdd6a0013d28dba93b85b3a4a9e7f442 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Tue, 12 Mar 2024 07:40:32 +0100 Subject: [PATCH 39/40] make it more cleat when running is testmode --- .../Gui/Components/UserTutorialsController.qml | 2 ++ tools/Scripts/RunApp.py | 18 +++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/EasyReflectometryApp/Gui/Components/UserTutorialsController.qml b/EasyReflectometryApp/Gui/Components/UserTutorialsController.qml index 9ff63196..60b8ab1a 100644 --- a/EasyReflectometryApp/Gui/Components/UserTutorialsController.qml +++ b/EasyReflectometryApp/Gui/Components/UserTutorialsController.qml @@ -28,6 +28,8 @@ EaElements.RemoteController { Component.onCompleted: { if (EaGlobals.Variables.isTestMode) { + // To ensure that Qt starts up there is a delay before the it is shut down again. + // When testing the application it should stay alive longer than the delay. print('*** TEST MODE START ***') delay(30000, function() { print('*** TEST MODE 30 s DELAYED END ***') diff --git a/tools/Scripts/RunApp.py b/tools/Scripts/RunApp.py index 05901391..cb438950 100644 --- a/tools/Scripts/RunApp.py +++ b/tools/Scripts/RunApp.py @@ -25,10 +25,17 @@ def runApp(): """ Functions.printNeutralMessage(f'Installed application exe path: {appExePath()}') try: - time_start = time.time() message = f'run {CONFIG.app_name}' if len(sys.argv) == 1: Functions.run(appExePath()) + elif sys.argv[1] == '--testmode': + time_start = time.time() + Functions.run(appExePath(), '--testmode') + time_end = time.time() + if time_end - time_start < DELAYED_QUIT: + # Delay is set in UserTutorialsController.qml + Functions.printFailMessage(f"Application ran for less the {DELAYED_QUIT} sec. Probably import error.") + sys.exit(1) else: #if 'test' in sys.argv[1:]: # Functions.createDir(CONFIG.screenshots_dir) @@ -36,14 +43,7 @@ def runApp(): except Exception as exception: Functions.printFailMessage(message, exception) sys.exit(1) - else: - time_end = time.time() - if time_end - time_start > DELAYED_QUIT: - message = f'Application {CONFIG.app_name} is running' - Functions.printSuccessMessage(message) - else: - Functions.printFailMessage(f"Application ran for less the {DELAYED_QUIT} sec. Probably import error.") - sys.exit(1) + if __name__ == "__main__": runApp() From 26c118d66461901ce0524b0a97c304357bb48d96 Mon Sep 17 00:00:00 2001 From: Andreas Pedersen Date: Wed, 13 Mar 2024 06:09:13 +0100 Subject: [PATCH 40/40] from v0.0.8 to v0.0.9 --- CHANGELOG.md | 2 ++ INSTALLATION.md | 6 +++--- pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc1510cc..bdbd5261 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ### Changes 0.0.9 +- Changes to make the MacOS version runable + ### Changes 0.0.8 - Just a retry of the release protocol diff --git a/INSTALLATION.md b/INSTALLATION.md index b543d9ca..35f49f88 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -2,9 +2,9 @@ To make the installation of EasyReflectometry as easy as possible, we prepare packaged releases for three major operating systems: -- [Windows](https://github.com/easyScience/EasyReflectometryApp/releases/download/v0.0.8-beta/EasyReflectometry_Windows_x86-32_v0.0.8-beta.exe) -- [macOS](https://github.com/easyScience/EasyReflectometryApp/releases/download/v0.0.8-beta/EasyReflectometry_macOS_x86-64_v0.0.8-beta.zip) (built on 10.15) -- [Linux](https://github.com/easyScience/EasyReflectometryApp/releases/download/v0.0.8-beta/EasyReflectometry_Linux_x86-64_v0.0.8-beta.zip) (built on Ubuntu-20.04) +- [Windows](https://github.com/easyScience/EasyReflectometryApp/releases/download/v0.0.9-beta/EasyReflectometry_Windows_x86-32_v0.0.9-beta.exe) +- [macOS](https://github.com/easyScience/EasyReflectometryApp/releases/download/v0.0.9-beta/EasyReflectometry_macOS_x86-64_v0.0.9-beta.zip) (built on 10.15) +- [Linux](https://github.com/easyScience/EasyReflectometryApp/releases/download/v0.0.9-beta/EasyReflectometry_Linux_x86-64_v0.0.9-beta.zip) (built on Ubuntu-20.04) If the relevant EasyReflectometry installation does not work on your system, then please try installation from source. diff --git a/pyproject.toml b/pyproject.toml index a26896c4..34c7e23a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "hatchling.build" # Note that while the project is called EasyReflectometryApp # the application itself is EasyReflectometry. name = "EasyReflectometry" -version = "0.0.9-dev" +version = "0.0.9" description = "Making reflectometry data analysis and modelling easy." authors = [ {name = "Andrew R. McCluskey", email = "andrew.mccluskey@ess.eu"},