summaryrefslogtreecommitdiff
path: root/silx/sx/__init__.py
diff options
context:
space:
mode:
authorAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2019-07-09 10:20:20 +0200
committerAlexandre Marie <alexandre.marie@synchrotron-soleil.fr>2019-07-09 10:20:20 +0200
commit654a6ac93513c3cc1ef97cacd782ff674c6f4559 (patch)
tree3b986e4972de7c57fa465820367602fc34bcb0d3 /silx/sx/__init__.py
parenta763e5d1b3921b3194f3d4e94ab9de3fbe08bbdd (diff)
New upstream version 0.11.0+dfsg
Diffstat (limited to 'silx/sx/__init__.py')
-rw-r--r--silx/sx/__init__.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/silx/sx/__init__.py b/silx/sx/__init__.py
index e3641c8..97a3460 100644
--- a/silx/sx/__init__.py
+++ b/silx/sx/__init__.py
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
-# Copyright (c) 2016-2018 European Synchrotron Radiation Facility
+# Copyright (c) 2016-2019 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -75,6 +75,10 @@ else:
_IS_NOTEBOOK = False
+# Placeholder for QApplication
+_qapp = None
+
+
def enable_gui():
"""Populate silx.sx module with silx.gui features and initialise Qt"""
if _NO_DISPLAY: # Missing DISPLAY under linux
@@ -82,18 +86,21 @@ def enable_gui():
'Not loading silx.gui features: No DISPLAY available')
return
- global qt, qapp
+ global qt, _qapp
if _IS_NOTEBOOK:
_get_ipython().enable_pylab(gui='qt', import_all=False)
from silx.gui import qt
- qapp = qt.QApplication.instance() or qt.QApplication([])
+ # Create QApplication and keep reference only if needed
+ if not qt.QApplication.instance():
+ _qapp = qt.QApplication([])
if hasattr(_sys, 'ps1'): # If from console, change windows icon
# Change windows default icon
from silx.gui import icons
- qapp.setWindowIcon(icons.getQIcon('silx'))
+ app = qt.QApplication.instance()
+ app.setWindowIcon(icons.getQIcon('silx'))
global ImageView, PlotWidget, PlotWindow, Plot1D
global Plot2D, StackView, ScatterView, TickMode