[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [PATCH 05/10] Renamed createnetwork.py to startnetwork.py.



The old name was not consistent with the add/delete/start/stop/list
verbs used for commands.

Updated the network menu to use the new name and module.
---
 src/virtManagerTui/createnetwork.py |   52 -----------------------------------
 src/virtManagerTui/netmenu.py       |    8 +++---
 src/virtManagerTui/startnetwork.py  |   52 +++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 56 deletions(-)
 delete mode 100644 src/virtManagerTui/createnetwork.py
 create mode 100644 src/virtManagerTui/startnetwork.py

diff --git a/src/virtManagerTui/createnetwork.py b/src/virtManagerTui/createnetwork.py
deleted file mode 100644
index 6b40bb6..0000000
--- a/src/virtManagerTui/createnetwork.py
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env python
-#
-# createnetwork.py - Copyright (C) 2009 Red Hat, Inc.
-# Written by Darryl L. Pierce <dpierce 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 *
-from configscreen import *
-
-LIST_PAGE   = 1
-CREATE_PAGE = 2
-
-class CreateNetworkConfigScreen(NetworkListConfigScreen):
-    def __init__(self):
-        NetworkListConfigScreen.__init__(self, "Create A Network")
-
-    def get_elements_for_page(self, screen, page):
-        if   page is LIST_PAGE:   return self.get_network_list_page(screen, created = False)
-        elif page is CREATE_PAGE: return self.get_create_network_page(screen)
-
-    def page_has_next(self, page):
-        if page is LIST_PAGE: return self.has_selectable_networks()
-
-    def page_has_back(self, page):
-        return (page is CREATE_PAGE)
-
-    def validate_input(self, page, errors):
-        if page is LIST_PAGE:
-            self.get_libvirt().create_network(self.get_selected_network())
-            return True
-
-    def get_create_network_page(self, screen):
-        return [Label("Network Started"),
-                Label("%s was successfully started." % self.get_selected_network())]
-
-def CreateNetwork():
-    screen = CreateNetworkConfigScreen()
-    screen.start()
diff --git a/src/virtManagerTui/netmenu.py b/src/virtManagerTui/netmenu.py
index 88e159f..4fb3a32 100644
--- a/src/virtManagerTui/netmenu.py
+++ b/src/virtManagerTui/netmenu.py
@@ -21,7 +21,7 @@ import traceback
 
 from menuscreen      import MenuScreen
 from definenet       import DefineNetwork
-from createnetwork   import CreateNetwork
+from startnetwork    import StartNetwork
 from destroynetwork  import DestroyNetwork
 from undefinenetwork import UndefineNetwork
 from listnetworks    import ListNetworks
@@ -30,7 +30,7 @@ import utils
 import logging
 
 DEFINE_NETWORK   = 1
-CREATE_NETWORK   = 2
+START_NETWORK    = 2
 DESTROY_NETWORK  = 3
 UNDEFINE_NETWORK = 4
 LIST_NETWORKS    = 5
@@ -41,14 +41,14 @@ class NetworkMenuScreen(MenuScreen):
 
     def get_menu_items(self):
         return (("Define A Network",   DEFINE_NETWORK),
-                ("Create A Network",   CREATE_NETWORK),
+                ("Start A Network",    START_NETWORK),
                 ("Destroy A Network",  DESTROY_NETWORK),
                 ("Undefine A Network", UNDEFINE_NETWORK),
                 ("List Networks",      LIST_NETWORKS))
 
     def handle_selection(self, item):
         if   item is DEFINE_NETWORK:   DefineNetwork()
-        elif item is CREATE_NETWORK:   CreateNetwork()
+        elif item is START_NETWORK:    StartNetwork()
         elif item is DESTROY_NETWORK:  DestroyNetwork()
         elif item is UNDEFINE_NETWORK: UndefineNetwork()
         elif item is LIST_NETWORKS:    ListNetworks()
diff --git a/src/virtManagerTui/startnetwork.py b/src/virtManagerTui/startnetwork.py
new file mode 100644
index 0000000..a54da8c
--- /dev/null
+++ b/src/virtManagerTui/startnetwork.py
@@ -0,0 +1,52 @@
+#!/usr/bin/env python
+#
+# startnetwork.py - Copyright (C) 2009 Red Hat, Inc.
+# Written by Darryl L. Pierce <dpierce 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 *
+from configscreen import *
+
+LIST_PAGE   = 1
+START_PAGE = 2
+
+class StartNetworkConfigScreen(NetworkListConfigScreen):
+    def __init__(self):
+        NetworkListConfigScreen.__init__(self, "Start A Network")
+
+    def get_elements_for_page(self, screen, page):
+        if   page is LIST_PAGE:  return self.get_network_list_page(screen, created = False)
+        elif page is START_PAGE: return self.get_start_network_page(screen)
+
+    def page_has_next(self, page):
+        if page is LIST_PAGE: return self.has_selectable_networks()
+
+    def page_has_back(self, page):
+        return (page is START_PAGE)
+
+    def validate_input(self, page, errors):
+        if page is LIST_PAGE:
+            self.get_libvirt().start_network(self.get_selected_network())
+            return True
+
+    def get_start_network_page(self, screen):
+        return [Label("Network Started"),
+                Label("%s was successfully started." % self.get_selected_network())]
+
+def StartNetwork():
+    screen = StartNetworkConfigScreen()
+    screen.start()
-- 
1.7.5.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]