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 _on_view_pages(self, widget):
     self.home.reset()
     uris = []
     for pIndex in xrange(self.pages.get_n_pages()):
         self.pages.set_current_page(pIndex)
         page = self.pages.get_nth_page(pIndex)
         overviewPage = PageOverviewWidget(page)
         overviewPage.connect("clicked", self._on_page_clicked)
         self.home.add_page(overviewPage)
         uris.append(page.webview.get_uri())
     self.home.show_all()
     self.box.set_current_page(0)
     
     def callback(events):
         self.home.recentDashboard.recentPages.reset()
         for event in events:
             page = PageButton(event.subjects[0])
             print event.subjects[0].uri
             self.home.recentDashboard.recentPages.add_page(page)
         self.home.show_all()
     event = Event()
     event.actor = "application://web.desktop"
     event.subjects = []
     for uri in uris:
         if uri:
             subject = Subject()
             subject.uri = "!"+uri
             event.subjects.append(subject)
     print event
     ZG.find_events_for_template(event, callback, result_type=2)
Exemplo n.º 3
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