示例#1
0
def setup_shell():

  banner = '+-----------------------------------------------------------+\n'
  banner += ' SimpleCV '
  banner += SIMPLECV_VERSION
  banner += ' [interactive shell] - http://simplecv.org\n'
  banner += '+-----------------------------------------------------------+\n'
  banner += '\n'
  banner += 'Commands: \n'
  banner += '\t"exit()" or press "Ctrl+ D" to exit the shell\n'
  banner += '\t"clear" to clear the shell screen\n'
  banner += '\t"tutorial" to begin the SimpleCV interactive tutorial\n'
  banner += '\t"example" gives a list of examples you can run\n'
  banner += '\t"forums" will launch a web browser for the help forums\n'
  banner += '\t"walkthrough" will launch a web browser with a walkthrough\n'
  banner += '\n'
  banner += 'Usage:\n'
  banner += '\tdot complete works to show library\n'
  banner += '\tfor example: Image().save("/tmp/test.jpg") will dot complete\n'
  banner += '\tjust by touching TAB after typing Image().\n'
  banner += '\n'
  banner += 'Documentation:\n'
  banner += '\thelp(Image), ?Image, Image?, or Image()? all do the same\n'
  banner += '\t"docs" will launch webbrowser showing documentation'
  banner += '\n'
  exit_msg = '\n... [Exiting the SimpleCV interactive shell] ...\n'
  


  #IPython version is less than 11
  if IPVER <= 10:
    #setup terminal to show SCV prompt
    argsv = ['-pi1','SimpleCV:\\#>','-pi2','   .\\D.:','-po','SimpleCV:\\#>','-nosep']

    scvShell = IPShellEmbed(argsv)
    scvShell.set_banner(banner)
    scvShell.set_exit_msg(exit_msg)
    scvShell.IP.api.expose_magic("tutorial",magic_tutorial)
    scvShell.IP.api.expose_magic("clear", magic_clear)
    scvShell.IP.api.expose_magic("example", magic_examples)
    scvShell.IP.api.expose_magic("forums", magic_forums)
    scvShell.IP.api.expose_magic("walkthrough", magic_walkthrough)
    scvShell.IP.api.expose_magic("docs", magic_docs)

    return scvShell

  #IPython version 0.11 or higher
  else:
    cfg = Config()
    cfg.PromptManager.in_template = "SimpleCV:\\#> "
    cfg.PromptManager.out_template = "SimpleCV:\\#: "
    #~ cfg.InteractiveShellEmbed.prompt_in1 = "SimpleCV:\\#> "
    #~ cfg.InteractiveShellEmbed.prompt_out="SimpleCV:\\#: "
    scvShell = InteractiveShellEmbed(config=cfg, banner1=banner, exit_msg = exit_msg)
    scvShell.define_magic("tutorial",magic_tutorial)
    scvShell.define_magic("clear", magic_clear)
    scvShell.define_magic("example", magic_examples)
    scvShell.define_magic("forums", magic_forums)
    scvShell.define_magic("walkthrough", magic_walkthrough)
    scvShell.define_magic("docs", magic_docs)

    return scvShell
示例#2
0
def setup_shell():

    banner = '+----------------------------------------------------+\n'
    banner += ' SimpleCV [interactive shell] - http://simplecv.org\n'
    banner += '+----------------------------------------------------+\n'
    banner += '\n'
    banner += 'Commands: \n'
    banner += '\t"exit()" or press "Ctrl+ D" to exit the shell\n'
    banner += '\t"clear" to clear the shell screen\n'
    banner += '\t"tutorial" to begin the SimpleCV interactive tutorial\n'
    banner += '\t"cheatsheet" gives a cheatsheet of all the shell functions\n'
    banner += '\t"example" gives a list of examples you can run'
    banner += '\n'
    banner += 'Usage:\n'
    banner += '\tdot complete works to show library\n'
    banner += '\tfor example: Image().save("/tmp/test.jpg") will dot complete\n'
    banner += '\tjust by touching TAB after typing Image().\n'
    banner += 'API Documentation:\n'
    banner += '\t"help function_name" will give in depth documentation of API\n'
    banner += '\texample: help Image\n'
    banner += 'Editor:\n'
    banner += '\t"editor" will run the SimpleCV code editor in a browser\n'
    banner += '\t\texample:'
    banner += 'help Image or ?Image\n'
    banner += '\t\twill give the in-depth information about that class\n'
    banner += '\t"?function_name" will give the quick API documentation\n'
    banner += '\t\texample:'
    banner += '?Image.save\n'
    banner += '\t\twill give help on the image save function'
    exit_msg = '\n... [Exiting the SimpleCV interactive shell] ...\n'

    #IPython version is less than 11
    if IPVER <= 10:
        #setup terminal to show SCV prompt
        argsv = [
            '-pi1', 'SimpleCV:\\#>', '-pi2', '   .\\D.:', '-po',
            'SimpleCV:\\#>', '-nosep'
        ]

        scvShell = IPShellEmbed(argsv)
        scvShell.set_banner(banner)
        scvShell.set_exit_msg(exit_msg)
        scvShell.IP.api.expose_magic("tutorial", magic_tutorial)
        scvShell.IP.api.expose_magic("clear", magic_clear)
        scvShell.IP.api.expose_magic("cheatsheet", magic_cheatsheet)
        scvShell.IP.api.expose_magic("example", magic_examples)
        scvShell.IP.api.expose_magic("editor", magic_editor)

        return scvShell

    #IPython version 0.11 or higher
    else:
        cfg = Config()
        cfg.PromptManager.in_template = "SimpleCV:\\#> "
        cfg.PromptManager.out_template = "SimpleCV:\\#: "
        #~ cfg.InteractiveShellEmbed.prompt_in1 = "SimpleCV:\\#> "
        #~ cfg.InteractiveShellEmbed.prompt_out="SimpleCV:\\#: "
        scvShell = InteractiveShellEmbed(config=cfg,
                                         banner1=banner,
                                         exit_msg=exit_msg)
        scvShell.define_magic("tutorial", magic_tutorial)
        scvShell.define_magic("clear", magic_clear)
        scvShell.define_magic("cheatsheet", magic_cheatsheet)
        scvShell.define_magic("example", magic_examples)
        scvShell.define_magic("editor", magic_editor)

        return scvShell
示例#3
0
文件: Shell.py 项目: ilibx/SimpleCV
def setup_shell():

  banner = '+-----------------------------------------------------------+\n'
  banner += ' SimpleCV '
  banner += SIMPLECV_VERSION
  banner += ' [interactive shell] - http://simplecv.org\n'
  banner += '+-----------------------------------------------------------+\n'
  banner += '\n'
  banner += 'Commands: \n'
  banner += '\t"exit()" or press "Ctrl+ D" to exit the shell\n'
  banner += '\t"clear" to clear the shell screen\n'
  banner += '\t"tutorial" to begin the SimpleCV interactive tutorial\n'
  banner += '\t"example" gives a list of examples you can run\n'
  banner += '\t"forums" will launch a web browser for the help forums\n'
  banner += '\t"walkthrough" will launch a web browser with a walkthrough\n'
  banner += '\n'
  banner += 'Usage:\n'
  banner += '\tdot complete works to show library\n'
  banner += '\tfor example: Image().save("/tmp/test.jpg") will dot complete\n'
  banner += '\tjust by touching TAB after typing Image().\n'
  banner += '\n'
  banner += 'Documentation:\n'
  banner += '\thelp(Image), ?Image, Image?, or Image()? all do the same\n'
  banner += '\t"docs" will launch webbrowser showing documentation'
  banner += '\n'
  exit_msg = '\n... [Exiting the SimpleCV interactive shell] ...\n'
  


  #IPython version is less than 11
  if IPVER <= 10:
    #setup terminal to show SCV prompt
    argsv = ['-pi1','SimpleCV:\\#>','-pi2','   .\\D.:','-po','SimpleCV:\\#>','-nosep']

    scvShell = IPShellEmbed(argsv)
    scvShell.set_banner(banner)
    scvShell.set_exit_msg(exit_msg)
    scvShell.IP.api.expose_magic("tutorial",magic_tutorial)
    scvShell.IP.api.expose_magic("clear", magic_clear)
    scvShell.IP.api.expose_magic("example", magic_examples)
    scvShell.IP.api.expose_magic("forums", magic_forums)
    scvShell.IP.api.expose_magic("walkthrough", magic_walkthrough)
    scvShell.IP.api.expose_magic("docs", magic_docs)

    return scvShell

  #IPython version 0.11 or higher
  else:
    cfg = Config()
    cfg.PromptManager.in_template = "SimpleCV:\\#> "
    cfg.PromptManager.out_template = "SimpleCV:\\#: "
    #~ cfg.InteractiveShellEmbed.prompt_in1 = "SimpleCV:\\#> "
    #~ cfg.InteractiveShellEmbed.prompt_out="SimpleCV:\\#: "
    scvShell = InteractiveShellEmbed(config=cfg, banner1=banner, exit_msg = exit_msg)
    scvShell.define_magic("tutorial",magic_tutorial)
    scvShell.define_magic("clear", magic_clear)
    scvShell.define_magic("example", magic_examples)
    scvShell.define_magic("forums", magic_forums)
    scvShell.define_magic("walkthrough", magic_walkthrough)
    scvShell.define_magic("docs", magic_docs)

    return scvShell
示例#4
0
def setup_shell():
  
  banner = '+----------------------------------------------------+\n'
  banner += ' SimpleCV [interactive shell] - http://simplecv.org\n'
  banner += '+----------------------------------------------------+\n'
  banner += '\n'
  banner += 'Commands: \n'
  banner += '\t"exit()" or press "Ctrl+ D" to exit the shell\n'
  banner += '\t"clear" to clear the shell screen\n'
  banner += '\t"tutorial" to begin the SimpleCV interactive tutorial\n'
  banner += '\t"cheatsheet" gives a cheatsheet of all the shell functions\n' 
  banner += '\t"example" gives a list of examples you can run'
  banner += '\n'
  banner += 'Usage:\n'
  banner += '\tdot complete works to show library\n'
  banner += '\tfor example: Image().save("/tmp/test.jpg") will dot complete\n'
  banner += '\tjust by touching TAB after typing Image().\n'
  banner += 'API Documentation:\n'
  banner += '\t"help function_name" will give in depth documentation of API\n'
  banner += '\texample: help Image\n'
  banner += 'Editor:\n'
  banner += '\t"editor" will run the SimpleCV code editor in a browser\n'
  banner += '\t\texample:'
  banner += 'help Image or ?Image\n'
  banner += '\t\twill give the in-depth information about that class\n'
  banner += '\t"?function_name" will give the quick API documentation\n'
  banner += '\t\texample:'
  banner += '?Image.save\n'
  banner += '\t\twill give help on the image save function'
  exit_msg = '\n... [Exiting the SimpleCV interactive shell] ...\n'


  #IPython version is less than 11
  if IPVER <= 10:
    #setup terminal to show SCV prompt
    argsv = ['-pi1','SimpleCV:\\#>','-pi2','   .\\D.:','-po','SimpleCV:\\#>','-nosep']

    scvShell = IPShellEmbed(argsv)
    scvShell.set_banner(banner)
    scvShell.set_exit_msg(exit_msg)
    scvShell.IP.api.expose_magic("tutorial",magic_tutorial)
    scvShell.IP.api.expose_magic("clear", magic_clear)
    scvShell.IP.api.expose_magic("cheatsheet", magic_cheatsheet)
    scvShell.IP.api.expose_magic("example", magic_examples)
    scvShell.IP.api.expose_magic("editor", magic_editor)
    
    return scvShell

  #IPython version 0.11 or higher
  else:
    cfg = Config()
    cfg.PromptManager.in_template = "SimpleCV:\\#> "
    cfg.PromptManager.out_template = "SimpleCV:\\#: "
    #~ cfg.InteractiveShellEmbed.prompt_in1 = "SimpleCV:\\#> "
    #~ cfg.InteractiveShellEmbed.prompt_out="SimpleCV:\\#: "
    scvShell = InteractiveShellEmbed(config=cfg, banner1=banner, exit_msg = exit_msg)
    scvShell.define_magic("tutorial",magic_tutorial)
    scvShell.define_magic("clear", magic_clear)
    scvShell.define_magic("cheatsheet", magic_cheatsheet)
    scvShell.define_magic("example", magic_examples)
    scvShell.define_magic("editor", magic_editor)

    return scvShell