mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
Fixes bz 218201. Choosing an existing file, using the dialog or typing the path manually, will now cause the file's size to show up in the file size box. Also the wizard will complain if the user manually types a directory path instead of an existing file or a new file.
This commit is contained in:
parent
ba20edec8c
commit
f5e462a8e8
@ -7396,7 +7396,7 @@ TB</property>
|
||||
<child>
|
||||
<widget class="GtkTable" id="table23">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_rows">8</property>
|
||||
<property name="n_rows">7</property>
|
||||
<property name="n_columns">5</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="row_spacing">2</property>
|
||||
@ -7809,7 +7809,7 @@ TB</property>
|
||||
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
|
||||
<property name="snap_to_ticks">True</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="adjustment">500 100 16000 100 500 500</property>
|
||||
<property name="adjustment">500 0 16000 100 500 500</property>
|
||||
<signal name="changed" handler="on_storage_file_size_changed" last_modification_time="Thu, 10 Aug 2006 19:19:04 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
@ -7859,63 +7859,6 @@ TB</property>
|
||||
<property name="y_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox42">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image89">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon_size">4</property>
|
||||
<property name="icon_name">gtk-info</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label302">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><small><b>Note:</b> File size parameter is only relevant for new files</small></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">7</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="right_attach">4</property>
|
||||
<property name="top_attach">7</property>
|
||||
<property name="bottom_attach">8</property>
|
||||
<property name="x_options">fill</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
@ -493,17 +493,23 @@ class vmmCreate(gobject.GObject):
|
||||
file = None
|
||||
if(response == gtk.RESPONSE_ACCEPT):
|
||||
file = fcdialog.get_filename()
|
||||
|
||||
if file != None:
|
||||
self.window.get_widget("storage-file-address").set_text(file)
|
||||
|
||||
size = os.stat(file).st_size/(1024*1024)
|
||||
self.window.get_widget("storage-file-size").set_value(size)
|
||||
|
||||
def toggle_storage_size(self, ignore1=None, ignore2=None):
|
||||
file = self.get_config_disk_image()
|
||||
if file != None and len(file) > 0 and not(os.path.exists(file)):
|
||||
self.window.get_widget("storage-file-size").set_sensitive(True)
|
||||
else:
|
||||
self.window.get_widget("storage-file-size").set_sensitive(False)
|
||||
|
||||
if file != None and len(file) > 0 and os.path.isfile(file):
|
||||
size = os.path.getsize(file)/(1024*1024)
|
||||
self.window.get_widget("storage-file-size").set_value(size)
|
||||
else:
|
||||
self.window.get_widget("storage-file-size").set_value(0)
|
||||
|
||||
def confirm_overwrite_callback(self, chooser):
|
||||
# Only called when the user has chosen an existing file
|
||||
self.window.get_widget("storage-file-size").set_sensitive(False)
|
||||
@ -585,6 +591,12 @@ class vmmCreate(gobject.GObject):
|
||||
_("You must specify a partition or a file for storage for the guest install"))
|
||||
return False
|
||||
|
||||
if not self.window.get_widget("storage-partition").get_active():
|
||||
if os.path.isdir(disk):
|
||||
self._validation_error_box(_("Storage Address Is Directory"), \
|
||||
_("You chose 'Simple File' storage for your storage method, but chose a directory instead of a file. Please enter a new filename or choose an existing file."))
|
||||
return False
|
||||
|
||||
# do this always, since there's no "leaving a notebook page" event.
|
||||
self.window.get_widget("create-back").set_sensitive(True)
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user