mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-03-05 20:58:31 +03:00
Show netdev and optical errors in UI.
Take the error from the vmmConnection object, and show where appropriate in various UI locations.
This commit is contained in:
parent
12e6d6c8bd
commit
085f2de8f0
@ -336,8 +336,16 @@ class vmmAddHardware(gobject.GObject):
|
||||
self.change_macaddr_use()
|
||||
|
||||
net_list = self.window.get_widget("net-list")
|
||||
net_warn = self.window.get_widget("net-list-warn")
|
||||
uihelpers.populate_network_list(net_list, self.vm.get_connection())
|
||||
|
||||
error = self.vm.get_connection().netdev_error
|
||||
if error:
|
||||
net_warn.show()
|
||||
vmmutil.tooltip_wrapper(net_warn, error)
|
||||
else:
|
||||
net_warn.hide()
|
||||
|
||||
netmodel = self.window.get_widget("net-model")
|
||||
self.populate_network_model_model(netmodel.get_model())
|
||||
if len(netmodel.get_model()) > 0:
|
||||
|
@ -19,11 +19,11 @@
|
||||
#
|
||||
import gtk.glade
|
||||
import gobject
|
||||
import logging
|
||||
|
||||
import virtinst
|
||||
|
||||
import virtManager.uihelpers as uihelpers
|
||||
import virtManager.util as util
|
||||
from virtManager.storagebrowse import vmmStorageBrowser
|
||||
from virtManager.error import vmmErrorDialog
|
||||
|
||||
@ -74,14 +74,13 @@ class vmmChooseCD(gobject.GObject):
|
||||
win.show()
|
||||
|
||||
def reset_state(self):
|
||||
if self.conn.is_remote():
|
||||
self.window.get_widget("physical-media").set_sensitive(False)
|
||||
self.window.get_widget("iso-image").set_active(True)
|
||||
self.window.get_widget("cd-path").set_active(-1)
|
||||
self.window.get_widget("iso-file-chooser").set_sensitive(False)
|
||||
cd_path = self.window.get_widget("cd-path")
|
||||
use_cdrom = (cd_path.get_active() > -1)
|
||||
|
||||
if use_cdrom:
|
||||
self.window.get_widget("physical-media").set_active(True)
|
||||
else:
|
||||
self.window.get_widget("physical-media").set_sensitive(True)
|
||||
self.window.get_widget("iso-file-chooser").set_sensitive(True)
|
||||
self.window.get_widget("iso-image").set_active(True)
|
||||
|
||||
def ok(self,ignore1=None, ignore2=None):
|
||||
path = None
|
||||
@ -128,14 +127,20 @@ class vmmChooseCD(gobject.GObject):
|
||||
self._browse_file()
|
||||
|
||||
def initialize_opt_media(self):
|
||||
try:
|
||||
widget = self.window.get_widget("cd-path")
|
||||
uihelpers.init_optical_combo(widget)
|
||||
uihelpers.populate_optical_combo(self.conn, widget)
|
||||
self.window.get_widget("physical-media").set_sensitive(True)
|
||||
except Exception, e:
|
||||
logging.error("Unable to create optical-helper widget: '%s'", e)
|
||||
self.window.get_widget("physical-media").set_sensitive(False)
|
||||
widget = self.window.get_widget("cd-path")
|
||||
warn = self.window.get_widget("cd-path-warn")
|
||||
error = self.conn.optical_error
|
||||
|
||||
uihelpers.init_optical_combo(widget)
|
||||
uihelpers.populate_optical_combo(self.conn, widget)
|
||||
|
||||
if error:
|
||||
warn.show()
|
||||
util.tooltip_wrapper(warn, error)
|
||||
else:
|
||||
warn.hide()
|
||||
|
||||
self.window.get_widget("physical-media").set_sensitive(not bool(error))
|
||||
|
||||
def set_storage_path(self, src, path):
|
||||
self.window.get_widget("iso-path").set_text(path)
|
||||
|
@ -406,19 +406,19 @@ class vmmCreate(gobject.GObject):
|
||||
# Install local
|
||||
iso_option = self.window.get_widget("install-local-iso")
|
||||
cdrom_option = self.window.get_widget("install-local-cdrom")
|
||||
|
||||
# Install local/iso
|
||||
cdrom_list = self.window.get_widget("install-local-cdrom-combo")
|
||||
try:
|
||||
sigs = uihelpers.populate_optical_combo(self.conn, cdrom_list)
|
||||
self.conn_signals.extend(sigs)
|
||||
except Exception, e:
|
||||
logging.exception("Unable to populate optical-helper widget: '%s'", e)
|
||||
cdrom_warn = self.window.get_widget("install-local-cdrom-warn")
|
||||
|
||||
sigs = uihelpers.populate_optical_combo(self.conn, cdrom_list)
|
||||
self.conn_signals.extend(sigs)
|
||||
|
||||
if self.conn.optical_error:
|
||||
cdrom_warn.show()
|
||||
cdrom_option.set_sensitive(False)
|
||||
util.tooltip_wrapper(
|
||||
self.window.get_widget("install-local-cdrom-box"),
|
||||
_("Error listing CD-ROM devices."))
|
||||
self.window.get_widget("install-local-cdrom-box").set_sensitive(is_local)
|
||||
util.tooltip_wrapper(cdrom_warn, self.conn.optical_error)
|
||||
else:
|
||||
cdrom_warn.hide()
|
||||
|
||||
# Don't select physical CDROM if no valid media is present
|
||||
use_cd = (cdrom_list.get_active() >= 0)
|
||||
if use_cd:
|
||||
@ -482,8 +482,15 @@ class vmmCreate(gobject.GObject):
|
||||
|
||||
# Networking
|
||||
net_list = self.window.get_widget("config-netdev")
|
||||
net_warn = self.window.get_widget("config-netdev-warn")
|
||||
uihelpers.populate_network_list(net_list, self.conn)
|
||||
|
||||
if self.conn.netdev_error:
|
||||
net_warn.show()
|
||||
util.tooltip_wrapper(net_warn, self.conn.netdev_error)
|
||||
else:
|
||||
net_warn.hide()
|
||||
|
||||
newmac = uihelpers.generate_macaddr(self.conn)
|
||||
self.window.get_widget("config-set-macaddr").set_active(bool(newmac))
|
||||
self.window.get_widget("config-macaddr").set_text(newmac)
|
||||
|
@ -72,7 +72,6 @@ class vmmHalHelper(gobject.GObject):
|
||||
self._device_added)
|
||||
self.hal_iface.connect_to_signal("DeviceRemoved",
|
||||
self._device_removed)
|
||||
|
||||
except Exception, e:
|
||||
(_type, value, stacktrace) = sys.exc_info ()
|
||||
logging.error("Unable to connect to HAL to list network "
|
||||
|
@ -957,6 +957,7 @@
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox6">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="net-list">
|
||||
<property name="visible">True</property>
|
||||
@ -967,13 +968,12 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment15">
|
||||
<widget class="GtkImage" id="net-list-warn">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<property name="stock">gtk-dialog-warning</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
@ -117,19 +117,6 @@
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="cd-path">
|
||||
<property name="visible">True</property>
|
||||
<signal name="changed" handler="on_cd_path_changed"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
@ -161,7 +148,6 @@
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Device Media:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">cd-path</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
@ -172,6 +158,37 @@
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="cd-path">
|
||||
<property name="visible">True</property>
|
||||
<signal name="changed" handler="on_cd_path_changed"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImage" id="cd-path-warn">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-warning</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
@ -369,7 +369,7 @@
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">4</property>
|
||||
<child>
|
||||
<widget class="GtkVBox" id="install-local-cdrom-box">
|
||||
<widget class="GtkVBox" id="vbox123">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">4</property>
|
||||
@ -396,6 +396,7 @@
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox10">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="install-local-cdrom-combo">
|
||||
<property name="visible">True</property>
|
||||
@ -408,7 +409,14 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<widget class="GtkImage" id="install-local-cdrom-warn">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-warning</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
@ -1488,6 +1496,7 @@ User shouldn't see this.</property>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox8">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="config-netdev">
|
||||
<property name="visible">True</property>
|
||||
@ -1498,6 +1507,16 @@ User shouldn't see this.</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkImage" id="config-netdev-warn">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-dialog-warning</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
|
Loading…
x
Reference in New Issue
Block a user