def _show(self):
        '''Create the editable fields for IP address, netmask, router,
        dns address and dns domain
        
        '''
        self.nic = solaris_install.sysconfig.profile.from_engine().nic
        if self.nic.type != NetworkInfo.MANUAL:
            raise SkipException

        nic_name = NetworkInfo.get_nic_name(self.nic.nic_iface)

        if self.nic.find_defaults:
            self.set_defaults(self.nic)

        self.main_win.set_header_text(NICConfigure.HEADER_TEXT % nic_name)

        max_y = self.win_size_y - 16
        max_x = self.win_size_x - 1
        y_loc = 1
        y_loc += self.center_win.add_paragraph(NICConfigure.PARAGRAPH,
                                               y_loc,
                                               max_y=max_y)

        # Adding the NIC name to the screen squishes everything a bit
        # This will be relieved when the DNS items move to a nameservice screen
        max_y = 2
        description_start = (NICConfigure.ITEM_OFFSET * 2 +
                             self.list_area.columns)
        y_loc += 1
        self.make_field(NICConfigure.NIC_NAME_LABEL,
                        NICConfigure.NIC_DESCRIPTION,
                        y_loc,
                        max_y,
                        max_x,
                        description_start,
                        nic_name,
                        selectable=False)

        y_loc += max_y
        self.ip_field = self.make_field(NICConfigure.IP_LABEL,
                                        NICConfigure.IP_DESCRIPTION, y_loc,
                                        max_y, max_x, description_start,
                                        self.nic.ip_address)

        y_loc += max_y
        self.netmask_field = self.make_field(NICConfigure.NETMASK_LABEL,
                                             NICConfigure.NETMASK_DESCRIPTION,
                                             y_loc, max_y, max_x,
                                             description_start,
                                             self.nic.netmask)

        y_loc += max_y
        self.gateway_field = self.make_field(NICConfigure.GATEWAY_LABEL,
                                             NICConfigure.GATEWAY_DESCRIPTION,
                                             y_loc, max_y, max_x,
                                             description_start,
                                             self.nic.gateway)
        self.main_win.do_update()
        self.center_win.activate_object()
 def _show(self):
     '''Create the editable fields for IP address, netmask, router,
     dns address and dns domain
     
     '''
     self.nic = solaris_install.sysconfig.profile.from_engine().nic
     if self.nic.type != NetworkInfo.MANUAL:
         raise SkipException
     
     nic_name = NetworkInfo.get_nic_name(self.nic.nic_iface)
     
     if self.nic.find_defaults:
         self.set_defaults(self.nic)
     
     self.main_win.set_header_text(NICConfigure.HEADER_TEXT % nic_name)
     
     max_y = self.win_size_y - 16
     max_x = self.win_size_x - 1
     y_loc = 1
     y_loc += self.center_win.add_paragraph(NICConfigure.PARAGRAPH, y_loc,
                                            max_y=max_y)
     
     # Adding the NIC name to the screen squishes everything a bit
     # This will be relieved when the DNS items move to a nameservice screen
     max_y = 2
     description_start = (NICConfigure.ITEM_OFFSET * 2 +
                          self.list_area.columns)
     y_loc += 1
     self.make_field(NICConfigure.NIC_NAME_LABEL,
                     NICConfigure.NIC_DESCRIPTION, y_loc, max_y, max_x,
                     description_start, nic_name, selectable=False)
     
     y_loc += max_y
     self.ip_field = self.make_field(NICConfigure.IP_LABEL,
                                     NICConfigure.IP_DESCRIPTION,
                                     y_loc, max_y, max_x,
                                     description_start,
                                     self.nic.ip_address)
     
     y_loc += max_y
     self.netmask_field = self.make_field(NICConfigure.NETMASK_LABEL,
                                          NICConfigure.NETMASK_DESCRIPTION,
                                          y_loc, max_y, max_x,
                                          description_start,
                                          self.nic.netmask)
     
     y_loc += max_y
     self.gateway_field = self.make_field(NICConfigure.GATEWAY_LABEL,
                                          NICConfigure.GATEWAY_DESCRIPTION,
                                          y_loc, max_y, max_x,
                                          description_start,
                                          self.nic.gateway)
     self.main_win.do_update()
     self.center_win.activate_object()
    def _show(self):
        '''Create a list of NICs to choose from. If more than 15 NICs are
        found, create a scrolling region to put them in
        
        '''
        self.nic = solaris_install.sysconfig.profile.from_engine().nic
        if self.nic.type != NetworkInfo.MANUAL:
            raise SkipException
        if len(self.ether_nics) == 1:
            self.set_nic_in_profile(self.ether_nics[0])
            raise SkipException

        if self.nic.nic_iface is None:
            selected_nic_name = ""
        else:
            selected_nic_name = NetworkInfo.get_nic_name(self.nic.nic_iface)

        y_loc = 1
        y_loc += self.center_win.add_paragraph(NICSelect.PARAGRAPH, y_loc)

        selected_nic = 0

        y_loc += 1
        max_nics = min(NICSelect.MAX_NICS, self.center_win.area.lines - y_loc)
        if len(self.ether_nics) > max_nics:
            columns = self.win_size_x - NICSelect.LIST_OFFSET
            win_area = WindowArea(lines=max_nics,
                                  columns=columns,
                                  y_loc=y_loc,
                                  x_loc=NICSelect.LIST_OFFSET,
                                  scrollable_lines=len(self.ether_nics))
            self.scroll_region = ScrollWindow(win_area, window=self.center_win)
            self.list_region = self.scroll_region
            y_loc = 0
        else:
            self.scroll_region = None
            self.list_region = self.center_win

        for nic in self.ether_nics:
            self.list_area.y_loc = y_loc

            #
            # display list item in form of "NIC name (NIC device)" -
            # e.g. "net0 (bge0)"
            # If NIC device is not populated, display just NIC name.
            #
            list_item_text = NetworkInfo.get_nic_desc(nic)

            # list item width
            self.list_area.columns = len(list_item_text) + 1

            list_item = ListItem(self.list_area,
                                 window=self.list_region,
                                 text=list_item_text,
                                 data_obj=nic)
            if NetworkInfo.get_nic_name(nic) == selected_nic_name:
                selected_nic = list_item
            y_loc += 1

        self.main_win.do_update()
        if self.scroll_region:
            self.center_win.activate_object(self.scroll_region)
            self.scroll_region.activate_object_force(selected_nic,
                                                     force_to_top=True)
        else:
            self.center_win.activate_object(selected_nic)
    def _show(self):
        '''Create a list of NICs to choose from. If more than 15 NICs are
        found, create a scrolling region to put them in
        
        '''
        self.nic = solaris_install.sysconfig.profile.from_engine().nic
        if self.nic.type != NetworkInfo.MANUAL:
            raise SkipException
        if len(self.ether_nics) == 1:
            self.set_nic_in_profile(self.ether_nics[0])
            raise SkipException
        
        if self.nic.nic_iface is None:
            selected_nic_name = ""
        else:
            selected_nic_name = NetworkInfo.get_nic_name(self.nic.nic_iface)
        
        y_loc = 1
        y_loc += self.center_win.add_paragraph(NICSelect.PARAGRAPH, y_loc)
        
        selected_nic = 0
        
        y_loc += 1
        max_nics = min(NICSelect.MAX_NICS, self.center_win.area.lines - y_loc)
        if len(self.ether_nics) > max_nics:
            columns = self.win_size_x - NICSelect.LIST_OFFSET
            win_area = WindowArea(lines=max_nics, columns=columns,
                                  y_loc=y_loc, x_loc=NICSelect.LIST_OFFSET,
                                  scrollable_lines=len(self.ether_nics))
            self.scroll_region = ScrollWindow(win_area, window=self.center_win)
            self.list_region = self.scroll_region
            y_loc = 0
        else:
            self.scroll_region = None
            self.list_region = self.center_win
        
        for nic in self.ether_nics:
            self.list_area.y_loc = y_loc

            #
            # display list item in form of "NIC name (NIC device)" -
            # e.g. "net0 (bge0)"
            # If NIC device is not populated, display just NIC name.
            #
            list_item_text = NetworkInfo.get_nic_desc(nic)

            # list item width
            self.list_area.columns = len(list_item_text) + 1

            list_item = ListItem(self.list_area, window=self.list_region,
                                 text=list_item_text, data_obj=nic)
            if NetworkInfo.get_nic_name(nic) == selected_nic_name:
                selected_nic = list_item
            y_loc += 1
        
        self.main_win.do_update()
        if self.scroll_region:
            self.center_win.activate_object(self.scroll_region)
            self.scroll_region.activate_object_force(selected_nic,
                                                     force_to_top=True)
        else:
            self.center_win.activate_object(selected_nic)