def runIt(self, mscreen):
        """
        Show and run the screen, save files if necesarry
        """
        g1 = snack.Grid(1, 1)
        g2 = snack.Grid(2, 6)
        g2.setField(snack.Label(_("Name")), 0, 0, anchorLeft=1)
        g2.setField(snack.Label(_("Device")), 0, 1, anchorLeft=1)
        g2.setField(snack.Label(_("ISP Phonenumber")), 0, 2, anchorLeft=1)
        g2.setField(snack.Label(_("ISP Login")), 0, 3, anchorLeft=1)
        g2.setField(snack.Label(_("ISP Password")), 0, 4, anchorLeft=1)
        g2.setField(snack.Label(_("MSN")), 0, 5, anchorLeft=1)
        g2.setField(self.name, 1, 0, (1, 0, 0, 0))
        g2.setField(self.hwdev, 1, 1, (1, 0, 0, 0))
        g2.setField(self.phoneno, 1, 2, (1, 0, 0, 0), anchorLeft=1)
        g2.setField(self.login, 1, 3, (1, 0, 0, 0))
        g2.setField(self.password, 1, 4, (1, 0, 0, 0))
        g2.setField(self.msn, 1, 5, (1, 0, 0, 0))
        bb = snack.ButtonBar(mscreen,
                             ((_("Ok"), "ok"), (_("Cancel"), "cancel")))
        tl = snack.GridForm(mscreen, _("ISDN 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)
        self.setState(self.isdn)
        while 1:
            res = tl.run()
            if bb.buttonPressed(res) == "cancel":
                mscreen.popWindow()
                return False

            elif bb.buttonPressed(res) == "ok":
                mscreen.popWindow()
                self.processInfo()
                return True
예제 #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 runIt(self, screen):
        """
        Show and run the screen, save files if necesarry
        """
        self.screen = screen
        g1 = snack.Grid(1, 1)
        g2 = snack.Grid(2, 11)
        g2.setField(snack.Label(_("Name")), 0, 0, anchorLeft=1)
        g2.setField(snack.Label(_("Device")), 0, 1, anchorLeft=1)
        g2.setField(snack.Label(_("Use DHCP")), 0, 2, anchorLeft=1)
        g2.setField(snack.Label(_("Static IP")), 0, 3, anchorLeft=1)
        g2.setField(snack.Label(_("Netmask")), 0, 4, anchorLeft=1)
        g2.setField(snack.Label(_("Default gateway IP")), 0, 5, anchorLeft=1)
        g2.setField(snack.Label(_("Read Device Bus ID")), 0, 6, anchorLeft=1)
        g2.setField(snack.Label(_("Data Device Bus ID")), 0, 7, anchorLeft=1)
        g2.setField(snack.Label(_("Write Device Bus ID")), 0, 8, anchorLeft=1)
        g2.setField(snack.Label(_("Options")), 0, 9, anchorLeft=1)
        g2.setField(snack.Label(_("MAC Address")), 0, 10, anchorLeft=1)
        g2.setField(self.name, 1, 0, (1, 0, 0, 0))
        g2.setField(self.hwdev, 1, 1, (1, 0, 0, 0))
        g2.setField(self.dynip, 1, 2, (1, 0, 0, 0), anchorLeft=1)
        g2.setField(self.statip, 1, 3, (1, 0, 0, 0))
        g2.setField(self.netmask, 1, 4, (1, 0, 0, 0))
        g2.setField(self.gwy, 1, 5, (1, 0, 0, 0))
        g2.setField(self.ioport, 1, 6, (1, 0, 0, 0))
        g2.setField(self.ioport1, 1, 7, (1, 0, 0, 0))
        g2.setField(self.ioport2, 1, 8, (1, 0, 0, 0))
        g2.setField(self.options, 1, 9, (1, 0, 0, 0))
        g2.setField(self.macaddr, 1, 10, (1, 0, 0, 0))

        self.dynip.setCallback(self.useDynamicCheckBox)
        bb = snack.ButtonBar(self.screen,
                             ((_("Ok"), "ok"), (_("Cancel"), "cancel")))
        self.setState(self.dev)
        tl = snack.GridForm(screen, _("Devernet 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)
        self.useDynamicCheckBox()
        while 1:
            res = tl.run()
            if bb.buttonPressed(res) == "cancel":
                screen.popWindow()
                return False
            elif bb.buttonPressed(res) == "ok":
                screen.popWindow()
                self.processInfo()
                return True
예제 #4
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]
예제 #5
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]
 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]
예제 #7
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
예제 #8
0
def get_ftp_dest(answers):
    text = "Please enter the URL for your FTP directory and, optionally, a username and password"
    url_field = snack.Entry(50)
    user_field = snack.Entry(16)
    passwd_field = snack.Entry(16, password=1)
    url_text = snack.Textbox(11, 1, "URL:")
    user_text = snack.Textbox(11, 1, "Username:"******"Password:"******"Specify Path", 'getftpdest', 1, 3)
    bb = snack.ButtonBar(tui.screen, ['Ok', 'Back'])
    t = snack.TextboxReflowed(50, text)

    entry_grid = snack.Grid(2, 3)
    entry_grid.setField(url_text, 0, 0)
    entry_grid.setField(url_field, 1, 0)
    entry_grid.setField(user_text, 0, 1)
    entry_grid.setField(user_field, 1, 1, anchorLeft=1)
    entry_grid.setField(passwd_text, 0, 2)
    entry_grid.setField(passwd_field, 1, 2, anchorLeft=1)

    gf.add(t, 0, 0, padding=(0, 0, 0, 1))
    gf.add(entry_grid, 0, 1, padding=(0, 0, 0, 1))
    gf.add(bb, 0, 2, growx=1)

    button = bb.buttonPressed(gf.runOnce())

    if button == 'back': return uicontroller.LEFT_BACKWARDS

    url = url_field.value()
    if not url.startswith('ftp://'):
        url = 'ftp://' + url
    if user_field.value() != '':
        quoted_user = urllib.quote(user_field.value(), safe='')
        if passwd_field.value() != '':
            quoted_passwd = urllib.quote(passwd_field.value(), safe='')
            answers['dest-address'] = url.replace(
                '//', '//%s:%s@' % (quoted_user, quoted_passwd), 1)
        else:
            answers['dest-address'] = url.replace('//', '//%s@' % quoted_user,
                                                  1)
    else:
        answers['dest-address'] = url

    return uicontroller.RIGHT_FORWARDS
예제 #9
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]
예제 #10
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]
예제 #11
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]
예제 #12
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
예제 #13
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]
 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]
예제 #15
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]
 def get_confirm_page(self, screen):
     ignore = screen
     self.__confirm_remove = snack.Checkbox(
         "Check here to confirm undefining %s." %
         self.get_selected_domain().get_name(), 0)
     grid = snack.Grid(1, 1)
     grid.setField(self.__confirm_remove, 0, 0)
     return [grid]
예제 #17
0
 def get_os_type_page(self, screen):
     types = []
     for typ in Guest.list_os_types():
         types.append([Guest.get_os_type_label(typ), typ, self.__config.is_os_type(typ)])
     self.__os_types = snack.RadioBar(screen, types)
     grid = snack.Grid(1, 1)
     grid.setField(self.__os_types, 0, 0, anchorLeft=1)
     return [snack.Label("Choose the operating system type"),
             grid]
예제 #18
0
 def get_os_variant_page(self, screen):
     variants = []
     typ = self.__config.get_os_type()
     for variant in Guest.list_os_variants(typ):
         variants.append([Guest.get_os_variant_label(typ, variant), variant, self.__config.is_os_variant(variant)])
     self.__os_variants = snack.RadioBar(screen, variants)
     grid = snack.Grid(1, 1)
     grid.setField(self.__os_variants, 0, 0, anchorLeft=1)
     return [snack.Label("Choose the operating system version"),
             grid]
예제 #19
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]
예제 #20
0
    def runIt(self, screen):
        """
        Show and run the screen, save files if necesarry
        """
        self.screen = screen
        g1 = snack.Grid(1, 1)
        g2 = snack.Grid(2, 8)
        g2.setField(snack.Label (_("Name")), 0, 0, anchorLeft = 1)
        g2.setField(snack.Label (_("Device")), 0, 1, anchorLeft = 1)
        g2.setField(snack.Label (_("Use DHCP")), 0, 2, anchorLeft = 1)
        g2.setField(snack.Label (_("Static IP")), 0, 3, anchorLeft = 1)
        g2.setField(snack.Label (_("Netmask")), 0, 4, anchorLeft = 1)
        g2.setField(snack.Label (_("Default gateway IP")), 0, 5, anchorLeft = 1)
        g2.setField(snack.Label (_("Primary DNS Server")), 0, 6, anchorLeft = 1)
        g2.setField(snack.Label (_("Secondary DNS Server")), 0, 7, anchorLeft = 1)
        g2.setField(self.name, 1, 0, (1, 0, 0, 0))
        g2.setField(self.hwdev, 1, 1, (1, 0, 0, 0))
        g2.setField(self.dynip, 1, 2, (1, 0, 0, 0), anchorLeft = 1)
        g2.setField(self.statip, 1, 3, (1, 0, 0, 0))
        g2.setField(self.netmask, 1, 4, (1, 0, 0, 0))
        g2.setField(self.gwy, 1, 5, (1, 0, 0, 0))
        g2.setField(self.dnsserver1, 1, 6, (1, 0, 0, 0))
        g2.setField(self.dnsserver2, 1, 7, (1, 0, 0, 0))
        self.dynip.setCallback(self.useDynamicCheckBox)
        bb = snack.ButtonBar(self.screen, ((_("Ok"), "ok"),
                                           (_("Cancel"), "cancel")))
        self.setState(self.dev)
        tl = snack.GridForm(screen, _("Network 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)
        self.useDynamicCheckBox()
        while 1:
            res = tl.run()
            if bb.buttonPressed(res) == "cancel":
                screen.popWindow()
                return False

            elif bb.buttonPressed(res) == "ok":
                screen.popWindow()
                self.processInfo()
                return True
예제 #21
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]
예제 #22
0
 def get_local_install_page(self, screen):
     self.__install_source = snack.RadioBar(screen, (("Use CDROM or DVD",
                                                DomainConfig.INSTALL_SOURCE_CDROM,
                                                self.__config.get_use_cdrom_source()),
                                               ("Use ISO image",
                                                DomainConfig.INSTALL_SOURCE_ISO,
                                                self.__config.get_use_cdrom_source() is False)))
     grid = snack.Grid(1, 1)
     grid.setField(self.__install_source, 0, 0, anchorLeft=1)
     return [snack.Label("Locate your install media"),
             grid]
예제 #23
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]
예제 #24
0
 def get_bridge_page(self, screen):
     bridges = []
     for bridge in self.get_libvirt().list_bridges():
         bridges.append(["Virtual network '%s'" % bridge.name(), bridge.name(), self.__config.get_network_bridge() is bridge.name()])
     self.__network_bridges = snack.RadioBar(screen, (bridges))
     if self.__config.get_mac_address() is None:
         self.__config.set_mac_address(self.get_libvirt().generate_mac_address())
     self.__mac_address = snack.Entry(20, self.__config.get_mac_address())
     grid = snack.Grid(1, 1)
     grid.setField(self.__network_bridges, 0, 0)
     return [snack.Label("Select an existing bridge"),
             grid]
예제 #25
0
    def redraw(self):
        if self._grid is None:
            self._grid = snack.Grid(self._cols + 1, self._rows + 1)
            self._form.add(self._grid)
            for w in self._widgets:
                self._grid.setField(w.widget, w.col, w.row, w.padding,
                                    w.anchorLeft, w.anchorTop, w.anchorRight,
                                    w.anchorBottom, w.growx, w.growy)
                self._form.add(w.widget)

            self._app.screen.gridWrappedWindow(self._grid, self._title)
        self._form.draw()
예제 #26
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]
예제 #27
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."
         )
     ]
예제 #28
0
 def get_enable_storage_page(self, screen):
     self.__enable_storage = snack.Checkbox("Enable storage for this virtual machine", self.__config.get_enable_storage())
     self.__storage_type     = snack.RadioBar(screen, ((["Create a disk image on the computer's hard disk",
                                                  DomainConfig.NEW_STORAGE,
                                                  self.__config.get_use_local_storage()]),
                                                (["Select managed or other existing storage",
                                                  DomainConfig.EXISTING_STORAGE,
                                                  self.__config.get_use_local_storage() is False])))
     grid = snack.Grid(1, 2)
     grid.setField(self.__enable_storage, 0, 0, anchorLeft=1)
     grid.setField(self.__storage_type, 0, 1, anchorLeft=1)
     return [snack.Label("Configure storage"),
             grid]
예제 #29
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]
예제 #30
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]