Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Create you own interactive shell

Project description

The module helps to create a custom interactive shell similar to the python
interactive shell

exmaple usage
$ ./semanticsbml_console.py -q ’c 0;a 0’ -p ../../../
release_25September2007_sbmls/...
...curated/BIOMD0000000090.xml
semanticSBML main menu
l list all loaded models
o [FILENAME] open a model
d [DIR] open all models in the directory (without arguments last used)
c [MODEL_NR] display check results for a model
a [MODEL_NR] annotate a model with database identifiers
e export a svg image of a model
m [[MODEL_NR1] , ..] merge 2 or more models by inserting a list of models
s save model(s)
v save model(s) as
r [MODEL_NR] remove model
about about this software
i ID -SBML Generate SBML files from Database Identifiers
commands: help, dir, rec, prec, play, hist, q, exit
you can use ctrl+D (win ctr+Z) to exit
###executing### c 0

example integration:
create a main menu:
self._locals = {
'l':(self.listFiles,'List Models'),
'i2s':(Id2Sbml_view,'ID -> SBML'),
'd':(self.openDirectory,'Open Directory')
}
self._help="
<<< semanticSBML main menu >>>
l list all loaded models
d [DIR] open all models in the directory (without arguments last used)
i2s ID - SBML Generate SBML files from Database Identifiers"

cc = CustomConsole(self._locals,self._help).run()


a submenu can be created like this:

class Id2Sbml_view():
def __init__(self):
help=" ID -> SBML
e [ID1 ID2] Enter a List of KEGG Reaction Identifiers
q exit this menu"
cc = CustomConsole({'e':(self.slotNext_l,'insert list'),'q':
(self.exit,'exit')},help).run('...')

also user input can be returned directly without connecting it to a function::
input = CustomConsole().raw_input('Are you sure you want to do this? y/n:')
this function should be used instead of the native python raw_input since its
input is captured and can be replayed

Project details


Release history Release notifications

This version
History Node

1.0

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page