# HG changeset patch # User Goffi # Date 1553721771 -3600 # Node ID 5d96bcd3bfecbc63c6825772ed3586168812c052 # Parent 4772ba26623fcb5b9587cdbb684c0fad117ff0e8 chat: added an extra menu (3 dots menu): first entry is this menu display bookmarks. This menu will be used in the future to show advances actions like showing occupants or configuring room. diff -r 4772ba26623f -r 5d96bcd3bfec cagou/plugins/plugin_wid_chat.kv --- a/cagou/plugins/plugin_wid_chat.kv Wed Mar 27 22:22:51 2019 +0100 +++ b/cagou/plugins/plugin_wid_chat.kv Wed Mar 27 22:22:51 2019 +0100 @@ -142,6 +142,26 @@ font_size: dp(25) color: 0.4, 0.4, 0.4, 1 + + size_hint_y: None + height: dp(30) + on_texture_size: self.parent.parent.width = max(self.parent.parent.width, self.texture_size[0] + dp(10)) + +: + size_hint: None, 1 + width: 10 + auto_width: False + MenuButton: + text: _("Bookmarks") + on_release: root.select("bookmark") + +: + size_hint: None, 1 + symbol: "dot-3-vert" + width: dp(30) + font_size: dp(25) + color: 0.4, 0.4, 0.4, 1 + on_release: self.chat.extra_menu.open(self) : size_hint: None, 1 diff -r 4772ba26623f -r 5d96bcd3bfec cagou/plugins/plugin_wid_chat.py --- a/cagou/plugins/plugin_wid_chat.py Wed Mar 27 22:22:51 2019 +0100 +++ b/cagou/plugins/plugin_wid_chat.py Wed Mar 27 22:22:51 2019 +0100 @@ -23,6 +23,7 @@ import sys from sat.core import log as logging from sat.core.i18n import _ +from sat.core import exceptions from cagou.core.constants import Const as C from kivy.uix.boxlayout import BoxLayout from kivy.uix.gridlayout import GridLayout @@ -174,6 +175,24 @@ menu.TransferMenu(callback=self.chat.onTransferOK).show(self) +class ExtraMenu(DropDown): + chat = properties.ObjectProperty() + + def on_select(self, menu): + if menu == 'bookmark': + G.host.bridge.menuLaunch(C.MENU_GLOBAL, (u"groups", u"bookmarks"), + {}, C.NO_SECURITY_LIMIT, self.chat.profile, + callback=partial( + G.host.actionManager, profile=self.chat.profile), + errback=G.host.errback) + else: + raise exceptions.InternalError(u"Unknown menu: {}".format(menu)) + + +class ExtraButton(SymbolButton): + chat = properties.ObjectProperty() + + class EncryptionMainButton(SymbolButton): def __init__(self, chat, **kwargs): @@ -181,7 +200,6 @@ @param chat(Chat): Chat instance """ self.chat = chat - # for now we do a simple ContextMenu as we have only OTR self.encryption_menu = EncryptionMenu(chat) super(EncryptionMainButton, self).__init__(**kwargs) self.bind(on_release=self.encryption_menu.open) @@ -393,6 +411,9 @@ if type_ == C.CHAT_ONE2ONE: self.encryption_btn = EncryptionMainButton(self) self.headerInputAddExtra(self.encryption_btn) + self.extra_menu = ExtraMenu(chat=self) + extra_btn = ExtraButton(chat=self) + self.headerInputAddExtra(extra_btn) self.header_input.hint_text = u"{}".format(target) self.postInit()