~thekorn/+junk/softwarecenter-zeitgeist-plugin

1 by Markus Korn
initial version of a softwarecenter plugin for zeitgeist
1
from softwarecenter.plugin import Plugin
2
2 by Markus Korn
connecting to the view changed signal
3
from zeitgeist.client import ZeitgeistClient
3 by Markus Korn
added code to insert event objects
4
from zeitgeist.datamodel import Event, Interpretation, Manifestation
2 by Markus Korn
connecting to the view changed signal
5
1 by Markus Korn
initial version of a softwarecenter plugin for zeitgeist
6
class ZeitgeistPlugin(Plugin):
7
    
8
    def init_plugin(self):
9
        self.app._logger.debug("ZeitgeistPlugin loaded")
2 by Markus Korn
connecting to the view changed signal
10
        self.app.available_pane.app_details.connect("selected", self.on_app_details_select)
11
        self.zeitgeist_client = ZeitgeistClient()
12
13
    def on_app_details_select(self, widget, app):
3 by Markus Korn
added code to insert event objects
14
        event = Event.new_for_values(
15
            interpretation=Interpretation.ACCESS_EVENT,
16
            manifestation=Manifestation.USER_ACTIVITY,
17
            actor="application://software-center.desktop",
18
            subject_uri="application://%s" %app.pkgname,
19
            subject_interpretation=Interpretation.SOFTWARE,
20
            subject_manifestation=Manifestation.SOFTWARE_ITEM,
21
        )
22
        self.app._logger.debug("changed app view, logging event to zeitgeist: %r" %event)
23
        self.zeitgeist_client.insert_event(event)