[pytango] 92/483: added support for ipython 0.12 and future 0.13

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:27 UTC 2017


This is an automated email from the git hooks/post-receive script.

sbodomerle-guest pushed a commit to annotated tag bliss_8.10
in repository pytango.

commit 66741ac5d9de715d3e9ba5545fe94dd79d5a037e
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Mon Jan 16 15:42:58 2012 +0000

    added support for ipython 0.12 and future 0.13
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@18938 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 PyTango/ipython/__init__.py                    |   9 +-
 PyTango/ipython/ipython_00_12/__init__.py      |  31 +++++++
 PyTango/ipython/ipython_00_12/ipython_00_12.py | 110 +++++++++++++++++++++++++
 3 files changed, 149 insertions(+), 1 deletion(-)

diff --git a/PyTango/ipython/__init__.py b/PyTango/ipython/__init__.py
index c85d1c8..da3f699 100644
--- a/PyTango/ipython/__init__.py
+++ b/PyTango/ipython/__init__.py
@@ -85,10 +85,17 @@ if ipv >= [0, 10] and ipv < [0, 11]:
     load_config = None
     load_ipython_extension = None
     unload_ipython_extension = None
-elif ipv >= [0, 11] and ipv <= [0, 13]:
+elif ipv >= [0, 11] and ipv < [0, 12]:
     import ipython_00_11
     init_ipython = None
     install = ipython_00_11.install
     load_config = ipython_00_11.load_config
     load_ipython_extension = ipython_00_11.load_ipython_extension
     unload_ipython_extension = ipython_00_11.unload_ipython_extension
+elif ipv >= [0, 12] and ipv <= [0, 13]:
+    import ipython_00_12
+    init_ipython = None
+    install = ipython_00_12.install
+    load_config = ipython_00_12.load_config
+    load_ipython_extension = ipython_00_12.load_ipython_extension
+    unload_ipython_extension = ipython_00_12.unload_ipython_extension
diff --git a/PyTango/ipython/ipython_00_12/__init__.py b/PyTango/ipython/ipython_00_12/__init__.py
new file mode 100644
index 0000000..2766c15
--- /dev/null
+++ b/PyTango/ipython/ipython_00_12/__init__.py
@@ -0,0 +1,31 @@
+################################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+## 
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
+## 
+## PyTango is free software: you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+## 
+## PyTango 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 Lesser General Public License for more details.
+## 
+## You should have received a copy of the GNU Lesser General Public License
+## along with PyTango.  If not, see <http://www.gnu.org/licenses/>.
+##
+################################################################################
+
+__all__ = ['load_ipython_extension', 'unload_ipython_extension', 'load_config',
+           'install']
+
+from PyTango.ipython.ipython_00_11 import *
+
+#rewrite 0.11's load config
+from ipython_00_12 import load_config
+
diff --git a/PyTango/ipython/ipython_00_12/ipython_00_12.py b/PyTango/ipython/ipython_00_12/ipython_00_12.py
new file mode 100644
index 0000000..1912d90
--- /dev/null
+++ b/PyTango/ipython/ipython_00_12/ipython_00_12.py
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+
+################################################################################
+##
+## This file is part of PyTango, a python binding for Tango
+## 
+## http://www.tango-controls.org/static/PyTango/latest/doc/html/index.html
+##
+## Copyright 2011 CELLS / ALBA Synchrotron, Bellaterra, Spain
+## 
+## PyTango is free software: you can redistribute it and/or modify
+## it under the terms of the GNU Lesser General Public License as published by
+## the Free Software Foundation, either version 3 of the License, or
+## (at your option) any later version.
+## 
+## PyTango 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 Lesser General Public License for more details.
+## 
+## You should have received a copy of the GNU Lesser General Public License
+## along with PyTango.  If not, see <http://www.gnu.org/licenses/>.
+##
+################################################################################
+
+"""An IPython profile designed to provide a user friendly interface to Tango"""
+
+__all__ = ["load_config"]
+
+def load_config(config):
+    
+    import IPython.utils.coloransi
+    d = { "version" : PyTango.Release.version,
+          "pyver" : __get_python_version(),
+          "ipyver" : __get_ipython_version(),
+          "pytangover" : __get_pytango_version() }
+    d.update(IPython.utils.coloransi.TermColors.__dict__)
+
+    so = Struct(
+        spock_banner="""%(Blue)shint: Try typing: mydev = Device("%(LightBlue)s<tab>%(Normal)s""")
+
+    so = config.get("spock_options", so)
+
+    # ------------------------------------
+    # Application
+    # ------------------------------------
+    app = config.Application
+    app.log_level = 30
+
+    # ------------------------------------
+    # InteractiveShell
+    # ------------------------------------
+    i_shell = config.InteractiveShell
+    i_shell.colors = 'Linux'
+    #i_shell.prompt_in1 = 'Spock <$DB_NAME> [\\#]: '
+    #i_shell.prompt_out = 'Result [\\#]: '
+    
+    # ------------------------------------
+    # PromptManager
+    # ------------------------------------
+    prompt = config.PromptManager
+    prompt.in_template = 'Spock {DB_NAME} [\\#]: '
+    #prompt.in2_template = 
+    prompt.out_template = 'Result [\\#]: '
+    
+    # ------------------------------------
+    # InteractiveShellApp
+    # ------------------------------------
+    i_shell_app = config.InteractiveShellApp
+    extensions = getattr(i_shell_app, 'extensions', [])
+    extensions.append('PyTango.ipython')
+    i_shell_app.extensions = extensions
+    
+    # ------------------------------------
+    # TerminalIPythonApp: options for the IPython terminal (and not Qt Console)
+    # ------------------------------------
+    term_app = config.TerminalIPythonApp
+    term_app.display_banner = True
+    #term_app.nosep = False
+    #term_app.classic = True
+    
+    # ------------------------------------
+    # IPKernelApp: options for the  Qt Console
+    # ------------------------------------
+    #kernel_app = config.IPKernelApp
+    ipython_widget = config.IPythonWidget
+    ipython_widget.in_prompt  = 'Spock [<span class="in-prompt-number">%i</span>]: '
+    ipython_widget.out_prompt = '  Out [<span class="out-prompt-number">%i</span>]: '
+    
+    #zmq_i_shell = config.ZMQInteractiveShell
+    
+    # ------------------------------------
+    # TerminalInteractiveShell
+    # ------------------------------------
+    term_i_shell = config.TerminalInteractiveShell
+    banner = """\
+%(Purple)sSpock %(version)s%(Normal)s -- An interactive %(Purple)sTango%(Normal)s client.
+
+Running on top of Python %(pyver)s, IPython %(ipyver)s and PyTango %(pytangover)s
+
+help      -> Spock's help system.
+object?   -> Details about 'object'. ?object also works, ?? prints more.
+"""
+    
+    banner = banner % d
+    banner = banner.format(**d)
+    spock_banner = so.spock_banner % d
+    spock_banner = spock_banner.format(**d)
+    term_i_shell.banner1 = banner
+    term_i_shell.banner2 = spock_banner
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git



More information about the debian-science-commits mailing list