def __init__(self, views=None):

        if views is None:
            print('load views from database ...')
            views = ft.get_class_devices('PanicViewDS')
            views.append(ft.get_tango_host())

        print('ViewChooser(%s)' % views)
        self.view = ''
        self.views = fd.dicts.SortedDict()
        for v in views:
            if ':' in v:
                self.views[v] = v
            else:
                desc = ft.get_device(v).Description.split('\n')[0]
                self.views[desc] = v

        Qt.QDialog.__init__(self, None)
        #self.setModal(True)
        self.setWindowTitle('PANIC View Chooser')
        self.setLayout(Qt.QVBoxLayout())
        self.layout().addWidget(Qt.QLabel('Choose an AlarmView'))
        self.chooser = Qt.QComboBox()
        self.chooser.addItems(self.views.keys())
        self.layout().addWidget(self.chooser)
        self.button = Qt.QPushButton('Done')
        self.layout().addWidget(self.button)
        self.button.connect(self.button, Qt.SIGNAL('pressed()'), self.done)
        self.button.connect(self.button, Qt.SIGNAL('pressed()'), self.close)
예제 #2
0
def get_hdbpp_databases():
    cms = ft.get_class_devices('HdbConfigurationManager')
    dbs = {}
    for c in cms:
        props = ['LibConfiguration', 'ArchiverList']
        props = ft.get_database().get_device_property(c, props)
        db = dict(t.split('=') for t in props['LibConfiguration'])['dbname']
        dbs[db] = {c: None}
        for a in props['ArchiverList']:
            dbs[db][a] = ft.get_device_property(a, 'AttributeList')
    return dbs
예제 #3
0
def get_hdbpp_databases(archivers=[],dbs={}):
    """
    Method to obtain list of dbs/archivers; it allows to match any 
    archiver list against existing dbs.
    
    This method can be used in cached mode executed like:
    
        dbs = get_hdbpp_databases()
        for a in archivers:
            db = get_hdbpp_databases(a,dbs).keys()[0]
      
    """
    if not dbs:
        dbs = {}
        print('Loading databases from Tango')
        cms = ft.get_class_devices('HdbConfigurationManager')
        for c in cms:
            try:
                props = ['LibConfiguration','ArchiverList']
                props = ft.get_database().get_device_property(c,props)
                db = dict(t.split('=') 
                          for t in props['LibConfiguration'])['dbname']
                dbs[db] = {c:None}
                for c in props['ArchiverList']:
                    dbs[db][c] =  ft.get_device_property(c,'AttributeList')
            except:
                print('Unable to load %s config' % str(c))
                traceback.print_exc()
    else:
        dbs = dbs.copy()
            
    if archivers:
        archivers = list(archivers) #Don't use toList here!
        targets = []
        for a in archivers:
            m = fn.parse_tango_model(a,fqdn=True)
            targets.extend((m.fullname, m.devicename, m.devicemodel))
            
        print(targets)

        for db,archs in dbs.items():
            narchs = {}
            for a in archs.keys():
                if fn.inCl(a,targets):
                    m = fn.parse_tango_model(a,fqdn=True).fullname
                    narchs[m] = archs[a]
            if not narchs:
                dbs.pop(db)
            else:
                dbs[db] = narchs
            
    return dbs
예제 #4
0
    def __init__(self, mask=None):
        #mask = mask or 'FolderDS/*'
        self.mask = mask
        ProxiesDict.__init__(self)
        devs = tango.get_class_devices('FolderDS')
        extra = fn.get_database().get_class_property('FolderDS',
                                                     ['ExtraDevices'])
        devs.extend(extra.get('ExtraDevices', []))
        if mask: devs = fn.filtersmart(devs, mask)
        self.hosts = fn.defaultdict(list)

        for d in devs:
            self[d]
예제 #5
0
 def load_by_class(self, klass):
     """ Initializes the ServersDict using all the devices from a given class """
     self.load_from_devs_list(get_class_devices(klass))
예제 #6
0
 def load_by_class(self,klass):
     """ Initializes the ServersDict using all the devices from a given class """
     self.load_from_devs_list(get_class_devices(klass))