home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / lib / python2.4 / site-packages / AppInstall / DialogProprietary.py < prev    next >
Encoding:
Python Source  |  2006-08-02  |  2.6 KB  |  70 lines

  1. # (c) 2005 Canonical, GPL
  2.  
  3. from SimpleGladeApp import SimpleGladeApp
  4. import gtk
  5. import gobject
  6. import os
  7. from gettext import gettext as _
  8. import gettext
  9. from BrowserView import GtkHtml2BrowserView as BrowserView
  10.  
  11. class DialogProprietary(SimpleGladeApp):
  12.  
  13.     def __init__(self, datadir, parent, item):
  14.         SimpleGladeApp.__init__(self,
  15.                                 path=datadir+"/gnome-app-install.glade",
  16.                                 root="dialog_proprietary",
  17.                                 domain="gnome-app-install")
  18.         msg = "<b><big>%s</big></b>\n\n%s\n\n%s" % (_("Install software from %s?") % item.channel,
  19.                                                     _("%s is provided by a third party vendor.") %
  20.                                                     item.name,
  21.                                                     _("You need a working internet connection to "
  22.                                                       " continue."))
  23.         self.dialog_proprietary.set_transient_for(parent)
  24.         self.dialog_proprietary.realize()
  25.         self.dialog_proprietary.window.set_functions(gtk.gdk.FUNC_MOVE)
  26.         self.label_proprietary.set_markup(msg)
  27.         self.item = item
  28.         self.button_add_channel.set_label(_("_Install"))
  29.  
  30.     def run(self):
  31.         if self.item.licenseUri:
  32.             msg = self.label_proprietary.get_label()
  33.             msg += "\n\n"
  34.             msg += _("The application comes with the following license "
  35.                      "terms and conditions. Click on the "
  36.                      "'Install' button to accept them:")
  37.             self.label_proprietary.set_markup(msg)
  38.             self.tooltips = gtk.Tooltips()
  39.             self.tooltips.set_tip(self.button_add_channel, \
  40.                                   _("Accept the license terms and install "\
  41.                                     "the software"))
  42.             self.browser.show()
  43.             self.browser.loadUri(self.item.licenseUri)
  44.         else:
  45.             self.button_add_channel.set_label(_("_Ok"))
  46.             self.browser.hide()
  47.         self.button_add_channel.grab_default()
  48.         return self.dialog_proprietary.run()
  49.  
  50.     def hide(self):
  51.         self.dialog_proprietary.hide()
  52.  
  53.     def create_proprietary_browser_view(self, s1, s2, i1, i2):
  54.         #print "create_custom_browser_view()"
  55.         self.browser = BrowserView()
  56.         return self.browser
  57.  
  58.  
  59. if __name__ == "__main__":
  60.     import sys
  61.  
  62.     class Item(object):
  63.         pass
  64.     
  65.     item = Item()
  66.     item.licenseUri = sys.argv[1]
  67.     item.channel = sys.argv[1]
  68.     dia = DialogProprietary("../data/", None, item)
  69.     dia.run()
  70.