def _on_uri_changed(self, webview, load_status):
     if self.webview.get_property("load-status") ==\
         WebKit.LoadStatus.FINISHED:
         if self.current_uri != self.webview.get_uri():
             if self.current_uri:
                 event = Event()
                 event.interpretation = Interpretation.LEAVE_EVENT
                 event.manifestation = Manifestation.USER_ACTIVITY
                 event.actor = "application://web.desktop"
                 subject = Subject()
                 subject.uri = self.current_uri
                 subject.mimetype = "text/html"
                 subject.text = self.current_title
                 subject.interpretation = Interpretation.WEBSITE
                 subject.manifestation = Manifestation.REMOTE_PORT_ADDRESS
                 event.subjects = [subject]
                 ZG.insert_event(event)
             self.current_uri = self.webview.get_uri()
             self.current_title = self.webview.get_title()
             print "===>", self.current_title 
             event = Event()
             event.interpretation = Interpretation.ACCESS_EVENT
             event.manifestation = Manifestation.USER_ACTIVITY
             event.actor = "application://web.desktop"
             subject = Subject()
             subject.uri = self.current_uri
             subject.mimetype = "text/html"
             subject.text = self.current_title
             subject.interpretation = Interpretation.WEBSITE
             subject.manifestation = Manifestation.REMOTE_PORT_ADDRESS
             event.subjects = [subject]
             ZG.insert_event(event)
Exemplo n.º 2
0
def format_events(commits):
    events = []
    for commit in commits:
        if not commit["desc"].lower().startswith("merge"):
            event = Event()
            event.timestamp = commit["timestamp"] * 1000
            event.actor = commit["actor"]
            event.interpretation = Interpretation.MODIFY_EVENT
            event.manifestation = Manifestation.USER_ACTIVITY
            subj = Subject()
            subj.uri = "dav://%s" % commit["uri"]
            subj.origin = "dav:// " + event.actor
            subj.interpretation = Interpretation.MESSAGE
            subj.manifestation = Manifestation.FILE_DATA_OBJECT.REMOTE_DATA_OBJECT
            subj.text = commit["desc"]
            event.subjects = [subj]
            for f in commit["files"]:
                if f.strip() != "":
                    subj = Subject()
                    subj.uri = "file://" + f
                    subj.interpretation = Interpretation.DOCUMENT
                    subj.manifestation = Manifestation.FILE_DATA_OBJECT.REMOTE_DATA_OBJECT
                    subj.text = f.split("/")[-1]
                    event.subjects.append(subj)
            events.append(event)
    return events
Exemplo n.º 3
0
def dict2event(d):
    ev = Event()
    ev[0][Event.Id] = d.get("id", "")
    ev.timestamp = d.get("timestamp", "")
    ev.interpretation = d.get("interpretation", "")
    ev.manifestation = d.get("manifestation", "")
    ev.actor = d.get("actor", "")
    ev.origin = d.get("origin", "")
    ev.payload = d.get("payload", "")

    subjects = d.get("subjects", [])
    for sd in subjects:
        subj = Subject()
        subj.uri = sd.get("uri", "")
        subj.current_uri = sd.get("current_uri", "")
        subj.interpretation = sd.get("interpretation", "")
        subj.manifestation = sd.get("manifestation", "")
        subj.origin = sd.get("origin", "")
        subj.current_origin = sd.get("current_origin", "")
        subj.mimetype = sd.get("mimetype", "")
        subj.text = sd.get("text", "")
        subj.storage = sd.get("storage", "")
        ev.append_subject(subj)
    return ev
def dict2event(d):
	ev = Event()
	ev[0][Event.Id] = d.get("id", "").encode("UTF-8")
	ev.timestamp = str(d.get("timestamp", ""))
	ev.interpretation = str(d.get("interpretation", "").encode("UTF-8"))
	ev.manifestation = str(d.get("manifestation", "").encode("UTF-8"))
	ev.actor = str(d.get("actor", "").encode("UTF-8"))
	ev.origin = str(d.get("origin", "").encode("UTF-8"))
	ev.payload = str(d.get("payload", "").encode("UTF-8"))
	
	subjects = d.get("subjects", [])
	for sd in subjects:
		subj = Subject()
		subj.uri = str(sd.get("uri", "").encode("UTF-8"))
		subj.current_uri = str(sd.get("current_uri", "")).encode("UTF-8")
		subj.interpretation = str(sd.get("interpretation", "").encode("UTF-8"))
		subj.manifestation = str(sd.get("manifestation", "").encode("UTF-8"))
		subj.origin = str(sd.get("origin", "").encode("UTF-8"))
		subj.current_origin = str(sd.get("current_origin", "")).encode("UTF-8")
		subj.mimetype = str(sd.get("mimetype", "").encode("UTF-8"))
		subj.text = str(sd.get("text", "").encode("UTF-8"))
		subj.storage = str(sd.get("storage", "").encode("UTF-8"))
		ev.append_subject(subj)
	return ev
Exemplo n.º 5
0
 def __create_user_event(self):
     event = ZeitgeistEvent()
     event.actor = APPLICATION_URI_PREFIX + self.distro.get_app_id(
     ) + ".desktop"
     event.manifestation = ZeitgeistDataModel.Manifestation.EVENT_MANIFESTATION.USER_ACTIVITY
     return event
Exemplo n.º 6
0
 def __create_user_event(self):
     event = ZeitgeistEvent()
     event.actor = APPLICATION_URI_PREFIX + self.distro.get_app_id() + ".desktop"
     event.manifestation = ZeitgeistDataModel.Manifestation.EVENT_MANIFESTATION.USER_ACTIVITY
     return event