Skip to content

Commit 28b5b41

Browse files
committed
qtvcp -move saving of prefs/settings and shutdown code to qtvcp file
If someone didn't want the exit dialog. the settings were not saved. This behaivour was done by accident a while ago when we were try to stop crashes at exit.
1 parent 1bb31cc commit 28b5b41

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

lib/python/qtvcp/qt_makegui.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def shutdown(self):
130130
def sync_qsettings(self):
131131
try:
132132
self.settings.sync()
133+
log.debug('Qsettings sync called:')
133134
except Exception as e:
134135
log.debug('Error with Qsettings sync function:\n {}'.format(e))
135136

lib/python/qtvcp/widgets/screen_options.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,7 @@ def closeEvent(self, event):
391391
answer = True
392392
# system shutdown
393393
if answer == QtWidgets.QMessageBox.DestructiveRole:
394-
self.QTVCP_INSTANCE_.settings.sync()
395394
self.QTVCP_INSTANCE_.shutdown()
396-
self.QTVCP_INSTANCE_.panel_.shutdown()
397-
STATUS.shutdown()
398395
try:
399396
HANDLER = self.QTVCP_INSTANCE_.handler_instance
400397
if 'system_shutdown_request__' in dir(HANDLER):
@@ -411,10 +408,7 @@ def closeEvent(self, event):
411408
elif answer:
412409
if self.PREFS_ and self.play_sounds and self.shutdown_play_sound:
413410
STATUS.emit('play-sound', self.shutdown_exit_sound_type)
414-
self.QTVCP_INSTANCE_.settings.sync()
415411
self.QTVCP_INSTANCE_.shutdown()
416-
self.QTVCP_INSTANCE_.panel_.shutdown()
417-
STATUS.shutdown()
418412
event.accept()
419413
# cancel
420414
elif answer == False:

src/emc/usr_intf/qtvcp/qtvcp.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def __init__(self):
247247
global HAL
248248
HAL = self.halcomp
249249
# initialize the window
250-
window = qt_makegui.VCPWindow(self.hal, self.PATH)
250+
self.w = window = qt_makegui.VCPWindow(self.hal, self.PATH)
251251

252252
# give reference to user command line options
253253
if opts.useropts:
@@ -446,6 +446,21 @@ def postgui_cmd(self):
446446
# This can be called by control c or an early error.
447447
# close out HAL pins
448448
def shutdown(self,signum=None,stack_frame=None):
449+
450+
from qtvcp.core import Status
451+
s = Status()
452+
LOG.debug('Status shutdown')
453+
s.shutdown()
454+
455+
try:
456+
self.w.sync_qsettings()
457+
except:
458+
pass
459+
try:
460+
self.w.panel_.shutdown()
461+
except:
462+
pass
463+
449464
LOG.debug('Exiting HAL')
450465
HAL.exit()
451466

0 commit comments

Comments
 (0)