changeset 278:444ba439530f

chat: moved transfer button to header_box
author Goffi <goffi@goffi.org>
date Wed, 20 Mar 2019 09:29:44 +0100
parents f5302d57fb09
children aea973de55d9
files cagou/plugins/plugin_wid_chat.kv cagou/plugins/plugin_wid_chat.py
diffstat 2 files changed, 19 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.kv	Wed Mar 20 09:29:44 2019 +0100
+++ b/cagou/plugins/plugin_wid_chat.kv	Wed Mar 20 09:29:44 2019 +0100
@@ -14,7 +14,6 @@
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-#:import TransferMenu cagou.core.menu.TransferMenu
 #:import SimpleXHTMLWidget cagou.core.simple_xhtml.SimpleXHTMLWidget
 #:import _ sat.core.i18n._
 #:import C cagou.core.constants.Const
@@ -124,14 +123,6 @@
             multiline: True
             hint_text: _(u"Enter your message here")
             on_text_validate: root.onSend(args[0])
-        SymbolButton
-            # transfer button
-            size_hint: 1, None
-            symbol: "plus-circled"
-            size_hint: None, 1
-            width: dp(30)
-            font_size: dp(25)
-            on_release: TransferMenu(callback=root.onTransferOK).show(self)
 
 
 <SendButton>:
@@ -142,6 +133,15 @@
     font_size: dp(25)
     on_release: self.message_input_box.send_text()
 
+# Buttons added in header
+
+<TransferButton>:
+    size_hint: None, 1
+    symbol: "plus-circled"
+    width: dp(30)
+    font_size: dp(25)
+    color: 0.4, 0.4, 0.4, 1
+
 
 <EncryptionMainButton>:
     size_hint: None, 1
--- a/cagou/plugins/plugin_wid_chat.py	Wed Mar 20 09:29:44 2019 +0100
+++ b/cagou/plugins/plugin_wid_chat.py	Wed Mar 20 09:29:44 2019 +0100
@@ -40,6 +40,7 @@
 from kivy.uix.dropdown import DropDown
 from kivy.core.window import Window
 from cagou import G
+from cagou.core import menu
 
 log = logging.getLogger(__name__)
 
@@ -166,6 +167,13 @@
     pass
 
 
+class TransferButton(SymbolButton):
+    chat = properties.ObjectProperty()
+
+    def on_release(self, *args):
+        menu.TransferMenu(callback=self.chat.onTransferOK).show(self)
+
+
 class EncryptionMainButton(SymbolButton):
 
     def __init__(self, chat, **kwargs):
@@ -380,6 +388,8 @@
         self._hi_comp_dropdown = DropDown()
         self._hi_comp_allowed = True
         cagou_widget.CagouWidget.__init__(self)
+        transfer_btn = TransferButton(chat=self)
+        self.headerInputAddExtra(transfer_btn)
         if type_ == C.CHAT_ONE2ONE:
             self.encryption_btn = EncryptionMainButton(self)
             self.headerInputAddExtra(self.encryption_btn)