def initiate_purchase(self, app, iconname, url=None, html=None):
"""
initiates the purchase workflow inside the embedded webkit window
for the item specified
"""
if not self._ask_for_tos_acceptance_if_needed():
self.emit("terms-of-service-declined")
return False
self.init_view()
self.app = app
self.iconname = iconname
self.wk.webkit.load_html_string(self.LOADING_HTML, "file:///")
self.wk.show()
while Gtk.events_pending():
Gtk.main_iteration()
if url:
self.wk.webkit.load_uri(url)
elif html:
self.wk.webkit.load_html_string(html, "file:///")
else:
self.wk.webkit.load_html_string(DUMMY_HTML, "file:///")
self.pack_start(self.wk, True, True, 0)
# only for debugging
if os.environ.get("SOFTWARE_CENTER_DEBUG_BUY"):
GObject.timeout_add_seconds(1, _generate_events, self)
return True
评论列表
文章目录