Skip to content

Commit b755950

Browse files
committed
qtvcp -keep track of embedded panels so as to call closing functions
otherwise preference saving won't work
1 parent d649e80 commit b755950

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

lib/python/qtvcp/qt_makegui.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def __init__(self, halcomp=None, path=None):
9393
self.PREFS_ = None
9494
self.originalCloseEvent_ = self.closeEvent
9595
self._halWidgetList = []
96+
self._VCPWindowList = []
9697
self.settings = QtCore.QSettings('QtVcp', path.BASENAME)
9798
log.info('Qsettings file path: yellow<{}>'.format(self.settings.fileName()))
9899
# make an instance with embedded variables so they
@@ -119,10 +120,12 @@ def keyPressTrap(self, e):
119120
def keyReleaseTrap(self, e):
120121
return False
121122

123+
# call closing function on main and embedded windows.
122124
def shutdown(self):
123-
if self.has_closing_handler:
124-
log.debug('Calling handler file Closing_cleanup__ function.')
125-
self.handler_instance.closing_cleanup__()
125+
for i in (self._VCPWindowList):
126+
if 'closing_cleanup__' in dir(i):
127+
log.debug('Calling handler file Closing_cleanup__ function of {}.'.format(i))
128+
i.closing_cleanup__()
126129

127130
def sync_qsettings(self):
128131
try:

lib/python/qtvcp/qt_makepins.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def __init__(self, halcomp, path, window, debug):
4343
self._screenOptions = None
4444
self._geo_string = ''
4545
self.PATH = path
46+
window._VCPWindowList.append(window)
4647

4748
# see if a screenoptions widget is present
4849
# if it is then initiate the preference file
@@ -97,6 +98,7 @@ def __init__(self, halcomp, path, window, debug):
9798
# search for ui path and load if available
9899
uipath = self.PATH.find_embed_panel_path(cmd)
99100
window[pName].instance(uipath)
101+
window._VCPWindowList.append(window[pName])
100102

101103
# initialize handler if available
102104
if hndlr is not True and os.path.exists(hndlr):

0 commit comments

Comments
 (0)