- from sugar.graphics.alert import ConfirmationAlert
- from jarabe.model import bundleregistry
- from sugar.activity import activityfactory
- class VersionAlert(journalactivity.JournalActivity):
- def __init__(self):
- JournalActivity.__init__(self)
- self.bundle = None
- def older_version_clicked_cb(self):
- alert1=ConfirmationAlert()
- alert1.props.title = _('Newer Version Found')
- alert1.props.msg = _('Newer version of the chosen activity is available do you still want to continue with the installation? If Yes click Ok and the activity icon of the older .xo file in the Journal')
- alert1.connect('response',self.downgrade_alert_response_cb)
- self.add_alert(alert1)
- alert1.show()
- def give_bundle(self,bundle):
- self.bundle = bundle
- return
- def downgrade_alert_response_cb(self, alert1, response_id):
- if response_id is gtk.RESPONSE_OK:
- self.remove_alert(alert1)
- registry = bundleregistry.get_registry()
- registry.install(self.bundle,uid=None,force_downgrade=True)
- installed_bundle = registry.get_bundle(self.bundle.get_bundle_id())
- if installed_bundle:
- activityfactory.create(installed_bundle)
- elif response_id is gtk.RESPONSE_CANCEL:
- self.remove_alert(alert)
- self.destroy()
SHARE
TWEET
Untitled
a guest
Oct 20th, 2010
24
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
RAW Paste Data
