예제 #1
0
 def get_item(self):
     item = self.get_active_iter()
     if item is None:
         return None
     name = self._items.get(item, 0)[0]
     objname = '%s_%s' % (self._namedlist.get_base_name(), name)
     return helper.find_object(objname)
예제 #2
0
 def add_instruments(self):
     inslist = qt.instruments.get_instrument_names()
     inslist.sort()
     for insname in inslist:
         # This should perhaps go through qt.get_instrument_proxy()
         ins = helper.find_object('instrument_%s' % insname)
         self.add_instrument(ins)
예제 #3
0
    def set_instrument(self, ins):
        if type(ins) == types.StringType:
            # This should perhaps go through qt.get_instrument_proxy()
            ins = helper.find_object('instruments_%s' % ins)

        if self._instrument == ins:
            return True

        if ins is not None:
            self._insname = ins.get_name()
        else:
            self._insname = ''

        self._instrument = ins
        self._param_list.clear()
        if ins is not None:
            self._param_list.append([TEXT_NONE])

            self._instrument.connect('parameter-added', self._parameter_added_cb)

            for (name, options) in misc.dict_to_ordered_tuples(ins.get_shared_parameters()):
                if len(self._types) > 0 and options['type'] not in self._types:
                    continue

                if options['flags'] & self._flags:
                    self._param_list.append([name])
        else:
            self._param_list.clear()
예제 #4
0
    def __init__(self, types=[]):
        self._ins_list = gtk.ListStore(gobject.TYPE_STRING)
        QTComboBox.__init__(self, model=self._ins_list)

        self._types = types
        self._ins_list.append([TEXT_NONE])
        self._instruments = qt.instruments
        for insname in self._instruments.get_instrument_names():
            # This should perhaps go through qt.get_instrument_proxy()
            ins = helper.find_object('instrument_%s' % insname)
            if len(types) == 0 or ins.has_tag(types):
                self._ins_list.append([insname])

        self._instruments.connect('instrument-added', self._instrument_added_cb)
        self._instruments.connect('instrument-removed', self._instrument_removed_cb)
        self._instruments.connect('instrument-changed', self._instrument_changed_cb)
예제 #5
0
def get_plot_proxy(name):
    return helper.find_object('%s:plot_%s' % (config['instance_name'], name))
예제 #6
0
flow = helper.find_remote_object('%s:flow' % config['instance_name'])
if flow is None:
    flow = helper.find_remote_object('flow')
    if flow is None:
        raise ValueError('Unable to locate qt.flow object (%s), client failed to start' % config['instance_name'])
    else:
        print 'Connected to undefined qtlab instance'

for i in range(100):
    status = flow.get_status()
    if not (status is None or status == "starting"):
        break
    print 'Status: %r, waiting...' % status
    time.sleep(2)

instruments = helper.find_object('%s:instruments1' % config['instance_name'])
plots = helper.find_object('%s:namedlist_plot' % config['instance_name'])
data = helper.find_object('%s:namedlist_data' % config['instance_name'])
interpreter = helper.find_object('%s:python_server' % config['instance_name'])
frontpanels = {}
sliders = {}

from lib.gui.qtwindow import QTWindow
windows = QTWindow.get_named_list()

def get_instrument_proxy(name):
    return helper.find_object('%s:instrument_%s' % (config['instance_name'], name))

def get_data_proxy(name):
    return helper.find_object('%s:data_%s' % (config['instance_name'], name))