예제 #1
0
 def hook(shell, is_continuation):
     if not is_continuation:
         print
         print "cwd =", cwd_filt2(5),
         proj = vars(__builtins__).get("__emzed_project__")
         if proj:
             proj = "\x01\x1b[0;35;47m(project=%s)\x01\x1b[0m" % proj
             print
             print proj,
     from IPython.ipapi import TryNext
     raise TryNext()
예제 #2
0
def win32_clipboard_get():
    """ Get the current clipboard's text on Windows.

    Requires Mark Hammond's pywin32 extensions.
    """
    try:
        import win32clipboard
    except ImportError:
        message = ("Getting text from the clipboard requires the pywin32 "
                   "extensions: http://sourceforge.net/projects/pywin32/")
        raise TryNext(message)
    win32clipboard.OpenClipboard()
    text = win32clipboard.GetClipboardData(win32clipboard.CF_TEXT)
    # FIXME: convert \r\n to \n?
    win32clipboard.CloseClipboard()
    return text
예제 #3
0
def tkinter_clipboard_get():
    """ Get the clipboard's text using Tkinter.

    This is the default on systems that are not Windows or OS X. It may
    interfere with other UI toolkits and should be replaced with an
    implementation that uses that toolkit.
    """
    try:
        import Tkinter
    except ImportError:
        message = ("Getting text from the clipboard on this platform "
                   "requires Tkinter.")
        raise TryNext(message)
    root = Tkinter.Tk()
    root.withdraw()
    text = root.clipboard_get()
    root.destroy()
    return text
예제 #4
0
 def __call__(self):
     from IPython.ipapi import TryNext
     powerline = self.powerline()
     if powerline is not None:
         powerline.shutdown()
     raise TryNext()