Example #1
0
    def main(args=[]):
        """Main launcher, load views and stops threads on exit"""

        t0 = time.time()
        args = args or ft.get_free_property('PANIC', 'DefaultArgs')
        opts = [a for a in args if a.startswith('-')]
        args = [a for a in args if not a.startswith('-')]

        if any(o in opts for o in ('-h', '--help', '-?')):
            print(HELP)
            return

        from taurus.qt.qtgui.application import TaurusApplication
        uniqueapp = TaurusApplication([])  #opts)

        if '--calc' in opts:
            args = args or ['']
            form = AlarmPreview(*args)
            form.show()
            uniqueapp.exec_()
            return

        if '--panel' in opts:
            args = args or ['*']
            import panic.gui.panel
            form = panic.gui.panel.QAlarmPanel()
            form.setModel(args)
            form.show()
            uniqueapp.exec_()
            return

        # ([os.getenv('PANIC_DEFAULT')] if os.getenv('PANIC_DEFAULT') else []))

        ## @TODO: Global views (multi-host) to be added
        #if not views:
        #vc = ViewChooser()
        #vc.exec_()
        #views = vc.view
        #if not views or not any(views):
        #sys.exit(-1)

        print '=' * 80
        trace('launching AlarmGUI ... %s, %s' % (args, opts))
        print '=' * 80
        alarmApp = AlarmGUI(filters='|'.join(args),
                            options=opts,
                            mainwindow=True)
        print('AlarmGUI created after %s seconds' % (time.time() - t0))
        #alarmApp.tmw.show()
        n = uniqueapp.exec_()

        print('AlarmGUI exits ...')

        sys.exit(n)
Example #2
0
def get_alias_file(schema=''):
    from fandango.tango import get_free_property, get_class_property
    if not schema or schema in ('*', ''):
        alias_file = get_free_property('PyTangoArchiving', 'AliasFile')
    else:
        alias_file = get_class_property('%sextractor' % schema, 'AliasFile')
        if isSequence(alias_file) and len(alias_file):
            alias_file = alias_file[0]
        if not alias_file:
            alias_file = get_alias_file()

    return alias_file
Example #3
0
def get_alias_file(schema = ''):
    from fandango.tango import get_free_property,get_class_property
    if not schema or schema in ('*',''):
        alias_file = get_free_property('PyTangoArchiving','AliasFile')
    else:
        alias_file = get_class_property('%sextractor'%schema,'AliasFile')
        if isSequence(alias_file) and len(alias_file):
            alias_file = alias_file[0]
        if not alias_file:
            alias_file = get_alias_file()

    return alias_file