##// END OF EJS Templates
Merge pull request #1703 from takluyver/i211...
Min RK -
r6741:cb19d0db merge
parent child Browse files
Show More
@@ -38,11 +38,18 b' class TryNext(IPythonCoreError):'
38 should be used to handle the operation. If you pass arguments to the
38 should be used to handle the operation. If you pass arguments to the
39 constructor those arguments will be used by the next hook instead of the
39 constructor those arguments will be used by the next hook instead of the
40 original ones.
40 original ones.
41
42 A _msg argument will not be passed on, so it can be used as a displayable
43 error message.
41 """
44 """
42
45
43 def __init__(self, *args, **kwargs):
46 def __init__(self, _msg="", *args, **kwargs):
44 self.args = args
47 self.args = args
45 self.kwargs = kwargs
48 self.kwargs = kwargs
49 self.msg = _msg
50
51 def __str__(self):
52 return str(self.msg)
46
53
47 class UsageError(IPythonCoreError):
54 class UsageError(IPythonCoreError):
48 """Error in magic function arguments, etc.
55 """Error in magic function arguments, etc.
@@ -17,7 +17,7 b' def win32_clipboard_get():'
17 except ImportError:
17 except ImportError:
18 message = ("Getting text from the clipboard requires the pywin32 "
18 message = ("Getting text from the clipboard requires the pywin32 "
19 "extensions: http://sourceforge.net/projects/pywin32/")
19 "extensions: http://sourceforge.net/projects/pywin32/")
20 raise TryNext(message)
20 raise TryNext(_msg=message)
21 win32clipboard.OpenClipboard()
21 win32clipboard.OpenClipboard()
22 text = win32clipboard.GetClipboardData(win32clipboard.CF_TEXT)
22 text = win32clipboard.GetClipboardData(win32clipboard.CF_TEXT)
23 # FIXME: convert \r\n to \n?
23 # FIXME: convert \r\n to \n?
@@ -46,7 +46,7 b' def tkinter_clipboard_get():'
46 except ImportError:
46 except ImportError:
47 message = ("Getting text from the clipboard on this platform "
47 message = ("Getting text from the clipboard on this platform "
48 "requires Tkinter.")
48 "requires Tkinter.")
49 raise TryNext(message)
49 raise TryNext(_msg=message)
50 root = Tkinter.Tk()
50 root = Tkinter.Tk()
51 root.withdraw()
51 root.withdraw()
52 text = root.clipboard_get()
52 text = root.clipboard_get()
General Comments 0
You need to be logged in to leave comments. Login now