Mercurial > libervia-desktop-kivy
comparison 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 |
comparison
equal
deleted
inserted
replaced
85:c2a7234d13d2 | 86:c711be670ecd |
---|---|
12 # GNU Affero General Public License for more details. | 12 # GNU Affero General Public License for more details. |
13 | 13 |
14 # You should have received a copy of the GNU Affero General Public License | 14 # You should have received a copy of the GNU Affero General Public License |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 |
17 #:import expanduser os.path.expanduser | |
18 #:import platform kivy.utils.platform | |
19 | 17 |
20 <SimpleXHTMLWidgetEscapedText>: | 18 <SimpleXHTMLWidgetEscapedText>: |
21 size_hint: None, None | 19 size_hint: None, None |
22 size: self.texture_size | 20 size: self.texture_size |
23 | 21 |
81 xhtml: root.message_xhtml or self.escape(root.message or u' ') | 79 xhtml: root.message_xhtml or self.escape(root.message or u' ') |
82 color: (0.74,0.74,0.24,1) if root.mess_data.type == "info" else (0, 0, 0, 1) | 80 color: (0.74,0.74,0.24,1) if root.mess_data.type == "info" else (0, 0, 0, 1) |
83 padding: root.mess_padding | 81 padding: root.mess_padding |
84 bold: True if root.mess_data.type == "info" else False | 82 bold: True if root.mess_data.type == "info" else False |
85 | 83 |
86 <MessageInputBox>: | |
87 size_hint: 1, None | |
88 height: dp(40) | |
89 message_input: message_input | |
90 MessageInputWidget: | |
91 id: message_input | |
92 size_hint: 1, 1 | |
93 hint_text: "Enter your message here" | |
94 on_text_validate: root.parent.onSend(args[0]) | |
95 IconButton | |
96 # upload button | |
97 source: app.expand("{media}/icons/tango/actions/32/list-add.png") | |
98 allow_stretch: True | |
99 size_hint: None, 1 | |
100 width: max(self.texture_size[0], dp(40)) | |
101 on_release: root.parent.onUploadButton() | |
102 | 84 |
103 <FileUploader>: | 85 <Chat>: |
104 FileChooserListView: | 86 messages_widget: messages_widget |
105 id: filechooser | 87 ScrollView: |
106 rootpath: "/" if platform == 'android' else expanduser('~') | 88 size_hint: 1, 0.8 |
107 Button: | 89 scroll_y: 0 |
108 text: "upload" | 90 do_scroll_x: False |
91 MessagesWidget: | |
92 id: messages_widget | |
93 MessageInputBox: | |
109 size_hint: 1, None | 94 size_hint: 1, None |
110 height: dp(50) | 95 height: dp(40) |
111 on_release: root.parent_chat.onUploadOK(filechooser) | 96 message_input: message_input |
112 Button: | 97 MessageInputWidget: |
113 text: "cancel" | 98 id: message_input |
114 size_hint: 1, None | 99 size_hint: 1, 1 |
115 height: dp(50) | 100 hint_text: "Enter your message here" |
116 on_release: root.parent_chat.onUploadCancel(filechooser) | 101 on_text_validate: root.onSend(args[0]) |
102 IconButton | |
103 # upload button | |
104 source: app.expand("{media}/icons/tango/actions/32/list-add.png") | |
105 allow_stretch: True | |
106 size_hint: None, 1 | |
107 width: max(self.texture_size[0], dp(40)) | |
108 on_release: upload_menu.show(self) | |
109 UploadMenu: | |
110 id: upload_menu | |
111 callback: root.onUploadOK |