Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian User (http://www.linux-archive.org/debian-user/)
-   -   Change the device reinitialization dialog (http://www.linux-archive.org/debian-user/466015-change-device-reinitialization-dialog.html)

Martin Gracik 12-15-2010 01:41 PM

Change the device reinitialization dialog
 
Resolves: rhbz#657376
---
gui.py | 78 ++++++++++---
ui/reinitialize-dialog.glade | 257 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 320 insertions(+), 15 deletions(-)
create mode 100644 ui/reinitialize-dialog.glade

diff --git a/gui.py b/gui.py
index eb6dc22..3dfbddb 100755
--- a/gui.py
+++ b/gui.py
@@ -810,6 +810,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>
%s MB %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
@@ -1072,6 +1122,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 task_gui import RepoCreator
dialog = RepoCreator(self.anaconda)
@@ -1178,21 +1238,9 @@ class InstallInterface(InstallInterfaceBase):
"using cached answer: %s" % self._initLabelAnswers["all"])
return self._initLabelAnswers["all"]

- rc = self.messageWindow(_("Warning"),
- _("Error processing drive:

"
- "%(path)s
%(size)-0.fMB
%(description)s

"
- "This device may need to be reinitialized.

"
- "REINITIALIZING WILL CAUSE ALL DATA TO BE LOST!

"
- "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:
diff --git a/ui/reinitialize-dialog.glade b/ui/reinitialize-dialog.glade
new file mode 100644
index 0000000..6b1ec5a
--- /dev/null
+++ b/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_PAREN T</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>
--
1.7.3.2

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

Chris Lumens 12-15-2010 02:42 PM

Change the device reinitialization dialog
 
> gui.py | 78 ++++++++++---
> ui/reinitialize-dialog.glade | 257 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 320 insertions(+), 15 deletions(-)
> create mode 100644 ui/reinitialize-dialog.glade

For consistency you will probably want to add a similar class in text.py
and make the wording there the same.

Also, do you still have the screenshot of this dialog available? That's
so much easier to look at than a glade file which I just have to assume
is correct.

- Chris

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

Martin Gracik 12-15-2010 02:52 PM

Change the device reinitialization dialog
 
here you go http://mgracik.fedorapeople.org/reinitialize-dialog.png

On Wed, 2010-12-15 at 10:42 -0500, Chris Lumens wrote:
> > gui.py | 78 ++++++++++---
> > ui/reinitialize-dialog.glade | 257 ++++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 320 insertions(+), 15 deletions(-)
> > create mode 100644 ui/reinitialize-dialog.glade
>
> For consistency you will probably want to add a similar class in text.py
> and make the wording there the same.
>
> Also, do you still have the screenshot of this dialog available? That's
> so much easier to look at than a glade file which I just have to assume
> is correct.
>
> - Chris
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

--
Martin Gracik <mgracik@redhat.com>

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

David Lehman 12-15-2010 03:07 PM

Change the device reinitialization dialog
 
On Wed, 2010-12-15 at 16:52 +0100, Martin Gracik wrote:
> here you go http://mgracik.fedorapeople.org/reinitialize-dialog.png

Are blank and unpartitioned not the same thing in this context? We do
support whole-disk formatting like filesystems and lvm pvs, which would
be considered unpartitioned disks that do not lead to display of this
dialog. Is the addition of the term "unpartitioned" making it less
confusing or more confusing?

Dave

>
> On Wed, 2010-12-15 at 10:42 -0500, Chris Lumens wrote:
> > > gui.py | 78 ++++++++++---
> > > ui/reinitialize-dialog.glade | 257 ++++++++++++++++++++++++++++++++++++++++++
> > > 2 files changed, 320 insertions(+), 15 deletions(-)
> > > create mode 100644 ui/reinitialize-dialog.glade
> >
> > For consistency you will probably want to add a similar class in text.py
> > and make the wording there the same.
> >
> > Also, do you still have the screenshot of this dialog available? That's
> > so much easier to look at than a glade file which I just have to assume
> > is correct.
> >
> > - Chris
> >
> > _______________________________________________
> > Anaconda-devel-list mailing list
> > Anaconda-devel-list@redhat.com
> > https://www.redhat.com/mailman/listinfo/anaconda-devel-list
>


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

Chris Lumens 12-15-2010 03:12 PM

Change the device reinitialization dialog
 
> here you go http://mgracik.fedorapeople.org/reinitialize-dialog.png

Looks nice. And thanks for doing this with glade.

Oh - remember to add "data/ui/reinitialize-dialog.glade.h" to
po/POTFILES.in way down at the bottom, or translations will not get
pulled in.

- Chris

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

Martin Gracik 12-20-2010 03:48 PM

Change the device reinitialization dialog
 
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_PAREN T</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>
%s MB %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:

"
- "%(path)s
%(size)-0.fMB
%(description)s

"
- "This device may need to be reinitialized.

"
- "REINITIALIZING WILL CAUSE ALL DATA TO BE LOST!

"
- "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:
--
1.7.3.2

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

Martin Gracik 12-20-2010 04:13 PM

Change the device reinitialization dialog
 
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_PAREN T</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>
%s MB %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:

"
> - "%(path)s
%(size)-0.fMB
%(description)s

"
> - "This device may need to be reinitialized.

"
> - "REINITIALIZING WILL CAUSE ALL DATA TO BE LOST!

"
> - "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@redhat.com>

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

"Brian C. Lane" 12-20-2010 04:51 PM

Change the device reinitialization dialog
 
On Mon, Dec 20, 2010 at 06:13:47PM +0100, Martin Gracik wrote:
> This one was already pushed to rhel6-branch, but it needed some changes
> for master...
>

Ack

--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 05:54 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.