- more outstanding output of frappy server state - frappy() does now alse an update if needed - frappy.show() to show state only
75 lines
2.4 KiB
Python
75 lines
2.4 KiB
Python
# *****************************************************************************
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify it under
|
|
# the terms of the GNU General Public License as published by the Free Software
|
|
# Foundation; either version 2 of the License, or (at your option) any later
|
|
# version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
# details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along with
|
|
# this program; if not, write to the Free Software Foundation, Inc.,
|
|
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
#
|
|
# Module authors:
|
|
# Markus Zolliker <markus.zolliker@psi.ch>
|
|
#
|
|
# *****************************************************************************
|
|
|
|
from nicos import session, config
|
|
from nicos.utils import printTable
|
|
from nicos.commands import helparglist, usercommand
|
|
from .devices import get_frappy_config, all_info
|
|
from servicemanager import FrappyManager, SeaManager
|
|
|
|
|
|
SERVICES = FrappyManager.services
|
|
|
|
|
|
@usercommand
|
|
def set_se_list():
|
|
fc = get_frappy_config()
|
|
if fc:
|
|
fc.set_envalias()
|
|
|
|
|
|
@usercommand
|
|
def frappy_main(*args):
|
|
raise NameError('frappy_main(<cfg>) is no longer avaiable, use frappy(<cfg>) instead')
|
|
|
|
|
|
@usercommand
|
|
def frappy_stick(*args):
|
|
raise NameError('frappy_stick(<cfg>) is no longer avaiable, use frappy(stick=<cfg>) instead')
|
|
|
|
|
|
@usercommand
|
|
def frappy_addons(*args):
|
|
raise NameError('frappy_addons(<cfg>) is no longer avaiable, use frappy(addons=<cfg>) instead')
|
|
|
|
|
|
@usercommand
|
|
@helparglist('')
|
|
def frappy_list(service=None):
|
|
"""list available configuration files"""
|
|
content = []
|
|
|
|
def prt(line):
|
|
content.append(line)
|
|
|
|
if service is None:
|
|
prt('Available configuration files')
|
|
prt('')
|
|
prt('Hint: if no config file can be found which matches your needs exactly')
|
|
prt('make a copy of an existing one, and change the description accordingly')
|
|
prt('')
|
|
prt('Usage (default argument "main"):')
|
|
prt('')
|
|
printTable(['command'], [['frappy_list(%r)' % s] for s in SERVICES], prt)
|
|
|
|
FrappyManager().do_listcfg(config.instrument, service or 'main', prt)
|
|
session.log.info('\n%s', '\n'.join(content))
|