details: Don't error if 'direct' iface doesn't have virtualport settings

Fix some cosmetic issues as well
This commit is contained in:
Cole Robinson 2011-03-17 15:36:36 -04:00
parent 926e4af0fd
commit 035d5a2eec
3 changed files with 47 additions and 45 deletions

View File

@ -375,11 +375,11 @@ class vmmDetails(vmmGObjectUI):
"on_network_model_combo_changed": self.config_enable_apply,
"on_virtualport-type_changed": self.config_enable_apply,
"on_virtualport-managerid_changed": self.config_enable_apply,
"on_virtualport-typeid_changed": self.config_enable_apply,
"on_virtualport-typeidversion_changed": self.config_enable_apply,
"on_virtualport-instanceid_changed": self.config_enable_apply,
"on_vport_type_changed": self.config_enable_apply,
"on_vport_managerid_changed": self.config_enable_apply,
"on_vport_typeid_changed": self.config_enable_apply,
"on_vport_typeidversion_changed": self.config_enable_apply,
"on_vport_instanceid_changed": self.config_enable_apply,
"on_gfx_type_combo_changed": self.config_enable_apply,
"on_vnc_keymap_combo_changed": self.config_enable_apply,
@ -1734,19 +1734,20 @@ class vmmDetails(vmmGObjectUI):
# Network options
def config_network_apply(self, dev_id_info):
model = self.get_combo_label_value("network-model")
virtualport_type = self.window.get_widget("virtualport-type").get_text()
virtualport_managerid = self.window.get_widget("virtualport-managerid").get_text()
virtualport_typeid = self.window.get_widget("virtualport-typeid").get_text()
virtualport_typeidversion = self.window.get_widget("virtualport-typeidversion").get_text()
virtualport_instanceid = self.window.get_widget("virtualport-instanceid").get_text()
vport_type = self.window.get_widget("vport-type").get_text()
vport_managerid = self.window.get_widget("vport-managerid").get_text()
vport_typeid = self.window.get_widget("vport-typeid").get_text()
vport_typeidversion = self.window.get_widget("vport-typeidversion").get_text()
vport_instanceid = self.window.get_widget("vport-instanceid").get_text()
return self._change_config_helper([self.vm.define_network_model,
self.vm.define_virtualport],
[(dev_id_info, model),
(dev_id_info, virtualport_type,
virtualport_managerid,
virtualport_typeid,
virtualport_typeidversion,
virtualport_instanceid)])
(dev_id_info, vport_type,
vport_managerid,
vport_typeid,
vport_typeidversion,
vport_instanceid)])
# Graphics options
def config_graphics_apply(self, dev_id_info):
@ -2222,20 +2223,20 @@ class vmmDetails(vmmGObjectUI):
self.window.get_widget("network-mac-address").set_text(net.macaddr)
self.window.get_widget("network-source-device").set_text(desc)
if nettype == "direct":
self.window.get_widget("virtualport-type").set_text(net.virtualport.type)
self.window.get_widget("virtualport-managerid").set_text(net.virtualport.managerid)
self.window.get_widget("virtualport-typeid").set_text(net.virtualport.typeid)
self.window.get_widget("virtualport-typeidversion").set_text(net.virtualport.typeidversion)
self.window.get_widget("virtualport-instanceid").set_text(net.virtualport.instanceid)
self.window.get_widget("virtualport-expander").set_property("visible", True)
else:
self.window.get_widget("virtualport-type").set_text("")
self.window.get_widget("virtualport-managerid").set_text("")
self.window.get_widget("virtualport-typeid").set_text("")
self.window.get_widget("virtualport-typeidversion").set_text("")
self.window.get_widget("virtualport-instanceid").set_text("")
self.window.get_widget("virtualport-expander").hide()
# Virtualport config
show_vport = (nettype == "direct")
vport = net.virtualport
self.window.get_widget("vport-expander").set_property("visible",
show_vport)
self.window.get_widget("vport-type").set_text(vport.type or "")
self.window.get_widget("vport-managerid").set_text(
vport.managerid or "")
self.window.get_widget("vport-typeid").set_text(
vport.typeid or "")
self.window.get_widget("vport-typeidversion").set_text(
vport.typeidversion or "")
self.window.get_widget("vport-instanceid").set_text(
vport.instanceid or "")
uihelpers.populate_netmodel_combo(self.vm,
self.window.get_widget("network-model-combo"))

View File

@ -404,7 +404,8 @@ class vmmDomainBase(vmmLibvirtObject):
editdev.model = newmodel
return self._redefine_device(change, devobj)
def define_virtualport(self, devobj, newtype, newmanagerid, newtypeid, newtypeidversion, newinstanceid):
def define_virtualport(self, devobj, newtype, newmanagerid,
newtypeid, newtypeidversion, newinstanceid):
def change(editdev):
editdev.virtualport.type = newtype or None
editdev.virtualport.managerid = newmanagerid or None

View File

@ -3763,7 +3763,7 @@ I/O:</property>
</packing>
</child>
<child>
<widget class="GtkExpander" id="virtualport-expander">
<widget class="GtkExpander" id="vport-expander">
<property name="can_focus">True</property>
<child>
<widget class="GtkHBox" id="hbox1124">
@ -3777,12 +3777,12 @@ I/O:</property>
<property name="column_spacing">6</property>
<property name="row_spacing">3</property>
<child>
<widget class="GtkEntry" id="virtualport-instanceid">
<widget class="GtkEntry" id="vport-instanceid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<property name="width_chars">40</property>
<signal name="changed" handler="on_virtualport-instanceid_changed"/>
<signal name="changed" handler="on_vport_instanceid_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
@ -3793,7 +3793,7 @@ I/O:</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="virtualport-instanceid-label">
<widget class="GtkLabel" id="vport-instanceid-label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Instance id:</property>
@ -3807,11 +3807,11 @@ I/O:</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="virtualport-typeidversion">
<widget class="GtkEntry" id="vport-typeidversion">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_virtualport-typeidversion_changed"/>
<signal name="changed" handler="on_vport_typeidversion_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
@ -3822,7 +3822,7 @@ I/O:</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="virtualport-typeidversion-label">
<widget class="GtkLabel" id="vport-typeidversion-label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Typeid version:</property>
@ -3836,11 +3836,11 @@ I/O:</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="virtualport-typeid">
<widget class="GtkEntry" id="vport-typeid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_virtualport-typeid_changed"/>
<signal name="changed" handler="on_vport_typeid_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
@ -3851,7 +3851,7 @@ I/O:</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="virtualport-typeid-label">
<widget class="GtkLabel" id="vport-typeid-label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Typeid:</property>
@ -3865,11 +3865,11 @@ I/O:</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="virtualport-managerid">
<widget class="GtkEntry" id="vport-managerid">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_virtualport-managerid_changed"/>
<signal name="changed" handler="on_vport_managerid_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>
@ -3880,7 +3880,7 @@ I/O:</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="virtualport-managerid-label">
<widget class="GtkLabel" id="vport-managerid-label">
<property name="visible">True</property>
<property name="xalign">1</property>
<property name="label" translatable="yes">Managerid:</property>
@ -3909,11 +3909,11 @@ I/O:</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="virtualport-type">
<widget class="GtkEntry" id="vport-type">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
<signal name="changed" handler="on_virtualport-type_changed"/>
<signal name="changed" handler="on_vport_type_changed"/>
</widget>
<packing>
<property name="left_attach">1</property>