예제 #1
0
    def __init__(self, screen, tui):
        self.screen = screen
        self.tui = tui
        self.tui.alreadyRegistered = 0

        self.server = convert_url_from_puny(self.tui.serverURL)
        fixed_server_url = rhnreg.makeNiceServerUrl(self.server)

        #Save the config only if the url is different
        if fixed_server_url != self.server:
            self.server = fixed_server_url
            config.setServerURL(self.server)
            cfg.save()

        size = snack._snack.size()

        toplevel = snack.GridForm(screen, sstr(SATELLITE_URL_WINDOW), 1, 4)

        prompt_text = SATELLITE_URL_TEXT
        url_label = SATELLITE_URL_PROMPT
        ssl_label = SATELLITE_URL_PROMPT2

        label = snack.Textbox(size[0] - 10,
                              3,
                              sstr(prompt_text),
                              scroll=0,
                              wrap=1)

        toplevel.add(label, 0, 0, anchorLeft=1)

        # spacer
        label = snack.Label(sstr(""))
        toplevel.add(label, 0, 1)

        grid = snack.Grid(2, 3)

        label = snack.Label(sstr(url_label))
        grid.setField(label, 0, 0, padding=(0, 0, 1, 0), anchorRight=1)

        self.urlEntry = snack.Entry(40)
        self.urlEntry.set(self.server)
        grid.setField(self.urlEntry, 1, 0, anchorLeft=1)

        label = snack.Label(sstr(ssl_label))
        grid.setField(label, 0, 1, padding=(0, 0, 1, 0), anchorRight=1)

        self.sslEntry = snack.Entry(40)
        self.sslEntry.set(tui.sslCACert)
        grid.setField(self.sslEntry, 1, 1, anchorLeft=1)

        toplevel.add(grid, 0, 2)

        # BUTTON BAR
        self.bb = snack.ButtonBar(screen, [(sstr(NEXT), "next"),
                                           (sstr(BACK), "back"),
                                           (sstr(CANCEL), "cancel")])

        toplevel.add(self.bb, 0, 3, padding=(0, 1, 0, 0), growx=1)

        self.g = toplevel
예제 #2
0
    def runIt(self, screen):
        g1 = snack.Grid(1, 1)
        g2 = snack.Grid(2, 5)
        g2.setField(snack.Label(_("Hostname")), 0, 0, anchorLeft=1)
        g2.setField(snack.Label(_("Primary DNS")), 0, 1, anchorLeft=1)
        g2.setField(snack.Label(_("Secondary DNS")), 0, 2, anchorLeft=1)
        g2.setField(snack.Label(_("Tertiary DNS")), 0, 3, anchorLeft=1)
        g2.setField(snack.Label(_("DNS search path")), 0, 4, anchorLeft=1)
        #g2.setField(snack.Label (_("Default gateway IP")), 0, 5, anchorLeft = 1)
        g2.setField(self.hostname, 1, 0, (1, 0, 0, 0))
        g2.setField(self.primaryDNS, 1, 1, (1, 0, 0, 0))
        g2.setField(self.secondaryDNS, 1, 2, (1, 0, 0, 0))
        g2.setField(self.tertiaryDNS, 1, 3, (1, 0, 0, 0))
        g2.setField(self.searchList, 1, 4, (1, 0, 0, 0))
        #g2.setField(gwy, 1, 5, (1, 0, 0, 0))
        #dynip.setCallback(useDynamicCheckBox)
        bb = snack.ButtonBar(screen,
                             ((_("Ok"), "ok"), (_("Cancel"), "cancel")))
        self.setState(self.prof)
        tl = snack.GridForm(screen, _("DNS configuration"), 1, 3)
        tl.add(g1, 0, 0, (0, 0, 0, 1), anchorLeft=1)
        tl.add(g2, 0, 1, (0, 0, 0, 1))
        tl.add(bb, 0, 2, growx=1)
        # if
        res = tl.run()
        if bb.buttonPressed(res) == "cancel":
            print "cancel"
            screen.popWindow()
            return False

        elif bb.buttonPressed(res) == "ok":
            screen.popWindow()
            self.processInfo()
            return True
예제 #3
0
 def get_details_page(self, screen):
     if not self.__configured:
         self.__hypervisor = snack.RadioBar(
             screen, ((HYPERVISORS[HYPERVISOR_XEN], HYPERVISOR_XEN, True),
                      (HYPERVISORS[HYPERVISOR_KVM], HYPERVISOR_KVM, False)))
         self.__connection = snack.RadioBar(
             screen,
             ((CONNECTIONS[CONNECTION_LOCAL], CONNECTION_LOCAL, True),
              (CONNECTIONS[CONNECTION_KERBEROS], CONNECTION_KERBEROS,
               False), (CONNECTIONS[CONNECTION_SSL], CONNECTION_SSL, False),
              (CONNECTIONS[CONNECTION_SSH], CONNECTION_SSH, False)))
         self.__hostname = snack.Entry(50, "")
         self.__autoconnect = snack.Checkbox("Autoconnect on Startup")
         self.__configured = True
     grid = snack.Grid(2, 4)
     grid.setField(snack.Label("Hypervisor:"),
                   0,
                   0,
                   anchorRight=1,
                   anchorTop=1)
     grid.setField(self.__hypervisor, 1, 0, anchorLeft=1)
     grid.setField(snack.Label("Connection:"),
                   0,
                   1,
                   anchorRight=1,
                   anchorTop=1)
     grid.setField(self.__connection, 1, 1, anchorLeft=1)
     grid.setField(snack.Label("Hostname:"), 0, 2, anchorRight=1)
     grid.setField(self.__hostname, 1, 2, anchorLeft=1)
     grid.setField(snack.Label(""), 0, 3, anchorRight=1)
     grid.setField(self.__autoconnect, 1, 3, anchorLeft=1)
     return [snack.Label("Add Connection"), grid]
예제 #4
0
    def __init__(self, screen, tui):
        self.screen = screen
        self.tui = tui
        self.tui.alreadyRegistered = 0

        self.server = self.tui.serverURL

        size = snack._snack.size()

        toplevel = snack.GridForm(screen, REGISTER_WINDOW.encode('utf-8'), 1,
                                  4)

        decoded_server = convert_url_from_pune(self.server)
        url = self.server
        if decoded_server != self.server:
            url += " (%s)" % decoded_server
        login_prompt = LOGIN_PROMPT % url
        login_label = LOGIN
        login_tip = LOGIN_TIP

        label = snack.Textbox(size[0] - 10,
                              3,
                              login_prompt.encode('utf-8'),
                              scroll=0,
                              wrap=1)

        toplevel.add(label, 0, 0, anchorLeft=1)

        grid = snack.Grid(2, 3)

        label = snack.Label(login_label.encode('utf-8'))
        grid.setField(label, 0, 0, padding=(0, 0, 1, 0), anchorRight=1)

        self.userNameEntry = snack.Entry(20)
        self.userNameEntry.set(tui.userName)
        grid.setField(self.userNameEntry, 1, 0, anchorLeft=1)

        label = snack.Label(PASSWORD.encode('utf-8'))
        grid.setField(label, 0, 1, padding=(0, 0, 1, 0), anchorRight=1)

        try:
            self.passwordEntry = snack.Entry(20, password=1)
        except TypeError:
            self.passwordEntry = snack.Entry(20, hidden=1)
        self.passwordEntry.set(tui.password)
        grid.setField(self.passwordEntry, 1, 1, anchorLeft=1)

        toplevel.add(grid, 0, 1)

        label = snack.TextboxReflowed(size[0] - 10, login_tip.encode('utf-8'))
        toplevel.add(label, 0, 2, anchorLeft=1)

        # BUTTON BAR
        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, 3, padding=(0, 1, 0, 0), growx=1)

        self.g = toplevel
예제 #5
0
 def get_select_iso_page(self, screen):
     ignore = screen
     self.__iso_path = snack.Entry(50, self.__config.get_iso_path())
     grid = snack.Grid(1, 2)
     grid.setField(snack.Label("Enter ISO path:"), 0, 0, anchorLeft=1)
     grid.setField(self.__iso_path, 0, 1, anchorLeft=1)
     return [snack.Label("Enter the full path to an install ISO"),
             grid]
예제 #6
0
 def get_local_storage_page(self, screen):
     ignore = screen
     self.__storage_size     = snack.Entry(6, str(self.__config.get_storage_size()))
     self.__allocate_storage = snack.Checkbox("Allocate entire disk now", self.__config.get_allocate_storage())
     grid = snack.Grid(2, 2)
     grid.setField(self.__allocate_storage, 0, 0, growx=1, anchorLeft=1)
     grid.setField(snack.Label("Storage size (GB):"), 0, 1, anchorLeft=1)
     grid.setField(self.__storage_size, 1, 1)
     return [snack.Label("Configure local storage"),
             grid]
예제 #7
0
 def get_confirm_page(self, screen):
     ignore = screen
     grid = snack.Grid(2, 5)
     grid.setField(snack.Label("Volume Name:"), 0, 0, anchorRight=1)
     grid.setField(snack.Label(
         "%s (%s)" %
         (self.__config.get_name(), self.__config.get_pool().name())),
                   1,
                   0,
                   anchorLeft=1)
     if self.__config.needs_format():
         grid.setField(snack.Label("Format:"), 0, 1, anchorRight=1)
         grid.setField(snack.Label(self.__config.get_format()),
                       1,
                       1,
                       anchorLeft=1)
     # NOTE: here we multiply the sizes by 1024^2 since the size_as_mb_or_gb is expect bytes
     grid.setField(snack.Label("Max. Capacity:"), 0, 2, anchorRight=1)
     grid.setField(snack.Label(
         "%s" % (utils.size_as_mb_or_gb(self.__config.get_max_capacity() *
                                        (1024**2)))),
                   1,
                   2,
                   anchorLeft=1)
     grid.setField(snack.Label("Allocation:"), 0, 3, anchorRight=1)
     grid.setField(snack.Label(
         "%s" % (utils.size_as_mb_or_gb(self.__config.get_allocation() *
                                        (1024**2)))),
                   1,
                   3,
                   anchorLeft=1)
     return [snack.Label("Ready To Allocation New Storage Volume"), grid]
예제 #8
0
    def get_confirm_page(self, screen):
        ignore = screen

        grid = snack.Grid(2, 4)
        grid.setField(snack.Label("Hypervisor:"), 0, 0, anchorRight=1)
        grid.setField(snack.Label(
            HYPERVISORS[self.__hypervisor.getSelection()]),
                      1,
                      0,
                      anchorLeft=1)
        grid.setField(snack.Label("Connection:"), 0, 1, anchorRight=1)
        grid.setField(snack.Label(
            CONNECTIONS[self.__connection.getSelection()]),
                      1,
                      1,
                      anchorLeft=1)
        if self.__connection.getSelection() is not CONNECTION_LOCAL:
            hostname = self.__hostname.value()
        else:
            hostname = "local"
        grid.setField(snack.Label("Hostname:"), 0, 2, anchorRight=1)
        grid.setField(snack.Label(hostname), 1, 2, anchorLeft=1)
        grid.setField(snack.Label("Autoconnect on Startup:"),
                      0,
                      3,
                      anchorRight=1)
        label = "Yes"
        if not self.__autoconnect.value():
            label = "No"
        grid.setField(snack.Label(label), 1, 3, anchorLeft=1)
        return [snack.Label("Confirm Connection"), grid]
예제 #9
0
 def get_ram_and_cpu_page(self, screen):
     ignore = screen
     self.__memory = snack.Entry(10, str(self.__config.get_memory()))
     self.__cpus   = snack.Entry(10, str(self.__config.get_cpus()))
     grid = snack.Grid(2, 2)
     grid.setField(snack.Label("Memory (RAM):"), 0, 0, anchorRight=1)
     grid.setField(self.__memory, 1, 0, anchorLeft=1)
     grid.setField(snack.Label("CPUs:"), 0, 1, anchorRight=1)
     grid.setField(self.__cpus, 1, 1, anchorLeft=1)
     return [snack.Label("Choose memory and CPU settings"),
             grid]
예제 #10
0
 def get_confirm_page(self, screen):
     ignore = screen
     grid = snack.Grid(1, 2)
     grid.setField(snack.Label("Username: %s" % self.__username.value()), 0,
                   0)
     admin_label = "is not"
     if self.__adminuser.value():
         admin_label = "is"
     grid.setField(
         snack.Label("This user %s an administrator." % admin_label), 0, 1)
     return [snack.Label("Create this user account?"), grid]
예제 #11
0
 def get_volume_name_page(self, screen):
     ignore = screen
     self.__name = snack.Entry(50, self.__config.get_name())
     grid = snack.Grid(2, 1)
     grid.setField(snack.Label("Name:"), 0, 0, anchorRight=1)
     grid.setField(self.__name, 1, 0, anchorLeft=1)
     return [
         snack.Label("New Storage Volume"), grid,
         snack.Label(
             "Name of the volume to create. File extension may be appended."
         )
     ]
예제 #12
0
    def get_detail_page_elements(self, screen):
        ignore = screen
        domain = self.get_selected_domain()
        fields = []

        # build the list to display
        fields.append(("Basic Details", None))
        fields.append(("Name", domain.get_name()))
        fields.append(("UUID", domain.get_uuid()))
        fields.append(("Status", domain.run_status()))
        fields.append(("Description", domain.get_description() or ""))
        fields.append(("", None))

        fields.append(("Hypervisor Details", None))
        fields.append(("Hypervisor", domain.get_pretty_hv_type()))
        fields.append(("Architecture", domain.get_arch() or "Unknown"))
        fields.append(("Emulator", domain.get_emulator() or "None"))
        fields.append(("", None))

        fields.append(("Machine Settings", None))
        if bool(domain.get_acpi()):
            fields.append(("ACPI", "Enabled"))
        if bool(domain.get_apic()):
            fields.append(("APIC", "Enabled"))
        fields.append(("Clock offset", domain.get_clock() or "Same as host"))
        fields.append(("", None))

        fields.append(("Security", None))

        semodel, setype, vmlabel = domain.get_seclabel()
        caps = self.get_libvirt().get_capabilities()
        if caps.host.secmodel and caps.host.secmodel.model:
            semodel = caps.host.secmodel.model
        fields.append(("Model", semodel or "None"))

        if semodel is not None and semodel != "apparmor":
            fields.append(("Type", setype))
            fields.append(("Label", vmlabel))

        grid = snack.Grid(2, len(fields))
        row = 0
        for field in fields:
            if field[1] is not None:
                grid.setField(snack.Label("%s :  " % field[0]),
                              0,
                              row,
                              anchorRight=1)
                grid.setField(snack.Label(field[1]), 1, row, anchorLeft=1)
            else:
                grid.setField(snack.Label("%s" % field[0]), 1, row)
            row += 1

        return [grid]
예제 #13
0
 def get_network_install_page(self, screen):
     ignore = screen
     self.__install_url    = snack.Entry(50, self.__config.get_install_url())
     self.__kickstart_url  = snack.Entry(50, self.__config.get_kickstart_url())
     self.__kernel_options = snack.Entry(50, self.__config.get_kernel_options())
     grid = snack.Grid(2, 3)
     grid.setField(snack.Label("URL:"), 0, 0, anchorRight=1)
     grid.setField(self.__install_url, 1, 0, anchorLeft=1)
     grid.setField(snack.Label("Kickstart URL:"), 0, 1, anchorRight=1)
     grid.setField(self.__kickstart_url, 1, 1, anchorLeft=1)
     grid.setField(snack.Label("Kernel Options:"), 0, 2, anchorRight=1)
     grid.setField(self.__kernel_options, 1, 2, anchorLeft=1)
     return [snack.Label("Provide the operating system URL"),
             grid]
예제 #14
0
 def get_select_volume_page(self, screen):
     volumes = []
     for volume in self.get_libvirt().list_storage_volumes(self.__config.get_storage_pool()):
         volumes.append([volume, volume, volume == self.__config.get_storage_volume()])
     if len(volumes) > 0:
         self.__storage_volume = snack.RadioBar(screen, (volumes))
         grid = snack.Grid(2, 1)
         grid.setField(snack.Label("Storage volumes:"), 0, 0, anchorTop=1)
         grid.setField(self.__storage_volume, 1, 0)
         self.__has_volumes = True
     else:
         grid = snack.Label("This storage pool has no defined volumes.")
         self.__has_volumes = False
     return [snack.Label("Configure Managed Storage: Select A Volume"),
             grid]
예제 #15
0
 def get_select_pool_page(self, screen):
     pools = []
     for pool in self.get_libvirt().list_storage_pools():
         pools.append([pool, pool, pool == self.__config.get_storage_pool()])
     if len(pools) > 0:
         self.__storage_pool = snack.RadioBar(screen, (pools))
         grid = snack.Grid(2, 1)
         grid.setField(snack.Label("Storage pool:"), 0, 0, anchorTop=1)
         grid.setField(self.__storage_pool, 1, 0)
         self.__has_pools = True
     else:
         grid = snack.Label("There are no storage pools available.")
         self.__has_pools = False
     return [snack.Label("Configure Managed Storage: Select A Pool"),
             grid]
예제 #16
0
def _make_grid_input_path(insScreen, title, label, strText):

    l = snack.Label(label)
    l1 = snack.Label(" ")
    e = snack.Entry(50, strText)
    b = snack.ButtonBar(insScreen,
                        (("   OK   ", "ok"), (" Cancel ", "cancel")))

    g = snack.GridForm(insScreen, title, 3, 6)
    g.add(l, 0, 1)
    g.add(l1, 0, 2)
    g.add(e, 0, 3)
    g.add(l1, 0, 4)
    g.add(b, 0, 5)

    return e, b, g
예제 #17
0
def _make_grid_search(insScreen, search_id):

    l = snack.Label("Search Value:")
    l1 = snack.Label(" ")
    e = snack.Entry(30, search_id)
    b = snack.ButtonBar(insScreen,
                        (("Search", "search"), ("Search off", "cancel")))

    g = snack.GridForm(insScreen, "Enter Search String", 3, 6)
    g.add(l, 0, 1)
    g.add(l1, 0, 2)
    g.add(e, 0, 3)
    g.add(l1, 0, 4)
    g.add(b, 0, 5)

    return e, b, g
예제 #18
0
 def get_target_page(self, screen):
     ignore = screen
     self.__targets = snack.Listbox(0)
     for connection in self.get_virt_manager_config().get_connection_list():
         self.__targets.append(connection, connection)
     return [snack.Label("Select A Target Host"),
             self.__targets]
예제 #19
0
 def get_stop_page(self, screen):
     ignore = screen
     grid = snack.Grid(1, 1)
     grid.setField(
         snack.Label("%s was successfully stopped." %
                     self.get_selected_domain().get_name()), 0, 0)
     return [grid]
예제 #20
0
파일: ventana.py 프로젝트: elcodigok/slGTD
 def mostrarListado(self):
     opcion = ""
     while (opcion != "back"):
         self.contenido = self.leerArchivo()
         self.label = snack.Label(self.texto)
         self.botones = snack.ButtonBar(
             self.screen, ((gettext.gettext("Add"), "add"),
                           (gettext.gettext("Delete"), "delete"),
                           (gettext.gettext("Back"), "back")))
         self.lista = snack.Listbox(height=13,
                                    width=60,
                                    returnExit=1,
                                    showCursor=0,
                                    scroll=1)
         for registro in self.contenido:
             fecha = registro.split("\t")[1]
             recordView = registro.split("\t")[0] + "(" + fecha.strip(
                 ":created") + ")"
             self.lista.append(recordView, registro)
         self.grid = snack.GridForm(self.screen, self.titulo, 1, 3)
         self.grid.add(self.label, 0, 0, growx=0, growy=0, anchorLeft=1)
         self.grid.add(self.lista, 0, 1)
         self.grid.add(self.botones, 0, 2, growx=1, growy=0)
         respuesta = self.grid.runOnce()
         opcion = self.botones.buttonPressed(respuesta)
         if (opcion == "add"):
             cargaDeValores = Datos.Datos(self.archivo,
                                          gettext.gettext("New"),
                                          self.texto, self.screen)
             cargaDeValores.altas()
         elif (opcion == "delete"):
             self.guardarArchivo(self.lista.current())
예제 #21
0
 def get_virt_details_page(self, screen):
     virt_types = []
     for typ in self.get_libvirt().list_virt_types():
         virt_types.append([typ, typ, self.__config.is_virt_type(typ)])
     self.__virt_types = snack.RadioBar(screen, (virt_types))
     archs = []
     for arch in self.get_libvirt().list_architectures():
         archs.append([arch, arch, self.__config.is_architecture(arch)])
     self.__architectures = snack.RadioBar(screen, (archs))
     grid = snack.Grid(2, 2)
     grid.setField(snack.Label("Virt Type:"), 0, 0, anchorRight=1, anchorTop=1)
     grid.setField(self.__virt_types, 1, 0, anchorLeft=1)
     grid.setField(snack.Label("Architecture:"), 0, 1, anchorRight=1, anchorTop=1)
     grid.setField(self.__architectures, 1, 1, anchorLeft=1)
     return [snack.Label("Configure virtualization details"),
             grid]
 def get_remove_page(self, screen):
     ignore = screen
     grid = snack.Grid(1, 1)
     grid.setField(
         snack.Label("%s has been removed." %
                     self.get_selected_domain().get_name()), 0, 0)
     return [grid]
 def get_storage_pool_list_page(self, screen, defined=True, created=True):
     ignore = screen
     pools = self.get_libvirt().list_storage_pools(defined=defined,
                                                   created=created)
     if len(pools) > 0:
         self.__has_pools = True
         self.__pools_list = snack.Listbox(0)
         for pool in pools:
             self.__pools_list.append(pool, pool)
         result = self.__pools_list
     else:
         self.__has_pools = False
         result = snack.Label("There are no storage pools available.")
     grid = snack.Grid(1, 1)
     grid.setField(result, 0, 0)
     return [snack.Label("Storage Pool List"), grid]
예제 #24
0
 def get_confirm_remove_page(self, screen):
     ignore = screen
     self.__confirm = snack.Checkbox(
         "Remove this connection: %s" % self.get_selected_connection(), 0)
     grid = snack.Grid(1, 1)
     grid.setField(self.__confirm, 0, 0)
     return [snack.Label("Remove Host Connection"), grid]
 def get_confirm_page(self, screen):
     ignore = screen
     self.__confirm = snack.Checkbox(
         "Check here to confirm deleting volume: %s" %
         self.get_selected_volume())
     grid = snack.Grid(1, 1)
     grid.setField(self.__confirm, 0, 0)
     return [snack.Label("Remove Selected Storage Volume"), grid]
예제 #26
0
    def get_connection_list_page(self, screen):
        ignore = screen
        connections = self.get_virt_manager_config().get_connection_list()
        result = None

        if len(connections) > 0:
            self.__has_connections = True
            self.__connection_list = snack.Listbox(0)
            for connection in connections:
                self.__connection_list.append(connection, connection)
            result = self.__connection_list
        else:
            self.__has_connections = False
            result = snack.Label("There are no defined connections.")
        grid = snack.Grid(1, 1)
        grid.setField(result, 0, 0)
        return [snack.Label("Host List"), grid]
예제 #27
0
 def get_max_capacity_page(self, screen):
     ignore = screen
     self.__capacity = snack.Entry(6, str(self.__config.get_max_capacity()))
     self.__allocation = snack.Entry(6, str(self.__config.get_allocation()))
     grid = snack.Grid(2, 2)
     grid.setField(snack.Label("Max. Capacity (MB):"), 0, 0, anchorRight=1)
     grid.setField(self.__capacity, 1, 0, anchorLeft=1)
     grid.setField(snack.Label("Allocation (MB):"), 0, 1, anchorRight=1)
     grid.setField(self.__allocation, 1, 1, anchorLeft=1)
     return [
         snack.Label("Storage Volume Quota"),
         snack.Label(
             "%s's available space: %s" %
             (self.__config.get_pool().name(),
              utils.size_as_mb_or_gb(self.__config.get_pool().info()[3]))),
         grid
     ]
예제 #28
0
 def get_volume_format_page(self, screen):
     ignore = screen
     self.__formats = snack.Listbox(0)
     for fmt in self.__config.get_formats_for_pool():
         self.__formats.append(fmt, fmt)
     grid = snack.Grid(1, 1)
     grid.setField(self.__formats, 0, 0)
     return [snack.Label("Select The Volume Format"), grid]
예제 #29
0
파일: tui.py 프로젝트: xkollar/spacewalk
    def __init__(self, screen, tui):
        self.name = "PackagesWindow"
        self.screen = screen
        self.tui = tui
        size = snack._snack.size()
        toplevel = snack.GridForm(screen, PACKAGES_WINDOW.encode('utf-8'), 1,
                                  5)
        self.g = toplevel

        text = snack.TextboxReflowed(size[0] - 10,
                                     PACKAGES_WINDOW_DESC1.encode('utf-8'))

        toplevel.add(text, 0, 0, anchorLeft=1)

        self.packagesButton = snack.Checkbox(
            PACKAGES_WINDOW_DESC2.encode('utf-8'), 1)
        toplevel.add(self.packagesButton,
                     0,
                     1,
                     padding=(0, 1, 0, 1),
                     anchorLeft=1)

        label = snack.Label(PACKAGES_WINDOW_UNCHECK.encode('utf-8'))
        toplevel.add(label, 0, 2, anchorLeft=1)

        #self.packageList = snack.Listbox(size[1]-18, 1, width = size[0]-10)
        self.packageList = snack.CheckboxTree(size[1] - 18, 1)
        toplevel.add(self.packageList, 0, 3)

        # do we need to read the packages from disk?
        if tui.packageList == []:
            self.pwin = snack.GridForm(screen,
                                       PACKAGES_WINDOW_PKGLIST.encode('utf-8'),
                                       1, 1)

            self.scale = snack.Scale(40, 100)
            self.pwin.add(self.scale, 0, 0)
            self.pwin.draw()
            self.screen.refresh()
            getArch = 0
            if rhnreg.cfg['supportsExtendedPackageProfile']:
                getArch = 1
            tui.packageList = pkgUtils.getInstalledPackageList(getArch=getArch)
            self.screen.popWindow()

        for package in tui.packageList:
            self.packageList.append(
                "%s-%s-%s" %
                (package['name'], package['version'], package['release']),
                item=package['name'],
                selected=1)

        # BUTTON BAR
        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, 4, padding=(0, 1, 0, 0), growx=1)
    def get_network_list_page(self, screen, defined=True, started=True):
        ignore = screen
        uuids = self.get_libvirt().list_networks(defined, started)
        result = None

        if len(uuids) > 0:
            self.__has_networks = True
            self.__network_list = snack.Listbox(0)
            for uuid in uuids:
                network = self.get_libvirt().get_network(uuid)
                self.__network_list.append(uuid, network.get_name())
            result = self.__network_list
        else:
            self.__has_networks = False
            result = snack.Label("There are no networks available.")
        grid = snack.Grid(1, 1)
        grid.setField(result, 0, 0)
        return [snack.Label("Network List"), grid]