~davidc3/onehundredscopes/invaders

« back to all changes in this revision

Viewing changes to desura-scope.py

  • Committer: David Callé
  • Date: 2011-11-19 18:50:24 UTC
  • Revision ID: davidc@framli.eu-20111119185024-fsl8r65u1swnsz0d
Uri activation almost working. Improvements on the Desura scope.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
                self.scope.connect ("notify::active-search", self.on_search_changed)
33
33
                self.scope.connect ("notify::active", self.on_search_changed)
34
34
                self.scope.connect ("filters-changed", self.on_search_changed);
 
35
                self.scope.connect ("activate-uri", self.on_click);
35
36
                self.scope.export()
36
37
 
 
38
        def on_click (self, scope, uri):
 
39
                working_dir = uri.rsplit('/',1)[0]
 
40
                print "Launching from %s" % working_dir
 
41
                GLib.spawn_async([working_dir+"/desura_launch_Play.sh"], flags=(GLib.SPAWN_SEARCH_PATH | GLib.SPAWN_DO_NOT_REAP_CHILD), working_directory=working_dir)
 
42
 
37
43
        def get_search_string (self):
38
44
                search = self.scope.props.active_search
39
45
                return search.props.search_string if search else None
55
61
                                icon_hint = i[2]
56
62
                                model.append (uri, icon_hint, 0,"text/html", title, comment, uri)
57
63
#                               model.append (uri, icon_hint, 1,"text/html", title, "A game of fun and mayhem...", uri)
 
64
                                if self.scope.props.active_search:
 
65
                                        self.scope.props.active_search.emit("finished")
58
66
 
59
67
        def check_filters(self, filter_name):
60
68
                try:
92
100
                                icon_hint = "/home/david/.games/desura/"+row[12]
93
101
                                d.execute('select * from exe where itemid = ?', [internalid])
94
102
                                for row in d:
95
 
                                        uri = row[2]
 
103
                                        uri = "/home/david/.games/desura/"+row[2]
96
104
                                        print uri
97
105
                                if search is None or search is '' or title.lower().find(search.lower())  > -1  or genre.lower().find(search.lower())  > -1:
98
106
                                        item_list.append(title)
99
 
                                        item_list.append('')
 
107
                                        item_list.append(uri)
100
108
                                        item_list.append(icon_hint)
101
109
                                        item_list.append(genre)
102
110
                                        data_list.append(item_list)