--- ui/details.ui | 214 +---------------------------------------------- virtManager/details.py | 32 +++---- virtManager/fsdetails.py | 17 ++++ 3 files changed, 31 insertions(+), 232 deletions(-) diff --git a/ui/details.ui b/ui/details.ui index f1946c4..6277fe4 100644 --- a/ui/details.ui +++ b/ui/details.ui @@ -6048,223 +6048,13 @@ <property name="label_xalign">0</property> <property name="shadow_type">none</property> <child> - <object class="GtkAlignment" id="alignment45"> + <object class="GtkAlignment" id="fs-alignment"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="top_padding">3</property> <property name="left_padding">12</property> <child> - <object class="GtkTable" id="table12"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="n_rows">4</property> - <property name="n_columns">2</property> - <property name="column_spacing">6</property> - <property name="row_spacing">6</property> - <child> - <object class="GtkLabel" id="fs-mode-title"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Mode:</property> - </object> - <packing> - <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> - <object class="GtkLabel" id="label64"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Driver:</property> - </object> - <packing> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="fs-wrpolicy-title"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Write Policy:</property> - </object> - <packing> - <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> - </packing> - </child> - <child> - <object class="GtkLabel" id="label65"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Source:</property> - </object> - <packing> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label66"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Target:</property> - </object> - <packing> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="fs-readonly-title"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Readonly Filesystem:</property> - </object> - <packing> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="fs-mode"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label">label</property> - </object> - <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="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="fs-driver"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label">label</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="fs-wrpolicy"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label">label</property> - </object> - <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> - <object class="GtkLabel" id="fs-source"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label">label</property> - <property name="ellipsize">end</property> - </object> - <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="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="fs-target"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label">label</property> - <property name="ellipsize">end</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="fs-readonly"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label">label</property> - <property name="ellipsize">end</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">6</property> - <property name="bottom_attach">7</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="label67"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Type:</property> - </object> - <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="fs-type"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">label</property> - </object> - <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> - </packing> - </child> - </object> + <placeholder/> </child> </object> </child> diff --git a/virtManager/details.py b/virtManager/details.py index 32d51d7..f1bcce6 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 virtManager.fsdetails import vmmFSDetails from virtinst import VirtualRNGDevice import virtinst @@ -551,6 +552,11 @@ class vmmDetails(vmmGObjectUI): self.vm.connect("config-changed", self.refresh_vm_state) self.vm.connect("resources-sampled", self.refresh_resources) + self.fsDetails = vmmFSDetails(self.vm) + self.fsDetails.set_initial_state() + fsAlignment = self.widget("fs-alignment") + fsAlignment.add(self.fsDetails.topwin) + self.populate_hw_list() self.repopulate_boot_list() @@ -582,6 +588,8 @@ class vmmDetails(vmmGObjectUI): self.conn = None self.addhwmenu = None + self.fsDetails.cleanup() + def show(self): logging.debug("Showing VM details: %s", self.vm) vis = self.is_visible() @@ -589,6 +597,8 @@ class vmmDetails(vmmGObjectUI): if vis: return + self.fsDetails.topwin.show_all() + self.emit("details-opened") self.refresh_vm_state() @@ -3324,26 +3334,8 @@ class vmmDetails(vmmGObjectUI): if not dev: return - self.widget("fs-type").set_text(dev.type) - - # mode can be irrelevant depending on the fs driver type - # selected. - if dev.mode: - self.show_pair("fs-mode", True) - self.widget("fs-mode").set_text(dev.mode) - else: - self.show_pair("fs-mode", False) - - self.widget("fs-driver").set_text(dev.driver or _("Default")) - - self.widget("fs-wrpolicy").set_text(dev.wrpolicy or _("Default")) - - self.widget("fs-source").set_text(dev.source or _("RAM")) - self.widget("fs-target").set_text(dev.target) - if dev.readonly: - self.widget("fs-readonly").set_text("Yes") - else: - self.widget("fs-readonly").set_text("No") + self.fsDetails.set_dev(dev) + self.fsDetails.update_fs_rows() def refresh_boot_page(self): # Refresh autostart diff --git a/virtManager/fsdetails.py b/virtManager/fsdetails.py index a0196bb..8bfafc1 100644 --- a/virtManager/fsdetails.py +++ b/virtManager/fsdetails.py @@ -192,6 +192,23 @@ class vmmFSDetails(vmmGObjectUI): return combo.get_model()[combo.get_active()][1] # Setters + def set_dev(self, dev): + self._dev = dev + + self.set_config_value("fs-type", dev.type or "default") + self.set_config_value("fs-mode", dev.mode or "default") + self.set_config_value("fs-driver", dev.driver or "default") + self.set_config_value("fs-wrpolicy", dev.wrpolicy or "default") + self.set_config_value("fs-format", dev.format or "default") + if dev.type != VirtualFilesystem.TYPE_RAM: + self.widget("fs-source").set_text(dev.source) + else: + self.set_config_ram_usage(dev.source, dev.units) + self.widget("fs-target").set_text(dev.target or "") + self.widget("fs-readonly").set_active(dev.readonly) + + self.show_pair_combo("fs-type", self.conn.is_openvz() or self.conn.is_lxc()) + def set_config_ram_usage(self, usage, units): value = int(usage) -- 1.8.5.2 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list