home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 February / maximum-cd-2011-02.iso / DiscContents / digsby_setup85.exe / lib / gui / clipboard.pyo (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-11-24  |  1.6 KB  |  62 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. import wx
  5. import path
  6.  
  7. def CopyToClipboard(s):
  8.     if not s:
  9.         return None
  10.     if not isinstance(s, basestring):
  11.         raise TypeError
  12.     isinstance(s, basestring)
  13.     clip = wx.TheClipboard
  14.     if clip.Open():
  15.         
  16.         try:
  17.             clip.SetData(wx.TextDataObject(s))
  18.             return True
  19.         finally:
  20.             clip.Close()
  21.  
  22.     
  23.     return False
  24.  
  25. copy = CopyToClipboard
  26. _clipboard_types = {
  27.     wx.DF_BITMAP: (wx.BitmapDataObject, 'Bitmap'),
  28.     wx.DF_TEXT: (wx.TextDataObject, 'Text'),
  29.     wx.DF_FILENAME: (wx.FileDataObject, 'Filenames') }
  30.  
  31. def clipboard_get(df_type):
  32.     df = wx.DataFormat(df_type)
  33.     clip = wx.TheClipboard
  34.     if clip.Open():
  35.         
  36.         try:
  37.             if clip.IsSupported(df):
  38.                 (obj_type, obj_attr) = _clipboard_types[df_type]
  39.                 obj = obj_type()
  40.                 clip.GetData(obj)
  41.                 return getattr(obj, obj_attr)
  42.         finally:
  43.             clip.Close()
  44.  
  45.     
  46.  
  47.  
  48. def get_bitmap():
  49.     return clipboard_get(wx.DF_BITMAP)
  50.  
  51.  
  52. def get_text():
  53.     return clipboard_get(wx.DF_TEXT)
  54.  
  55.  
  56. def get_files():
  57.     res = clipboard_get(wx.DF_FILENAME)
  58.     if res is None:
  59.         return res
  60.     return map(path.path, res)
  61.  
  62.