[virt-tools-list] [PATCH 4/4] virt-manager: show correctly EGD RNG devices information
Giuseppe Scrivano
gscrivan at redhat.com
Fri Oct 25 15:13:29 UTC 2013
Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
ui/details.ui | 144 +++++++++++++++++++++++++++++--------------------
virtManager/details.py | 38 ++++++++-----
2 files changed, 111 insertions(+), 71 deletions(-)
diff --git a/ui/details.ui b/ui/details.ui
index a37544c..88ad9e1 100644
--- a/ui/details.ui
+++ b/ui/details.ui
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Fri Oct 4 08:04:58 2013 -->
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkAccelGroup" id="accelgroup1"/>
@@ -1380,8 +1379,8 @@
<property name="use_underline">True</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
- <signal name="activate" handler="on_security_type_changed" swapped="no"/>
<signal name="toggled" handler="on_security_type_changed" swapped="no"/>
+ <signal name="activate" handler="on_security_type_changed" swapped="no"/>
</object>
<packing>
<property name="x_options"/>
@@ -1528,7 +1527,6 @@
<object class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="vexpand">False</property>
<property name="spacing">12</property>
<child>
<object class="GtkFrame" id="frame24">
@@ -2013,7 +2011,6 @@
<object class="GtkExpander" id="expander5">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="vexpand">False</property>
<child>
<object class="GtkAlignment" id="alignment31">
<property name="visible">True</property>
@@ -2237,7 +2234,6 @@
<object class="GtkExpander" id="expander6">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="vexpand">False</property>
<child>
<object class="GtkAlignment" id="alignment39">
<property name="visible">True</property>
@@ -2475,7 +2471,6 @@
<object class="GtkExpander" id="expander3">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="vexpand">False</property>
<child>
<object class="GtkAlignment" id="alignment16">
<property name="visible">True</property>
@@ -3804,7 +3799,6 @@
<object class="GtkExpander" id="expander4">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="vexpand">False</property>
<child>
<object class="GtkBox" id="box10">
<property name="visible">True</property>
@@ -3815,7 +3809,6 @@
<object class="GtkGrid" id="table11">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">False</property>
<property name="row_spacing">3</property>
<property name="column_spacing">8</property>
<child>
@@ -3952,7 +3945,6 @@
<object class="GtkComboBox" id="disk-cache">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">False</property>
<property name="has_entry">True</property>
<signal name="changed" handler="on_disk_cache_combo_changed" swapped="no"/>
<child internal-child="entry">
@@ -3972,7 +3964,6 @@
<object class="GtkComboBox" id="disk-io">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">False</property>
<property name="has_entry">True</property>
<signal name="changed" handler="on_disk_io_combo_changed" swapped="no"/>
<child internal-child="entry">
@@ -4099,7 +4090,6 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">16</property>
- <property name="text" translatable="yes">0</property>
<property name="adjustment">adjustment8</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
@@ -4119,7 +4109,6 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">16</property>
- <property name="text" translatable="yes">0</property>
<property name="adjustment">adjustment9</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
@@ -4139,7 +4128,6 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">16</property>
- <property name="text" translatable="yes">0</property>
<property name="adjustment">adjustment10</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
@@ -4159,7 +4147,6 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">16</property>
- <property name="text" translatable="yes">0</property>
<property name="adjustment">adjustment11</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
@@ -4179,7 +4166,6 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">16</property>
- <property name="text" translatable="yes">0</property>
<property name="adjustment">adjustment12</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
@@ -4199,7 +4185,6 @@
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">16</property>
- <property name="text" translatable="yes">0</property>
<property name="adjustment">adjustment13</property>
<property name="climb_rate">1</property>
<property name="numeric">True</property>
@@ -4472,8 +4457,6 @@
<object class="GtkAlignment" id="alignment3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">False</property>
- <property name="vexpand">False</property>
<child>
<placeholder/>
</child>
@@ -4489,13 +4472,11 @@
<object class="GtkComboBox" id="network-source-mode">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">False</property>
<property name="has_entry">True</property>
<signal name="changed" handler="on_network-source-mode-combo_changed" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry6">
<property name="can_focus">True</property>
- <property name="hexpand">False</property>
</object>
</child>
</object>
@@ -4510,13 +4491,11 @@
<object class="GtkComboBox" id="network-model">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">False</property>
<property name="has_entry">True</property>
<signal name="changed" handler="on_network_model_combo_changed" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry7">
<property name="can_focus">True</property>
- <property name="hexpand">False</property>
</object>
</child>
</object>
@@ -4531,7 +4510,6 @@
<object class="GtkComboBox" id="network-source">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">False</property>
<signal name="changed" handler="on_network_source_combo_changed" swapped="no"/>
</object>
<packing>
@@ -5150,14 +5128,11 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <property name="hexpand">False</property>
<property name="has_entry">True</property>
<signal name="changed" handler="on_gfx_type_combo_changed" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry10">
<property name="can_focus">True</property>
- <property name="hexpand">False</property>
- <property name="vexpand">False</property>
</object>
</child>
</object>
@@ -5654,7 +5629,6 @@
<object class="GtkLabel" id="video-heads">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">False</property>
<property name="xalign">0</property>
<property name="label">label</property>
<property name="selectable">True</property>
@@ -5672,7 +5646,6 @@
<object class="GtkLabel" id="video-ram">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">False</property>
<property name="xalign">0</property>
<property name="label">label</property>
<property name="selectable">True</property>
@@ -5731,7 +5704,6 @@
<object class="GtkComboBox" id="video-model">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="hexpand">False</property>
<property name="has_entry">True</property>
<signal name="changed" handler="on_video_model_combo_changed" swapped="no"/>
<child internal-child="entry">
@@ -6655,11 +6627,25 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="rng-host">
+ <object class="GtkLabel" id="rng-label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Backend type:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">2</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="rng-backend-type">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label">rng-host</property>
+ <property name="label">rng-backend-type</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -6669,25 +6655,25 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="rng-label2">
+ <object class="GtkLabel" id="rng-label7">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Host:</property>
+ <property name="label" translatable="yes">Mode:</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">2</property>
+ <property name="top_attach">3</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="rng-service">
+ <object class="GtkLabel" id="rng-mode">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label">rng-service</property>
+ <property name="label">rng-mode</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -6697,53 +6683,81 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="rng-label3">
+ <object class="GtkLabel" id="rng-label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Service:</property>
+ <property name="label" translatable="yes">Host:</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">3</property>
+ <property name="top_attach">4</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="rng-label4">
+ <object class="GtkLabel" id="rng-connect-host">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">rng-connect-host</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="rng-label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Backend type:</property>
+ <property name="label" translatable="yes">Service:</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="rng-backend-type">
+ <object class="GtkLabel" id="rng-connect-service">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label">rng-backend-type</property>
+ <property name="label">rng-connect-service</property>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="rng-rate-period">
+ <object class="GtkLabel" id="rng-label8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">Bind Host:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="rng-bind-host">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label">rng-rate-period</property>
+ <property name="label">rng-bind-host</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -6753,43 +6767,57 @@
</packing>
</child>
<child>
- <object class="GtkLabel" id="rng-label6">
+ <object class="GtkLabel" id="rng-label9">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Rate (period):</property>
+ <property name="label" translatable="yes">Bind Service:</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">6</property>
+ <property name="top_attach">7</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="rng-label7">
+ <object class="GtkLabel" id="rng-bind-service">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">rng-bind-service</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">7</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="rng-label6">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">1</property>
- <property name="label" translatable="yes">Mode:</property>
+ <property name="label" translatable="yes">Rate (period):</property>
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">5</property>
+ <property name="top_attach">8</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="rng-mode">
+ <object class="GtkLabel" id="rng-rate-period">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label">rng-mode</property>
+ <property name="label">rng-rate-period</property>
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">5</property>
+ <property name="top_attach">8</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -6803,7 +6831,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">7</property>
+ <property name="top_attach">9</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
@@ -6817,7 +6845,7 @@
</object>
<packing>
<property name="left_attach">1</property>
- <property name="top_attach">7</property>
+ <property name="top_attach">9</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
diff --git a/virtManager/details.py b/virtManager/details.py
index 2878612..bb280bf 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -36,6 +36,7 @@ from virtManager.addhardware import vmmAddHardware
from virtManager.choosecd import vmmChooseCD
from virtManager.snapshots import vmmSnapshotPage
from virtManager.graphwidgets import Sparkline
+from virtinst import VirtualRNGDevice
import virtinst
from virtinst import util
@@ -3077,30 +3078,37 @@ class vmmDetails(vmmGObjectUI):
def refresh_rng_page(self):
dev = self.get_hw_selection(HW_LIST_COL_DEVICE)
values = {
+ "rng-bind-host" : "bind_host",
+ "rng-bind-service" : "bind_service",
+ "rng-connect-host" : "connect_host",
+ "rng-connect-service" : "connect_service",
"rng-type" : "type",
"rng-device" : "device",
- "rng-host" : "backend_source_host",
- "rng-service" : "backend_source_service",
- "rng-mode" : "backend_source_mode",
"rng-backend-type" : "backend_type",
"rng-rate-bytes" : "rate_bytes",
"rng-rate-period" : "rate_period"
}
rewriter = {
"rng-type" : lambda x:
- virtinst.VirtualRNGDevice.get_pretty_type(x),
+ VirtualRNGDevice.get_pretty_type(x),
"rng-backend-type" : lambda x:
- virtinst.VirtualRNGDevice.get_pretty_backend_type(x),
- "rng-mode" : lambda x:
- virtinst.VirtualRNGDevice.get_pretty_mode(x)
+ VirtualRNGDevice.get_pretty_backend_type(x),
}
- is_egd = dev.type == virtinst.VirtualRNGDevice.TYPE_EGD
- uihelpers.set_grid_row_visible(self.widget("rng-device"), not is_egd)
- uihelpers.set_grid_row_visible(self.widget("rng-host"), is_egd)
- uihelpers.set_grid_row_visible(self.widget("rng-service"), is_egd)
- uihelpers.set_grid_row_visible(self.widget("rng-mode"), is_egd)
- uihelpers.set_grid_row_visible(self.widget("rng-backend-type"), is_egd)
+ def set_visible(widget, v):
+ uihelpers.set_grid_row_visible(self.widget(widget), v)
+
+ is_egd = dev.type == VirtualRNGDevice.TYPE_EGD
+ udp = dev.backend_type == VirtualRNGDevice.BACKEND_TYPE_UDP
+ bind = VirtualRNGDevice.BACKEND_MODE_BIND in dev.backend_mode()
+
+ set_visible("rng-device", not is_egd)
+ set_visible("rng-mode", is_egd and not udp)
+ set_visible("rng-backend-type", is_egd)
+ set_visible("rng-connect-host", is_egd and (udp or not bind))
+ set_visible("rng-connect-service", is_egd and (udp or not bind))
+ set_visible("rng-bind-host", is_egd and (udp or bind))
+ set_visible("rng-bind-service", is_egd and (udp or bind))
for k, prop in values.items():
val = "-"
@@ -3111,6 +3119,10 @@ class vmmDetails(vmmGObjectUI):
val = r(val)
self.widget(k).set_text(val)
+ if is_egd and not udp:
+ mode = VirtualRNGDevice.get_pretty_mode(dev.backend_mode()[0])
+ self.widget("rng-mode").set_text(mode)
+
def refresh_char_page(self):
chardev = self.get_hw_selection(HW_LIST_COL_DEVICE)
if not chardev:
--
1.8.3.1
More information about the virt-tools-list
mailing list