[pytango] 150/483: fixes #3570971

Sandor Bodo-Merle sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:14:35 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 27afbb8f0ab38c6c28e931f8c4699b2fd803faa9
Author: tiagocoutinho <tiagocoutinho at 4e9c00fd-8f2e-0410-aa12-93ce3db5e235>
Date:   Thu Oct 4 07:44:44 2012 +0000

    fixes #3570971
    
    git-svn-id: http://svn.code.sf.net/p/tango-cs/code/bindings/PyTango/trunk@21208 4e9c00fd-8f2e-0410-aa12-93ce3db5e235
---
 PyTango/ipython/ipython_00_11/ipython_00_11.py | 32 +++++++++++++++-----------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/PyTango/ipython/ipython_00_11/ipython_00_11.py b/PyTango/ipython/ipython_00_11/ipython_00_11.py
index 7981d2e..c2e0526 100644
--- a/PyTango/ipython/ipython_00_11/ipython_00_11.py
+++ b/PyTango/ipython/ipython_00_11/ipython_00_11.py
@@ -1115,21 +1115,27 @@ def init_display(ip):
     html_formatter.for_type(PyTango.GroupAttrReply, display_groupreply_html)
     html_formatter.for_type(PyTango.GroupCmdReply, display_groupreply_html)
 
-from IPython.utils.traitlets import Unicode
-from IPython.frontend.qt.console.rich_ipython_widget import RichIPythonWidget
-
-class ITangoConsole(RichIPythonWidget):
-    
-    banner = Unicode(config=True)
-
-    def _banner_default(self):
-        config = get_config()
-        return config.ITangoConsole.banner
+# overwrite the original IPython Qt widget with our own so we can put a
+# customized banner. IPython may have been installed without Qt support so we
+# protect this code agaist an import error
+try:
+    from IPython.utils.traitlets import Unicode
+    from IPython.frontend.qt.console.rich_ipython_widget import RichIPythonWidget
+
+    class ITangoConsole(RichIPythonWidget):
+        
+        banner = Unicode(config=True)
 
-import IPython.frontend.qt.console.qtconsoleapp
-IPythonQtConsoleApp = IPython.frontend.qt.console.qtconsoleapp.IPythonQtConsoleApp
-IPythonQtConsoleApp.widget_factory = ITangoConsole      
+        def _banner_default(self):
+            config = get_config()
+            return config.ITangoConsole.banner
 
+    import IPython.frontend.qt.console.qtconsoleapp
+    IPythonQtConsoleApp = IPython.frontend.qt.console.qtconsoleapp.IPythonQtConsoleApp
+    IPythonQtConsoleApp.widget_factory = ITangoConsole      
+except ImportError:
+    pass
+    
 def init_ipython(ip=None, store=True, pytango=True, colors=True, console=True,
                  magic=True):
 

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