[PATCH 1/7] Offer completions for new mountpoints.

David Lehman dlehman at redhat.com
Fri Aug 24 20:20:59 UTC 2012


---
 pyanaconda/ui/gui/spokes/custom.glade |   10 ++++++++++
 pyanaconda/ui/gui/spokes/custom.py    |   17 +++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.glade b/pyanaconda/ui/gui/spokes/custom.glade
index b417920..93d60ec 100644
--- a/pyanaconda/ui/gui/spokes/custom.glade
+++ b/pyanaconda/ui/gui/spokes/custom.glade
@@ -2,6 +2,15 @@
 <interface>
   <!-- interface-requires gtk+ 3.0 -->
   <!-- interface-requires AnacondaWidgets 1.0 -->
+  <object class="GtkListStore" id="mountPointStore">
+    <columns>
+      <!-- column-name path -->
+      <column type="gchararray"/>
+    </columns>
+  </object>
+  <object class="GtkEntryCompletion" id="mountPointCompletion">
+    <property name="model">mountPointStore</property>
+  </object>
   <object class="GtkDialog" id="addDialog">
     <property name="can_focus">False</property>
     <property name="border_width">5</property>
@@ -135,6 +144,7 @@ after creating the mount point below.</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="invisible_char">●</property>
+                <property name="completion">mountPointCompletion</property>
               </object>
               <packing>
                 <property name="left_attach">1</property>
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 6f5fdcc..57477af 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -81,15 +81,27 @@ def ui_storage_logger():
     storage_log.removeFilter(f)
 
 class AddDialog(GUIObject):
-    builderObjects = ["addDialog"]
+    builderObjects = ["addDialog", "mountPointStore", "mountPointCompletion"]
     mainWidgetName = "addDialog"
     uiFile = "spokes/custom.glade"
 
     def __init__(self, *args, **kwargs):
+        self.mountpoints = kwargs.pop("mountpoints", [])
         GUIObject.__init__(self, *args, **kwargs)
         self.size = Size(bytes=0)
         self.mountpoint = ""
 
+        # sure, add whatever you want to this list. this is just a start.
+        paths = ["/", "/boot", "/home", "/usr", "/var", "swap"]
+        store = self.builder.get_object("mountPointStore")
+        for path in paths:
+            if path not in self.mountpoints:
+                store.append([path])
+
+        completion = self.builder.get_object("mountPointCompletion")
+        completion.set_text_column(0)
+        completion.set_popup_completion(True)
+
     def on_add_cancel_clicked(self, button, *args):
         self.window.destroy()
 
@@ -744,7 +756,8 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
     def on_add_clicked(self, button):
         self._save_right_side(self._current_selector)
 
-        dialog = AddDialog(self.data)
+        dialog = AddDialog(self.data,
+                           mountpoints=self.__storage.mountpoints.keys())
         with enlightbox(self.window, dialog.window):
             dialog.refresh()
             rc = dialog.run()
-- 
1.7.7.6



More information about the anaconda-patches mailing list