[Uludag-commits] r16986 - in branches/yali4/yali4: . gui

uludag-commits at pardus.org.tr uludag-commits at pardus.org.tr
5 Şub 2008 Sal 16:11:26 EET


Author: gokmen.goksel
Date: Tue Feb  5 16:11:26 2008
New Revision: 16986

Modified:
   branches/yali4/yali4/gui/ScrBootloader.py
   branches/yali4/yali4/gui/ScrPartitionAuto.py
   branches/yali4/yali4/partition.py
   branches/yali4/yali4/storage.py
Log:
* Correct way for old-fashion automatic partitioning..

Modified: branches/yali4/yali4/gui/ScrBootloader.py
=================================================================
--- branches/yali4/yali4/gui/ScrBootloader.py	(original)
+++ branches/yali4/yali4/gui/ScrBootloader.py	Tue Feb  5 16:11:26 2008
@@ -98,8 +98,9 @@
                      self.slotSelect)
 
     def backCheck(self):
-        # we need to go partition auto screen, not manual ;)
-        ctx.mainScreen.moveInc = 2
+        if ctx.autoInstall:
+            # we need to go partition auto screen, not manual ;)
+            ctx.mainScreen.moveInc = 2
         return True
 
     def slotSelect(self):
@@ -123,7 +124,8 @@
         dev.deleteAllPartitions()
         dev.commit()
 
-        p = dev.addPartition(parttype.root.parted_type,
+        p = dev.addPartition(None,
+                             parttype.root.parted_type,
                              parttype.root.filesystem,
                              dev.getFreeMB(),
                              parttype.root.parted_flags)

Modified: branches/yali4/yali4/gui/ScrPartitionAuto.py
=================================================================
--- branches/yali4/yali4/gui/ScrPartitionAuto.py	(original)
+++ branches/yali4/yali4/gui/ScrPartitionAuto.py	Tue Feb  5 16:11:26 2008
@@ -86,7 +86,7 @@
         self.connect(self.ui.accept_auto_1, SIGNAL("clicked()"),self.slotSelectAuto)
         self.connect(self.ui.accept_auto_2, SIGNAL("clicked()"),self.slotSelectAuto)
         self.connect(self.ui.manual, SIGNAL("clicked()"),self.slotSelectManual)
-        self.connect(self.ui.device_list, SIGNAL("itemChanged(QListWidgetItem*)"),self.slotDeviceChanged)
+        self.connect(self.ui.device_list, SIGNAL("currentRowChanged(int)"),self.slotDeviceChanged)
 
     def shown(self):
         ctx.mainScreen.disableNext()
@@ -98,6 +98,7 @@
         if self.ui.accept_auto_1.isChecked() or self.ui.accept_auto_2.isChecked():
             ctx.installData.autoPartDev = self.device
             ctx.debugger.log("Automatic Partition selected..")
+            ctx.debugger.log("Trying to use %s for automatic partitioning.." % self.device.getPath())
             if self.ui.accept_auto_2.isChecked():
                 ctx.installData.autoPartMethod = methodEraseAll
             # skip next screen()
@@ -107,7 +108,7 @@
         return True
 
     def slotDeviceChanged(self, i):
-        self.device = i.getDevice()
+        self.device = self.ui.device_list.item(i).getDevice()
 
     def slotSelectAuto(self):
         self.enable_next = True

Modified: branches/yali4/yali4/partition.py
=================================================================
--- branches/yali4/yali4/partition.py	(original)
+++ branches/yali4/yali4/partition.py	Tue Feb  5 16:11:26 2008
@@ -60,6 +60,11 @@
         return self._partition.type == parted.PARTITION_LOGICAL
 
     ##
+    # check if partition is logical
+    def isFreespace(self):
+        return self._partition.type == parted.PARTITION_FREESPACE
+
+    ##
     # check if partition is extended
     def isExtended(self):
         return self._partition.type == parted.PARTITION_EXTENDED

Modified: branches/yali4/yali4/storage.py
=================================================================
--- branches/yali4/yali4/storage.py	(original)
+++ branches/yali4/yali4/storage.py	Tue Feb  5 16:11:26 2008
@@ -277,8 +277,8 @@
         # (OK not really ;)
         size_parts = 8
         for p in self.getPartitions():
-            # don't count logical parts
-            if not p.isLogical():
+            # don't count logical parts and free spaces
+            if not p.isLogical() and not p.isFreespace():
                 size_parts += p.getMB()
 
         size = size_total - size_parts
@@ -324,13 +324,16 @@
     # @param fs: filesystem.FileSystem or file system name (like "ext3")
     # @param size_mb: size of the partition in MBs.
     def addPartition(self, part, type, fs, size_mb, flags = []):
-        size = int(size_mb * MEGABYTE / self._sector_size)
 
         # Don't set bootable flag if there is already a bootable
         # partition in this disk. See bug #2217
         if (parted.PARTITION_BOOT in flags) and self.hasBootablePartition():
             flags = list(set(flags) - set([parted.PARTITION_BOOT]))
 
+        if not part:
+            part = self.__getLargestFreePedPartition()
+
+        size = int(size_mb * MEGABYTE / self._sector_size)
         geom = part.geom
 
         # creating a partition


Uludag-commits mesaj listesiyle ilgili daha fazla bilgi