[virt-tools-list] [virt-manager PATCH] addhardware: fix a chaotic widget naming

Chen Hanxiao chenhanxiao at cn.fujitsu.com
Mon Jun 15 07:39:30 UTC 2015


char-mode:      should be an entry
char-bind-host: should be an ComboBox

We mixed them, and much of the code use the improper naming,
but at least one got lost.

How to find:
Add Hardware->Serial->Tcp net console,
you could find that short-cut for 'Mode' missing :)

Signed-off-by: Chen Hanxiao <chenhanxiao at cn.fujitsu.com>
---
 ui/addhardware.ui          |  6 +++---
 virtManager/addhardware.py | 18 +++++++++---------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/ui/addhardware.ui b/ui/addhardware.ui
index a42f840..7ef9134 100644
--- a/ui/addhardware.ui
+++ b/ui/addhardware.ui
@@ -790,7 +790,7 @@
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkComboBox" id="char-mode">
+                              <object class="GtkComboBox" id="char-bind-host">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="halign">start</property>
@@ -855,7 +855,7 @@
                                 <property name="can_focus">False</property>
                                 <property name="spacing">6</property>
                                 <child>
-                                  <object class="GtkEntry" id="char-bind-host">
+                                  <object class="GtkEntry" id="char-mode">
                                     <property name="visible">True</property>
                                     <property name="can_focus">True</property>
                                   </object>
@@ -947,7 +947,7 @@
                                 <property name="xalign">0</property>
                                 <property name="label" translatable="yes">_Bind Host:</property>
                                 <property name="use_underline">True</property>
-                                <property name="mnemonic_widget">char-mode</property>
+                                <property name="mnemonic_widget">char-bind-host</property>
                               </object>
                               <packing>
                                 <property name="left_attach">0</property>
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index 7607529..cd1e855 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -260,16 +260,16 @@ class vmmAddHardware(vmmGObjectUI):
         video_dev = self.widget("video-model")
         self.build_video_combo(self.vm, video_dev)
 
-        # Character dev mode
-        char_mode = self.widget("char-mode")
+        # Character bind host mode
+        char_bind_host = self.widget("char-bind-host")
         # Mode name, desc
-        char_mode_model = Gtk.ListStore(str, str)
-        char_mode.set_model(char_mode_model)
-        uiutil.init_combo_text_column(char_mode, 1)
-        char_mode_model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
+        char_bind_host_model = Gtk.ListStore(str, str)
+        char_bind_host.set_model(char_bind_host_model)
+        uiutil.init_combo_text_column(char_bind_host, 1)
+        char_bind_host_model.set_sort_column_id(0, Gtk.SortType.ASCENDING)
         for t in VirtualSerialDevice.MODES:
             desc = VirtualSerialDevice.pretty_mode(t)
-            char_mode_model.append([t, desc + " (%s)" % t])
+            char_bind_host_model.append([t, desc + " (%s)" % t])
 
         # Char target type
         lst = self.widget("char-target-type")
@@ -447,7 +447,7 @@ class vmmAddHardware(vmmGObjectUI):
         self.widget("char-channel").set_text("")
         self.widget("char-host").set_text("127.0.0.1")
         self.widget("char-port").set_value(4555)
-        self.widget("char-bind-host").set_text("127.0.0.1")
+        self.widget("char-mode").set_text("127.0.0.1")
         self.widget("char-bind-port").set_value(4556)
         self.widget("char-use-telnet").set_active(False)
         self.widget("char-auto-socket").set_active(True)
@@ -1674,7 +1674,7 @@ class vmmAddHardware(vmmGObjectUI):
         source_channel = self.widget("char-channel").get_text()
         source_mode = uiutil.get_list_selection(modebox)
         source_host = self.widget("char-host").get_text()
-        bind_host = self.widget("char-bind-host").get_text()
+        bind_host = self.widget("char-mode").get_text()
         source_port = self.widget("char-port").get_value()
         bind_port = self.widget("char-bind-port").get_value()
         target_name = self.widget("char-target-name").get_child().get_text()
-- 
2.1.0




More information about the virt-tools-list mailing list