[pytango] 93/483: fixed prompt issue

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 166b67ffd25b70eaf37a0c7d88024f39af447e2a
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Mon Jan 16 15:58:58 2012 +0000

    fixed prompt issue
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@18939 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 PyTango/ipython/ipython_00_12/ipython_00_12.py | 33 ++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 5 deletions(-)

diff --git a/PyTango/ipython/ipython_00_12/ipython_00_12.py b/PyTango/ipython/ipython_00_12/ipython_00_12.py
index 1912d90..d1c6c52 100644
--- a/PyTango/ipython/ipython_00_12/ipython_00_12.py
+++ b/PyTango/ipython/ipython_00_12/ipython_00_12.py
@@ -27,14 +27,36 @@
 
 __all__ = ["load_config"]
 
+import sys
+import PyTango
+
+from IPython.utils.ipstruct import Struct
+from IPython.utils.coloransi import TermColors
+
+def __get_python_version():
+    return '.'.join(map(str,sys.version_info[:3]))
+
+def __get_ipython_version():
+    """Returns the current IPython version"""
+    import IPython
+    v = "<Unknown>"
+    try:
+        v = IPython.release.version
+    except Exception:
+        pass
+    return v
+
+def __get_pytango_version():
+    vi = PyTango.Release.version_info
+    return ".".join(map(str,vi[:3]))+vi[3]
+
+
 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__)
+    d.update(TermColors.__dict__)
 
     so = Struct(
         spock_banner="""%(Blue)shint: Try typing: mydev = Device("%(LightBlue)s<tab>%(Normal)s""")
@@ -84,7 +106,7 @@ def load_config(config):
     # ------------------------------------
     #kernel_app = config.IPKernelApp
     ipython_widget = config.IPythonWidget
-    ipython_widget.in_prompt  = 'Spock [<span class="in-prompt-number">%i</span>]: '
+    ipython_widget.in_prompt  = 'Spock {DB_NAME} [<span class="in-prompt-number">%i</span>]: '
     ipython_widget.out_prompt = '  Out [<span class="out-prompt-number">%i</span>]: '
     
     #zmq_i_shell = config.ZMQInteractiveShell
@@ -107,4 +129,5 @@ object?   -> Details about 'object'. ?object also works, ?? prints more.
     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
+    term_i_shell.banner2 = spock_banner
+

-- 
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