fix wrong spaces and priority for session restore

This commit is contained in:
Cosmin Popescu 2016-11-09 19:27:48 +01:00
parent c590a37043
commit 89e6ff6599
2 changed files with 7 additions and 7 deletions

View File

@ -211,16 +211,16 @@ def _load_session(name):
""" """
state_config = objreg.get('state-config') state_config = objreg.get('state-config')
session_manager = objreg.get('session-manager') session_manager = objreg.get('session-manager')
if name is None: if name is None and session_manager.exists('_autosave'):
name = '_autosave'
elif name is None:
try: try:
name = state_config['general']['session'] name = state_config['general']['session']
except KeyError: except KeyError:
# No session given as argument and none in the session file -> # No session given as argument and none in the session file ->
# start without loading a session # start without loading a session
if session_manager.exists('_autosave'): return
name = '_autosave'
else:
return
try: try:
session_manager.load(name) session_manager.load(name)
except sessions.SessionNotFoundError: except sessions.SessionNotFoundError:
@ -726,7 +726,7 @@ class Quitter:
# Now we can hopefully quit without segfaults # Now we can hopefully quit without segfaults
log.destroy.debug("Deferring QApplication::exit...") log.destroy.debug("Deferring QApplication::exit...")
objreg.get('signal-handler').deactivate() objreg.get('signal-handler').deactivate()
objreg.get('session-manager').session_delete('_autosave', force = True) objreg.get('session-manager').session_delete('_autosave', force=True)
# We use a singleshot timer to exit here to minimize the likelihood of # We use a singleshot timer to exit here to minimize the likelihood of
# segfaults. # segfaults.
QTimer.singleShot(0, functools.partial(qApp.exit, status)) QTimer.singleShot(0, functools.partial(qApp.exit, status))

View File

@ -686,7 +686,7 @@ class AbstractTab(QWidget):
@pyqtSlot(bool) @pyqtSlot(bool)
def _on_load_finished(self, ok): def _on_load_finished(self, ok):
sess_manager = objreg.get('session-manager') sess_manager = objreg.get('session-manager')
sess_manager.session_save('_autosave', quiet = True, force = True) sess_manager.session_save('_autosave', quiet=True, force=True)
if ok and not self._has_ssl_errors: if ok and not self._has_ssl_errors:
if self.url().scheme() == 'https': if self.url().scheme() == 'https':
self._set_load_status(usertypes.LoadStatus.success_https) self._set_load_status(usertypes.LoadStatus.success_https)