diff src/cagou/plugins/plugin_wid_chat.py @ 97:5d2289127bb7

menu (upload): better menu using dedicated widget: upload menu now use a decicated widget instead of context menu. The menu take half the size of the main window, and show each upload option as an icon. Use can select upload or P2P sending, and a short text message explains how the file will be transmitted.
author Goffi <goffi@goffi.org>
date Thu, 29 Dec 2016 23:47:07 +0100
parents 9a6121722669
children 4d8c122b86a6
line wrap: on
line diff
--- a/src/cagou/plugins/plugin_wid_chat.py	Thu Dec 29 23:47:04 2016 +0100
+++ b/src/cagou/plugins/plugin_wid_chat.py	Thu Dec 29 23:47:07 2016 +0100
@@ -613,10 +613,10 @@
             if cleaning_cb is not None:
                 cleaning_cb()
         # TODO: display message to user
-        log.warning(u"Can't upload file: {}".format(err_msg))
+        log.warning(u"Can't transfer file: {}".format(err_msg))
 
-    def fileUploadDone(self, metadata, profile):
-        log.debug("file uploaded: {}".format(metadata))
+    def fileTransferDone(self, metadata, profile):
+        log.debug("file transfered: {}".format(metadata))
         G.host.messageSend(
             self.target,
             {'': metadata['url']},
@@ -624,23 +624,23 @@
             profile_key=profile
             )
 
-    def fileUploadCb(self, progress_data, cleaning_cb):
+    def fileTransferCb(self, progress_data, cleaning_cb):
         try:
             progress_id = progress_data['progress']
         except KeyError:
             xmlui = progress_data['xmlui']
             G.host.showUI(xmlui)
         else:
-            self._waiting_pids[progress_id] = (self.fileUploadDone, cleaning_cb)
+            self._waiting_pids[progress_id] = (self.fileTransferDone, cleaning_cb)
 
-    def onUploadOK(self, file_path, cleaning_cb):
-        G.host.bridge.fileUpload(
+    def onTransferOK(self, file_path, cleaning_cb):
+        G.host.bridge.fileTransfer(
             file_path,
             "",
             "",
             {"ignore_tls_errors": C.BOOL_TRUE},  # FIXME: should not be the default
             self.profile,
-            callback = lambda progress_data: self.fileUploadCb(progress_data, cleaning_cb)
+            callback = lambda progress_data: self.fileTransferCb(progress_data, cleaning_cb)
             )
 
     def _mucJoinCb(self, joined_data):