[PATCH 1/6] Add a summary screen of actions to be performed on all disks.
David Lehman
dlehman at redhat.com
Mon Mar 11 22:28:34 UTC 2013
These all look okay to me.
On Mon, 2013-03-11 at 16:06 -0400, Chris Lumens wrote:
> ---
> po/POTFILES.in | 2 +
> pyanaconda/ui/gui/spokes/lib/summary.glade | 204 +++++++++++++++++++++++++++++
> pyanaconda/ui/gui/spokes/lib/summary.py | 66 ++++++++++
> 3 files changed, 272 insertions(+)
> create mode 100644 pyanaconda/ui/gui/spokes/lib/summary.glade
> create mode 100644 pyanaconda/ui/gui/spokes/lib/summary.py
>
> diff --git a/po/POTFILES.in b/po/POTFILES.in
> index c2ad78d..f9f3e79 100644
> --- a/po/POTFILES.in
> +++ b/po/POTFILES.in
> @@ -72,6 +72,7 @@ pyanaconda/ui/gui/spokes/lib/accordion.py
> pyanaconda/ui/gui/spokes/lib/cart.py
> pyanaconda/ui/gui/spokes/lib/passphrase.py
> pyanaconda/ui/gui/spokes/lib/resize.py
> +pyanaconda/ui/gui/spokes/lib/summary.py
>
> # Interface files.
> pyanaconda/ui/gui/spokes/advanced_user.glade
> @@ -89,6 +90,7 @@ pyanaconda/ui/gui/spokes/lib/cart.glade
> pyanaconda/ui/gui/spokes/lib/detailederror.glade
> pyanaconda/ui/gui/spokes/lib/passphrase.glade
> pyanaconda/ui/gui/spokes/lib/resize.glade
> +pyanaconda/ui/gui/spokes/lib/summary.glade
> pyanaconda/ui/gui/main.glade
> pyanaconda/ui/gui/hubs/summary.glade
> pyanaconda/ui/gui/hubs/progress.glade
> diff --git a/pyanaconda/ui/gui/spokes/lib/summary.glade b/pyanaconda/ui/gui/spokes/lib/summary.glade
> new file mode 100644
> index 0000000..3d020e8
> --- /dev/null
> +++ b/pyanaconda/ui/gui/spokes/lib/summary.glade
> @@ -0,0 +1,204 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<interface>
> + <!-- interface-requires gtk+ 3.0 -->
> + <object class="GtkListStore" id="actionStore">
> + <columns>
> + <!-- column-name actionOrder -->
> + <column type="gint"/>
> + <!-- column-name actionType -->
> + <column type="gchararray"/>
> + <!-- column-name actionFormatType -->
> + <column type="gchararray"/>
> + <!-- column-name actionDeviceName -->
> + <column type="gchararray"/>
> + <!-- column-name actionMountpoint -->
> + <column type="gchararray"/>
> + </columns>
> + </object>
> + <object class="GtkDialog" id="summaryDialog">
> + <property name="height_request">400</property>
> + <property name="can_focus">False</property>
> + <property name="border_width">5</property>
> + <property name="title" translatable="yes">SUMMARY OF CHANGES</property>
> + <property name="modal">True</property>
> + <property name="window_position">center-on-parent</property>
> + <property name="destroy_with_parent">True</property>
> + <property name="type_hint">dialog</property>
> + <property name="decorated">False</property>
> + <child internal-child="vbox">
> + <object class="GtkBox" id="dialog-vbox1">
> + <property name="can_focus">False</property>
> + <property name="orientation">vertical</property>
> + <property name="spacing">2</property>
> + <child internal-child="action_area">
> + <object class="GtkButtonBox" id="dialog-action_area1">
> + <property name="can_focus">False</property>
> + <property name="layout_style">end</property>
> + <child>
> + <object class="GtkButton" id="summaryCancelButton">
> + <property name="label" translatable="yes">_Cancel & Return to Custom Partitioning</property>
> + <property name="visible">True</property>
> + <property name="can_focus">True</property>
> + <property name="receives_default">True</property>
> + <property name="use_underline">True</property>
> + </object>
> + <packing>
> + <property name="expand">False</property>
> + <property name="fill">True</property>
> + <property name="position">0</property>
> + <property name="non_homogeneous">True</property>
> + </packing>
> + </child>
> + <child>
> + <object class="GtkButton" id="summaryAcceptButton">
> + <property name="label" translatable="yes">_Accept Changes</property>
> + <property name="visible">True</property>
> + <property name="can_focus">True</property>
> + <property name="receives_default">True</property>
> + <property name="use_underline">True</property>
> + </object>
> + <packing>
> + <property name="expand">False</property>
> + <property name="fill">True</property>
> + <property name="position">1</property>
> + <property name="non_homogeneous">True</property>
> + </packing>
> + </child>
> + </object>
> + <packing>
> + <property name="expand">False</property>
> + <property name="fill">True</property>
> + <property name="pack_type">end</property>
> + <property name="position">0</property>
> + </packing>
> + </child>
> + <child>
> + <object class="GtkBox" id="box1">
> + <property name="visible">True</property>
> + <property name="can_focus">False</property>
> + <property name="orientation">vertical</property>
> + <property name="spacing">6</property>
> + <child>
> + <object class="GtkLabel" id="label1">
> + <property name="visible">True</property>
> + <property name="can_focus">False</property>
> + <property name="xalign">0</property>
> + <property name="label" translatable="yes">SUMMARY OF CHANGES</property>
> + <attributes>
> + <attribute name="weight" value="bold"/>
> + </attributes>
> + </object>
> + <packing>
> + <property name="expand">False</property>
> + <property name="fill">True</property>
> + <property name="position">0</property>
> + </packing>
> + </child>
> + <child>
> + <object class="GtkLabel" id="label2">
> + <property name="visible">True</property>
> + <property name="can_focus">False</property>
> + <property name="xalign">0</property>
> + <property name="label" translatable="yes">Your customizations will result in the following changes taking effect on the disks you've selected:</property>
> + <property name="wrap">True</property>
> + </object>
> + <packing>
> + <property name="expand">False</property>
> + <property name="fill">True</property>
> + <property name="position">1</property>
> + </packing>
> + </child>
> + <child>
> + <object class="GtkScrolledWindow" id="scrolledwindow1">
> + <property name="visible">True</property>
> + <property name="can_focus">True</property>
> + <property name="shadow_type">in</property>
> + <child>
> + <object class="GtkTreeView" id="actionView">
> + <property name="visible">True</property>
> + <property name="sensitive">False</property>
> + <property name="can_focus">True</property>
> + <property name="model">actionStore</property>
> + <property name="headers_clickable">False</property>
> + <child internal-child="selection">
> + <object class="GtkTreeSelection" id="treeview-selection1"/>
> + </child>
> + <child>
> + <object class="GtkTreeViewColumn" id="orderColumn">
> + <property name="title" translatable="yes">Order</property>
> + <child>
> + <object class="GtkCellRendererText" id="orderRenderer"/>
> + <attributes>
> + <attribute name="text">0</attribute>
> + </attributes>
> + </child>
> + </object>
> + </child>
> + <child>
> + <object class="GtkTreeViewColumn" id="actionColumn">
> + <property name="title" translatable="yes">Action</property>
> + <child>
> + <object class="GtkCellRendererText" id="actionRenderer"/>
> + <attributes>
> + <attribute name="markup">1</attribute>
> + </attributes>
> + </child>
> + </object>
> + </child>
> + <child>
> + <object class="GtkTreeViewColumn" id="typeColumn">
> + <property name="title" translatable="yes">Type</property>
> + <child>
> + <object class="GtkCellRendererText" id="typeRenderer"/>
> + <attributes>
> + <attribute name="text">2</attribute>
> + </attributes>
> + </child>
> + </object>
> + </child>
> + <child>
> + <object class="GtkTreeViewColumn" id="deviceNameColumn">
> + <property name="title" translatable="yes">Device Name</property>
> + <child>
> + <object class="GtkCellRendererText" id="deviceNameRenderer"/>
> + <attributes>
> + <attribute name="text">3</attribute>
> + </attributes>
> + </child>
> + </object>
> + </child>
> + <child>
> + <object class="GtkTreeViewColumn" id="mountpointColumn">
> + <property name="title" translatable="yes">Mountpoint</property>
> + <child>
> + <object class="GtkCellRendererText" id="mountpointRenderer"/>
> + <attributes>
> + <attribute name="text">4</attribute>
> + </attributes>
> + </child>
> + </object>
> + </child>
> + </object>
> + </child>
> + </object>
> + <packing>
> + <property name="expand">True</property>
> + <property name="fill">True</property>
> + <property name="position">2</property>
> + </packing>
> + </child>
> + </object>
> + <packing>
> + <property name="expand">True</property>
> + <property name="fill">True</property>
> + <property name="position">1</property>
> + </packing>
> + </child>
> + </object>
> + </child>
> + <action-widgets>
> + <action-widget response="0">summaryCancelButton</action-widget>
> + <action-widget response="1">summaryAcceptButton</action-widget>
> + </action-widgets>
> + </object>
> +</interface>
> diff --git a/pyanaconda/ui/gui/spokes/lib/summary.py b/pyanaconda/ui/gui/spokes/lib/summary.py
> new file mode 100644
> index 0000000..a4a0899
> --- /dev/null
> +++ b/pyanaconda/ui/gui/spokes/lib/summary.py
> @@ -0,0 +1,66 @@
> +# Action summary dialog
> +#
> +# Copyright (C) 2013 Red Hat, Inc.
> +#
> +# This copyrighted material is made available to anyone wishing to use,
> +# modify, copy, or redistribute it subject to the terms and conditions of
> +# the GNU General Public License v.2, or (at your option) any later version.
> +# This program is distributed in the hope that it will be useful, but WITHOUT
> +# ANY WARRANTY expressed or implied, including the implied warranties of
> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
> +# Public License for more details. You should have received a copy of the
> +# GNU General Public License along with this program; if not, write to the
> +# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
> +# 02110-1301, USA. Any Red Hat trademarks that are incorporated in the
> +# source code or documentation are not subject to the GNU General Public
> +# License and may only be used or replicated with the express permission of
> +# Red Hat, Inc.
> +#
> +# Red Hat Author(s): Chris Lumens <clumens at redhat.com>
> +#
> +
> +from gi.repository import Gtk
> +
> +from pyanaconda.ui.gui import GUIObject
> +
> +from blivet.deviceaction import ACTION_TYPE_DESTROY, ACTION_TYPE_RESIZE, ACTION_OBJECT_FORMAT
> +
> +import gettext
> +_ = lambda x: gettext.ldgettext("anaconda", x)
> +
> +__all__ = ["ActionSummaryDialog"]
> +
> +class ActionSummaryDialog(GUIObject):
> + builderObjects = ["actionStore", "summaryDialog"]
> + mainWidgetName = "summaryDialog"
> + uiFile = "spokes/lib/summary.glade"
> +
> + def initialize(self, actions):
> + for (i, action) in enumerate(actions, start=1):
> + mountpoint = ""
> +
> + if action.type in [ACTION_TYPE_DESTROY, ACTION_TYPE_RESIZE]:
> + typeString = """<span foreground='red'>%s</span>""" % action.typeDesc.title()
> + else:
> + typeString = """<span foreground='green'>%s</span>""" % action.typeDesc.title()
> + if action.obj == ACTION_OBJECT_FORMAT:
> + mountpoint = getattr(action.device.format, "mountpoint", "")
> +
> + self._store.append([i,
> + typeString,
> + action.objectTypeString,
> + action.device.name,
> + mountpoint])
> +
> + def refresh(self, actions):
> + GUIObject.refresh(self)
> +
> + self._store = self.builder.get_object("actionStore")
> +
> + self._store.clear()
> + self.initialize(actions)
> +
> + def run(self):
> + rc = self.window.run()
> + self.window.destroy()
> + return rc
More information about the anaconda-patches
mailing list