# HG changeset patch # User Goffi # Date 1527093855 -7200 # Node ID a68c9baa66948a9f212ef277f25b27b01a319c2d # Parent 284cb5c467b0b1b33543a14f74a970637a578ce7 plugin file sharing: use header hint to show current path, and open new path: - if header is empty, current path is shown as hint - if text is entered, it's used to filter files/dirs in the current path - if text is a path (i.e. if it contains a "/"), current path is changed to specified one when header is validated diff -r 284cb5c467b0 -r a68c9baa6694 cagou/plugins/plugin_wid_file_sharing.py --- a/cagou/plugins/plugin_wid_file_sharing.py Wed May 23 18:40:58 2018 +0200 +++ b/cagou/plugins/plugin_wid_file_sharing.py Wed May 23 18:44:15 2018 +0200 @@ -49,6 +49,7 @@ } MODE_VIEW = u"view" MODE_LOCAL = u"local" +SELECT_INSTRUCTIONS = _(u"Please select entities to share with") dist = modernmenu.dist @@ -269,9 +270,15 @@ print(instance) self.update_view(None, self.local_dir) + def onHeaderInput(self): + if u'/' in self.header_input.text or self.header_input.text == u'~': + self.current_dir = os.path.expanduser(self.header_input.text) + def onHeaderInputComplete(self, wid, text): """we filter items when text is entered in input box""" text = text.strip().lower() + if u'/' in text: + return filtering = len(text)>len(self._filter_last) self._filter_last = text for child in self.layout.children: @@ -349,6 +356,8 @@ log.debug(u'updating {}, {}'.format(self.current_dir, args)) self.layout.clear_widgets() self.header_input.text = u'' + self.header_input.hint_text = self.current_dir + if self.mode == MODE_LOCAL: filepath = os.path.join(self.local_dir, u'..') self.layout.add_widget(LocalPathWidget(sharing_wid=self, filepath=filepath))