After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 507242 - Add tag autocomplete
Add tag autocomplete
Status: RESOLVED FIXED
Product: postr
Classification: Other
Component: General
git master
Other Linux
: Normal enhancement
: ---
Assigned To: Postr Maintainers
Postr Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-01-04 12:14 UTC by Ross Burton
Modified: 2009-12-21 21:37 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (6.21 KB, patch)
2009-11-28 04:28 UTC, Francisco Rojas
none Details | Review
patch (6.42 KB, patch)
2009-12-01 05:46 UTC, Francisco Rojas
reviewed Details | Review
patch (6.53 KB, patch)
2009-12-20 14:06 UTC, Francisco Rojas
committed Details | Review

Description Ross Burton 2008-01-04 12:14:14 UTC
It should download the popular tag list and offer autocompletions in the entry somehow.
Comment 1 Francisco Rojas 2009-11-28 04:28:10 UTC
Created attachment 148634 [details] [review]
patch

Use the 100 most popular tags of the user and the 20 hottest
tag of the day to autocomplete the tag field

maybe we should remove the "..." button.
Comment 2 deignacio 2009-11-29 16:51:23 UTC
Review of attachment 148634 [details] [review]:

this looks like a good start.  however i think that the tag splitting logic needs to get fixed.  tags should be separated with a space, not comma, and quotes can override this.  from flickr's docs about tag strings: Separate each tag with a space: cameraphone urban moblog. Or to join 2 or more words together in one tag, use double quotes: "eric is the best".

::: src/TagsEntry.py
@@ +1,3 @@
+# Postr, a Flickr Uploader
+#
+# Copyright (C) 2006-2008 Ross Burton <ross@burtonini.com>

not sure if/how this should be updated now that it's 2009 and there are other contributors and such.

@@ +19,3 @@
+import gtk
+
+USER_POPULAR_TAGS = 100

add _COUNT? to the constants?

@@ +20,3 @@
+
+USER_POPULAR_TAGS = 100
+HOTS_TAGS=20

whitespace around =

@@ +36,3 @@
+        self.set_completion(self.completion)
+
+        # Use model column 0 as the text column

have a constant COL_TAG_NAME = 0 or something similar to that?  and then you can replace all of the 0s in the code.

@@ +47,3 @@
+        # note: the user may have typed only a part of the entire word
+        #       and so this step is necessary
+        if ',' in current_text:

tag splitting problem

@@ +50,3 @@
+            current_text = ','.join(current_text.split(',')[:-1])
+            # add the matching word
+            current_text = '%s, %s, ' % (current_text, model[iter][0])

constant

@@ +67,3 @@
+        # get the completion strings
+        modelstr = model[iter][0]
+        # check if the user has typed in a space char,

this seems to split the string on comma, not space.

@@ +71,3 @@
+        if ',' in key_string:
+            last_word = key_string.split(',')[-1].strip()
+            return modelstr.lower().startswith(last_word.lower())

this also matches all tags if the last character in the entry is the comma, displaying all tags.  not sure if that is intentional.  adding an "if last_word else False" would fix that.

@@ +77,3 @@
+    def update(self):
+        
+        self.completion_model = gtk.ListStore(str)

if you log out and re-login, this will recreate another liststore.  possibly check if the store exists already and just clear it?

@@ +93,3 @@
+        
+        for tag in rsp.getiterator('tag'):
+            self.completion_model.set(self.completion_model.append(), 0, tag.text)

could possibly add duplicate tags if there is an intersection in user and hot tags.

@@ +101,3 @@
+        dialog = ErrorDialog()
+        dialog.set_from_failure(failure)
+        dialog.show_all()

not sure what the user would do with a twisted error.  maybe just silently fail to populate the autocomplete and disable the completion if there are no entries after both taglists are fetched?
Comment 3 Francisco Rojas 2009-12-01 05:08:52 UTC
thank for your comments, I don't know why I though that the tags should be separated with a comma.
Comment 4 Francisco Rojas 2009-12-01 05:46:17 UTC
Created attachment 148808 [details] [review]
patch

* removed a bunch of magic numbers
* the tags are separated with a space 

There is some problems, when get the tag list from the flick API, some tags should be separated with space but isn't. e.g. the tag "the photo" is recived as thephoto  

I still don't know what to do with a twisted error, a error dialog is way to much, because the not loading the list doesn't affect to much the app.
Comment 5 Ross Burton 2009-12-01 08:36:18 UTC
"thephoto" is the canonical or clean representation of "the photo".  Returned tags are always in canonical form so that you don't need to bother worrying about whether "london" is the same tag as "LonDon".  If you really want to use the user-entered tags then you can use flickr.tags.getListUserRaw, but I wouldn't say it's worth it -- just use the clean tags.
Comment 6 Germán Poo-Caamaño 2009-12-15 15:37:16 UTC
Review of attachment 148808 [details] [review]:

Nice work.  Regarding the twisted error, I see an small issue that may be fixed 
before commit it:

If I write: "word ", as soon a press space after 'word' it propose me to autocomplete
with a long list of tags.

The problem I see with this behaviour relies on the mixed tags (from populars in the last
24hrs and the user ones), it looks too long.
Comment 7 Francisco Rojas 2009-12-20 14:06:25 UTC
Created attachment 150108 [details] [review]
patch

* propose the autocompletation after giving at least 1 letter of the word
* get the 100 most polular tags of the user and not the 300 like the last patch.
Comment 8 Germán Poo-Caamaño 2009-12-21 21:36:46 UTC
Review of attachment 150108 [details] [review]:

I applied the patch with 2 modifications:

- 200 most popular tags
- I removed the button with ellipsis that was located at the right of the tags_entry.

Thank you, Francisco.
Comment 9 Germán Poo-Caamaño 2009-12-21 21:37:30 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.