Mercurial > libervia-desktop-kivy
diff src/cagou/plugins/plugin_wid_chat.kv @ 86:c711be670ecd
core, chat: upload plugin system:
- extented plugin system so it's not only used with main widget. It is also used for upload widgets and can be extended more
- plugin file name is used to detect the type: plugin_wid_* for main widgets, plugin_upload_* for upload widget plugins
- a new UploadMenu class allows to easily add an upload button which will use loaded plugins
- plugin_info can now specify a list of allowed platforms in "platforms" key
- file upload in chat has been moved to a plugin
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 25 Dec 2016 16:41:21 +0100 |
parents | 46d962910801 |
children | 5d2289127bb7 |
line wrap: on
line diff
--- a/src/cagou/plugins/plugin_wid_chat.kv Sat Dec 24 14:20:49 2016 +0100 +++ b/src/cagou/plugins/plugin_wid_chat.kv Sun Dec 25 16:41:21 2016 +0100 @@ -14,8 +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 expanduser os.path.expanduser -#:import platform kivy.utils.platform <SimpleXHTMLWidgetEscapedText>: size_hint: None, None @@ -83,34 +81,31 @@ padding: root.mess_padding bold: True if root.mess_data.type == "info" else False -<MessageInputBox>: - size_hint: 1, None - height: dp(40) - message_input: message_input - MessageInputWidget: - id: message_input - size_hint: 1, 1 - hint_text: "Enter your message here" - on_text_validate: root.parent.onSend(args[0]) - IconButton - # upload button - source: app.expand("{media}/icons/tango/actions/32/list-add.png") - allow_stretch: True - size_hint: None, 1 - width: max(self.texture_size[0], dp(40)) - on_release: root.parent.onUploadButton() -<FileUploader>: - FileChooserListView: - id: filechooser - rootpath: "/" if platform == 'android' else expanduser('~') - Button: - text: "upload" +<Chat>: + messages_widget: messages_widget + ScrollView: + size_hint: 1, 0.8 + scroll_y: 0 + do_scroll_x: False + MessagesWidget: + id: messages_widget + MessageInputBox: size_hint: 1, None - height: dp(50) - on_release: root.parent_chat.onUploadOK(filechooser) - Button: - text: "cancel" - size_hint: 1, None - height: dp(50) - on_release: root.parent_chat.onUploadCancel(filechooser) + height: dp(40) + message_input: message_input + MessageInputWidget: + id: message_input + size_hint: 1, 1 + hint_text: "Enter your message here" + on_text_validate: root.onSend(args[0]) + IconButton + # upload button + source: app.expand("{media}/icons/tango/actions/32/list-add.png") + allow_stretch: True + size_hint: None, 1 + width: max(self.texture_size[0], dp(40)) + on_release: upload_menu.show(self) + UploadMenu: + id: upload_menu + callback: root.onUploadOK