Source
xxxxxxxxxx
return self.__invoke( dbus.Boolean, bool, self.__state['proxy'].contourlevels, dbus.Array(map( lambda(x): float(x), levels),signature="d"), baselevel, unitlevel, data )
import os
import re
import sys
import time
import base64
import string
from casa_stack_manip import stack_frame_find
import __casac__
try:
import dbus
try:
bus = dbus.SessionBus( )
have_dbus_module = True
except:
print "warning: dbus is not properly configured, viewer scripting will not be available"
have_dbus_module = False
bus = None
except:
print "warning: dbus is not available, viewer scripting will not be available"
have_dbus_module = False
bus = None
def dbus_connection( ):
return bus
def seqselect(test, list):
"""
Select the elements from a sequence that
satisfy the given test function
- compare The test function should have following
signature def test(item): and must return a boolean
- list The List from which element need to be selected
"""
selected = [ ]
for item in list:
if test(item) == True:
selected.append(item)
return selected
class viewertool(object):
"manage task engines"
__t = string.maketrans("abcdefghijklmnopqrstuvwxyz0123456789/*:%$#@!&()~+,.:;{}[]|\\\"'^","abcdefghijklmnopqrstuvwxyz0123456789__________________________")
###
### 'use_existing' defaults to false because:
### o for linux a new dbus session daemon is started for each casapy
### o for osx it would result in multiple casapy sessions using the same viewer
### o for casa.py included into python it makes sense to avoid a new viewer
### appearing (and sticking around) for each include
###
def __init__( self, with_gui=True, pre_launch=False, use_existing=False ):
if type(with_gui) != bool:
raise Exception, "the 'with_gui' parameter must be a boolean"
self.__state = { }
self.__state['proxy'] = None
self.__state['gui'] = with_gui