Re: [PATCH 1/2] Change the device reinitialization dialog

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This one was already pushed to rhel6-branch, but it needed some changes
for master...

On Mon, 2010-12-20 at 17:48 +0100, Martin Gracik wrote:
> Resolves: rhbz#657376
> ---
>  data/ui/reinitialize-dialog.glade  |  257 ++++++++++++++++++++++++++++++++++++
>  po/POTFILES.in                     |    1 +
>  pyanaconda/gui.py                  |   60 +++++++++
>  pyanaconda/installinterfacebase.py |   18 +--
>  4 files changed, 321 insertions(+), 15 deletions(-)
>  create mode 100644 data/ui/reinitialize-dialog.glade
> 
> diff --git a/data/ui/reinitialize-dialog.glade b/data/ui/reinitialize-dialog.glade
> new file mode 100644
> index 0000000..6b1ec5a
> --- /dev/null
> +++ b/data/ui/reinitialize-dialog.glade
> @@ -0,0 +1,257 @@
> +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd";>
> +
> +<glade-interface>
> +
> +<widget class="GtkDialog" id="reinitializeDialog">
> +  <property name="border_width">5</property>
> +  <property name="visible">True</property>
> +  <property name="title" translatable="yes">Storage Device Warning</property>
> +  <property name="type">GTK_WINDOW_TOPLEVEL</property>
> +  <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
> +  <property name="modal">True</property>
> +  <property name="resizable">True</property>
> +  <property name="destroy_with_parent">False</property>
> +  <property name="decorated">True</property>
> +  <property name="skip_taskbar_hint">False</property>
> +  <property name="skip_pager_hint">False</property>
> +  <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
> +  <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
> +  <property name="focus_on_map">True</property>
> +  <property name="urgency_hint">False</property>
> +  <property name="has_separator">False</property>
> +
> +  <child internal-child="vbox">
> +    <widget class="GtkVBox" id="dialog-vbox1">
> +      <property name="visible">True</property>
> +      <property name="homogeneous">False</property>
> +      <property name="spacing">0</property>
> +
> +      <child internal-child="action_area">
> +	<widget class="GtkHButtonBox" id="dialog-action_area1">
> +	  <property name="visible">True</property>
> +	  <property name="layout_style">GTK_BUTTONBOX_END</property>
> +
> +	  <child>
> +	    <widget class="GtkButton" id="button1">
> +	      <property name="visible">True</property>
> +	      <property name="can_default">True</property>
> +	      <property name="can_focus">True</property>
> +	      <property name="label" translatable="yes">Yes, discard any data</property>
> +	      <property name="use_underline">True</property>
> +	      <property name="relief">GTK_RELIEF_NORMAL</property>
> +	      <property name="focus_on_click">True</property>
> +	      <property name="response_id">-8</property>
> +	    </widget>
> +	  </child>
> +
> +	  <child>
> +	    <widget class="GtkButton" id="button2">
> +	      <property name="visible">True</property>
> +	      <property name="can_default">True</property>
> +	      <property name="can_focus">True</property>
> +	      <property name="has_focus">True</property>
> +	      <property name="label" translatable="yes">No, keep any data</property>
> +	      <property name="use_underline">True</property>
> +	      <property name="relief">GTK_RELIEF_NORMAL</property>
> +	      <property name="focus_on_click">True</property>
> +	      <property name="response_id">-9</property>
> +	    </widget>
> +	  </child>
> +	</widget>
> +	<packing>
> +	  <property name="padding">0</property>
> +	  <property name="expand">False</property>
> +	  <property name="fill">False</property>
> +	  <property name="pack_type">GTK_PACK_END</property>
> +	</packing>
> +      </child>
> +
> +      <child>
> +	<widget class="GtkTable" id="table1">
> +	  <property name="visible">True</property>
> +	  <property name="n_rows">2</property>
> +	  <property name="n_columns">2</property>
> +	  <property name="homogeneous">False</property>
> +	  <property name="row_spacing">10</property>
> +	  <property name="column_spacing">10</property>
> +
> +	  <child>
> +	    <widget class="GtkImage" id="image1">
> +	      <property name="visible">True</property>
> +	      <property name="stock">gtk-dialog-warning</property>
> +	      <property name="icon_size">6</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="left_attach">0</property>
> +	      <property name="right_attach">1</property>
> +	      <property name="top_attach">0</property>
> +	      <property name="bottom_attach">1</property>
> +	      <property name="x_options">fill</property>
> +	      <property name="y_options">fill</property>
> +	    </packing>
> +	  </child>
> +
> +	  <child>
> +	    <widget class="GtkLabel" id="label1">
> +	      <property name="visible">True</property>
> +	      <property name="label" translatable="yes">&lt;span size=&quot;large&quot; weight=&quot;bold&quot;&gt;The storage device below may contain data.&lt;/span&gt;</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</property>
> +	      <property name="yalign">0.5</property>
> +	      <property name="xpad">0</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="left_attach">1</property>
> +	      <property name="right_attach">2</property>
> +	      <property name="top_attach">0</property>
> +	      <property name="bottom_attach">1</property>
> +	      <property name="y_options"></property>
> +	    </packing>
> +	  </child>
> +
> +	  <child>
> +	    <widget class="GtkVBox" id="vbox2">
> +	      <property name="visible">True</property>
> +	      <property name="homogeneous">False</property>
> +	      <property name="spacing">10</property>
> +
> +	      <child>
> +		<widget class="GtkHBox" id="hbox1">
> +		  <property name="visible">True</property>
> +		  <property name="homogeneous">False</property>
> +		  <property name="spacing">10</property>
> +
> +		  <child>
> +		    <widget class="GtkImage" id="image2">
> +		      <property name="visible">True</property>
> +		      <property name="stock">gtk-harddisk</property>
> +		      <property name="icon_size">6</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">False</property>
> +		    </packing>
> +		  </child>
> +
> +		  <child>
> +		    <widget class="GtkLabel" id="disk_label">
> +		      <property name="visible">True</property>
> +		      <property name="label" translatable="yes"></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</property>
> +		      <property name="yalign">0.5</property>
> +		      <property name="xpad">0</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">True</property>
> +		      <property name="fill">True</property>
> +		    </packing>
> +		  </child>
> +		</widget>
> +		<packing>
> +		  <property name="padding">0</property>
> +		  <property name="expand">False</property>
> +		  <property name="fill">False</property>
> +		</packing>
> +	      </child>
> +
> +	      <child>
> +		<widget class="GtkLabel" id="label3">
> +		  <property name="visible">True</property>
> +		  <property name="label" translatable="yes">We could not detect partitions or filesystems on this device.
> +
> +This could be because the device is &lt;b&gt;blank&lt;/b&gt;, &lt;b&gt;unpartitioned&lt;/b&gt;, or &lt;b&gt;virtual&lt;/b&gt;. If not,
> +there may be data on the device that can not be recovered if you use it in this
> +installation. We can remove the device from this installation to protect the data.
> +
> +Are you sure this device does not contain valuable data?</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</property>
> +		  <property name="yalign">0.5</property>
> +		  <property name="xpad">0</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">True</property>
> +		  <property name="fill">True</property>
> +		</packing>
> +	      </child>
> +
> +	      <child>
> +		<widget class="GtkCheckButton" id="apply_to_all">
> +		  <property name="visible">True</property>
> +		  <property name="can_default">True</property>
> +		  <property name="can_focus">True</property>
> +		  <property name="label" translatable="yes">Apply my choice to all devices with undetected partitions or filesystems</property>
> +		  <property name="use_underline">True</property>
> +		  <property name="relief">GTK_RELIEF_NORMAL</property>
> +		  <property name="focus_on_click">True</property>
> +		  <property name="active">True</property>
> +		  <property name="inconsistent">False</property>
> +		  <property name="draw_indicator">True</property>
> +		</widget>
> +		<packing>
> +		  <property name="padding">10</property>
> +		  <property name="expand">True</property>
> +		  <property name="fill">True</property>
> +		</packing>
> +	      </child>
> +	    </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">fill</property>
> +	    </packing>
> +	  </child>
> +	</widget>
> +	<packing>
> +	  <property name="padding">0</property>
> +	  <property name="expand">True</property>
> +	  <property name="fill">True</property>
> +	</packing>
> +      </child>
> +    </widget>
> +  </child>
> +</widget>
> +
> +</glade-interface>
> diff --git a/po/POTFILES.in b/po/POTFILES.in
> index 7a14f6e..73b48c4 100644
> --- a/po/POTFILES.in
> +++ b/po/POTFILES.in
> @@ -161,6 +161,7 @@ data/ui/lukspassphrase.glade.h
>  data/ui/network.glade.h
>  data/ui/tasksel.glade.h
>  data/ui/zfcp-config.glade.h
> +data/ui/reinitialize-dialog.glade.h
>  
>  # lang-table
>  data/lang-table.h
> diff --git a/pyanaconda/gui.py b/pyanaconda/gui.py
> index 48537f7..36bcc76 100755
> --- a/pyanaconda/gui.py
> +++ b/pyanaconda/gui.py
> @@ -758,6 +758,56 @@ class MessageWindow:
>          except SystemError:
>              pass
>  
> +class ReinitializeWindow(MessageWindow):
> +
> +    def __init__ (self, title, path, size, description, details,
> +                  default=None, run=True, parent=None, destroyAfterRun=True):
> +
> +        self.debugRid = None
> +        self.title = title
> +        if flags.autostep:
> +            self.rc = 1
> +            return
> +        self.rc = None
> +        self.framed = False
> +        self.doCustom = False
> +
> +        xml = gtk.glade.XML(findGladeFile("reinitialize-dialog.glade"),
> +                            domain="anaconda")
> +
> +        self.dialog = xml.get_widget("reinitializeDialog")
> +        self.apply_to_all = xml.get_widget("apply_to_all")
> +
> +        self.label = xml.get_widget("disk_label")
> +        text = "<b>%s</b>\n%s MB\t%s" % (description, size, path)
> +        self.label.set_markup(text)
> +
> +        if parent:
> +            self.dialog.set_transient_for(parent)
> +        self.dialog.set_position(gtk.WIN_POS_CENTER)
> +
> +        if flags.debug:
> +            widget = self.dialog.add_button(_("_Debug"), 2)
> +            self.debugRid = 2
> +
> +        defaultchoice = 0 #no
> +        self.dialog.set_default_response(defaultchoice)
> +
> +        if run:
> +            self.run(destroyAfterRun)
> +
> +    def run(self, destroy=False):
> +        MessageWindow.run(self, destroy)
> +        apply_all = self.apply_to_all.get_active()
> +
> +        # doCustom is false, so we will have self.rc set up as following:
> +        # if "Yes, discard" was clicked - self.rc = 1
> +        # if "No, keep" was clicked     - self.rc = 0
> +        if self.rc == 1: #yes
> +            self.rc = 3 if apply_all else 2
> +        elif self.rc == 0: #no
> +            self.rc = 1 if apply_all else 0
> +
>  class DetailedMessageWindow(MessageWindow):
>      def __init__(self, title, text, longText=None, type="ok", default=None, custom_buttons=None, custom_icon=None, run=True, parent=None, destroyAfterRun=True, expanded=False):
>          self.title = title
> @@ -1043,6 +1093,16 @@ class InstallInterface(InstallInterfaceBase):
>                  custom_buttons, custom_icon, run=True, parent=parent).getrc()
>          return rc
>  
> +    def reinitializeWindow(self, title, path, size, description, details):
> +        if self.icw:
> +            parent = self.icw.window
> +        else:
> +            parent = None
> +
> +        rc = ReinitializeWindow(title, path, size, description, details,
> +                                parent=parent).getrc()
> +        return rc
> +
>      def createRepoWindow(self):
>          from iw.task_gui import RepoCreator
>          dialog = RepoCreator(self.anaconda)
> diff --git a/pyanaconda/installinterfacebase.py b/pyanaconda/installinterfacebase.py
> index 2dba067..e349268 100644
> --- a/pyanaconda/installinterfacebase.py
> +++ b/pyanaconda/installinterfacebase.py
> @@ -79,21 +79,9 @@ class InstallInterfaceBase(object):
>                       "using cached answer: %s" % self._initLabelAnswers["all"])
>              return self._initLabelAnswers["all"]
>  
> -        rc = self.messageWindow(_("Warning"),
> -                _("Error processing drive:\n\n"
> -                  "%(path)s\n%(size)-0.fMB\n%(description)s\n\n"
> -                  "This device may need to be reinitialized.\n\n"
> -                  "REINITIALIZING WILL CAUSE ALL DATA TO BE LOST!\n\n"
> -                  "This action may also be applied to all other disks "
> -                  "needing reinitialization.%(details)s")
> -                % {'path': path, 'size': size,
> -                   'description': description, 'details': details},
> -                type="custom",
> -                custom_buttons = [ _("_Ignore"),
> -                                   _("Ignore _all"),
> -                                   _("_Re-initialize"),
> -                                   _("Re-ini_tialize all") ],
> -                custom_icon="question")
> +        rc = self.reinitializeWindow(_("Storage Device Warning"),
> +                                     path, size, description, details)
> +
>          if rc == 0:
>              retVal = False
>          elif rc == 1:

-- 
Martin Gracik <mgracik@xxxxxxxxxx>

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux