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

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.6)
  3.  
  4. import wx
  5. import util
  6. from gui import contactdialogs
  7.  
  8. class ImWinDropTarget(wx.PyDropTarget):
  9.     
  10.     def __init__(self, parent):
  11.         wx.PyDropTarget.__init__(self)
  12.         self.dragged = wx.DataObjectComposite()
  13.         self.imwin = parent
  14.         import contacts.contactsdnd as contactsdnd
  15.         drag_types = dict(file = wx.FileDataObject(), text = wx.TextDataObject(), bitmap = wx.PyBitmapDataObject(), blist_item = contactsdnd.dataobject())
  16.         for dt, dobjs in drag_types.iteritems():
  17.             setattr(self.dragged, dt, dobjs)
  18.         
  19.         for v in drag_types.itervalues():
  20.             self.dragged.Add(v)
  21.         
  22.         self.SetDataObject(self.dragged)
  23.  
  24.     
  25.     def OnEnter(self, x, y, d):
  26.         return d
  27.  
  28.     
  29.     def OnDrop(self, x, y):
  30.         return True
  31.  
  32.     
  33.     def OnDragOver(self, x, y, d):
  34.         return wx.DragMove
  35.  
  36.     
  37.     def OnData(self, x, y, d):
  38.         if not self.GetData():
  39.             return None
  40.         dragged = self.dragged
  41.         dropped = util.Storage(files = dragged.file.GetFilenames(), bitmap = dragged.bitmap.GetBitmap(), text = dragged.text.GetText(), blist_item = dragged.blist_item.GetData())
  42.         import contacts.contactsdnd as contactsdnd
  43.         if dropped.files:
  44.             self.imwin.Top.Raise()
  45.             contactdialogs.send_files(self.imwin, self.imwin.convo.buddy, dropped.files)
  46.             return True
  47.         if dropped.bitmap:
  48.             return True
  49.         if dropped.text:
  50.             self.imwin.input_area.SetValue(dropped.text)
  51.             self.imwin.input_area.tc.SetSelection(-1, -1)
  52.             return True
  53.         return False
  54.  
  55.  
  56.