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

Source Code for Module rhn_register_firstboot_gui_window

  1  import functions # firstboot stuff 
  2  import os 
  3  import gtk 
  4   
  5  from firstboot_module_window import FirstbootModuleWindow 
  6   
  7  from up2date_client import messageWindow 
  8  from up2date_client import rhnregGui 
  9   
10 -class RhnRegisterFirstbootGuiWindow(FirstbootModuleWindow):
11 """This is a base class for our firstboot screens. It shouldn't be used 12 directly. 13 14 """ 15 needsparent = 1 16
17 - def __init__(self):
18 FirstbootModuleWindow.__init__(self) 19 self.doDebug = False 20 # Variables that fb windows need to define 21 assert hasattr(self, 'runPriority') 22 assert hasattr(self, 'moduleName') 23 assert hasattr(self, 'windowTitle') 24 assert hasattr(self, 'shortMessage') 25 assert hasattr(self, 'needsparent') 26 # Method to provide the screen contents 27 assert hasattr(self, '_getVbox')
28
29 - def passInParent(self,parent):
30 self.parent = parent
31
32 - def getNext(self):
33 pass
34
35 - def launch(self, doDebug=None):
36 """Firstboot calls this to set up the screen. It will use the _getVbox 37 method provided by the derived classes to get the contents of the 38 screen. 39 40 """ 41 self.doDebug = doDebug 42 if self.doDebug: 43 print(self.__class__.__name__, "launch called.") 44 45 self.icon = functions.imageFromPath("/usr/share/system-config-display/pixmaps/system-config-display.png") 46 self.mainVBox = gtk.VBox() 47 48 internalVBox = gtk.VBox(False, 10) 49 internalVBox.set_border_width(10) 50 51 vbox = self._getVbox() 52 53 internalVBox.pack_start(vbox, True) 54 self.mainVBox.pack_start(internalVBox, True) 55 56 # Set up cursor changing functions. Overriding functions that aren't in 57 # classes like this could be called a hack, but I think it's the best 58 # we can do with the current overall setup and isn't too bad. 59 # Having it here will cause this to get called once per module, but I'm 60 # not sure if it'll work to put it in the constructor. 61 def mySetBusyCursor(): 62 cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) 63 # I think we have to set the cursor using firstboot's .window instead of 64 # the one in our vboxes because the thing we use must be displayed when 65 # we change the cursor and sometimes this gets called by a screen before 66 # it's visible. 67 # TODO See if we can add functions to firstboot to provide a nice way to 68 # change the cursor. 69 self.parent.win.window.set_cursor(cursor) 70 while gtk.events_pending(): 71 gtk.main_iteration(False)
72 def mySetArrowCursor(): 73 # I think we have to set the cursor using firstboot's .window instead of 74 # the one in our vboxes because the thing we use must be displayed when 75 # we change the cursor and sometimes this gets called by a screen before 76 # it's visible. 77 self.parent.win.window.set_cursor(None) 78 while gtk.events_pending(): 79 gtk.main_iteration(False)
80 rhnregGui.setBusyCursor = mySetBusyCursor 81 rhnregGui.setArrowCursor = mySetArrowCursor 82 83 return self.mainVBox, self.icon, self.windowTitle 84
85 - def grabFocus(self):
86 if self.doDebug: 87 print(self.__class__.__name__, "grabFocus called.") 88 pass
89
90 - def fatalError(self, error, wrap=1):
91 # FIXME 92 if wrap: 93 text = messageWindow.wrap_text(error) 94 else: 95 text = error 96 dlg = messageWindow.ErrorDialog(text) 97 self._goImmediatelyToFinish()
98
99 - def _goImmediatelyToFinish(self):
100 self.parent.setPage("rhn_finish_gui") 101 def dummyApply(self, *args): 102 print("dummy") 103 return True
104 self.apply = dummyApply 105 self.parent.nextClicked() 106