[virt-tools-list] [virt-manager PATCH 2/5] virtManager: remove panic iobase from GUI

Pavel Hrdina phrdina at redhat.com
Tue Sep 5 07:59:16 UTC 2017


This is advanced configuration and it's not required to configure
at all to have a working panic device.

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 ui/addhardware.ui          | 25 -------------------------
 ui/details.ui              | 23 -----------------------
 virtManager/addhardware.py | 14 ++------------
 virtManager/details.py     | 14 +-------------
 virtinst/devicepanic.py    |  1 -
 5 files changed, 3 insertions(+), 74 deletions(-)

diff --git a/ui/addhardware.ui b/ui/addhardware.ui
index f41f6528..caee0be6 100644
--- a/ui/addhardware.ui
+++ b/ui/addhardware.ui
@@ -1743,31 +1743,6 @@
                                 <property name="top_attach">0</property>
                               </packing>
                             </child>
-                            <child>
-                              <object class="GtkLabel" id="panic-iobase-label">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="halign">start</property>
-                                <property name="label" translatable="yes">_IO Base:</property>
-                                <property name="use_underline">True</property>
-                                <property name="mnemonic_widget">panic-iobase</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">0</property>
-                                <property name="top_attach">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkEntry" id="panic-iobase">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="invisible_char">●</property>
-                              </object>
-                              <packing>
-                                <property name="left_attach">1</property>
-                                <property name="top_attach">1</property>
-                              </packing>
-                            </child>
                           </object>
                           <packing>
                             <property name="position">16</property>
diff --git a/ui/details.ui b/ui/details.ui
index dce332cc..04d2b213 100644
--- a/ui/details.ui
+++ b/ui/details.ui
@@ -5674,17 +5674,6 @@ if you know what you are doing.</small></property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkLabel" id="label96">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="halign">start</property>
-                                        <property name="label" translatable="yes">IO Base:</property>
-                                      </object>
-                                      <packing>
-                                        <property name="left_attach">0</property>
-                                        <property name="top_attach">1</property>
-                                      </packing>
-                                    </child>
                                     <child>
                                       <object class="GtkLabel" id="panic-type">
                                         <property name="visible">True</property>
@@ -5697,18 +5686,6 @@ if you know what you are doing.</small></property>
                                         <property name="top_attach">0</property>
                                       </packing>
                                     </child>
-                                    <child>
-                                      <object class="GtkLabel" id="panic-iobase">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="halign">start</property>
-                                        <property name="label" translatable="yes">panic-iobase</property>
-                                      </object>
-                                      <packing>
-                                        <property name="left_attach">1</property>
-                                        <property name="top_attach">1</property>
-                                      </packing>
-                                    </child>
                                   </object>
                                 </child>
                               </object>
diff --git a/virtManager/addhardware.py b/virtManager/addhardware.py
index 4d142c90..415e7e90 100644
--- a/virtManager/addhardware.py
+++ b/virtManager/addhardware.py
@@ -477,9 +477,6 @@ class vmmAddHardware(vmmGObjectUI):
         for i in ["rng-bind-service", "rng-connect-service"]:
             self.widget(i).set_text("708")
 
-        # Panic device params
-        self.widget("panic-iobase").set_text("0x505")
-
         # Controller device params
         self._populate_controller_type()
 
@@ -1758,18 +1755,11 @@ class vmmAddHardware(vmmGObjectUI):
     def _validate_page_panic(self):
         conn = self.conn.get_backend()
 
-        iobase = self.widget("panic-iobase").get_text()
-
-        value_mappings = {
-            "iobase": iobase,
-        }
+        type = uiutil.get_list_selection(self.widget("panic-type"))
 
         try:
             self._dev = VirtualPanicDevice(conn)
-            if not iobase:
-                iobase = self._dev.IOBASE_DEFAULT
-            for param_name, val in value_mappings.items():
-                setattr(self._dev, param_name, val)
+            self._dev.type = type
         except Exception as e:
             return self.err.val_err(_("Panic device parameter error"), e)
 
diff --git a/virtManager/details.py b/virtManager/details.py
index 4d1ae2cb..9ec2d8de 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -2795,20 +2795,8 @@ class vmmDetails(vmmGObjectUI):
         if not dev:
             return
 
-        def show_ui(param, val=None):
-            widgetname = "panic-" + param.replace("_", "-")
-            if not val:
-                val = getattr(dev, param)
-                if not val:
-                    propername = param.upper() + "_DEFAULT"
-                    val = getattr(virtinst.VirtualPanicDevice, propername, "-").upper()
-
-            uiutil.set_grid_row_visible(self.widget(widgetname), True)
-            self.widget(widgetname).set_text(val or "-")
-
         ptyp = virtinst.VirtualPanicDevice.get_pretty_type(dev.type)
-        show_ui("type", ptyp)
-        show_ui("iobase")
+        self.widget("panic-type").set_text(ptyp)
 
     def refresh_rng_page(self):
         dev = self.get_hw_selection(HW_LIST_COL_DEVICE)
diff --git a/virtinst/devicepanic.py b/virtinst/devicepanic.py
index 4a56491e..8b9a161f 100644
--- a/virtinst/devicepanic.py
+++ b/virtinst/devicepanic.py
@@ -25,7 +25,6 @@ class VirtualPanicDevice(VirtualDevice):
 
     virtual_device_type = VirtualDevice.VIRTUAL_DEV_PANIC
     ADDRESS_TYPE_ISA = "isa"
-    TYPE_DEFAULT = ADDRESS_TYPE_ISA
     TYPES = [ADDRESS_TYPE_ISA]
     IOBASE_DEFAULT = "0x505"
 
-- 
2.13.5




More information about the virt-tools-list mailing list