In the modern web landscape tags or hashtags are one key to efficient access and conceptualization of data. Thus, a lot of websites offer tags clouds to summarize data content and allow to assign tags to user-generated data. Even if the names of tags do not follow a scheme and are therefore free-style, grouping data is usually still possible, at least if we consider generic tags, or tags within the same domain of language. In other words, a web without tags is unimaginable. However, the value of tags goes far beyond the web.
We are still a bit old-fashioned since we are using a desktop app as our media center and thus, we need to find a clever way to utilize tags to improve access to our data. We are using GTK with a python interface which allows a smooth integration with our theano-based machine learning models and the rest of our application.
The first part, to assign tags to items is already done. Thus, we just need a way to use tags to find similar content more efficiently within the app. The idea is to get an overview what kind of similar items are available with just a single click. Frankly, the novelty is just to embed tags into the GUI framework and to use them as filters; not very spectacular, but extremely useful.
With GTK, we can use a simple label and fill it with markup to define targets that can be clicked:
label = gtk.Label()
Now, if we add the widget to a dialog, the text is underlined to indicate that a user can click the target. The click emits a special signal that can be captured with a callback which is the default way to connect widgets with actions in GTK:
The callback is a function that is called whenever a user clicks on the object and the signature for the callback is: callback(widget, target_value).
When the function handled the the request ‘True’ is returned, otherwise False which means the event is propagated to the next callback in the chain. To illustrate the difference, let’s consider the case where clicks on tags should be handled differently than clicks on URLs.
def callback(widget, target):
return False #forward
return True #handled -> stop
The callback processes tags by calling a dedicated function but in case of actual links, the internal callback is used which usually starts a browser with the given URL.
Now the question is how to integrate those links into a GUI? As a first shot, we could use the status bar to list all tags that are present in items listed in the dialog. Maybe with a variable size to indicate the importance of the tag with respect to the data. A click on a tag would start a search for the tag and present the results to the user.
Bottom line, it is extremely important to give users an overview about the data, for today, but also in general. For example, if Jurrasic Park is aired to today and the user likes the movie, he might be also interested to know what other “dinosaur” movies are on tonight or in the near future. With tags that act as links, navigating through the dataset is now much easier and it allows to give a short summary of the data, at least if the content is tagged.