home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyc (Python 2.6)
-
- import sys
- success = False
- in_ironpython = 'IronPython' in sys.version
- if in_ironpython:
-
- try:
- from ironpython_clipboard import GetClipboardText, SetClipboardText
- success = True
- except ImportError:
- pass
- except:
- None<EXCEPTION MATCH>ImportError
-
-
- None<EXCEPTION MATCH>ImportError
-
- try:
- from win32_clipboard import GetClipboardText, SetClipboardText
- success = True
- except ImportError:
- raise
-
-
- def send_data(lists):
- SetClipboardText(make_tab(lists))
-
-
- def set_clipboard_text(toclipboard):
- SetClipboardText(str(toclipboard))
-
-
- def make_tab(lists):
- if hasattr(lists, 'tolist'):
- lists = lists.tolist()
-
- ut = []
- for rad in lists:
- if type(rad) in [
- list,
- tuple]:
- []([]([ '%s' % x for x in rad ]))
- continue
- '\t'.join
- ut.append('%s' % rad)
-
- return '\n'.join(ut)
-
-
- def make_list_of_list(txt):
-
- def make_num(x):
-
- try:
- return int(x)
- except ValueError:
-
- try:
- return float(x)
- except ValueError:
-
- try:
- return complex(x)
- except ValueError:
- return x
-
-
- None<EXCEPTION MATCH>ValueError
-
-
- None<EXCEPTION MATCH>ValueError
-
- return x
-
- ut = []
- flag = False
- for x in txt.split('\r\n'):
- if x != '':
- continue
- _[1][x]
-
- return (ut, flag)
-
-
- def get_clipboard_text_and_convert(paste_list = False):
- txt = GetClipboardText()
- if txt:
- if paste_list and '\t' in txt:
- (array, flag) = make_list_of_list(txt)
- if flag:
- txt = repr(array)
- else:
- txt = 'array(%s)' % repr(array)
- txt = [](_[1])
-
-
- return txt
-
-