Advertisement
Guest User

Untitled

a guest
Oct 20th, 2010
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. from sugar.graphics.alert import ConfirmationAlert
  2. from jarabe.model import bundleregistry
  3. from sugar.activity import activityfactory
  4.  
  5. class VersionAlert(journalactivity.JournalActivity):
  6. def __init__(self):
  7. JournalActivity.__init__(self)
  8. self.bundle = None
  9.  
  10. def older_version_clicked_cb(self):
  11. alert1=ConfirmationAlert()
  12. alert1.props.title = _('Newer Version Found')
  13. 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')
  14. alert1.connect('response',self.downgrade_alert_response_cb)
  15. self.add_alert(alert1)
  16. alert1.show()
  17.  
  18. def give_bundle(self,bundle):
  19. self.bundle = bundle
  20. return
  21.  
  22. def downgrade_alert_response_cb(self, alert1, response_id):
  23. if response_id is gtk.RESPONSE_OK:
  24. self.remove_alert(alert1)
  25. registry = bundleregistry.get_registry()
  26. registry.install(self.bundle,uid=None,force_downgrade=True)
  27. installed_bundle = registry.get_bundle(self.bundle.get_bundle_id())
  28. if installed_bundle:
  29. activityfactory.create(installed_bundle)
  30. elif response_id is gtk.RESPONSE_CANCEL:
  31. self.remove_alert(alert)
  32. self.destroy()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement