3
# destroynetwork.py - Copyright (C) 2009 Red Hat, Inc.
4
# Written by Darryl L. Pierce <dpierce@redhat.com>
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; version 2 of the License.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
# MA 02110-1301, USA. A copy of the GNU General Public License is
19
# also available at http://www.gnu.org/copyleft/gpl.html.
22
from configscreen import *
27
class DestroyNetworkConfigScreen(NetworkListConfigScreen):
29
NetworkListConfigScreen.__init__(self, "Destroy A Network")
31
def get_elements_for_page(self, screen, page):
32
if page is LIST_PAGE: return self.get_network_list_page(screen, defined = False)
33
elif page is DESTROY_PAGE: return self.get_destroy_network_page(screen)
35
def page_has_next(self, page):
36
if page is LIST_PAGE: return self.has_selectable_networks()
39
def page_has_back(self, page):
40
if page is DESTROY_PAGE: return True
43
def validate_input(self, page, errors):
45
network = self.get_selected_network()
46
self.get_libvirt().destroy_network(network)
50
def get_destroy_network_page(self, screen):
51
return [Label("Network Destroyed"),
52
Label("%s has been destroyed." % self.get_selected_network())]
55
screen = DestroyNetworkConfigScreen()