[PATCH 4/6] Add the about messages for LVM and RAID.

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

 



* iw/partition_gui.py (createCB):  Add the messages.  Remove the pdb
call.
* ui/create-storage.glade: Make the buttons visible and sensitive.
---
 iw/partition_gui.py     |  120 +++++++++++++++++++++--------------------------
 ui/create-storage.glade |   32 ++++---------
 2 files changed, 64 insertions(+), 88 deletions(-)

diff --git a/iw/partition_gui.py b/iw/partition_gui.py
index 2d25bda..c7d2354 100644
--- a/iw/partition_gui.py
+++ b/iw/partition_gui.py
@@ -1076,15 +1076,17 @@ class PartitionWindow(InstallWindow):
         # control all three activations (Since they all depend on the same
         # thing)
         activate_create_partition = False
-        if self.tree.hasFreeHardDrives():
+        free_part_available = self.tree.hasFreeHardDrives()
+        if free_part_available:
             activate_create_partition = True
 
         # We activate the create Volume Group radio button if there is a free
         # partition with a Physical Volume format.
         activate_create_vg = False
+        availpvs = len(self.storage.unusedPVs())
         if (lvm.has_lvm()
                 and getFormat("lvmpv").supported
-                and len(self.storage.unusedPVs()) > 0):
+                and availpvs > 0):
             activate_create_vg = True
 
         # We activate the create RAID dev if there are partitions that have
@@ -1114,57 +1116,6 @@ class PartitionWindow(InstallWindow):
                                     custom_icon="warning")
             return
 
-# FIXME: Include the error messages somewhere.
-#        if not getFormat("software RAID").supported:
-#            self.intf.messageWindow(_("Not supported"),
-#                                    _("Software RAID is NOT supported on "
-#                                      "this platform."), type="ok",
-#                                    custom_icon="error")
-#            return
-#
-#        availminors = self.storage.unusedMDMinors
-#        if len(availminors) < 1:
-#            self.intf.messageWindow(_("No RAID minor device numbers available"),
-#                                    _("A software RAID device cannot "
-#                                      "be created because all of the "
-#                                      "available RAID minor device numbers "
-#                                      "have been used."),
-#
-#                                    type="ok", custom_icon="error")
-#        numparts = P_("You currently have %d software RAID partition free to use.",
-#                    "You currently have %d software RAID partitions free to use.",
-#                    len(availraidparts)) % len(availraidparts,)
-#
-#        lbltxt = _("Software RAID allows you to combine several disks into "
-#                    "a larger RAID device.  A RAID device can be configured "
-#                    "to provide additional speed and reliability compared "
-#                    "to using an individual drive.  For more information on "
-#                    "using RAID devices please consult the %s "
-#                    "documentation.") % (productName,)
-#
-#        lbltxt = lbltxt + "\n\n" + numparts + "\n\n"
-#
-#        if len(availraidparts) < 2:
-#            lbltxt = lbltxt + _("To use RAID you must first "
-#                                "create at least two partitions of type "
-#                                "'software RAID'.  Then you can "
-#                                "create a RAID device that can "
-#                                "be formatted and mounted.\n\n")
-#
-#        lbltxt = lbltxt + _("What do you want to do now?")
-#
-# FIXME: FOR THE LVM
-#        if not getFormat("lvmpv").supported or not lvm.has_lvm():
-#            self.intf.messageWindow(_("Not supported"),
-#                                    _("LVM is NOT supported on "
-#                                      "this platform."), type="ok",
-#                                    custom_icon="error")
-#            return
-
-
-
-
-
         # GTK crap starts here.
         create_storage_xml = gtk.glade.XML(
                 gui.findGladeFile("create-storage.glade"), domain="anaconda")
@@ -1214,17 +1165,56 @@ class PartitionWindow(InstallWindow):
         gui.addFrame(self.dialog)
         self.dialog.show_all()
 
-        # We loop in the self.dialog.run() only for the help screens.
-        # dialog_rc == 2 -> partition about
-        # dialog_rc == 3 -> raid about
-        # dialog_rc == 4 -> lvm about
-        while True:
-            dialog_rc = self.dialog.run()
-            if dialog_rc == 2 or dialog_rc == 3 or dialog_rc == 4:
-                # FIXME: Code to handle the About messages.
-                pass
-            else:
-                break
+        # Lets work the information messages with CB
+        # The RAID info message
+        rinfo_button = create_storage_xml.get_widget("create_storage_info_raid")
+        whatis_r = _("Software RAID allows you to combine several disks into "
+                    "a larger RAID device.  A RAID device can be configured "
+                    "to provide additional speed and reliability compared "
+                    "to using an individual drive.  For more information on "
+                    "using RAID devices please consult the %s "
+                    "documentation.\n") % (productName,)
+        whatneed_r = _("To use RAID you must first create at least two "
+                "partitions of type 'software RAID'.  Then you can create a "
+                "RAID device that can be formatted and mounted.\n\n")
+        whathave_r = P_(
+                "You currently have %d software RAID partition free to use.",
+                "You currently have %d software RAID partitions free to use.",
+                availraidparts) % (availraidparts,)
+        rinfo_message = "%s\n%s%s" % (whatis_r, whatneed_r, whathave_r)
+        rinfo_cb = lambda x : self.intf.messageWindow(_("About RAID"),
+                                rinfo_message, custom_icon="information")
+        rinfo_button.connect("clicked", rinfo_cb)
+
+        # The LVM info message
+        lvminfo_button = create_storage_xml.get_widget("create_storage_info_lvm")
+        whatis_lvm = _("LVM is an abbreviation for Logical Volume Manager. It "
+                "is a 3 tier construct. The fist is made up of any physical hard "
+                "drive or partition formated with LVM metadata.  These are "
+                "called Physical Volumes (PV).  On top of one or more of "
+                "these PVs, sits the second tier called Volume Group (VG). "
+                "It collects underlying PVs into one LVM element.  Finally, "
+                "on top of the VG sits the Logical Volume (LV) tier.  A VG "
+                "can have one or more LVs. Also note that the VGs can be an "
+                "aggregate of PVs from multiple physical disk. Resizing of "
+                "LVs is also possible. For more information on using LVM "
+                "please consult the %s documentation\n") % (productName, )
+        whatneed_lvm = _("To create a PV you need a partition with "
+                "free space.  To create a VG you need a PV that is not "
+                "part of any VG.  To create a LV you need a VG with free"
+                "space\n\n")
+        whathave_lvm = P_("You currently have %d available PV free to use.\n",
+                            "You currently have %d available PVs free to use.\n",
+                            availpvs) % (availpvs, )
+        if free_part_available:
+            whathave_lvm = whathave_lvm + _("You currently have free space to "
+                    "create PVs.")
+        lvminfo_message = "%s\n%s%s" % (whatis_lvm, whatneed_lvm, whathave_lvm)
+        lvminfo_cb = lambda x : self.intf.messageWindow(_("About LVM"),
+                                    lvminfo_message, custom_icon="information")
+        lvminfo_button.connect("clicked", lvminfo_cb)
+
+        dialog_rc = self.dialog.run()
 
         # If Cancel was pressed
         if dialog_rc == 0:
@@ -1286,8 +1276,6 @@ class PartitionWindow(InstallWindow):
             self.editPartition(device, isNew=1)
             return
 
-        import pdb ; pdb.set_trace()
-
     def resetCB(self, *args):
         if not confirmResetPartitionState(self.intf):
             return
diff --git a/ui/create-storage.glade b/ui/create-storage.glade
index 1ab3bff..5cd5b6b 100644
--- a/ui/create-storage.glade
+++ b/ui/create-storage.glade
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Wed Jul 29 18:27:47 2009 -->
+<!--Generated with glade3 3.4.5 on Thu Jul 30 13:53:49 2009 -->
 <glade-interface>
   <widget class="GtkDialog" id="create_storage_dialog">
     <property name="visible">True</property>
@@ -27,21 +27,7 @@
                   </widget>
                 </child>
                 <child>
-                  <widget class="GtkLinkButton" id="linkbutton1">
-                    <property name="sensitive">False</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="has_tooltip">True</property>
-                    <property name="label" translatable="yes">gtk-about</property>
-                    <property name="relief">GTK_RELIEF_NONE</property>
-                    <property name="use_stock">True</property>
-                    <property name="xalign">1</property>
-                    <property name="response_id">2</property>
-                    <property name="uri">http://glade.gnome.org</property>
-                  </widget>
-                  <packing>
-                    <property name="position">1</property>
-                  </packing>
+                  <placeholder/>
                 </child>
               </widget>
             </child>
@@ -88,12 +74,12 @@ selected by default&lt;/span&gt;</property>
                   </widget>
                 </child>
                 <child>
-                  <widget class="GtkLinkButton" id="linkbutton2">
-                    <property name="sensitive">False</property>
+                  <widget class="GtkLinkButton" id="create_storage_info_raid">
+                    <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
                     <property name="has_tooltip">True</property>
-                    <property name="label" translatable="yes">gtk-about</property>
+                    <property name="label" translatable="yes">gtk-info</property>
                     <property name="relief">GTK_RELIEF_NONE</property>
                     <property name="use_stock">True</property>
                     <property name="xalign">1</property>
@@ -101,6 +87,7 @@ selected by default&lt;/span&gt;</property>
                     <property name="uri">http://glade.gnome.org</property>
                   </widget>
                   <packing>
+                    <property name="expand">False</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -215,12 +202,12 @@ selected by default&lt;/span&gt;</property>
                   </widget>
                 </child>
                 <child>
-                  <widget class="GtkLinkButton" id="linkbutton3">
-                    <property name="sensitive">False</property>
+                  <widget class="GtkLinkButton" id="create_storage_info_lvm">
+                    <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="receives_default">True</property>
                     <property name="has_tooltip">True</property>
-                    <property name="label" translatable="yes">gtk-about</property>
+                    <property name="label" translatable="yes">gtk-info</property>
                     <property name="relief">GTK_RELIEF_NONE</property>
                     <property name="use_stock">True</property>
                     <property name="xalign">1</property>
@@ -228,6 +215,7 @@ selected by default&lt;/span&gt;</property>
                     <property name="uri">http://glade.gnome.org</property>
                   </widget>
                   <packing>
+                    <property name="expand">False</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
-- 
1.6.0.6

_______________________________________________
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