=== modified file 'ubiquity/components/partman.py' --- ubiquity/components/partman.py 2008-09-29 18:07:20 +0000 +++ ubiquity/components/partman.py 2008-10-24 07:40:26 +0000 @@ -904,8 +904,7 @@ if self.bad_auto_size: self.bad_auto_size = False return False - self.preseed(question, '%d%%' % self.extra_choice, - seen=False) + self.preseed(question, self.extra_choice, seen=False) self.succeeded = True return True elif self.building_cache: === modified file 'ubiquity/frontend/gtk_ui.py' --- ubiquity/frontend/gtk_ui.py 2008-10-15 20:02:15 +0000 +++ ubiquity/frontend/gtk_ui.py 2008-10-24 07:49:11 +0000 @@ -1555,7 +1555,7 @@ if choice == self.resize_choice: # resize_choice should have been hidden otherwise assert self.new_size_scale is not None - return choice, self.new_size_scale.get_value() + return choice, '%d B' % self.new_size_scale.get_size() elif (choice != self.manual_choice and choice in self.autopartition_extras): vbox = self.autopartition_extras[choice].child @@ -2913,14 +2913,23 @@ self.old_os_title = dev elif not self.old_os_title: self.old_os_title = '' + + def get_size(self): + '''Returns the size of the old partition, clipped to the minimum and + maximum sizes.''' + s1 = self.old_os.get_allocation().width + s2 = self.new_os.get_allocation().width + totalwidth = s1 + s2 + size = int(float(s1) * self.part_size / float(totalwidth)) + if size < self.min_size: + return self.min_size + elif size > self.max_size: + return self.max_size + else: + return size def get_value(self): '''Returns the percent the old partition is of the maximum size it can be.''' - s1 = self.old_os.get_allocation().width - s2 = self.new_os.get_allocation().width - totalwidth = s1 + s2 - percentwidth = float(s1) / float(totalwidth) - percentpart = percentwidth * self.part_size - return int((percentpart / self.max_size) * 100) + return int((float(self.get_size()) / self.max_size) * 100) # vim:ai:et:sts=4:tw=80:sw=4: === modified file 'ubiquity/frontend/kde_ui.py' --- ubiquity/frontend/kde_ui.py 2008-10-20 00:45:16 +0000 +++ ubiquity/frontend/kde_ui.py 2008-10-24 09:38:06 +0000 @@ -1332,7 +1332,7 @@ if choice == self.resize_choice: # resize choice should have been hidden otherwise assert self.new_size_scale is not None - return choice, self.new_size_scale.get_value() + return choice, '%d B' % self.new_size_scale.get_size() elif (choice != self.manual_choice and choice in self.autopartition_extra_buttongroup): disk_id = self.autopartition_extra_buttongroup[choice].checkedId() @@ -2648,12 +2648,21 @@ self.old_os_title = dev elif not self.old_os_title: self.old_os_title = '' - + + def get_size(self): + '''Returns the size of the old partition, clipped to the minimum and + maximum sizes.''' + s1 = self.old_os.width() + s2 = self.new_os.width() + totalwidth = s1 + s2 + size = int(float(s1) * self.part_size / float(totalwidth)) + if size < self.min_size: + return self.min_size + elif size > self.max_size: + return self.max_size + else: + return size + def get_value(self): '''Returns the percent the old partition is of the maximum size it can be.''' - s1 = self.old_os.width() - s2 = self.new_os.width() - totalwidth = s1 + s2 - percentwidth = float(s1) / float(totalwidth) - percentpart = percentwidth * self.part_size - return int((percentpart / self.max_size) * 100) + return int((float(self.get_size()) / self.max_size) * 100)