def OnData(self, x, y, result): self.GetData() format = self.__compositeDataObject.GetReceivedFormat() if format.GetType() in [ wx.DF_TEXT, wx.DF_UNICODETEXT ]: if self.__onDropURLCallback: self.__onDropURLCallback(x, y, self.__urlDataObject.GetText()) elif format.GetType() == wx.DF_FILENAME: if self.__onDropFileCallback: self.__onDropFileCallback(x, y, self.__fileDataObject.GetFilenames()) elif format.GetId() == 'text/x-moz-message': if self.__onDropMailCallback: data = self.__thunderbirdMailDataObject.GetData() # We expect the data to be encoded with 'unicode_internal', # but on Fedora it can also be 'utf-16', be prepared: try: data = data.decode('unicode_internal') except UnicodeDecodeError: data = data.decode('utf-16') self.__onDropMailCallback(x, y, thunderbird.getMail(data)) elif self.__macThunderbirdMailDataObject.GetData(): if self.__onDropMailCallback: self.__onDropMailCallback(x, y, thunderbird.getMail(self.__macThunderbirdMailDataObject.GetData().decode('unicode_internal'))) elif format.GetId() == 'Object Descriptor': if self.__onDropMailCallback: for mail in outlook.getCurrentSelection(): self.__onDropMailCallback(x, y, mail) self.reinit() return wx.DragCopy
def OnData(self, x, y, result): self.GetData() if self.__urlDataObject.GetText(): if self.__onDropURLCallback: self.__onDropURLCallback(x, y, self.__urlDataObject.GetText()) elif self.__thunderbirdMailDataObject.GetData(): if self.__onDropMailCallback: data = self.__thunderbirdMailDataObject.GetData() # We expect the data to be encoded with 'unicode_internal', # but on Fedora it can also be 'utf-16', be prepared: try: data = data.decode('unicode_internal') except UnicodeDecodeError: data = data.decode('utf-16') self.__onDropMailCallback(x, y, thunderbird.getMail(data)) elif self.__macThunderbirdMailDataObject.GetData(): if self.__onDropMailCallback: self.__onDropMailCallback(x, y, thunderbird.getMail(self.__macThunderbirdMailDataObject.GetData().decode('unicode_internal'))) else: files = self.__fileDataObject.GetFilenames() if files: if self.__onDropFileCallback: self.__onDropFileCallback(x, y, files) else: if self.__onDropMailCallback: for mail in outlook.getCurrentSelection(): self.__onDropMailCallback(x, y, mail) self.reinit() return wx.DragCopy
def OnData(self, x, y, result): self.GetData() if self.__urlDataObject.GetText(): if self.__onDropURLCallback: self.__onDropURLCallback(x, y, self.__urlDataObject.GetText()) elif self.__thunderbirdMailDataObject.GetData(): if self.__onDropMailCallback: self.__onDropMailCallback(x, y, thunderbird.getMail(self.__thunderbirdMailDataObject.GetData().decode('unicode_internal'))) elif self.__macThunderbirdMailDataObject.GetData(): if self.__onDropMailCallback: self.__onDropMailCallback(x, y, thunderbird.getMail(self.__macThunderbirdMailDataObject.GetData().decode('unicode_internal'))) else: files = self.__fileDataObject.GetFilenames() if files: if self.__onDropFileCallback: self.__onDropFileCallback(x, y, files) else: if self.__onDropMailCallback: for mail in outlook.getCurrentSelection(): self.__onDropMailCallback(x, y, mail) self.reinit() return wx.DragCopy
def OnData(self, x, y, result): # pylint: disable-msg=W0613 self.GetData() format = self.__compositeDataObject.GetReceivedFormat() if format.GetType() in [ wx.DF_TEXT, wx.DF_UNICODETEXT ]: if self.__onDropURLCallback: self.__onDropURLCallback(x, y, self.__urlDataObject.GetText()) elif format.GetType() == wx.DF_FILENAME: if self.__onDropFileCallback: self.__onDropFileCallback(x, y, self.__fileDataObject.GetFilenames()) elif format.GetId() == 'text/x-moz-message': if self.__onDropMailCallback: data = self.__thunderbirdMailDataObject.GetData() # We expect the data to be encoded with 'unicode_internal', # but on Fedora it can also be 'utf-16', be prepared: try: data = data.decode('unicode_internal') except UnicodeDecodeError: data = data.decode('utf-16') self.__onDropMailCallback(x, y, thunderbird.getMail(data)) elif self.__macThunderbirdMailDataObject.GetData(): if self.__onDropMailCallback: self.__onDropMailCallback(x, y, thunderbird.getMail(self.__macThunderbirdMailDataObject.GetData().decode('unicode_internal'))) elif format.GetId() == 'Object Descriptor': if self.__onDropMailCallback: for mail in outlook.getCurrentSelection(): self.__onDropMailCallback(x, y, mail) elif format.GetId() == 'public.url': url = self.__macMailObject.GetData() if url.startswith('message:') and self.__onDropURLCallback: self.__onDropURLCallback(x, y, url) self.reinit() return wx.DragCopy
def onOutlookDrop(self, x, y): if self.__onDropMailCallback: for mail in outlook.getCurrentSelection(): self.__onDropMailCallback(x, y, mail)