[virt-tools-list] [PATCH 7/9] Updated listnetworks.py to use the new screen grid helper method.

Darryl L. Pierce dpierce at redhat.com
Fri Jul 15 14:02:24 UTC 2011


From: "Darryl L. Pierce" <dpierce at redhat.com>

---
 src/virtManagerTui/listnetworks.py |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/src/virtManagerTui/listnetworks.py b/src/virtManagerTui/listnetworks.py
index b276874..5590c0a 100644
--- a/src/virtManagerTui/listnetworks.py
+++ b/src/virtManagerTui/listnetworks.py
@@ -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.
 
-import snack
+from snack import Label
 from networklistconfigscreen import NetworkListConfigScreen
 
 LIST_PAGE    = 1
@@ -66,17 +66,8 @@ class ListNetworksConfigScreen(NetworkListConfigScreen):
 
         fields.append(("Forwarding", network.pretty_forward_mode()))
 
-        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(field[0]), 1, row)
-            row += 1
-
-        return [snack.Label("Network Interface Details"), grid]
+        return [Label("Network Interface Details"),
+                self.create_grid_from_fields(fields)]
 
 def ListNetworks():
     screen = ListNetworksConfigScreen()
-- 
1.7.6




More information about the virt-tools-list mailing list