Commit 9a283bfa authored by dpace's avatar dpace
Browse files

STYLE: util.py imports _app from __main__, instead of using a global app variable

git-svn-id: http://svn.slicer.org/Slicer4/trunk@15524 3bd1e089-480b-0410-8dfb-8563597acbee
parent ca241d5c
import vtk, qt, ctk
import slicer
_app = _qSlicerCoreApplicationInstance
from slicer.util import *
import slicer.cli
......@@ -8,15 +11,10 @@ import slicer.cli
#
class _Internal():
import slicer.util
def __init__(self):
global _qSlicerCoreApplicationInstance
app = _qSlicerCoreApplicationInstance
slicer.util._app = app
import imp
moduleManager = app.moduleManager()
moduleManager = _app.moduleManager()
factoryManager = moduleManager.factoryManager()
factoryManager.connect('allModulesRegistered()', self.setSlicerModuleNames)
moduleManager.connect('moduleLoaded(qSlicerAbstractCoreModule*)', self.setSlicerModules)
......@@ -30,7 +28,7 @@ class _Internal():
setattr(slicer, _modules.__name__, _modules)
# Retrieve current instance of the scene and set 'slicer.mrmlScene'
setattr(slicer, 'mrmlScene', app.mrmlScene())
setattr(slicer, 'mrmlScene', _app.mrmlScene())
def setSlicerModuleNames(self):
......
# This variable should be set externally
_app = None
def quit():
exit()
......@@ -8,7 +5,7 @@ def exit():
app().quit()
def app():
global _app
from __main__ import _app
return _app
def mainWindow():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment