Module rhn_start_gui
[hide private]
[frames] | no frames]

Source Code for Module rhn_start_gui

  1  # Copyright 2006 Red Hat, Inc. 
  2  # 
  3  # This program is free software; you can redistribute it and/or modify 
  4  # it under the terms of the GNU General Public License as published by 
  5  # the Free Software Foundation; version 2 of the License. 
  6  # 
  7  # This program is distributed in the hope that it will be useful, 
  8  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
  9  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 10  # GNU General Public License for more details. 
 11  # 
 12  # You should have received a copy of the GNU General Public License 
 13  # along with this program; if not, write to the Free Software 
 14  # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
 15  # 
 16  # Authors: 
 17  #     Daniel Benamy <dbenamy@redhat.com> 
 18   
 19  import os 
 20  from up2date_client import rhnreg 
 21  from up2date_client import rhnregGui 
 22  from rhn_register_firstboot_gui_window import RhnRegisterFirstbootGuiWindow 
 23   
 24  import gtk 
 25  from gtk import glade 
 26  import gettext 
 27  t = gettext.translation('rhn-client-tools', fallback=True) 
 28  _ = t.ugettext 
 29  gtk.glade.bindtextdomain("rhn-client-tools") 
 30   
 31   
32 -class RhnStartWindow(RhnRegisterFirstbootGuiWindow):
33 runPriority=106 34 moduleName = _("Set Up Software Updates") 35 windowTitle = moduleName 36 shortMessage = _("Register with Red Hat Satellite") 37 needsparent = 1 38
39 - def __init__(self):
40 RhnRegisterFirstbootGuiWindow.__init__(self) 41 self.start_page = None
42
43 - def _getVbox(self):
44 if rhnreg.registered(): 45 self.start_page = KsRegisteredPage() 46 return self.start_page.startPageVbox() 47 if self.parent.checkNetwork(): 48 self.start_page = rhnregGui.StartPage(firstboot=True) 49 else: 50 self.start_page = NoNetworkPage() 51 return self.start_page.startPageVbox()
52
53 - def apply(self, *args):
54 """Returns True to change the page (to the one set).""" 55 if not self.start_page.startPageRegisterNow(): 56 dlg = rhnregGui.ConfirmQuitDialog() 57 if not dlg.rc: 58 self.parent.setPage("rhn_start_gui") 59 else: 60 self.parent.setPage("rhn_finish_gui") 61 return True
62
63 -class KsRegisteredPage:
64
65 - def __init__(self):
66 gladefile = "/usr/share/rhn/up2date_client/rh_register.glade" 67 ksRegisteredXml = gtk.glade.XML(gladefile, "ksRegisteredFirstbootVbox", 68 domain="rhn-client-tools") 69 self.vbox = ksRegisteredXml.get_widget('ksRegisteredFirstbootVbox')
70
71 - def startPageVbox(self):
72 return self.vbox
73
74 - def startPageRegisterNow(self):
75 return True
76 77
78 -class NoNetworkPage:
79
80 - def __init__(self):
81 gladefile = "/usr/share/rhn/up2date_client/rh_register.glade" 82 noNetworkXml = gtk.glade.XML(gladefile, "noNetworkFirstbootVbox", 83 domain="rhn-client-tools") 84 self.vbox = noNetworkXml.get_widget('noNetworkFirstbootVbox') 85 noNetworkXml.signal_autoconnect({ 86 "on_whyRegisterButton_clicked" : self.why_register_button_clicked, 87 })
88
89 - def startPageVbox(self):
90 return self.vbox
91
92 - def startPageRegisterNow(self):
93 # Sure, we'll register now. heh heh heh 94 # Just continue on past the rhn stuff. 95 return True
96
97 - def why_register_button_clicked(self, button):
99 100 childWindow = RhnStartWindow 101