~davidc3/onehundredscopes/calculator

« back to all changes in this revision

Viewing changes to src/unity-scope-calculator

  • Committer: David Callé
  • Date: 2011-12-07 21:52:39 UTC
  • Revision ID: davidc@framli.eu-20111207215239-enhob0lbfjwyosdx
Copy to clipboard and notify user on click

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
                self.scope.connect ("notify::active-global-search", self.on_search_changed)
34
34
                self.scope.connect ("notify::active", self.on_search_changed)
35
35
                self.scope.connect ("filters-changed", self.on_search_changed);
 
36
                self.scope.connect ("activate-uri", self.on_activate_uri);
36
37
                self.scope.export()
37
38
 
 
39
        def on_activate_uri (self, scope, uri):
 
40
                import gtk
 
41
                clipboard = gtk.clipboard_get()
 
42
                clipboard.set_text(uri)
 
43
                clipboard.store()
 
44
                GLib.spawn_command_line_async("notify-send -i gtk-copy '%s'" % uri)
 
45
                return Unity.ActivationResponse(handled=Unity.HandledType.HIDE_DASH, goto_uri='')
 
46
 
38
47
        def get_search_string (self):
39
48
                search = self.scope.props.active_global_search
40
49
                if search is None:
100
109
                print "Result: %s" % calc_result
101
110
                if search:
102
111
                        if not (calc_result.startswith("Argument")) and not (calc_result.startswith("Error")) and not (calc_result == ''):
103
 
                                model.append('', icon, 0, "text/html", calc_result, hint, '')
 
112
                                model.append(calc_result, icon, 0, "text/html", calc_result, hint, '')
104
113
 
105
114
import subprocess, threading
106
115
class Command(object):