def __init__(self, screen, tui): self.tui = tui if not rhnreg.server_supports_eus(): log.log_debug("Server does not support EUS, skipping OSReleaseWindow") raise WindowSkipException() self.available_channels = rhnreg.getAvailableChannels( tui.userName, tui.password) if len(self.available_channels['channels']) < 1: log.log_debug("No available EUS channels, skipping OSReleaseWindow") raise WindowSkipException() self.screen = screen self.size = snack._snack.size() self.selectChannel = False toplevel = snack.GridForm(self.screen, SELECT_OSRELEASE.encode('utf-8'), 1, 7) self.g = toplevel self.ostext = snack.TextboxReflowed(self.size[0]-10, OS_VERSION.encode('utf-8')) toplevel.add(self.ostext, 0, 0, anchorLeft = 1) optiontext1 = LIMITED_UPDATES.encode('utf-8') if self.tui.limited_updates_button: self.limited_updates_button = snack.SingleRadioButton(optiontext1, None, isOn = 1) else: self.limited_updates_button = snack.SingleRadioButton(optiontext1, None) toplevel.add(self.limited_updates_button, 0, 1, padding = (0, 1, 0, 1), anchorLeft = 1) self.sublabel = snack.Label(MINOR_RELEASE.encode('utf-8')) toplevel.add(self.sublabel, 0, 2, anchorLeft = 1) self.channelList = snack.Listbox(self.size[1]-22, 1, width = self.size[0]-10) toplevel.add(self.channelList, 0, 3) for key, value in sorted(self.available_channels['channels'].items(), key=lambda a:a[0]): if key in self.available_channels['receiving_updates']: value = value + "*" self.channelList.append(" " + value, key) self.tip = snack.TextboxReflowed(self.size[0]-10, CHANNEL_PAGE_TIP.encode('utf-8')) toplevel.add(self.tip, 0, 4, anchorLeft = 1) optiontext2 = ALL_UPDATES.encode('utf-8') if self.tui.all_updates_button: self.all_updates_button = snack.SingleRadioButton(optiontext2, self.limited_updates_button, isOn=1) else: self.all_updates_button = snack.SingleRadioButton(optiontext2, self.limited_updates_button) toplevel.add(self.all_updates_button, 0, 5, padding = (0, 0, 0, 1), anchorLeft = 1) #self.warning = snack.TextboxReflowed(self.size[0]-10, # CHANNEL_PAGE_WARNING.encode('utf-8')) #toplevel.add(self.warning, 0, 9, anchorLeft = 1) self.bb = snack.ButtonBar(screen, [(NEXT.encode('utf-8'), "next"), (BACK.encode('utf-8'), "back"), (CANCEL.encode('utf-8'), "cancel")]) toplevel.add(self.bb, 0, 6, growx = 1) self.screen.refresh()
def __init__(self, screen, tui): self.tui = tui if not rhnreg.server_supports_eus(): log.log_debug( "Server does not support EUS, skipping OSReleaseWindow") raise WindowSkipException() self.available_channels = rhnreg.getAvailableChannels( tui.userName, tui.password) if len(self.available_channels['channels']) < 1: log.log_debug( "No available EUS channels, skipping OSReleaseWindow") raise WindowSkipException() self.screen = screen self.size = snack._snack.size() self.selectChannel = False toplevel = snack.GridForm(self.screen, SELECT_OSRELEASE.encode('utf-8'), 1, 7) self.g = toplevel self.ostext = snack.TextboxReflowed(self.size[0] - 10, OS_VERSION.encode('utf-8')) toplevel.add(self.ostext, 0, 0, anchorLeft=1) optiontext1 = LIMITED_UPDATES.encode('utf-8') if self.tui.limited_updates_button: self.limited_updates_button = snack.SingleRadioButton(optiontext1, None, isOn=1) else: self.limited_updates_button = snack.SingleRadioButton( optiontext1, None) toplevel.add(self.limited_updates_button, 0, 1, padding=(0, 1, 0, 1), anchorLeft=1) self.sublabel = snack.Label(MINOR_RELEASE.encode('utf-8')) toplevel.add(self.sublabel, 0, 2, anchorLeft=1) self.channelList = snack.Listbox(self.size[1] - 22, 1, width=self.size[0] - 10) toplevel.add(self.channelList, 0, 3) for key, value in sorted(self.available_channels['channels'].items(), key=lambda a: a[0]): if key in self.available_channels['receiving_updates']: value = value + "*" self.channelList.append(" " + value, key) self.tip = snack.TextboxReflowed(self.size[0] - 10, CHANNEL_PAGE_TIP.encode('utf-8')) toplevel.add(self.tip, 0, 4, anchorLeft=1) optiontext2 = ALL_UPDATES.encode('utf-8') if self.tui.all_updates_button: self.all_updates_button = snack.SingleRadioButton( optiontext2, self.limited_updates_button, isOn=1) else: self.all_updates_button = snack.SingleRadioButton( optiontext2, self.limited_updates_button) toplevel.add(self.all_updates_button, 0, 5, padding=(0, 0, 0, 1), anchorLeft=1) #self.warning = snack.TextboxReflowed(self.size[0]-10, # CHANNEL_PAGE_WARNING.encode('utf-8')) #toplevel.add(self.warning, 0, 9, anchorLeft = 1) self.bb = snack.ButtonBar(screen, [(NEXT.encode('utf-8'), "next"), (BACK.encode('utf-8'), "back"), (CANCEL.encode('utf-8'), "cancel")]) toplevel.add(self.bb, 0, 6, growx=1) self.screen.refresh()
def __init__(self, screen, tui): self.tui = tui # As OSReleaseWindow seems to be the next window which gets tried # after InfoWindow has verified the login and password, we # can try to activate the hardware asset code here, before # available_eus_channels gets called. if self.tui.serverType == 'hosted': hw_activation_code = rhnreg._activate_hardware(self.tui.userName, self.tui.password) if hw_activation_code != None: self.tui.other['registration_number'] = hw_activation_code if not rhnreg.server_supports_eus(): log.log_debug("Server does not support EUS, skipping OSReleaseWindow") raise WindowSkipException() self.available_channels = rhnreg.getAvailableChannels( tui.userName, tui.password) if len(self.available_channels['channels']) < 1: log.log_debug("No available EUS channels, skipping OSReleaseWindow") raise WindowSkipException() self.name = "OSReleaseWindow" self.screen = screen self.size = snack._snack.size() self.selectChannel = False toplevel = snack.GridForm(self.screen, SELECT_OSRELEASE, 1, 7) self.g = toplevel self.ostext = snack.TextboxReflowed(self.size[0]-10, OS_VERSION) toplevel.add(self.ostext, 0, 0, anchorLeft = 1) optiontext1 = LIMITED_UPDATES if self.tui.limited_updates_button: self.limited_updates_button = snack.SingleRadioButton(optiontext1, None, isOn = 1) else: self.limited_updates_button = snack.SingleRadioButton(optiontext1, None) toplevel.add(self.limited_updates_button, 0, 1, padding = (0, 1, 0, 1), anchorLeft = 1) self.sublabel = snack.Label(MINOR_RELEASE) toplevel.add(self.sublabel, 0, 2, anchorLeft = 1) self.channelList = snack.Listbox(self.size[1]-22, 1, width = self.size[0]-10) toplevel.add(self.channelList, 0, 3) for key, value in sorted(self.available_channels['channels'].items(), key=lambda a:a[0]): if key in self.available_channels['receiving_updates']: value = value + "*" self.channelList.append(" " + value, key) self.tip = snack.TextboxReflowed(self.size[0]-10, CHANNEL_PAGE_TIP) toplevel.add(self.tip, 0, 4, anchorLeft = 1) optiontext2 = ALL_UPDATES if self.tui.all_updates_button: self.all_updates_button = snack.SingleRadioButton(optiontext2, self.limited_updates_button, isOn=1) else: self.all_updates_button = snack.SingleRadioButton(optiontext2, self.limited_updates_button) toplevel.add(self.all_updates_button, 0, 5, padding = (0, 0, 0, 1), anchorLeft = 1) #self.warning = snack.TextboxReflowed(self.size[0]-10, # CHANNEL_PAGE_WARNING) #toplevel.add(self.warning, 0, 9, anchorLeft = 1) self.bb = snack.ButtonBar(screen, [(NEXT, "next"), (BACK, "back"), (CANCEL, "cancel")]) toplevel.add(self.bb, 0, 6, growx = 1) self.screen.refresh()