forked from nilesh-patil/python-XTensions
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathXTInteractiveShell.py
More file actions
49 lines (39 loc) · 1.13 KB
/
XTInteractiveShell.py
File metadata and controls
49 lines (39 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#
#
# Python Interactive Shell XTension
#
# Copyright (c) 2013 Egor Zindy (egor.zindy@manchester.ac.uk), BSD-style copyright and disclaimer apply
#
# <CustomTools>
# <Menu name = "Python plugins">
# <Submenu name = "Code">
# <Item name="Interactive Shell" icon="Python" tooltip="Opens an interactive shell.">
# <Command>PythonXT::XTInteractiveShell(%i)</Command>
# </Item>
# </Submenu>
# </Menu>
# </CustomTools>
import ImarisLib
import time
import code
#import numpy
import BridgeLib
def XTInteractiveShell(aImarisId):
# Create an ImarisLib object
vImarisLib = ImarisLib.ImarisLib()
# Get an imaris object with id aImarisId
vImaris = vImarisLib.GetApplication(aImarisId)
# Check if the object is valid
if vImaris is None:
print "Could not connect to Imaris!"
time.sleep(2)
return
# Get the dataset
vDataSet = vImaris.GetDataSet()
# Check if the object is valid
if vDataSet is None:
print "Warning: No dataset!\n"
vars = globals().copy()
vars.update(locals())
shell = code.InteractiveConsole(vars)
shell.interact()