From 2f88b970fe5b30452e270596907b32019f7cd8ba Mon Sep 17 00:00:00 2001 From: Jonathan LEVY <23365238+j-levy@users.noreply.github.com> Date: Tue, 15 Jun 2021 17:29:35 +0200 Subject: [PATCH 1/2] reset editor when closing the window. fix #30 --- src/openalea/lpy/gui/objectdialog.py | 11 +++++------ src/openalea/lpy/gui/objectpanel.py | 3 ++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/openalea/lpy/gui/objectdialog.py b/src/openalea/lpy/gui/objectdialog.py index 204bd0ef..6ba03925 100644 --- a/src/openalea/lpy/gui/objectdialog.py +++ b/src/openalea/lpy/gui/objectdialog.py @@ -9,7 +9,7 @@ from openalea.plantgl.gui.qt.QtCore import QObject, pyqtSignal from openalea.plantgl.gui.qt.QtWidgets import QApplication, QCheckBox, QDialog, QHBoxLayout, QLayout, QMenuBar, QPushButton, QSizePolicy, QSpacerItem, QVBoxLayout - + class ObjectDialog(QDialog): """the class that will create dialog between the panel and the editor window""" valueChanged = pyqtSignal() @@ -25,7 +25,9 @@ def __init__(self, *args): def setupUi(self,editor): self.setObjectName("ObjectDialog") - self.resize(389, 282) + self.setBaseSize(600,400) + self.setMinimumHeight(200) + self.setMinimumWidth(300) self.verticalLayout = QVBoxLayout(self) self.verticalLayout.setSpacing(2) self.verticalLayout.setContentsMargins(2, 2, 2, 2) @@ -74,7 +76,7 @@ def setupUi(self,editor): self.applyButton.pressed.connect(self.__apply) self.autoUpdateCheckBox.toggled.connect(self.setAutomaticUpdate) self.objectView.valueChanged.connect(self.__valueChanged) - + def menu(self): return self._menu @@ -107,6 +109,3 @@ def setAutomaticUpdate(self,value): self.__apply() - def closeEvent(self,event): - QDialog.closeEvent(self,event) - diff --git a/src/openalea/lpy/gui/objectpanel.py b/src/openalea/lpy/gui/objectpanel.py index d427deea..c51a845f 100644 --- a/src/openalea/lpy/gui/objectpanel.py +++ b/src/openalea/lpy/gui/objectpanel.py @@ -137,7 +137,7 @@ def startObjectEdition(self,obj,id): def endObjectEdition(self): if self.editor: - self.editorDialog.hide() + self.editorDialog.hide() def getEditedObject(self): """ used by panel. ask for object edition to start. Use getEditor and setObjectToEditor """ @@ -147,6 +147,7 @@ def getEditedObject(self): def endEditionEvent(self): """ called when closing editor. """ self.editedobjectid = None + self.editor = None def isVisible(self): """ Tell whether editor is visible """ From f8717ee39d1c54366a50b9f72984f6ac842de353 Mon Sep 17 00:00:00 2001 From: Jonathan LEVY <23365238+j-levy@users.noreply.github.com> Date: Thu, 17 Jun 2021 09:46:06 +0200 Subject: [PATCH 2/2] function must return tuple, fix #29 --- src/openalea/lpy/gui/objectpanel.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openalea/lpy/gui/objectpanel.py b/src/openalea/lpy/gui/objectpanel.py index c51a845f..74019d93 100644 --- a/src/openalea/lpy/gui/objectpanel.py +++ b/src/openalea/lpy/gui/objectpanel.py @@ -143,6 +143,8 @@ def getEditedObject(self): """ used by panel. ask for object edition to start. Use getEditor and setObjectToEditor """ if not self.editedobjectid is None: return self.manager.retrieveObjectFromEditor(self.editor),self.editedobjectid + else: + return None, None #function must always return a tuple def endEditionEvent(self): """ called when closing editor. """