mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-01-11 05:17:59 +03:00
createpool: Hide options that aren't applicable for pool type
Rather than just desensitize them.
This commit is contained in:
parent
92ef22666a
commit
4b75b7dc0e
@ -268,12 +268,17 @@ class vmmCreatePool(vmmGObjectUI):
|
||||
return plist
|
||||
|
||||
def show_options_by_pool(self):
|
||||
def show_row(base, do_show):
|
||||
self.widget(base + "-label").set_property("visible", do_show)
|
||||
self.widget(base + "-box").set_property("visible", do_show)
|
||||
|
||||
src = hasattr(self._pool, "source_path")
|
||||
src_b = src and not self.conn.is_remote()
|
||||
tgt = hasattr(self._pool, "target_path")
|
||||
tgt_b = tgt and not self.conn.is_remote()
|
||||
host = hasattr(self._pool, "host")
|
||||
fmt = hasattr(self._pool, "formats")
|
||||
builddef, buildsens = self.get_build_default()
|
||||
|
||||
# Source path broswing is meaningless for net pools
|
||||
if self._pool.type in [Storage.StoragePool.TYPE_NETFS,
|
||||
@ -281,13 +286,17 @@ class vmmCreatePool(vmmGObjectUI):
|
||||
Storage.StoragePool.TYPE_SCSI]:
|
||||
src_b = False
|
||||
|
||||
show_row("pool-target", tgt)
|
||||
show_row("pool-source", src)
|
||||
show_row("pool-hostname", host)
|
||||
show_row("pool-format", fmt)
|
||||
show_row("pool-build", buildsens)
|
||||
|
||||
self.widget("pool-target-button").set_sensitive(tgt_b)
|
||||
self.widget("pool-source-button").set_sensitive(src_b)
|
||||
self.widget("pool-source-path").set_sensitive(src)
|
||||
self.widget("pool-hostname").set_sensitive(host)
|
||||
self.widget("pool-format").set_sensitive(fmt)
|
||||
self.widget("pool-format").set_active(-1)
|
||||
self.widget("pool-build").set_active(builddef)
|
||||
|
||||
self.widget("pool-format").set_active(-1)
|
||||
if fmt:
|
||||
self.populate_pool_format(getattr(self._pool, "formats"))
|
||||
self.widget("pool-format").set_active(0)
|
||||
@ -440,9 +449,6 @@ class vmmCreatePool(vmmGObjectUI):
|
||||
self.widget("pool-target-path").child.set_text(
|
||||
self._pool.target_path)
|
||||
self.widget("pool-back").set_sensitive(True)
|
||||
buildret = self.get_build_default()
|
||||
self.widget("pool-build").set_sensitive(buildret[1])
|
||||
self.widget("pool-build").set_active(buildret[0])
|
||||
self.widget("pool-finish").show()
|
||||
self.widget("pool-finish").grab_focus()
|
||||
self.widget("pool-forward").hide()
|
||||
@ -501,7 +507,8 @@ class vmmCreatePool(vmmGObjectUI):
|
||||
return self.err.val_err(_("Pool Parameter Error"), str(e))
|
||||
|
||||
buildval = self.widget("pool-build").get_active()
|
||||
buildsen = self.widget("pool-build").get_property("sensitive")
|
||||
buildsen = (self.widget("pool-build").get_property("sensitive") and
|
||||
self.widget("pool-build-box").get_property("visible"))
|
||||
if buildsen and buildval:
|
||||
ret = self.err.yes_no(_("Building a pool of this type will "
|
||||
"format the source device. Are you "
|
||||
|
@ -311,49 +311,13 @@
|
||||
<property name="n_rows">5</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">6</property>
|
||||
<property name="row_spacing">4</property>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="pool-format">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
|
||||
<signal name="changed" handler="on_pool_format_changed"/>
|
||||
<signal name="focus" handler="on_pool_format_focus"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="pool-build">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="focus_in_event" handler="on_pool_build_focus_in_event"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label19">
|
||||
<widget class="GtkLabel" id="pool-build-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="ypad">8</property>
|
||||
<property name="label" translatable="yes">B_uild Pool:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">pool-build</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">4</property>
|
||||
@ -363,7 +327,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox14">
|
||||
<widget class="GtkHBox" id="pool-source-box">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
@ -397,12 +361,11 @@
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox13">
|
||||
<widget class="GtkHBox" id="pool-target-box">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
@ -434,14 +397,14 @@
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label11">
|
||||
<widget class="GtkLabel" id="pool-target-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="ypad">8</property>
|
||||
<property name="label" translatable="yes">_Target Path:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">pool-target-path</property>
|
||||
@ -452,12 +415,12 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label17">
|
||||
<widget class="GtkLabel" id="pool-format-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="ypad">8</property>
|
||||
<property name="label" translatable="yes">F_ormat:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">pool-format</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
@ -467,12 +430,12 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label16">
|
||||
<widget class="GtkLabel" id="pool-hostname-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="ypad">8</property>
|
||||
<property name="label" translatable="yes">Host Na_me:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">pool-hostname</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
@ -482,12 +445,62 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="pool-hostname">
|
||||
<widget class="GtkLabel" id="pool-source-label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<signal name="focus_in_event" handler="on_pool_hostname_focus_in_event"/>
|
||||
<signal name="activate" handler="on_pool_hostname_activate"/>
|
||||
<property name="xalign">1</property>
|
||||
<property name="ypad">8</property>
|
||||
<property name="label" translatable="yes">_Source Path:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">pool-source-path</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="pool-build-box">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="pool-build">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="focus_in_event" handler="on_pool_build_focus_in_event"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkHBox" id="pool-hostname-box">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<widget class="GtkEntry" id="pool-hostname">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<signal name="focus_in_event" handler="on_pool_hostname_focus_in_event"/>
|
||||
<signal name="activate" handler="on_pool_hostname_activate"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
@ -498,17 +511,38 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label18">
|
||||
<widget class="GtkHBox" id="pool-format-box">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">1</property>
|
||||
<property name="label" translatable="yes">_Source Path:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">pool-source-path</property>
|
||||
<child>
|
||||
<widget class="GtkComboBox" id="pool-format">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="events">GDK_BUTTON_PRESS_MASK | GDK_STRUCTURE_MASK</property>
|
||||
<signal name="changed" handler="on_pool_format_changed"/>
|
||||
<signal name="focus" handler="on_pool_format_focus"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
|
Loading…
Reference in New Issue
Block a user