本文整理匯總了Python中zeitgeist.datamodel.Subject.uri方法的典型用法代碼示例。如果您正苦於以下問題:Python Subject.uri方法的具體用法?Python Subject.uri怎麽用?Python Subject.uri使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類zeitgeist.datamodel.Subject
的用法示例。
在下文中一共展示了Subject.uri方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _on_uri_changed
# 需要導入模塊: from zeitgeist.datamodel import Subject [as 別名]
# 或者: from zeitgeist.datamodel.Subject import uri [as 別名]
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)
示例2: format_events
# 需要導入模塊: from zeitgeist.datamodel import Subject [as 別名]
# 或者: from zeitgeist.datamodel.Subject import uri [as 別名]
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
示例3: _on_view_pages
# 需要導入模塊: from zeitgeist.datamodel import Subject [as 別名]
# 或者: from zeitgeist.datamodel.Subject import uri [as 別名]
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)
示例4: __create_app_subject
# 需要導入模塊: from zeitgeist.datamodel import Subject [as 別名]
# 或者: from zeitgeist.datamodel.Subject import uri [as 別名]
def __create_app_subject(self, desktop_file):
subject = ZeitgeistSubject()
subject.interpretation = ZeitgeistDataModel.Interpretation.SOFTWARE
subject.manifestation = ZeitgeistDataModel.Manifestation.SOFTWARE_ITEM
subject.uri = APPLICATION_URI_PREFIX + get_desktop_id(desktop_file);
subject.current_uri = subject.uri
subject.mimetype = "application/x-desktop"
return subject
示例5: handle_recent
# 需要導入模塊: from zeitgeist.datamodel import Subject [as 別名]
# 或者: from zeitgeist.datamodel.Subject import uri [as 別名]
def handle_recent(results):
self.recent = []
for event in results:
if exists(event.subjects[0].uri):
self.recent.append([event.subjects[0].uri, event.subjects[0].text])
subj = Subject()
subj.uri = "!"+event.subjects[0].uri
template.subjects.append(subj)
if len(self.recent) >= 5:
break
CLIENT.find_events_for_templates([template], handle_most, num_events = 1000, result_type = 4)
示例6: dict2event
# 需要導入模塊: from zeitgeist.datamodel import Subject [as 別名]
# 或者: from zeitgeist.datamodel.Subject import uri [as 別名]
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