[virt-tools-list] [PATCH 9/9] Renamed undefinenetwork.py to removenetwork.py.
Darryl L. Pierce
dpierce at redhat.com
Fri Jul 15 14:02:26 UTC 2011
From: "Darryl L. Pierce" <dpierce at redhat.com>
This makes the command name more consistent with other, similar
commands.
Updated all affected modules as well.
---
src/virtManagerTui/netmenu.py | 10 ++--
src/virtManagerTui/removenetwork.py | 93 +++++++++++++++++++++++++++++++++
src/virtManagerTui/undefinenetwork.py | 93 ---------------------------------
3 files changed, 98 insertions(+), 98 deletions(-)
create mode 100644 src/virtManagerTui/removenetwork.py
delete mode 100644 src/virtManagerTui/undefinenetwork.py
diff --git a/src/virtManagerTui/netmenu.py b/src/virtManagerTui/netmenu.py
index 1f646f0..5405ef8 100644
--- a/src/virtManagerTui/netmenu.py
+++ b/src/virtManagerTui/netmenu.py
@@ -21,13 +21,13 @@ from newt_syrup.menuscreen import MenuScreen
from addnetwork import AddNetwork
from startnetwork import StartNetwork
from stopnetwork import StopNetwork
-from undefinenetwork import UndefineNetwork
+from removenetwork import RemoveNetwork
from listnetworks import ListNetworks
ADD_NETWORK = 1
START_NETWORK = 2
STOP_NETWORK = 3
-UNDEFINE_NETWORK = 4
+REMOVE_NETWORK = 4
LIST_NETWORKS = 5
class NetworkMenuScreen(MenuScreen):
@@ -38,7 +38,7 @@ class NetworkMenuScreen(MenuScreen):
return (("Add A Network", ADD_NETWORK),
("Start A Network", START_NETWORK),
("Stop A Network", STOP_NETWORK),
- ("Undefine A Network", UNDEFINE_NETWORK),
+ ("Remove A Network", REMOVE_NETWORK),
("List Networks", LIST_NETWORKS))
def handle_selection(self, item):
@@ -48,8 +48,8 @@ class NetworkMenuScreen(MenuScreen):
StartNetwork()
elif item is STOP_NETWORK:
StopNetwork()
- elif item is UNDEFINE_NETWORK:
- UndefineNetwork()
+ elif item is REMOVE_NETWORK:
+ RemoveNetwork()
elif item is LIST_NETWORKS:
ListNetworks()
diff --git a/src/virtManagerTui/removenetwork.py b/src/virtManagerTui/removenetwork.py
new file mode 100644
index 0000000..5cf18aa
--- /dev/null
+++ b/src/virtManagerTui/removenetwork.py
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+#
+# removenetwork.py - Copyright (C) 2009 Red Hat, Inc.
+# Written by Darryl L. Pierce <dpierce at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# 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 Checkbox
+from snack import Label
+from networklistconfigscreen import NetworkListConfigScreen
+
+LIST_PAGE = 1
+CONFIRM_PAGE = 2
+REMOVE_PAGE = 3
+
+class RemoveNetworkConfigScreen(NetworkListConfigScreen):
+ def __init__(self):
+ NetworkListConfigScreen.__init__(self, "Remove A Network")
+ self.__deleted_network_name = None
+ self.__confirm_remove = None
+
+ def get_elements_for_page(self, screen, page):
+ if page is LIST_PAGE:
+ return self.get_network_list_page(screen, started=False)
+ elif page is CONFIRM_PAGE:
+ return self.get_confirm_page(screen)
+ elif page is REMOVE_PAGE:
+ return self.get_remove_network_page(screen)
+
+ def page_has_next(self, page):
+ if page is LIST_PAGE:
+ return self.has_selectable_networks()
+ if page is CONFIRM_PAGE:
+ return True
+ return False
+
+ def page_has_back(self, page):
+ if page is CONFIRM_PAGE:
+ return True
+ if page is REMOVE_PAGE:
+ return True
+ return False
+
+ def get_back_page(self, page):
+ if page is CONFIRM_PAGE:
+ return LIST_PAGE
+ elif page is REMOVE_PAGE:
+ return LIST_PAGE
+
+ def validate_input(self, page, errors):
+ if page is LIST_PAGE:
+ return True
+ elif page is CONFIRM_PAGE:
+ network = self.get_selected_network()
+ if self.__confirm_remove.value():
+ self.__deleted_network_name = network.get_name()
+ network.delete()
+ return True
+ else:
+ errors.append("You must confirm undefining %s." % network.get_name())
+ elif page is REMOVE_PAGE:
+ return True
+ return False
+
+ def get_confirm_page(self, screen):
+ ignore = screen
+ network = self.get_selected_network()
+ self.__confirm_remove = Checkbox("Check here to confirm undefining %s." % network.get_name())
+ fields = []
+ fields.append((self.__confirm_remove, None))
+ return [self.create_grid_from_fields(fields)]
+
+ def get_remove_network_page(self, screen):
+ ignore = screen
+ network_name = self.__deleted_network_name
+ return [Label("Network has been removed: %s" % network_name)]
+
+def RemoveNetwork():
+ screen = RemoveNetworkConfigScreen()
+ screen.start()
diff --git a/src/virtManagerTui/undefinenetwork.py b/src/virtManagerTui/undefinenetwork.py
deleted file mode 100644
index a40c86f..0000000
--- a/src/virtManagerTui/undefinenetwork.py
+++ /dev/null
@@ -1,93 +0,0 @@
-#!/usr/bin/env python
-#
-# undefinenetwork.py - Copyright (C) 2009 Red Hat, Inc.
-# Written by Darryl L. Pierce <dpierce at redhat.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# 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 Checkbox
-from snack import Label
-from networklistconfigscreen import NetworkListConfigScreen
-
-LIST_PAGE = 1
-CONFIRM_PAGE = 2
-UNDEFINE_PAGE = 3
-
-class UndefineNetworkConfigScreen(NetworkListConfigScreen):
- def __init__(self):
- NetworkListConfigScreen.__init__(self, "Undefine A Network")
- self.__deleted_network_name = None
- self.__confirm_undefine = None
-
- def get_elements_for_page(self, screen, page):
- if page is LIST_PAGE:
- return self.get_network_list_page(screen, started=False)
- elif page is CONFIRM_PAGE:
- return self.get_confirm_page(screen)
- elif page is UNDEFINE_PAGE:
- return self.get_undefine_network_page(screen)
-
- def page_has_next(self, page):
- if page is LIST_PAGE:
- return self.has_selectable_networks()
- if page is CONFIRM_PAGE:
- return True
- return False
-
- def page_has_back(self, page):
- if page is CONFIRM_PAGE:
- return True
- if page is UNDEFINE_PAGE:
- return True
- return False
-
- def get_back_page(self, page):
- if page is CONFIRM_PAGE:
- return LIST_PAGE
- elif page is UNDEFINE_PAGE:
- return LIST_PAGE
-
- def validate_input(self, page, errors):
- if page is LIST_PAGE:
- return True
- elif page is CONFIRM_PAGE:
- network = self.get_selected_network()
- if self.__confirm_undefine.value():
- self.__deleted_network_name = network.get_name()
- network.delete()
- return True
- else:
- errors.append("You must confirm undefining %s." % network.get_name())
- elif page is UNDEFINE_PAGE:
- return True
- return False
-
- def get_confirm_page(self, screen):
- ignore = screen
- network = self.get_selected_network()
- self.__confirm_undefine = Checkbox("Check here to confirm undefining %s." % network.get_name())
- fields = []
- fields.append((self.__confirm_undefine, None))
- return [self.create_grid_from_fields(fields)]
-
- def get_undefine_network_page(self, screen):
- ignore = screen
- network_name = self.__deleted_network_name
- return [Label("Network has been undefined: %s" % network_name)]
-
-def UndefineNetwork():
- screen = UndefineNetworkConfigScreen()
- screen.start()
--
1.7.6
More information about the virt-tools-list
mailing list