| … | |
… | |
| 3 | # General Public License as published by the Free Software Foundation, a copy |
3 | # General Public License as published by the Free Software Foundation, a copy |
| 4 | # of which can be found in the main directory of this project. |
4 | # of which can be found in the main directory of this project. |
| 5 | |
5 | |
| 6 | import gtk |
6 | import gtk |
| 7 | import GLIScreen |
7 | import GLIScreen |
| 8 | import GLIStorageDevice |
8 | import Partitioning |
| 9 | from GLIException import * |
9 | from GLIException import * |
| 10 | import re |
10 | import re |
| 11 | import PartitionButton |
11 | import PartitionButton |
| 12 | import PartProperties |
12 | import PartProperties |
| 13 | from gettext import gettext as _ |
13 | from gettext import gettext as _ |
| … | |
… | |
| 382 | self.controller.SHOW_BUTTON_HELP = True |
382 | self.controller.SHOW_BUTTON_HELP = True |
| 383 | self.controller.SHOW_BUTTON_BACK = False |
383 | self.controller.SHOW_BUTTON_BACK = False |
| 384 | self.controller.SHOW_BUTTON_FORWARD = True |
384 | self.controller.SHOW_BUTTON_FORWARD = True |
| 385 | self.controller.SHOW_BUTTON_FINISH = False |
385 | self.controller.SHOW_BUTTON_FINISH = False |
| 386 | |
386 | |
| 387 | self.devices = self.controller.install_profile.get_partition_tables() |
387 | # self.devices = self.controller.install_profile.get_partition_tables() |
| 388 | if not self.devices: |
388 | # if not self.devices: |
| 389 | part_load_error = 0 |
389 | part_load_error = 0 |
| 390 | tmp_drives = GLIStorageDevice.detect_devices() |
390 | tmp_drives = Partitioning.detect_devices() |
| 391 | tmp_drives.sort() |
391 | tmp_drives.sort() |
| 392 | for drive in tmp_drives: |
392 | for drive in tmp_drives: |
| 393 | try: |
393 | try: |
| 394 | self.devices[drive] = GLIStorageDevice.Device(drive, arch=self.controller.client_profile.get_architecture_template()) |
394 | self.devices[drive] = Partitioning.Device(drive, arch="x86") |
| 395 | self.devices[drive].set_partitions_from_disk() |
395 | # self.devices[drive].set_partitions_from_disk() |
| 396 | self.detected_dev_combo.append_text(drive) |
396 | self.detected_dev_combo.append_text(drive) |
| 397 | self.drives.append(drive) |
397 | self.drives.append(drive) |
| 398 | except: |
398 | except: |
| 399 | print _("Exception received while loading partitions") |
399 | print _("Exception received while loading partitions from device " + drive) |
| 400 | if self.devices.has_key(drive): del self.devices[drive] |
400 | if self.devices.has_key(drive): del self.devices[drive] |
| 401 | part_load_error = 1 |
401 | part_load_error = 1 |
| 402 | if part_load_error: |
402 | if part_load_error: |
| 403 | msgdlg = gtk.MessageDialog(parent=self.controller.window, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK, message_format="There was an error loading one or more drives' partition table. Possible causes are running as a normal user or partitions being out of disk order.") |
403 | msgdlg = gtk.MessageDialog(parent=self.controller.window, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK, message_format="There was an error loading one or more drives' partition table. Possible causes are running as a normal user or partitions being out of disk order.") |
| 404 | msgdlg.run() |
404 | msgdlg.run() |
| 405 | msgdlg.destroy() |
405 | msgdlg.destroy() |
| 406 | return |
406 | # return |
| 407 | |
407 | |
| 408 | if not self.drives: |
408 | if not self.drives: |
| 409 | tmp_drives = self.devices.keys() |
409 | tmp_drives = self.devices.keys() |
| 410 | tmp_drives.sort() |
410 | tmp_drives.sort() |
| 411 | self.drives = tmp_drives |
411 | self.drives = tmp_drives |
| … | |
… | |
| 415 | if self.devices: |
415 | if self.devices: |
| 416 | self.active_device = self.drives[0] |
416 | self.active_device = self.drives[0] |
| 417 | self.detected_dev_combo.set_active(0) |
417 | self.detected_dev_combo.set_active(0) |
| 418 | self.drive_changed(None) |
418 | self.drive_changed(None) |
| 419 | |
419 | |
| 420 | for device in self.devices: |
420 | # for device in self.devices: |
| 421 | for tmppart in self.devices[device].get_partitions(): |
421 | # for tmppart in self.devices[device].get_partitions(): |
| 422 | if tmppart.get_type() == "unknown": |
422 | # if tmppart.get_type() == "unknown": |
| 423 | msgdlg = gtk.MessageDialog(parent=self.controller.window, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK, message_format="One of your disks (%s) contains a partition (minor %s) of a type that the installer cannot currently handle. If you continue, you risk damaging your partition table. You have been warned!" % (device, str(tmppart.get_minor()))) |
423 | # msgdlg = gtk.MessageDialog(parent=self.controller.window, type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_OK, message_format="One of your disks (%s) contains a partition (minor %s) of a type that the installer cannot currently handle. If you continue, you risk damaging your partition table. You have been warned!" % (device, str(tmppart.get_minor()))) |
| 424 | msgdlg.run() |
424 | # msgdlg.run() |
| 425 | msgdlg.destroy() |
425 | # msgdlg.destroy() |
| 426 | return |
426 | # return |
| 427 | |
427 | |
| 428 | def deactivate(self): |
428 | def deactivate(self): |
| 429 | parts_tmp = {} |
429 | parts_tmp = {} |
| 430 | for device in self.devices.keys(): |
430 | for device in self.devices.keys(): |
| 431 | parts_tmp[device] = self.devices[device].get_install_profile_structure() |
431 | parts_tmp[device] = self.devices[device].get_install_profile_structure() |