comparison src/cagou/plugins/plugin_wid_chat.kv @ 78:46d962910801

chat: file upload first draft: - added a icon to upload files - only do a basic upload with list file browser for now - use the new progressFinished and progressError listeners
author Goffi <goffi@goffi.org>
date Thu, 22 Dec 2016 19:03:06 +0100
parents 2aa44a82d0e7
children c711be670ecd
comparison
equal deleted inserted replaced
77:bc170ccca744 78:46d962910801
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
17 19
18 <SimpleXHTMLWidgetEscapedText>: 20 <SimpleXHTMLWidgetEscapedText>:
19 size_hint: None, None 21 size_hint: None, None
20 size: self.texture_size 22 size: self.texture_size
21 23
79 xhtml: root.message_xhtml or self.escape(root.message or u' ') 81 xhtml: root.message_xhtml or self.escape(root.message or u' ')
80 color: (0.74,0.74,0.24,1) if root.mess_data.type == "info" else (0, 0, 0, 1) 82 color: (0.74,0.74,0.24,1) if root.mess_data.type == "info" else (0, 0, 0, 1)
81 padding: root.mess_padding 83 padding: root.mess_padding
82 bold: True if root.mess_data.type == "info" else False 84 bold: True if root.mess_data.type == "info" else False
83 85
84 <MessageInputWidget>: 86 <MessageInputBox>:
85 size_hint: 1, None 87 size_hint: 1, None
86 height: dp(40) 88 height: dp(40)
87 hint_text: "Enter your message here" 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
103 <FileUploader>:
104 FileChooserListView:
105 id: filechooser
106 rootpath: "/" if platform == 'android' else expanduser('~')
107 Button:
108 text: "upload"
109 size_hint: 1, None
110 height: dp(50)
111 on_release: root.parent_chat.onUploadOK(filechooser)
112 Button:
113 text: "cancel"
114 size_hint: 1, None
115 height: dp(50)
116 on_release: root.parent_chat.onUploadCancel(filechooser)