diff --git a/IPython/Extensions/astyle.py b/IPython/Extensions/astyle.py index b86810c..782a33c 100644 --- a/IPython/Extensions/astyle.py +++ b/IPython/Extensions/astyle.py @@ -266,10 +266,7 @@ else: yield (-1, True) for info in self: yield info - try: - ipipe.xrepr.when_type(Text)(xrepr_astyle_text) - except Exception: - pass + ipipe.xrepr.when_type(Text)(xrepr_astyle_text) def streamstyle(stream, styled=None): diff --git a/IPython/Extensions/ibrowse.py b/IPython/Extensions/ibrowse.py index bcd693d..68a07c1 100644 --- a/IPython/Extensions/ibrowse.py +++ b/IPython/Extensions/ibrowse.py @@ -796,16 +796,14 @@ class ibrowse(ipipe.Display): keymap.register("refresh", "r") keymap.register("refreshfind", "R") - def __init__(self, input=None, attrs=None): + def __init__(self, input=None, *attrs): """ Create a new browser. If ``attrs`` is not empty, it is the list of attributes that will be displayed in the browser, otherwise these will be determined by the objects on screen. """ - self.input = input + ipipe.Display.__init__(self, input) - if attrs is None: - attrs = () self.attrs = attrs # Stack of browser levels diff --git a/IPython/Extensions/igrid.py b/IPython/Extensions/igrid.py index 3b50286..a2d317f 100644 --- a/IPython/Extensions/igrid.py +++ b/IPython/Extensions/igrid.py @@ -1102,13 +1102,10 @@ class igrid(ipipe.Display): (which is curses-based) or ``idump`` (which simply does a print). """ - def __init__(self, input=None): - self.input = input - if wx.VERSION < (2, 7): def display(self): try: - # Try to create a "standalone" from. If this works we're probably + # Try to create a "standalone" frame. If this works we're probably # running with -wthread. # Note that this sets the parent of the frame to None, but we can't # pass a result object back to the shell anyway. diff --git a/IPython/Extensions/ipipe.py b/IPython/Extensions/ipipe.py index 51a3a0e..4569cb1 100644 --- a/IPython/Extensions/ipipe.py +++ b/IPython/Extensions/ipipe.py @@ -130,8 +130,6 @@ except ImportError: genutils = None ipapi = None -import astyle - __all__ = [ "ifile", "ils", "iglob", "iwalk", "ipwdentry", "ipwd", "igrpentry", "igrp", @@ -1932,6 +1930,9 @@ class Display(object): def __ror__(self, input): return input | self() + def __init__(self, input=None): + self.input = input + def __ror__(self, input): self.input = input return self @@ -2069,6 +2070,9 @@ def xformat(value, mode, maxlength): return (align, width, text) + +import astyle + class idump(Display): # The approximate maximum length of a column entry maxattrlength = 200 @@ -2076,7 +2080,8 @@ class idump(Display): # Style for column names style_header = astyle.Style.fromstr("white:black:bold") - def __init__(self, *attrs): + def __init__(self, input=None, *attrs): + Display.__init__(self, input) self.attrs = [upgradexattr(attr) for attr in attrs] self.headerpadchar = " " self.headersepchar = "|" diff --git a/doc/ChangeLog b/doc/ChangeLog index 337593a..0cce2b4 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,9 +1,11 @@ 2008-01-19 Walter Doerwald - * IPython/Extensions/ibrowse.py, IPython/Extensions/igrid.py: - The input object can now be passed to the constructor of ibrowse/igrid. + * ibrowse.py, igrid.py, ipipe.py: + The input object can now be passed to the constructor of the display classes. This makes it possible to use them with objects that implement __or__. - + * ipipe.py: Importing astyle.py is done as late as possible to + avoid problems with circular imports. + 2008-01-19 Ville Vainio * hooks.py, iplib.py: Added 'shell_hook' to customize how