mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Python console widget: Save registry fix (#6076)
* it is possible to call 'save_registry' only when window is showed up * used more clever way how to determine if should be saved
This commit is contained in:
parent
9ea90962c8
commit
64d39613fa
1 changed files with 9 additions and 1 deletions
|
|
@ -354,7 +354,7 @@ class PythonInterpreterWidget(QtWidgets.QWidget):
|
|||
default_width = 1000
|
||||
default_height = 600
|
||||
|
||||
def __init__(self, parent=None):
|
||||
def __init__(self, allow_save_registry=True, parent=None):
|
||||
super(PythonInterpreterWidget, self).__init__(parent)
|
||||
|
||||
self.setWindowTitle("{} Console".format(
|
||||
|
|
@ -414,6 +414,8 @@ class PythonInterpreterWidget(QtWidgets.QWidget):
|
|||
|
||||
self._first_show = True
|
||||
self._splitter_size_ratio = None
|
||||
self._allow_save_registry = allow_save_registry
|
||||
self._registry_saved = True
|
||||
|
||||
self._init_from_registry()
|
||||
|
||||
|
|
@ -457,6 +459,11 @@ class PythonInterpreterWidget(QtWidgets.QWidget):
|
|||
pass
|
||||
|
||||
def save_registry(self):
|
||||
# Window was not showed
|
||||
if not self._allow_save_registry or self._registry_saved:
|
||||
return
|
||||
|
||||
self._registry_saved = True
|
||||
setting_registry = PythonInterpreterRegistry()
|
||||
|
||||
setting_registry.set_item("width", self.width())
|
||||
|
|
@ -650,6 +657,7 @@ class PythonInterpreterWidget(QtWidgets.QWidget):
|
|||
|
||||
def showEvent(self, event):
|
||||
self._line_check_timer.start()
|
||||
self._registry_saved = False
|
||||
super(PythonInterpreterWidget, self).showEvent(event)
|
||||
# First show setup
|
||||
if self._first_show:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue