def notificationWindow(mw, name, text, buddy): method = config.get('gui', 'notification_method') try: function = globals()["notificationWindow_%s" % method] except: print "(1) notification method '%s' is not implemented, falling back to 'generic'." % method notificationWindow_generic(mw, name, text, buddy) return try: function(mw, name, text, buddy) except: print "(1) exception while using notification method '%s'" % method print "(1) falling back to 'generic'. Traceback follows:" config.tb() notificationWindow_generic(mw, name, text, buddy)
def notificationWindow(mw, name, text, buddy, color=""): method = config.get('gui', 'notification_method') try: function = globals()["notificationWindow_%s" % method] except: print "(1) notification method '%s' is not implemented, falling back to 'generic'." % method notificationWindow_generic(mw, name, text, buddy, color) return try: function(mw, name, text, buddy, color) except: print "(1) exception while using notification method '%s'" % method print "(1) falling back to 'generic'. Traceback follows:" config.tb() notificationWindow_generic(mw, name, text, buddy, color)
def OnDropFiles( self, x, y, filenames, ): if len(filenames) != 1: wx.MessageBox(lang.D_WARN_FILE_ONLY_ONE_MESSAGE, lang.D_WARN_FILE_ONLY_ONE_TITLE) return file_name = filenames[0] # --- begin evel hack if not os.path.exists(file_name): # sometimes the file name is in utf8 # but inside a unicode object! # FIXME: must report this bug to wx try: file_name_utf8 = '' for c in file_name: file_name_utf8 += chr(ord(c)) file_name = file_name_utf8.decode('utf-8') except: config.tb() wx.MessageBox( 'there is a strange bug in wx for your platform with wx.FileDropTarget and non-ascii characters in file names' ) return # --- end evel hack log.warn('file dropped: %s' % file_name) if not self.window.buddy.conn_in: wx.MessageBox(lang.D_WARN_BUDDY_OFFLINE_MESSAGE, lang.D_WARN_BUDDY_OFFLINE_TITLE) return transfer_window = FileTransferWindow(self.window.mw, self.window.buddy, file_name)
def OnDropFiles( self, x, y, filenames, ): if len(filenames) != 1: wx.MessageBox(lang.D_WARN_FILE_ONLY_ONE_MESSAGE, lang.D_WARN_FILE_ONLY_ONE_TITLE) return file_name = filenames[0] # --- begin evel hack if not os.path.exists(file_name): # sometimes the file name is in utf8 # but inside a unicode object! # FIXME: must report this bug to wx try: file_name_utf8 = '' for c in file_name: file_name_utf8 += chr(ord(c)) file_name = file_name_utf8.decode('utf-8') except: config.tb() wx.MessageBox('there is a strange bug in wx for your platform with wx.FileDropTarget and non-ascii characters in file names' ) return # --- end evel hack log.warn('file dropped: %s' % file_name) if not self.window.buddy.conn_in: wx.MessageBox(lang.D_WARN_BUDDY_OFFLINE_MESSAGE, lang.D_WARN_BUDDY_OFFLINE_TITLE) return transfer_window = FileTransferWindow(self.window.mw, self.window.buddy, file_name)