fix bug45
This commit is contained in:
@@ -35,7 +35,7 @@ class MainWindow(QMainWindow):
|
||||
|
||||
# 初始化管理器和操作类
|
||||
self.system_manager = SystemInfoManager()
|
||||
self.disk_ops = DiskOperations()
|
||||
self.disk_ops = DiskOperations(self.system_manager)
|
||||
self.raid_ops = RaidOperations()
|
||||
self.lvm_ops = LvmOperations()
|
||||
|
||||
@@ -208,12 +208,12 @@ class MainWindow(QMainWindow):
|
||||
|
||||
if dev_data.get('children'):
|
||||
logger.debug(f"磁盘 {disk_path} 存在现有分区,尝试计算下一个分区起始位置。")
|
||||
calculated_start_mib = self.disk_ops.get_disk_next_partition_start_mib(disk_path)
|
||||
if calculated_start_mib is None:
|
||||
calculated_start_mib, largest_free_space_mib = self.disk_ops.get_disk_free_space_info_mib(disk_path, total_disk_mib)
|
||||
if calculated_start_mib is None or largest_free_space_mib is None:
|
||||
QMessageBox.critical(self, "错误", f"无法确定磁盘 {disk_path} 的分区起始位置。")
|
||||
return
|
||||
start_position_mib = calculated_start_mib
|
||||
max_available_mib = total_disk_mib - start_position_mib
|
||||
max_available_mib = largest_free_space_mib
|
||||
if max_available_mib < 0:
|
||||
max_available_mib = 0.0
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user