mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
tui: Remove wildcard imports
This commit is contained in:
parent
1935c53bdf
commit
7e86f73b7f
@ -18,14 +18,13 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
import os
|
||||
from createmeter import CreateMeter
|
||||
from domainconfig import DomainConfig
|
||||
from configscreen import ConfigScreen
|
||||
import utils
|
||||
|
||||
from virtinst import *
|
||||
from virtinst import Guest
|
||||
|
||||
VM_DETAILS_PAGE = 1
|
||||
LOCAL_INSTALL_PAGE = 2
|
||||
@ -305,8 +304,8 @@ class DomainConfigScreen(ConfigScreen):
|
||||
return True
|
||||
|
||||
def get_vm_details_page(self, screen):
|
||||
self.__guest_name = Entry(50, self.__config.get_guest_name())
|
||||
self.__install_type = RadioBar(screen, (("Local install media (ISO image or CDROM)",
|
||||
self.__guest_name = snack.Entry(50, self.__config.get_guest_name())
|
||||
self.__install_type = snack.RadioBar(screen, (("Local install media (ISO image or CDROM)",
|
||||
DomainConfig.LOCAL_INSTALL,
|
||||
self.__config.is_install_type(DomainConfig.LOCAL_INSTALL)),
|
||||
("Network Install (HTTP, FTP, or NFS)",
|
||||
@ -315,25 +314,25 @@ class DomainConfigScreen(ConfigScreen):
|
||||
("Network Boot (PXE)",
|
||||
DomainConfig.PXE_INSTALL,
|
||||
self.__config.is_install_type(DomainConfig.PXE_INSTALL))))
|
||||
grid = Grid(2,3)
|
||||
grid.setField(Label("Name:"), 0, 0, anchorRight = 1)
|
||||
grid = snack.Grid(2,3)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__guest_name, 1, 0, anchorLeft = 1)
|
||||
grid.setField(Label("Choose how you would like to install the operating system"), 1, 1,
|
||||
grid.setField(snack.Label("Choose how you would like to install the operating system"), 1, 1,
|
||||
anchorLeft = 1, anchorTop = 1)
|
||||
grid.setField(self.__install_type, 1, 2, anchorLeft = 1)
|
||||
return [Label("Enter your machine details"),
|
||||
return [snack.Label("Enter your machine details"),
|
||||
grid]
|
||||
|
||||
def get_local_install_page(self, screen):
|
||||
self.__install_source = RadioBar(screen, (("Use CDROM or DVD",
|
||||
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 = Grid(1,1)
|
||||
grid = snack.Grid(1,1)
|
||||
grid.setField(self.__install_source, 0, 0, anchorLeft = 1)
|
||||
return [Label("Locate your install media"),
|
||||
return [snack.Label("Locate your install media"),
|
||||
grid]
|
||||
|
||||
def get_select_cdrom_page(self, screen):
|
||||
@ -341,42 +340,42 @@ class DomainConfigScreen(ConfigScreen):
|
||||
media = self.get_hal().list_installable_volumes()
|
||||
for drive in media.keys():
|
||||
drives.append([media[drive], drive, self.__config.is_install_media(drive)])
|
||||
self.__install_media = RadioBar(screen, (drives))
|
||||
grid = Grid(1, 1)
|
||||
self.__install_media = snack.RadioBar(screen, (drives))
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(self.__install_media, 0, 0)
|
||||
return [Label("Select the install media"),
|
||||
return [snack.Label("Select the install media"),
|
||||
grid]
|
||||
|
||||
def get_select_iso_page(self, screen):
|
||||
self.__iso_path = Entry(50, self.__config.get_iso_path())
|
||||
grid = Grid(1, 2)
|
||||
grid.setField(Label("Enter ISO path:"), 0, 0, anchorLeft = 1)
|
||||
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 [Label("Enter the full path to an install ISO"),
|
||||
return [snack.Label("Enter the full path to an install ISO"),
|
||||
grid]
|
||||
|
||||
def get_network_install_page(self, screen):
|
||||
self.__install_url = Entry(50, self.__config.get_install_url())
|
||||
self.__kickstart_url = Entry(50, self.__config.get_kickstart_url())
|
||||
self.__kernel_options = Entry(50, self.__config.get_kernel_options())
|
||||
grid = Grid(2,3)
|
||||
grid.setField(Label("URL:"), 0, 0, anchorRight = 1)
|
||||
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(Label("Kickstart URL:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label("Kickstart URL:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(self.__kickstart_url, 1, 1, anchorLeft = 1)
|
||||
grid.setField(Label("Kernel Options:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(snack.Label("Kernel Options:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(self.__kernel_options, 1, 2, anchorLeft = 1)
|
||||
return [Label("Provide the operating system URL"),
|
||||
return [snack.Label("Provide the operating system URL"),
|
||||
grid]
|
||||
|
||||
def get_os_type_page(self, screen):
|
||||
types = []
|
||||
for type in Guest.list_os_types():
|
||||
types.append([Guest.get_os_type_label(type), type, self.__config.is_os_type(type)])
|
||||
self.__os_types = RadioBar(screen, types)
|
||||
grid = Grid(1, 1)
|
||||
self.__os_types = snack.RadioBar(screen, types)
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(self.__os_types, 0, 0, anchorLeft = 1)
|
||||
return [Label("Choose the operating system type"),
|
||||
return [snack.Label("Choose the operating system type"),
|
||||
grid]
|
||||
|
||||
def get_os_variant_page(self, screen):
|
||||
@ -384,45 +383,45 @@ class DomainConfigScreen(ConfigScreen):
|
||||
type = self.__config.get_os_type()
|
||||
for variant in Guest.list_os_variants(type):
|
||||
variants.append([Guest.get_os_variant_label(type, variant), variant, self.__config.is_os_variant(variant)])
|
||||
self.__os_variants = RadioBar(screen, variants)
|
||||
grid = Grid(1, 1)
|
||||
self.__os_variants = snack.RadioBar(screen, variants)
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(self.__os_variants, 0, 0, anchorLeft = 1)
|
||||
return [Label("Choose the operating system version"),
|
||||
return [snack.Label("Choose the operating system version"),
|
||||
grid]
|
||||
|
||||
def get_ram_and_cpu_page(self, screen):
|
||||
self.__memory = Entry(10, str(self.__config.get_memory()))
|
||||
self.__cpus = Entry(10, str(self.__config.get_cpus()))
|
||||
grid = Grid(2,2)
|
||||
grid.setField(Label("Memory (RAM):"), 0, 0, anchorRight = 1)
|
||||
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(Label("CPUs:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label("CPUs:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(self.__cpus, 1, 1, anchorLeft = 1)
|
||||
return [Label("Choose memory and CPU settings"),
|
||||
return [snack.Label("Choose memory and CPU settings"),
|
||||
grid]
|
||||
|
||||
def get_enable_storage_page(self, screen):
|
||||
self.__enable_storage = Checkbox("Enable storage for this virtual machine", self.__config.get_enable_storage())
|
||||
self.__storage_type = RadioBar(screen,((["Create a disk image on the computer's hard disk",
|
||||
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 = Grid(1,2)
|
||||
grid = snack.Grid(1,2)
|
||||
grid.setField(self.__enable_storage, 0, 0, anchorLeft = 1)
|
||||
grid.setField(self.__storage_type, 0, 1, anchorLeft = 1)
|
||||
return [Label("Configure storage"),
|
||||
return [snack.Label("Configure storage"),
|
||||
grid]
|
||||
|
||||
def get_local_storage_page(self, screen):
|
||||
self.__storage_size = Entry(6, str(self.__config.get_storage_size()))
|
||||
self.__allocate_storage = Checkbox("Allocate entire disk now", self.__config.get_allocate_storage())
|
||||
grid = Grid(2, 2)
|
||||
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(Label("Storage size (GB):"), 0, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Storage size (GB):"), 0, 1, anchorLeft = 1)
|
||||
grid.setField(self.__storage_size, 1, 1)
|
||||
return [Label("Configure local storage"),
|
||||
return [snack.Label("Configure local storage"),
|
||||
grid]
|
||||
|
||||
def get_select_pool_page(self, screen):
|
||||
@ -430,15 +429,15 @@ class DomainConfigScreen(ConfigScreen):
|
||||
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 = RadioBar(screen, (pools))
|
||||
grid = Grid(2, 1)
|
||||
grid.setField(Label("Storage pool:"), 0, 0, anchorTop = 1)
|
||||
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 = Label("There are no storage pools available.")
|
||||
grid = snack.Label("There are no storage pools available.")
|
||||
self.__has_pools = False
|
||||
return [Label("Configure Managed Storage: Select A Pool"),
|
||||
return [snack.Label("Configure Managed Storage: Select A Pool"),
|
||||
grid]
|
||||
|
||||
def get_select_volume_page(self, screen):
|
||||
@ -446,65 +445,65 @@ class DomainConfigScreen(ConfigScreen):
|
||||
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 = RadioBar(screen, (volumes))
|
||||
grid = Grid(2, 1)
|
||||
grid.setField(Label("Storage volumes:"), 0, 0, anchorTop = 1)
|
||||
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 = Label("This storage pool has no defined volumes.")
|
||||
grid = snack.Label("This storage pool has no defined volumes.")
|
||||
self.__has_volumes = False
|
||||
return [Label("Configure Managed Storage: Select A Volume"),
|
||||
return [snack.Label("Configure Managed Storage: Select A Volume"),
|
||||
grid]
|
||||
|
||||
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 = RadioBar(screen, (bridges))
|
||||
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 = Entry(20, self.__config.get_mac_address())
|
||||
grid = Grid(1, 1)
|
||||
self.__mac_address = snack.Entry(20, self.__config.get_mac_address())
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(self.__network_bridges, 0, 0)
|
||||
return [Label("Select an existing bridge"),
|
||||
return [snack.Label("Select an existing bridge"),
|
||||
grid]
|
||||
|
||||
def get_virt_details_page(self, screen):
|
||||
virt_types = []
|
||||
for type in self.get_libvirt().list_virt_types():
|
||||
virt_types.append([type, type, self.__config.is_virt_type(type)])
|
||||
self.__virt_types = RadioBar(screen, (virt_types))
|
||||
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 = RadioBar(screen, (archs))
|
||||
grid = Grid(2, 2)
|
||||
grid.setField(Label("Virt Type:"), 0, 0, anchorRight = 1, anchorTop = 1)
|
||||
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(Label("Architecture:"), 0, 1, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(snack.Label("Architecture:"), 0, 1, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(self.__architectures, 1, 1, anchorLeft = 1)
|
||||
return [Label("Configure virtualization details"),
|
||||
return [snack.Label("Configure virtualization details"),
|
||||
grid]
|
||||
|
||||
def get_confirm_page(self, screen):
|
||||
grid = Grid(2, 6)
|
||||
grid.setField(Label("OS:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(Label(Guest.get_os_variant_label(self.__config.get_os_type(),
|
||||
grid = snack.Grid(2, 6)
|
||||
grid.setField(snack.Label("OS:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(snack.Label(Guest.get_os_variant_label(self.__config.get_os_type(),
|
||||
self.__config.get_os_variant())), 1, 0, anchorLeft = 1)
|
||||
grid.setField(Label("Install:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(Label(self.__config.get_install_type_text()), 1, 1, anchorLeft = 1)
|
||||
grid.setField(Label("Memory:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(Label("%s MB" % self.__config.get_memory()), 1, 2, anchorLeft = 1)
|
||||
grid.setField(Label("CPUs:"), 0, 3, anchorRight = 1)
|
||||
grid.setField(Label("%d" % self.__config.get_cpus()), 1, 3, anchorLeft = 1)
|
||||
grid.setField(Label("Storage:"), 0, 4, anchorRight = 1)
|
||||
grid.setField(Label("%s (on %s)" % (self.__config.get_storage_volume(),
|
||||
grid.setField(snack.Label("Install:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_install_type_text()), 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Memory:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(snack.Label("%s MB" % self.__config.get_memory()), 1, 2, anchorLeft = 1)
|
||||
grid.setField(snack.Label("CPUs:"), 0, 3, anchorRight = 1)
|
||||
grid.setField(snack.Label("%d" % self.__config.get_cpus()), 1, 3, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Storage:"), 0, 4, anchorRight = 1)
|
||||
grid.setField(snack.Label("%s (on %s)" % (self.__config.get_storage_volume(),
|
||||
self.__config.get_storage_pool())),
|
||||
1, 4, anchorLeft = 1)
|
||||
grid.setField(Label("Network:"), 0, 5, anchorRight = 1)
|
||||
grid.setField(Label(self.__config.get_network_bridge()), 1, 5, anchorLeft = 1)
|
||||
return [Label("Ready to begin installation of %s" % self.__config.get_guest_name()),
|
||||
grid.setField(snack.Label("Network:"), 0, 5, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_network_bridge()), 1, 5, anchorLeft = 1)
|
||||
return [snack.Label("Ready to begin installation of %s" % self.__config.get_guest_name()),
|
||||
grid]
|
||||
|
||||
def AddDomain():
|
||||
|
@ -16,9 +16,9 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
|
||||
from configscreen import *
|
||||
from configscreen import ConfigScreen
|
||||
|
||||
DETAILS_PAGE = 1
|
||||
CONFIRM_PAGE = 2
|
||||
@ -90,44 +90,44 @@ class AddHostConfigScreen(ConfigScreen):
|
||||
|
||||
def get_details_page(self, screen):
|
||||
if not self.__configured:
|
||||
self.__hypervisor = RadioBar(screen, ((HYPERVISORS[HYPERVISOR_XEN], HYPERVISOR_XEN, True),
|
||||
self.__hypervisor = snack.RadioBar(screen, ((HYPERVISORS[HYPERVISOR_XEN], HYPERVISOR_XEN, True),
|
||||
(HYPERVISORS[HYPERVISOR_KVM], HYPERVISOR_KVM, False)))
|
||||
self.__connection = RadioBar(screen, ((CONNECTIONS[CONNECTION_LOCAL], CONNECTION_LOCAL, True),
|
||||
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 = Entry(50, "")
|
||||
self.__autoconnect = Checkbox("Autoconnect on Startup")
|
||||
self.__hostname = snack.Entry(50, "")
|
||||
self.__autoconnect = snack.Checkbox("Autoconnect on Startup")
|
||||
self.__configured = True
|
||||
grid = Grid(2, 4)
|
||||
grid.setField(Label("Hypervisor:"), 0, 0, anchorRight = 1, anchorTop = 1)
|
||||
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(Label("Connection:"), 0, 1, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(snack.Label("Connection:"), 0, 1, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(self.__connection, 1, 1, anchorLeft = 1)
|
||||
grid.setField(Label("Hostname:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(snack.Label("Hostname:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(self.__hostname, 1, 2, anchorLeft = 1)
|
||||
grid.setField(Label(""), 0, 3, anchorRight = 1)
|
||||
grid.setField(snack.Label(""), 0, 3, anchorRight = 1)
|
||||
grid.setField(self.__autoconnect, 1, 3, anchorLeft = 1)
|
||||
return [Label("Add Connection"),
|
||||
return [snack.Label("Add Connection"),
|
||||
grid]
|
||||
|
||||
def get_confirm_page(self, screen):
|
||||
grid = Grid(2, 4)
|
||||
grid.setField(Label("Hypervisor:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(Label(HYPERVISORS[self.__hypervisor.getSelection()]), 1, 0, anchorLeft = 1)
|
||||
grid.setField(Label("Connection:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(Label(CONNECTIONS[self.__connection.getSelection()]), 1, 1, anchorLeft = 1)
|
||||
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(Label("Hostname:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(Label(hostname), 1, 2, anchorLeft = 1)
|
||||
grid.setField(Label("Autoconnect on Startup:"), 0, 3, anchorRight = 1)
|
||||
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(Label(label), 1, 3, anchorLeft = 1)
|
||||
return [Label("Confirm Connection"),
|
||||
grid.setField(snack.Label(label), 1, 3, anchorLeft = 1)
|
||||
return [snack.Label("Confirm Connection"),
|
||||
grid]
|
||||
|
||||
def AddHost():
|
||||
|
@ -16,11 +16,11 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
import traceback
|
||||
import utils
|
||||
|
||||
from configscreen import *
|
||||
from configscreen import ConfigScreen
|
||||
from poolconfig import PoolConfig
|
||||
from virtinst import Storage
|
||||
|
||||
@ -111,75 +111,75 @@ class AddStoragePoolConfigScreen(ConfigScreen):
|
||||
self.set_finished()
|
||||
|
||||
def get_pool_name_page(self, screen):
|
||||
self.__name = Entry(50, self.__config.get_name())
|
||||
self.__name = snack.Entry(50, self.__config.get_name())
|
||||
pooltypes = []
|
||||
for pooltype in Storage.StoragePool.get_pool_types():
|
||||
pooltypes.append(["%s: %s" % (pooltype, Storage.StoragePool.get_pool_type_desc(pooltype)),
|
||||
pooltype,
|
||||
self.__config.get_type() is pooltype])
|
||||
self.__type = RadioBar(screen, pooltypes)
|
||||
grid = Grid(2, 2)
|
||||
grid.setField(Label("Name:"), 0, 0, anchorRight = 1)
|
||||
self.__type = snack.RadioBar(screen, pooltypes)
|
||||
grid = snack.Grid(2, 2)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__name, 1, 0, anchorLeft = 1)
|
||||
grid.setField(Label("Type:"), 0, 1, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(snack.Label("Type:"), 0, 1, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(self.__type, 1, 1, anchorLeft = 1)
|
||||
return [Label("Add Storage Pool"),
|
||||
return [snack.Label("Add Storage Pool"),
|
||||
grid]
|
||||
|
||||
def get_pool_details_page(self, screen):
|
||||
rows = 0
|
||||
if self.__config.needs_target_path():
|
||||
self.__target_path = Entry(50, self.__config.get_target_path())
|
||||
self.__target_path = snack.Entry(50, self.__config.get_target_path())
|
||||
rows += 1
|
||||
if self.__config.needs_format():
|
||||
formats = []
|
||||
for format in self.__config.get_formats():
|
||||
formats.append([format, format, format is self.__config.get_format()])
|
||||
self.__formats = RadioBar(screen, formats)
|
||||
self.__formats = snack.RadioBar(screen, formats)
|
||||
rows += 1
|
||||
if self.__config.needs_hostname():
|
||||
self.__hostname = Entry(50, self.__config.get_hostname())
|
||||
self.__hostname = snack.Entry(50, self.__config.get_hostname())
|
||||
rows += 1
|
||||
if self.__config.needs_source_path():
|
||||
self.__source_path = Entry(50, self.__config.get_source_path())
|
||||
self.__source_path = snack.Entry(50, self.__config.get_source_path())
|
||||
rows += 1
|
||||
if self.__config.needs_build_pool():
|
||||
self.__build_pool = Checkbox("Build Pool", self.__config.get_build_pool())
|
||||
self.__build_pool = snack.Checkbox("Build Pool", self.__config.get_build_pool())
|
||||
rows += 1
|
||||
self.__build_pool = Checkbox("Build Pool", self.__config.get_build_pool())
|
||||
self.__build_pool = snack.Checkbox("Build Pool", self.__config.get_build_pool())
|
||||
rows += 1
|
||||
grid = Grid(2, rows)
|
||||
grid = snack.Grid(2, rows)
|
||||
currentrow = 0
|
||||
if self.__config.needs_target_path():
|
||||
grid.setField(Label("Target Path:"), 0, currentrow, anchorRight = 1)
|
||||
grid.setField(snack.Label("Target Path:"), 0, currentrow, anchorRight = 1)
|
||||
grid.setField(self.__target_path, 1, currentrow, anchorLeft = 1)
|
||||
currentrow += 1
|
||||
if self.__config.needs_format():
|
||||
grid.setField(Label("Format:"), 0, currentrow, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(snack.Label("Format:"), 0, currentrow, anchorRight = 1, anchorTop = 1)
|
||||
grid.setField(self.__formats, 1, currentrow, anchorLeft = 1)
|
||||
currentrow += 1
|
||||
if self.__config.needs_hostname():
|
||||
grid.setField(Label("Host Name:"), 0, currentrow, anchorRight = 1)
|
||||
grid.setField(snack.Label("Host Name:"), 0, currentrow, anchorRight = 1)
|
||||
grid.setField(self.__hostname, 1, currentrow, anchorRight = 1)
|
||||
currentrow += 1
|
||||
if self.__config.needs_source_path():
|
||||
grid.setField(Label("Source Path:"), 0, currentrow, anchorRight = 1)
|
||||
grid.setField(snack.Label("Source Path:"), 0, currentrow, anchorRight = 1)
|
||||
grid.setField(self.__source_path, 1, currentrow, anchorLeft = 1)
|
||||
currentrow += 1
|
||||
if self.__config.needs_build_pool():
|
||||
grid.setField(Label(" "), 0, currentrow, anchorRight = 1)
|
||||
grid.setField(snack.Label(" "), 0, currentrow, anchorRight = 1)
|
||||
grid.setField(self.__build_pool, 1, currentrow, anchorLeft = 1)
|
||||
currentrow += 1
|
||||
return [Label("Specify a storage location to be later split into virtual machine storage"),
|
||||
return [snack.Label("Specify a storage location to be later split into virtual machine storage"),
|
||||
grid]
|
||||
|
||||
def get_confirm_page(self, screen):
|
||||
grid = Grid(2, 2)
|
||||
grid.setField(Label("Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(Label(self.__config.get_name()), 1, 0, anchorLeft = 1)
|
||||
grid.setField(Label("Target Path:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(Label(self.__config.get_target_path()), 1, 1, anchorLeft = 1)
|
||||
return [Label("Confirm Pool Details"),
|
||||
grid = snack.Grid(2, 2)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_name()), 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Target Path:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_target_path()), 1, 1, anchorLeft = 1)
|
||||
return [snack.Label("Confirm Pool Details"),
|
||||
grid]
|
||||
|
||||
def AddStoragePool():
|
||||
|
@ -16,13 +16,13 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
import traceback
|
||||
|
||||
from createmeter import CreateMeter
|
||||
from configscreen import *
|
||||
from configscreen import StorageListConfigScreen
|
||||
from volumeconfig import StorageVolumeConfig
|
||||
from utils import *
|
||||
import utils
|
||||
|
||||
SELECT_POOL_PAGE = 1
|
||||
VOLUME_NAME_PAGE = 2
|
||||
@ -79,7 +79,7 @@ class AddVolumeConfigScreen(StorageListConfigScreen):
|
||||
else:
|
||||
errors.append("You must select a storage pool.")
|
||||
elif page is VOLUME_NAME_PAGE:
|
||||
if string_is_not_blank(self.__name.value()):
|
||||
if utils.string_is_not_blank(self.__name.value()):
|
||||
return True
|
||||
else:
|
||||
errors.append("Storage object name can only contain alphanumeric, '_', '.', or '-' characters.")
|
||||
@ -89,8 +89,8 @@ class AddVolumeConfigScreen(StorageListConfigScreen):
|
||||
else:
|
||||
errors.append("You must select a volume format.")
|
||||
elif page is MAX_CAPACITY_PAGE:
|
||||
if string_is_not_blank(self.__capacity.value()):
|
||||
if string_is_not_blank(self.__allocation.value()):
|
||||
if utils.string_is_not_blank(self.__capacity.value()):
|
||||
if utils.string_is_not_blank(self.__allocation.value()):
|
||||
capacity = int(self.__capacity.value())
|
||||
allocation = int(self.__allocation.value())
|
||||
if capacity > 0:
|
||||
@ -128,49 +128,49 @@ class AddVolumeConfigScreen(StorageListConfigScreen):
|
||||
self.set_finished()
|
||||
|
||||
def get_volume_name_page(self, screen):
|
||||
self.__name = Entry(50, self.__config.get_name())
|
||||
grid = Grid(2, 1)
|
||||
grid.setField(Label("Name:"), 0, 0, anchorRight = 1)
|
||||
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 [Label("New Storage Volume"),
|
||||
return [snack.Label("New Storage Volume"),
|
||||
grid,
|
||||
Label("Name of the volume to create. File extension may be appended.")]
|
||||
snack.Label("Name of the volume to create. File extension may be appended.")]
|
||||
|
||||
def get_volume_format_page(self, screen):
|
||||
self.__formats = Listbox(0)
|
||||
self.__formats = snack.Listbox(0)
|
||||
for format in self.__config.get_formats_for_pool():
|
||||
self.__formats.append(format, format)
|
||||
grid = Grid(1, 1)
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(self.__formats, 0, 0)
|
||||
return [Label("Select The Volume Format"),
|
||||
return [snack.Label("Select The Volume Format"),
|
||||
grid]
|
||||
|
||||
def get_max_capacity_page(self, screen):
|
||||
self.__capacity = Entry(6, str(self.__config.get_max_capacity()))
|
||||
self.__allocation = Entry(6, str(self.__config.get_allocation()))
|
||||
grid = Grid(2, 2)
|
||||
grid.setField(Label("Max. Capacity (MB):"), 0, 0, anchorRight = 1)
|
||||
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(Label("Allocation (MB):"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label("Allocation (MB):"), 0, 1, anchorRight = 1)
|
||||
grid.setField(self.__allocation, 1, 1, anchorLeft = 1)
|
||||
return [Label("Storage Volume Quota"),
|
||||
Label("%s's available space: %s" % (self.__config.get_pool().name(),
|
||||
size_as_mb_or_gb(self.__config.get_pool().info()[3]))),
|
||||
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]
|
||||
|
||||
def get_confirm_page(self, screen):
|
||||
grid = Grid(2, 5)
|
||||
grid.setField(Label("Volume Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(Label("%s (%s)" % (self.__config.get_name(), self.__config.get_pool().name())), 1, 0, anchorLeft = 1)
|
||||
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(Label("Format:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(Label(self.__config.get_format()), 1, 1, anchorLeft = 1)
|
||||
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(Label("Max. Capacity:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(Label("%s" % (size_as_mb_or_gb(self.__config.get_max_capacity() * 1024**2))), 1, 2, anchorLeft = 1)
|
||||
grid.setField(Label("Allocation:"), 0, 3, anchorRight = 1)
|
||||
grid.setField(Label("%s" % (size_as_mb_or_gb(self.__config.get_allocation() * 1024**2))), 1, 3, anchorLeft = 1)
|
||||
return [Label("Ready To Allocation New Storage Volume"),
|
||||
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 AddStorageVolume():
|
||||
|
@ -16,11 +16,11 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
|
||||
import logging
|
||||
import libvirtworker
|
||||
from configscreen import *
|
||||
from configscreen import HostListConfigScreen
|
||||
|
||||
CONNECTION_LIST_PAGE = 1
|
||||
CONNECTED_PAGE = 2
|
||||
@ -53,7 +53,7 @@ class ChangeHostConfigScreen(HostListConfigScreen):
|
||||
return page is CONNECTED_PAGE
|
||||
|
||||
def get_connected_page(self, screen):
|
||||
return [Label("Connected to %s" % self.get_selected_connection())]
|
||||
return [snack.Label("Connected to %s" % self.get_selected_connection())]
|
||||
|
||||
def ChangeHost():
|
||||
screen = ChangeHostConfigScreen()
|
||||
|
@ -16,9 +16,9 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
from halworker import HALWorker
|
||||
from libvirtworker import *
|
||||
from libvirtworker import LibvirtWorker, VirtManagerConfig
|
||||
import traceback
|
||||
|
||||
BACK_BUTTON = "back"
|
||||
@ -89,28 +89,28 @@ class ConfigScreen:
|
||||
def start(self):
|
||||
active = True
|
||||
while active and (self.__finished == False):
|
||||
screen = SnackScreen()
|
||||
screen = snack.SnackScreen()
|
||||
elements = self.get_elements_for_page(screen, self.__current_page)
|
||||
# TODO: need to set the form height to the number of elements on the page
|
||||
gridform = GridForm(screen, self.get_title(), 2, 2)
|
||||
gridform = snack.GridForm(screen, self.get_title(), 2, 2)
|
||||
|
||||
# Here you would put the list of elements
|
||||
# and programmatically set the indicator as
|
||||
# they're rendered
|
||||
pages = self.get_page_list()
|
||||
if len(pages) > 0:
|
||||
leftmenu = Grid(2, len(pages))
|
||||
leftmenu = snack.Grid(2, len(pages))
|
||||
current_element = 0
|
||||
for page in pages:
|
||||
leftmenu.setField(Label(page), 0, current_element, anchorLeft = 1)
|
||||
leftmenu.setField(snack.Label(page), 0, current_element, anchorLeft = 1)
|
||||
indicator = " "
|
||||
if current_element == self.__current_page - 1:
|
||||
indicator = "<-"
|
||||
leftmenu.setField(Label(indicator), 1, current_element)
|
||||
leftmenu.setField(snack.Label(indicator), 1, current_element)
|
||||
current_element += 1
|
||||
gridform.add(leftmenu, 0, 0, anchorTop = 1, padding = (3, 0, 3, 0))
|
||||
|
||||
content = Grid(1, len(elements) + 1)
|
||||
content = snack.Grid(1, len(elements) + 1)
|
||||
current_element = 0
|
||||
for element in elements:
|
||||
content.setField(element, 0, current_element)
|
||||
@ -121,7 +121,7 @@ class ConfigScreen:
|
||||
if self.page_has_next(self.__current_page): buttons.append(["Next", NEXT_BUTTON, "F12"])
|
||||
if self.page_has_finish(self.__current_page): buttons.append(["Finish", FINISH_BUTTON, "F10"])
|
||||
buttons.append(["Cancel", CANCEL_BUTTON, "ESC"])
|
||||
buttonbar = ButtonBar(screen, buttons)
|
||||
buttonbar = snack.ButtonBar(screen, buttons)
|
||||
content.setField(buttonbar, 0, current_element, growx = 1)
|
||||
gridform.add(content, 1, 0, anchorTop = 1)
|
||||
current_element += 1
|
||||
@ -139,14 +139,14 @@ class ConfigScreen:
|
||||
error_text = ""
|
||||
for error in errors:
|
||||
error_text += "%s\n" % error
|
||||
ButtonChoiceWindow(screen,
|
||||
snack.ButtonChoiceWindow(screen,
|
||||
"There Were Errors",
|
||||
error_text,
|
||||
buttons = ["OK"])
|
||||
elif pressed == CANCEL_BUTTON:
|
||||
active = False
|
||||
except Exception, error:
|
||||
ButtonChoiceWindow(screen,
|
||||
snack.ButtonChoiceWindow(screen,
|
||||
"An Exception Has Occurred",
|
||||
str(error) + "\n" + traceback.format_exc(),
|
||||
buttons = ["OK"])
|
||||
@ -165,7 +165,7 @@ class DomainListConfigScreen(ConfigScreen):
|
||||
result = None
|
||||
|
||||
if self.__has_domains:
|
||||
self.__domain_list = Listbox(0)
|
||||
self.__domain_list = snack.Listbox(0)
|
||||
for uuid in domuuids:
|
||||
domain = self.get_libvirt().get_domain(uuid)
|
||||
|
||||
@ -173,8 +173,8 @@ class DomainListConfigScreen(ConfigScreen):
|
||||
self.__domain_list.append(domain.get_name(), domain)
|
||||
result = [self.__domain_list]
|
||||
else:
|
||||
grid = Grid(1, 1)
|
||||
grid.setField(Label("There are no domains available."), 0, 0)
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(snack.Label("There are no domains available."), 0, 0)
|
||||
result = [grid]
|
||||
|
||||
return result
|
||||
@ -197,17 +197,17 @@ class NetworkListConfigScreen(ConfigScreen):
|
||||
|
||||
if len(uuids) > 0:
|
||||
self.__has_networks = True
|
||||
self.__network_list = Listbox(0)
|
||||
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 = Label("There are no networks available.")
|
||||
grid = Grid(1, 1)
|
||||
result = snack.Label("There are no networks available.")
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(result, 0, 0)
|
||||
return [Label("Network List"),
|
||||
return [snack.Label("Network List"),
|
||||
grid]
|
||||
|
||||
def get_selected_network(self):
|
||||
@ -227,16 +227,16 @@ class StorageListConfigScreen(ConfigScreen):
|
||||
pools = self.get_libvirt().list_storage_pools(defined=defined, created=created)
|
||||
if len(pools) > 0:
|
||||
self.__has_pools = True
|
||||
self.__pools_list = Listbox(0)
|
||||
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 = Label("There are no storage pools available.")
|
||||
grid = Grid(1, 1)
|
||||
result = snack.Label("There are no storage pools available.")
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(result, 0, 0)
|
||||
return [Label("Storage Pool List"),
|
||||
return [snack.Label("Storage Pool List"),
|
||||
grid]
|
||||
|
||||
def get_selected_pool(self):
|
||||
@ -250,17 +250,17 @@ class StorageListConfigScreen(ConfigScreen):
|
||||
pool = self.get_libvirt().get_storage_pool(self.get_selected_pool())
|
||||
if len(pool.listVolumes()) > 0:
|
||||
self.__has_volumes = True
|
||||
self.__volumes_list = Listbox(0)
|
||||
self.__volumes_list = snack.Listbox(0)
|
||||
for volname in pool.listVolumes():
|
||||
volume = pool.storageVolLookupByName(volname)
|
||||
self.__volumes_list.append("%s (%0.2f GB)" % (volume.name(), volume.info()[2] / 1024**3), volume.name())
|
||||
result = self.__volumes_list
|
||||
else:
|
||||
self.__has_volumes = False
|
||||
result = Label("There are no storage volumes available.")
|
||||
grid = Grid(1, 1)
|
||||
result = snack.Label("There are no storage volumes available.")
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(result, 0, 0)
|
||||
return [Label("Storage Volume List"),
|
||||
return [snack.Label("Storage Volume List"),
|
||||
grid]
|
||||
|
||||
def get_selected_volume(self):
|
||||
@ -281,16 +281,16 @@ class HostListConfigScreen(ConfigScreen):
|
||||
|
||||
if len(connections) > 0:
|
||||
self.__has_connections = True
|
||||
self.__connection_list = Listbox(0)
|
||||
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 = Label("There are no defined connections.")
|
||||
grid = Grid(1, 1)
|
||||
result = snack.Label("There are no defined connections.")
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(result, 0, 0)
|
||||
return [Label("Host List"),
|
||||
return [snack.Label("Host List"),
|
||||
grid]
|
||||
|
||||
def get_selected_connection(self):
|
||||
|
@ -18,7 +18,7 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
from configscreen import ConfigScreen
|
||||
from userworker import UserWorker
|
||||
|
||||
@ -75,30 +75,30 @@ class CreateUserConfigScreen(ConfigScreen):
|
||||
|
||||
def get_details_page(self, screen):
|
||||
if self.__username is None:
|
||||
self.__username = Entry(50, "")
|
||||
self.__password = Entry(50, "", password = 1)
|
||||
self.__confirm = Entry(50, "", password = 1)
|
||||
self.__adminuser = Checkbox("This user is an administrator", False)
|
||||
grid = Grid(2, 4)
|
||||
grid.setField(Label("Username:"), 0, 0, anchorRight = 1)
|
||||
self.__username = snack.Entry(50, "")
|
||||
self.__password = snack.Entry(50, "", password = 1)
|
||||
self.__confirm = snack.Entry(50, "", password = 1)
|
||||
self.__adminuser = snack.Checkbox("This user is an administrator", False)
|
||||
grid = snack.Grid(2, 4)
|
||||
grid.setField(snack.Label("Username:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__username, 1, 0, anchorLeft = 1)
|
||||
grid.setField(Label("Password:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label("Password:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(self.__password, 1, 1, anchorLeft = 1)
|
||||
grid.setField(Label("Confirm password:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(snack.Label("Confirm password:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(self.__confirm, 1, 2, anchorLeft = 1)
|
||||
grid.setField(Label(" "), 0, 3)
|
||||
grid.setField(snack.Label(" "), 0, 3)
|
||||
grid.setField(self.__adminuser, 1, 3, anchorLeft = 1)
|
||||
return [Label("Enter The User Details"),
|
||||
return [snack.Label("Enter The User Details"),
|
||||
grid]
|
||||
|
||||
def get_confirm_page(self, screen):
|
||||
grid = Grid(1, 2)
|
||||
grid.setField(Label("Username: %s" % self.__username.value()), 0, 0)
|
||||
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(Label("This user %s an administrator." % admin_label), 0, 1)
|
||||
return [Label("Create this user account?"),
|
||||
grid.setField(snack.Label("This user %s an administrator." % admin_label), 0, 1)
|
||||
return [snack.Label("Create this user account?"),
|
||||
grid]
|
||||
|
||||
def CreateUser():
|
||||
|
@ -16,15 +16,15 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
from IPy import IP
|
||||
import traceback
|
||||
import logging
|
||||
import re
|
||||
|
||||
from configscreen import ConfigScreen
|
||||
import utils
|
||||
from configscreen import ConfigScreen
|
||||
from networkconfig import NetworkConfig
|
||||
from utils import *
|
||||
|
||||
NETWORK_NAME_PAGE = 1
|
||||
IPV4_ADDRESS_PAGE = 2
|
||||
@ -138,70 +138,70 @@ class DefineNetworkConfigScreen(ConfigScreen):
|
||||
return False
|
||||
|
||||
def get_network_name_page(self, screen):
|
||||
self.__name = Entry(50, self.__config.get_name())
|
||||
grid = Grid(2, 1)
|
||||
grid.setField(Label("Network Name:"), 0, 0)
|
||||
self.__name = snack.Entry(50, self.__config.get_name())
|
||||
grid = snack.Grid(2, 1)
|
||||
grid.setField(snack.Label("Network Name:"), 0, 0)
|
||||
grid.setField(self.__name, 1, 0)
|
||||
return [Label("Please choose a name for your virtual network"),
|
||||
return [snack.Label("Please choose a name for your virtual network"),
|
||||
grid]
|
||||
|
||||
def get_ipv4_address_page(self, screen):
|
||||
self.__ipv4_address = Entry(18, self.__config.get_ipv4_address())
|
||||
grid = Grid(2, 1)
|
||||
grid.setField(Label("Network:"), 0, 0, anchorRight = 1)
|
||||
self.__ipv4_address = snack.Entry(18, self.__config.get_ipv4_address())
|
||||
grid = snack.Grid(2, 1)
|
||||
grid.setField(snack.Label("Network:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__ipv4_address, 1, 0, anchorLeft = 1)
|
||||
return [Label("You will need to choose an IPv4 address space for the virtual network:"),
|
||||
return [snack.Label("You will need to choose an IPv4 address space for the virtual network:"),
|
||||
grid,
|
||||
Label("HINT: The network should be chosen from"),
|
||||
Label("one of the IPv4 private address ranges;"),
|
||||
Label("e.g., 10.0.0.0/8, 172.168.0.0/12, 192.168.0.0/16")]
|
||||
snack.Label("HINT: The network should be chosen from"),
|
||||
snack.Label("one of the IPv4 private address ranges;"),
|
||||
snack.Label("e.g., 10.0.0.0/8, 172.168.0.0/12, 192.168.0.0/16")]
|
||||
|
||||
def get_network_details_page(self, screen):
|
||||
grid = Grid(2, 6)
|
||||
grid.setField(Label("Network:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(Label(self.__config.get_ipv4_address()), 1, 0, anchorLeft = 1)
|
||||
grid.setField(Label("Netmask:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(Label(self.__config.get_ipv4_netmask()), 1, 1, anchorLeft = 1)
|
||||
grid.setField(Label("Broadcast:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(Label(self.__config.get_ipv4_broadcast()), 1, 2, anchorLeft = 1)
|
||||
grid.setField(Label("Gateway:"), 0, 3, anchorRight = 1)
|
||||
grid.setField(Label(self.__config.get_ipv4_gateway()), 1, 3, anchorLeft = 1)
|
||||
grid.setField(Label("Size:"), 0, 4, anchorRight = 1)
|
||||
grid.setField(Label("%d addresses" % self.__config.get_ipv4_max_addresses()), 1, 4, anchorLeft = 1)
|
||||
grid.setField(Label("Type:"), 0, 5, anchorRight = 1)
|
||||
grid.setField(Label(self.__config.get_ipv4_network_type()), 1, 5, anchorLeft = 1)
|
||||
return [Label("Network Details"),
|
||||
grid = snack.Grid(2, 6)
|
||||
grid.setField(snack.Label("Network:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_address()), 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Netmask:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_netmask()), 1, 1, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Broadcast:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_broadcast()), 1, 2, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Gateway:"), 0, 3, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_gateway()), 1, 3, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Size:"), 0, 4, anchorRight = 1)
|
||||
grid.setField(snack.Label("%d addresses" % self.__config.get_ipv4_max_addresses()), 1, 4, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Type:"), 0, 5, anchorRight = 1)
|
||||
grid.setField(snack.Label(self.__config.get_ipv4_network_type()), 1, 5, anchorLeft = 1)
|
||||
return [snack.Label("Network Details"),
|
||||
grid]
|
||||
|
||||
def get_public_network_alert_page(self, screen):
|
||||
grid = Grid(1, 2)
|
||||
grid.setField(Label("The network should normally use a private IPv4 address."), 0, 0, anchorLeft = 1)
|
||||
grid.setField(Label("Use this non-private address anyway?"), 0, 1, anchorLeft = 1)
|
||||
return [Label("Check Network Address"),
|
||||
grid = snack.Grid(1, 2)
|
||||
grid.setField(snack.Label("The network should normally use a private IPv4 address."), 0, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Use this non-private address anyway?"), 0, 1, anchorLeft = 1)
|
||||
return [snack.Label("Check Network Address"),
|
||||
grid]
|
||||
|
||||
def get_dhcp_range_page(self, screen):
|
||||
self.__start_address = Entry(15, self.__config.get_ipv4_start_address())
|
||||
self.__end_address = Entry(15, self.__config.get_ipv4_end_address())
|
||||
grid = Grid(2,2)
|
||||
grid.setField(Label("Start:"), 0, 0, anchorRight = 1)
|
||||
self.__start_address = snack.Entry(15, self.__config.get_ipv4_start_address())
|
||||
self.__end_address = snack.Entry(15, self.__config.get_ipv4_end_address())
|
||||
grid = snack.Grid(2,2)
|
||||
grid.setField(snack.Label("Start:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(self.__start_address, 1, 0, anchorLeft = 1)
|
||||
grid.setField(Label("End:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(snack.Label("End:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(self.__end_address, 1, 1, anchorLeft = 1)
|
||||
return [Label("Selecting The DHCP Range"),
|
||||
return [snack.Label("Selecting The DHCP Range"),
|
||||
grid,
|
||||
Label("TIP: Unless you wish to reserve some addresses to allow static network"),
|
||||
Label("configuration in virtual machines, these paraemters can be left with"),
|
||||
Label("their default values.")]
|
||||
snack.Label("TIP: Unless you wish to reserve some addresses to allow static network"),
|
||||
snack.Label("configuration in virtual machines, these paraemters can be left with"),
|
||||
snack.Label("their default values.")]
|
||||
|
||||
def get_network_type_page(self, screen):
|
||||
self.__isolated_network = Checkbox("Isolated virtual network",
|
||||
self.__isolated_network = snack.Checkbox("Isolated virtual network",
|
||||
self.__config.is_isolated_network())
|
||||
grid = Grid(1, 3)
|
||||
grid.setField(Label("Please indicate whether this virtual network should be"), 0, 0, anchorLeft = 1)
|
||||
grid.setField(Label("connected to the physical network."), 0, 1, anchorLeft = 1)
|
||||
grid = snack.Grid(1, 3)
|
||||
grid.setField(snack.Label("Please indicate whether this virtual network should be"), 0, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("connected to the physical network."), 0, 1, anchorLeft = 1)
|
||||
grid.setField(self.__isolated_network, 0, 2)
|
||||
return [Label("Connecting To Physical Network"),
|
||||
return [snack.Label("Connecting To Physical Network"),
|
||||
grid]
|
||||
|
||||
def get_select_physical_network_page(self, screen):
|
||||
@ -209,47 +209,47 @@ class DefineNetworkConfigScreen(ConfigScreen):
|
||||
devices.append(["NAT to any physical device", "", self.__config.get_physical_device() == ""])
|
||||
for device in self.get_hal().list_network_devices():
|
||||
devices.append(["NAT to physical device %s" % device, device, self.__config.get_physical_device() == device])
|
||||
self.__physical_devices = RadioBar(screen, (devices))
|
||||
grid = Grid(1, 2)
|
||||
grid.setField(Label("Forward to physical network:"), 0, 0)
|
||||
self.__physical_devices = snack.RadioBar(screen, (devices))
|
||||
grid = snack.Grid(1, 2)
|
||||
grid.setField(snack.Label("Forward to physical network:"), 0, 0)
|
||||
grid.setField(self.__physical_devices, 0, 1)
|
||||
return [Label("Connecting To Physical Network"),
|
||||
return [snack.Label("Connecting To Physical Network"),
|
||||
grid]
|
||||
|
||||
def get_summary_page(self, screen):
|
||||
grid1 = Grid(2, 1)
|
||||
grid1.setField(Label("Network name:"), 0, 0, anchorRight = 1)
|
||||
grid1.setField(Label(self.__config.get_name()), 1, 0, anchorLeft = 1)
|
||||
grid1 = snack.Grid(2, 1)
|
||||
grid1.setField(snack.Label("Network name:"), 0, 0, anchorRight = 1)
|
||||
grid1.setField(snack.Label(self.__config.get_name()), 1, 0, anchorLeft = 1)
|
||||
|
||||
grid2 = Grid(2, 3)
|
||||
grid2.setField(Label("Network:"), 0, 0, anchorRight = 1)
|
||||
grid2.setField(Label(self.__config.get_ipv4_address()), 1, 0, anchorLeft = 1)
|
||||
grid2.setField(Label("Gateway:"), 0, 1, anchorRight = 1)
|
||||
grid2.setField(Label(self.__config.get_ipv4_gateway()), 1, 1, anchorLeft = 1)
|
||||
grid2.setField(Label("Netmask:"), 0, 2, anchorRight = 1)
|
||||
grid2.setField(Label(self.__config.get_ipv4_netmask()), 1, 2, anchorLeft = 1)
|
||||
grid2 = snack.Grid(2, 3)
|
||||
grid2.setField(snack.Label("Network:"), 0, 0, anchorRight = 1)
|
||||
grid2.setField(snack.Label(self.__config.get_ipv4_address()), 1, 0, anchorLeft = 1)
|
||||
grid2.setField(snack.Label("Gateway:"), 0, 1, anchorRight = 1)
|
||||
grid2.setField(snack.Label(self.__config.get_ipv4_gateway()), 1, 1, anchorLeft = 1)
|
||||
grid2.setField(snack.Label("Netmask:"), 0, 2, anchorRight = 1)
|
||||
grid2.setField(snack.Label(self.__config.get_ipv4_netmask()), 1, 2, anchorLeft = 1)
|
||||
|
||||
grid3 = Grid(2, 2)
|
||||
grid3.setField(Label("Start address:"), 0, 0, anchorRight = 1)
|
||||
grid3.setField(Label(self.__config.get_ipv4_start_address()), 1, 0, anchorLeft = 1)
|
||||
grid3.setField(Label("End address:"), 0, 1, anchorRight = 1)
|
||||
grid3.setField(Label(self.__config.get_ipv4_end_address()), 1, 1, anchorLeft = 1)
|
||||
grid3 = snack.Grid(2, 2)
|
||||
grid3.setField(snack.Label("Start address:"), 0, 0, anchorRight = 1)
|
||||
grid3.setField(snack.Label(self.__config.get_ipv4_start_address()), 1, 0, anchorLeft = 1)
|
||||
grid3.setField(snack.Label("End address:"), 0, 1, anchorRight = 1)
|
||||
grid3.setField(snack.Label(self.__config.get_ipv4_end_address()), 1, 1, anchorLeft = 1)
|
||||
|
||||
grid4 = Grid(2, 1)
|
||||
grid4.setField(Label("Connectivity:"), 0, 0, anchorRight = 1)
|
||||
grid4 = snack.Grid(2, 1)
|
||||
grid4.setField(snack.Label("Connectivity:"), 0, 0, anchorRight = 1)
|
||||
if self.__config.is_isolated_network():
|
||||
grid4.setField(Label("Isolated virtual network"), 1, 0, anchorLeft = 1)
|
||||
grid4.setField(snack.Label("Isolated virtual network"), 1, 0, anchorLeft = 1)
|
||||
else:
|
||||
grid4.setField(Label("NAT to %s" % self.__config.get_physical_device_text()), 1, 0, anchorLeft = 1)
|
||||
grid4.setField(snack.Label("NAT to %s" % self.__config.get_physical_device_text()), 1, 0, anchorLeft = 1)
|
||||
|
||||
return [Label("Ready To Create Network"),
|
||||
Label("Summary"),
|
||||
return [snack.Label("Ready To Create Network"),
|
||||
snack.Label("Summary"),
|
||||
grid1,
|
||||
Label("IPv4 Network"),
|
||||
snack.Label("IPv4 Network"),
|
||||
grid2,
|
||||
Label("DHCP"),
|
||||
snack.Label("DHCP"),
|
||||
grid3,
|
||||
Label("Forwarding"),
|
||||
snack.Label("Forwarding"),
|
||||
grid4]
|
||||
|
||||
def DefineNetwork():
|
||||
|
@ -16,13 +16,13 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
|
||||
from configscreen import *
|
||||
from configscreen import ConfigScreen
|
||||
|
||||
class HostConnectConfigScreen(ConfigScreen):
|
||||
def __init__(self):
|
||||
ConfigScree
|
||||
ConfigScreen.__init__(self)
|
||||
|
||||
def HostConnect():
|
||||
screen = HostConnectConfigScreen()
|
||||
|
@ -16,7 +16,7 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
|
||||
from menuscreen import MenuScreen
|
||||
from changehost import ChangeHost
|
||||
|
@ -18,9 +18,9 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
from libvirtworker import LibvirtWorker
|
||||
from configscreen import *
|
||||
from configscreen import DomainListConfigScreen
|
||||
|
||||
class ListDomainsConfigScreen(DomainListConfigScreen):
|
||||
LIST_PAGE = 1
|
||||
@ -86,14 +86,14 @@ class ListDomainsConfigScreen(DomainListConfigScreen):
|
||||
fields.append(("Type", setype))
|
||||
fields.append(("Label", vmlabel))
|
||||
|
||||
grid = Grid(2, len(fields))
|
||||
grid = snack.Grid(2, len(fields))
|
||||
row = 0
|
||||
for field in fields:
|
||||
if field[1] is not None:
|
||||
grid.setField(Label("%s : " % field[0]), 0, row, anchorRight = 1)
|
||||
grid.setField(Label(field[1]), 1, row, anchorLeft = 1)
|
||||
grid.setField(snack.Label("%s : " % field[0]), 0, row, anchorRight = 1)
|
||||
grid.setField(snack.Label(field[1]), 1, row, anchorLeft = 1)
|
||||
else:
|
||||
grid.setField(Label("%s" % field[0]), 1, row)
|
||||
grid.setField(snack.Label("%s" % field[0]), 1, row)
|
||||
row += 1
|
||||
|
||||
return [grid]
|
||||
|
@ -16,7 +16,8 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from configscreen import *
|
||||
import snack
|
||||
from configscreen import NetworkListConfigScreen
|
||||
|
||||
LIST_PAGE = 1
|
||||
DETAILS_PAGE = 2
|
||||
@ -62,17 +63,17 @@ class ListNetworksConfigScreen(NetworkListConfigScreen):
|
||||
|
||||
fields.append(("Forwarding", network.pretty_forward_mode()))
|
||||
|
||||
grid = Grid(2, len(fields))
|
||||
grid = snack.Grid(2, len(fields))
|
||||
row = 0
|
||||
for field in fields:
|
||||
if field[1] is not None:
|
||||
grid.setField(Label("%s : "% field[0]), 0, row, anchorRight = 1)
|
||||
grid.setField(Label(field[1]), 1, row, anchorLeft = 1)
|
||||
grid.setField(snack.Label("%s : "% field[0]), 0, row, anchorRight = 1)
|
||||
grid.setField(snack.Label(field[1]), 1, row, anchorLeft = 1)
|
||||
else:
|
||||
grid.setField(Label(field[0]), 1, row)
|
||||
grid.setField(snack.Label(field[0]), 1, row)
|
||||
row += 1
|
||||
|
||||
return [Label("Network Interface Details"), grid]
|
||||
return [snack.Label("Network Interface Details"), grid]
|
||||
|
||||
def ListNetworks():
|
||||
screen = ListNetworksConfigScreen()
|
||||
|
@ -16,10 +16,10 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
|
||||
from configscreen import *
|
||||
from utils import *
|
||||
from configscreen import StorageListConfigScreen
|
||||
import utils
|
||||
|
||||
LIST_PAGE = 1
|
||||
DETAILS_PAGE = 2
|
||||
@ -43,20 +43,20 @@ class ListStoragePoolsConfigScreen(StorageListConfigScreen):
|
||||
|
||||
def get_pool_details_page(self, screen):
|
||||
pool = self.get_libvirt().get_storage_pool(self.get_selected_pool())
|
||||
volumes = Listbox(0);
|
||||
volumes = snack.Listbox(0);
|
||||
for name in pool.listVolumes():
|
||||
volume = pool.storageVolLookupByName(name)
|
||||
volumes.append("%s (%s)" % (name, size_as_mb_or_gb(volume.info()[1])), name)
|
||||
grid = Grid(2, 3)
|
||||
grid.setField(Label("Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(Label(pool.name()), 1, 0, anchorLeft = 1)
|
||||
grid.setField(Label("Volumes:"), 0, 1, anchorRight = 1)
|
||||
volumes.append("%s (%s)" % (name, util.size_as_mb_or_gb(volume.info()[1])), name)
|
||||
grid = snack.Grid(2, 3)
|
||||
grid.setField(snack.Label("Name:"), 0, 0, anchorRight = 1)
|
||||
grid.setField(snack.Label(pool.name()), 1, 0, anchorLeft = 1)
|
||||
grid.setField(snack.Label("Volumes:"), 0, 1, anchorRight = 1)
|
||||
grid.setField(volumes, 1, 1, anchorLeft = 1)
|
||||
grid.setField(Label("Autostart:"), 0, 2, anchorRight = 1)
|
||||
grid.setField(snack.Label("Autostart:"), 0, 2, anchorRight = 1)
|
||||
label = "No"
|
||||
if pool.autostart(): label = "Yes"
|
||||
grid.setField(Label(label), 1, 2, anchorLeft = 1)
|
||||
return [Label("Details For Storage Pool: %s" % self.get_selected_pool()),
|
||||
grid.setField(snack.Label(label), 1, 2, anchorLeft = 1)
|
||||
return [snack.Label("Details For Storage Pool: %s" % self.get_selected_pool()),
|
||||
grid]
|
||||
|
||||
def ListStoragePools():
|
||||
|
@ -16,7 +16,7 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
import traceback
|
||||
|
||||
from menuscreen import MenuScreen
|
||||
|
@ -16,7 +16,7 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
import traceback
|
||||
|
||||
import utils
|
||||
@ -31,12 +31,12 @@ class MenuScreen:
|
||||
def start(self):
|
||||
finished = False
|
||||
while finished == False:
|
||||
screen = SnackScreen()
|
||||
menu = Listbox(height = 0, width = 0, returnExit = 1)
|
||||
screen = snack.SnackScreen()
|
||||
menu = snack.Listbox(height = 0, width = 0, returnExit = 1)
|
||||
for menu_item in self.get_menu_items():
|
||||
menu.append(menu_item[0], menu_item[1])
|
||||
menu.append("Exit Menu", EXIT_MENU)
|
||||
gridform = GridForm(screen, self.__title, 1, 4)
|
||||
gridform = snack.GridForm(screen, self.__title, 1, 4)
|
||||
gridform.add(menu, 0, 0)
|
||||
result = gridform.run();
|
||||
screen.popWindow()
|
||||
@ -46,9 +46,9 @@ class MenuScreen:
|
||||
if result.current() == EXIT_MENU: finished = True
|
||||
else: self.handle_selection(result.current())
|
||||
except Exception, error:
|
||||
screen = SnackScreen()
|
||||
screen = snack.SnackScreen()
|
||||
logging.info("An exception occurred: %s" % str(error))
|
||||
ButtonChoiceWindow(screen,
|
||||
snack.ButtonChoiceWindow(screen,
|
||||
"An Exception Has Occurred",
|
||||
str(error) + "\n" + traceback.format_exc(),
|
||||
buttons = ["OK"])
|
||||
|
@ -18,9 +18,9 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
from libvirtworker import LibvirtWorker
|
||||
from configscreen import *
|
||||
from configscreen import DomainListConfigScreen
|
||||
|
||||
LIST_DOMAINS = 1
|
||||
SELECT_TARGET = 2
|
||||
@ -64,15 +64,15 @@ class MigrateDomainConfigScreen(DomainListConfigScreen):
|
||||
self.set_finished()
|
||||
|
||||
def get_target_page(self, screen):
|
||||
self.__targets = Listbox(0)
|
||||
self.__targets = snack.Listbox(0)
|
||||
for connection in self.get_virt_manager_config().get_connection_list():
|
||||
self.__targets.append(connection, connection)
|
||||
return [Label("Select A Target Host"),
|
||||
return [snack.Label("Select A Target Host"),
|
||||
self.__targets]
|
||||
|
||||
def get_confirm_page(self, screen):
|
||||
self.__confirm = Checkbox("Confirm migrating this virtual machine.")
|
||||
grid = Grid(1, 1)
|
||||
self.__confirm = snack.Checkbox("Confirm migrating this virtual machine.")
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(self.__confirm, 0, 0)
|
||||
return [grid]
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
import traceback
|
||||
|
||||
from menuscreen import MenuScreen
|
||||
|
@ -16,7 +16,7 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
import traceback
|
||||
|
||||
from menuscreen import MenuScreen
|
||||
|
@ -18,8 +18,8 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
from configscreen import *
|
||||
import snack
|
||||
from configscreen import DomainListConfigScreen
|
||||
|
||||
class PauseDomainConfigScreen(DomainListConfigScreen):
|
||||
LIST_PAGE = 1
|
||||
@ -60,8 +60,8 @@ class PauseDomainConfigScreen(DomainListConfigScreen):
|
||||
return False
|
||||
|
||||
def get_stop_page(self, screen):
|
||||
grid = Grid(1, 1)
|
||||
grid.setField(Label("%s was successfully paused." % self.get_selected_domain().get_name()), 0, 0)
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(snack.Label("%s was successfully paused." % self.get_selected_domain().get_name()), 0, 0)
|
||||
return [grid]
|
||||
|
||||
def PauseDomain():
|
||||
|
@ -18,8 +18,8 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
from configscreen import *
|
||||
import snack
|
||||
from configscreen import DomainListConfigScreen
|
||||
|
||||
class RemoveDomainConfigScreen(DomainListConfigScreen):
|
||||
LIST_PAGE = 1
|
||||
@ -68,14 +68,14 @@ class RemoveDomainConfigScreen(DomainListConfigScreen):
|
||||
return False
|
||||
|
||||
def get_confirm_page(self, screen):
|
||||
self.__confirm_remove = Checkbox("Check here to confirm undefining %s." % self.get_selected_domain().get_name(), 0)
|
||||
grid = Grid(1, 1)
|
||||
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]
|
||||
|
||||
def get_remove_page(self, screen):
|
||||
grid = Grid(1, 1)
|
||||
grid.setField(Label("%s has been removed." % self.get_selected_domain().get_name()), 0, 0)
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(snack.Label("%s has been removed." % self.get_selected_domain().get_name()), 0, 0)
|
||||
return [grid]
|
||||
|
||||
def RemoveDomain():
|
||||
|
@ -16,9 +16,9 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
|
||||
from configscreen import *
|
||||
from configscreen import HostListConfigScreen
|
||||
|
||||
SELECT_HOST_PAGE = 1
|
||||
CONFIRM_REMOVE_PAGE = 2
|
||||
@ -55,10 +55,10 @@ class RemoveHostConfigScreen(HostListConfigScreen):
|
||||
self.set_finished()
|
||||
|
||||
def get_confirm_remove_page(self, screen):
|
||||
self.__confirm = Checkbox("Remove this connection: %s" % self.get_selected_connection(), 0)
|
||||
grid = Grid(1, 1)
|
||||
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 [Label("Remove Host Connection"),
|
||||
return [snack.Label("Remove Host Connection"),
|
||||
grid]
|
||||
|
||||
def RemoveHost():
|
||||
|
@ -18,8 +18,8 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
from configscreen import *
|
||||
import snack
|
||||
from configscreen import StorageListConfigScreen
|
||||
|
||||
LIST_POOLS_PAGE = 1
|
||||
CONFIRM_PAGE = 2
|
||||
@ -61,10 +61,10 @@ class RemoveStoragePoolConfigScreen(StorageListConfigScreen):
|
||||
self.set_finished()
|
||||
|
||||
def get_confirm_page(self, screen):
|
||||
self.__confirm = Checkbox("Check here to confirm deleting pool: %s" % self.get_selected_pool())
|
||||
grid = Grid(1, 1)
|
||||
self.__confirm = snack.Checkbox("Check here to confirm deleting pool: %s" % self.get_selected_pool())
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(self.__confirm, 0, 0)
|
||||
return [Label("Remove Selected Storage Pool"),
|
||||
return [snack.Label("Remove Selected Storage Pool"),
|
||||
grid]
|
||||
|
||||
def RemoveStoragePool():
|
||||
|
@ -16,13 +16,13 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
import traceback
|
||||
|
||||
import utils
|
||||
from createmeter import CreateMeter
|
||||
from configscreen import *
|
||||
from configscreen import StorageListConfigScreen
|
||||
from volumeconfig import StorageVolumeConfig
|
||||
from utils import *
|
||||
|
||||
SELECT_POOL_PAGE = 1
|
||||
SELECT_VOLUME_PAGE = 2
|
||||
@ -65,10 +65,10 @@ class RemoveVolumeConfigScreen(StorageListConfigScreen):
|
||||
return page is CONFIRM_PAGE
|
||||
|
||||
def get_confirm_page(self, screen):
|
||||
self.__confirm = Checkbox("Check here to confirm deleting volume: %s" % self.get_selected_volume())
|
||||
grid = Grid(1, 1)
|
||||
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 [Label("Remove Selected Storage Volume"),
|
||||
return [snack.Label("Remove Selected Storage Volume"),
|
||||
grid]
|
||||
|
||||
def RemoveStorageVolume():
|
||||
|
@ -18,8 +18,8 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
from configscreen import *
|
||||
import snack
|
||||
from configscreen import DomainListConfigScreen
|
||||
|
||||
class StartDomainConfigScreen(DomainListConfigScreen):
|
||||
LIST_PAGE = 1
|
||||
@ -59,8 +59,8 @@ class StartDomainConfigScreen(DomainListConfigScreen):
|
||||
errors.append("You must first select a domain to start.")
|
||||
|
||||
def get_start_domain_page(self, screen):
|
||||
grid = Grid(1, 1)
|
||||
grid.setField(Label("%s was successfully started." % self.get_selected_domain().get_name()), 0, 0)
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(snack.Label("%s was successfully started." % self.get_selected_domain().get_name()), 0, 0)
|
||||
return [grid]
|
||||
|
||||
def StartDomain():
|
||||
|
@ -18,8 +18,8 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
from configscreen import *
|
||||
import snack
|
||||
from configscreen import NetworkListConfigScreen
|
||||
|
||||
LIST_PAGE = 1
|
||||
START_PAGE = 2
|
||||
@ -49,7 +49,7 @@ class StartNetworkConfigScreen(NetworkListConfigScreen):
|
||||
|
||||
def get_start_network_page(self, screen):
|
||||
network = self.get_selected_network()
|
||||
return [Label("%s was successfully started." % network.get_name())]
|
||||
return [snack.Label("%s was successfully started." % network.get_name())]
|
||||
|
||||
def StartNetwork():
|
||||
screen = StartNetworkConfigScreen()
|
||||
|
@ -18,8 +18,8 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
from configscreen import *
|
||||
import snack
|
||||
from configscreen import StorageListConfigScreen
|
||||
|
||||
LIST_POOLS_PAGE = 1
|
||||
FINAL_PAGE = 2
|
||||
@ -55,7 +55,7 @@ class StartStoragePoolConfigScreen(StorageListConfigScreen):
|
||||
self.set_finished()
|
||||
|
||||
def get_final_page(self, screen):
|
||||
return [Label("Storage pool started: %s" % self.get_selected_pool())]
|
||||
return [snack.Label("Storage pool started: %s" % self.get_selected_pool())]
|
||||
|
||||
def StartStoragePool():
|
||||
screen = StartStoragePoolConfigScreen()
|
||||
|
@ -18,8 +18,8 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
from configscreen import *
|
||||
import snack
|
||||
from configscreen import DomainListConfigScreen
|
||||
|
||||
class StopDomainConfigScreen(DomainListConfigScreen):
|
||||
LIST_PAGE = 1
|
||||
@ -60,8 +60,8 @@ class StopDomainConfigScreen(DomainListConfigScreen):
|
||||
return False
|
||||
|
||||
def get_stop_page(self, screen):
|
||||
grid = Grid(1, 1)
|
||||
grid.setField(Label("%s was successfully stopped." % self.get_selected_domain().get_name()), 0, 0)
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(snack.Label("%s was successfully stopped." % self.get_selected_domain().get_name()), 0, 0)
|
||||
return [grid]
|
||||
|
||||
def StopDomain():
|
||||
|
@ -18,8 +18,8 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
from configscreen import *
|
||||
import snack
|
||||
from configscreen import NetworkListConfigScreen
|
||||
|
||||
LIST_PAGE = 1
|
||||
STOP_PAGE = 2
|
||||
@ -49,7 +49,7 @@ class StopNetworkConfigScreen(NetworkListConfigScreen):
|
||||
|
||||
def get_stop_network_page(self, screen):
|
||||
network = self.get_selected_network()
|
||||
return [Label("%s has been stopped." % network.get_name())]
|
||||
return [snack.Label("%s has been stopped." % network.get_name())]
|
||||
|
||||
def StopNetwork():
|
||||
screen = StopNetworkConfigScreen()
|
||||
|
@ -18,8 +18,8 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
from configscreen import *
|
||||
import snack
|
||||
from configscreen import StorageListConfigScreen
|
||||
|
||||
LIST_POOLS_PAGE = 1
|
||||
FINAL_PAGE = 2
|
||||
@ -55,7 +55,7 @@ class StopStoragePoolConfigScreen(StorageListConfigScreen):
|
||||
self.set_finished()
|
||||
|
||||
def get_final_page(self, screen):
|
||||
return [Label("Storage pool stopped: %s" % self.get_selected_pool())]
|
||||
return [snack.Label("Storage pool stopped: %s" % self.get_selected_pool())]
|
||||
|
||||
def StopStoragePool():
|
||||
screen = StopStoragePoolConfigScreen()
|
||||
|
@ -16,7 +16,7 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
import snack
|
||||
import traceback
|
||||
|
||||
from menuscreen import MenuScreen
|
||||
|
@ -18,8 +18,8 @@
|
||||
# MA 02110-1301, USA. A copy of the GNU General Public License is
|
||||
# also available at http://www.gnu.org/copyleft/gpl.html.
|
||||
|
||||
from snack import *
|
||||
from configscreen import *
|
||||
import snack
|
||||
from configscreen import NetworkListConfigScreen
|
||||
|
||||
LIST_PAGE = 1
|
||||
CONFIRM_PAGE = 2
|
||||
@ -63,14 +63,14 @@ class UndefineNetworkConfigScreen(NetworkListConfigScreen):
|
||||
|
||||
def get_confirm_page(self, screen):
|
||||
network = self.get_selected_network()
|
||||
self.__confirm_undefine = Checkbox("Check here to confirm undefining %s." % network.get_name())
|
||||
grid = Grid(1, 1)
|
||||
self.__confirm_undefine = snack.Checkbox("Check here to confirm undefining %s." % network.get_name())
|
||||
grid = snack.Grid(1, 1)
|
||||
grid.setField(self.__confirm_undefine, 0, 0)
|
||||
return [grid]
|
||||
|
||||
def get_undefine_network_page(self, screen):
|
||||
network_name = self.__deleted_network_name
|
||||
return [Label("Network has been undefined: %s" % network_name)]
|
||||
return [snack.Label("Network has been undefined: %s" % network_name)]
|
||||
|
||||
def UndefineNetwork():
|
||||
screen = UndefineNetworkConfigScreen()
|
||||
|
Loading…
Reference in New Issue
Block a user