From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> --- ui/details.ui | 203 +++++++++++++++++++++++++------------------------ virtManager/details.py | 25 +++++- virtManager/domain.py | 6 +- 3 files changed, 132 insertions(+), 102 deletions(-) diff --git a/ui/details.ui b/ui/details.ui index c85e0e4b..d22e2624 100644 --- a/ui/details.ui +++ b/ui/details.ui @@ -4664,114 +4664,121 @@ if you know what you are doing.</small></property> <property name="label_xalign">0</property> <property name="shadow_type">none</property> <child> - <object class="GtkAlignment" id="alignment30"> + <object class="GtkGrid"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="top_padding">3</property> - <property name="left_padding">12</property> + <property name="margin_left">12</property> + <property name="margin_top">3</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> <child> - <object class="GtkTable" id="table4"> + <object class="GtkLabel" id="label18"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="n_columns">2</property> - <property name="column_spacing">8</property> - <property name="row_spacing">4</property> - <child> - <object class="GtkLabel" id="video-heads"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label">label</property> - <property name="selectable">True</property> - <property name="xalign">0</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="x_options">GTK_FILL</property> - <property name="y_options"/> - </packing> - </child> - <child> - <object class="GtkLabel" id="video-ram"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label">label</property> - <property name="selectable">True</property> - <property name="xalign">0</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="x_options">GTK_FILL</property> - <property name="y_options"/> - </packing> - </child> - <child> - <object class="GtkLabel" id="label17"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">RAM:</property> - <property name="xalign">1</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"/> - </packing> - </child> - <child> - <object class="GtkLabel" id="label18"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">M_odel:</property> - <property name="use_underline">True</property> - <property name="mnemonic_widget">combobox-entry13</property> - <property name="xalign">1</property> + <property name="label" translatable="yes">M_odel:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">combobox-entry13</property> + <property name="xalign">1</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="video-model"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="has_entry">True</property> + <signal name="changed" handler="on_video_model_combo_changed" swapped="no"/> + <child internal-child="entry"> + <object class="GtkEntry" id="combobox-entry13"> + <property name="can_focus">True</property> </object> - <packing> - <property name="x_options">GTK_FILL</property> - <property name="y_options"/> - </packing> - </child> - <child> - <object class="GtkLabel" id="label25"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="label" translatable="yes">Heads:</property> - <property name="xalign">1</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> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label17"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">RAM:</property> + <property name="xalign">1</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="video-ram"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label">label</property> + <property name="selectable">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label25"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Heads:</property> + <property name="xalign">1</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="video-heads"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label">label</property> + <property name="selectable">True</property> + <property name="xalign">0</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">3D acceleration:</property> + <property name="xalign">1</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">3</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="video-3d"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="draw_indicator">True</property> + <signal name="toggled" handler="on_video_3d_toggled" swapped="no"/> <child> - <object class="GtkComboBox" id="video-model"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="has_entry">True</property> - <signal name="changed" handler="on_video_model_combo_changed" swapped="no"/> - <child internal-child="entry"> - <object class="GtkEntry" id="combobox-entry13"> - <property name="can_focus">True</property> - </object> - </child> - </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> + <placeholder/> </child> </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + </packing> </child> </object> </child> diff --git a/virtManager/details.py b/virtManager/details.py index 3e37a12c..f12b2829 100644 --- a/virtManager/details.py +++ b/virtManager/details.py @@ -95,6 +95,7 @@ EDIT_GFX_OPENGL, EDIT_GFX_RENDERNODE, EDIT_VIDEO_MODEL, +EDIT_VIDEO_3D, EDIT_WATCHDOG_MODEL, EDIT_WATCHDOG_ACTION, @@ -107,7 +108,7 @@ EDIT_FS, EDIT_HOSTDEV_ROMBAR, -) = range(1, 48) +) = range(1, 49) # Columns in hw list model @@ -540,8 +541,8 @@ class vmmDetails(vmmGObjectUI): "on_sound_model_combo_changed": lambda *x: self.enable_apply(x, EDIT_SOUND_MODEL), - "on_video_model_combo_changed": lambda *x: self.enable_apply(x, - EDIT_VIDEO_MODEL), + "on_video_model_combo_changed": self.video_model_changed, + "on_video_3d_toggled": self.video_3d_toggled, "on_watchdog_model_combo_changed": lambda *x: self.enable_apply(x, EDIT_WATCHDOG_MODEL), @@ -1732,6 +1733,16 @@ class vmmDetails(vmmGObjectUI): self.widget("cpu-topology-table").set_sensitive(do_enable) self.config_cpu_topology_changed() + def video_model_changed(self, ignore): + model = uiutil.get_list_selection(self.widget("video-model")) + uiutil.set_grid_row_visible( + self.widget("video-3d"), model == "virtio") + self.enable_apply(EDIT_VIDEO_MODEL) + + def video_3d_toggled(self, ignore): + self.widget("video-3d").set_inconsistent(False) + self.enable_apply(EDIT_VIDEO_3D) + # Boot device / Autostart def config_bootdev_selected(self, ignore=None): boot_row = self.get_boot_selection() @@ -2194,6 +2205,9 @@ class vmmDetails(vmmGObjectUI): if model: kwargs["model"] = model + if self.edited(EDIT_VIDEO_3D): + kwargs["accel3d"] = self.widget("video-3d").get_active() + return vmmAddHardware.change_config_helper(self.vm.define_video, kwargs, self.vm, self.err, devobj=devobj) @@ -2953,6 +2967,11 @@ class vmmDetails(vmmGObjectUI): uiutil.set_list_selection(self.widget("video-model"), model) + if vid.accel3d is None: + self.widget("video-3d").set_inconsistent(True) + else: + self.widget("video-3d").set_active(vid.accel3d) + def refresh_watchdog_page(self): watch = self.get_hw_selection(HW_LIST_COL_DEVICE) if not watch: diff --git a/virtManager/domain.py b/virtManager/domain.py index 58580861..5b412b9b 100644 --- a/virtManager/domain.py +++ b/virtManager/domain.py @@ -876,7 +876,7 @@ class vmmDomain(vmmLibvirtObject): else: self._redefine_xmlobj(xmlobj) - def define_video(self, devobj, do_hotplug, model=_SENTINEL): + def define_video(self, devobj, do_hotplug, model=_SENTINEL, accel3d=_SENTINEL): xmlobj = self._make_xmlobj_to_define() editdev = self._lookup_device_to_define(xmlobj, devobj, do_hotplug) if not editdev: @@ -893,6 +893,10 @@ class vmmDomain(vmmLibvirtObject): editdev.heads = None editdev.ram = None editdev.vgamem = None + editdev.accel3d = None + + if accel3d != _SENTINEL: + editdev.accel3d = accel3d if do_hotplug: self.hotplug(device=editdev) -- 2.11.0.295.gd7dffce1c.dirty _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list