예제 #1
0
파일: gathergui.py 프로젝트: jrd/bootsetup
 def update_buttons(self):
     install_ok = False
     multiple = False
     grub2_edit_ok = False
     if (
         self.cfg.cur_mbr_device
         and os.path.exists("/dev/{0}".format(self.cfg.cur_mbr_device))
         and slt.getDiskInfo(self.cfg.cur_mbr_device)
     ):
         if self.cfg.cur_bootloader == "lilo" and not self._editing:
             if len(self.BootPartitionListStore) > 1:
                 multiple = True
             for bp in self.BootPartitionListStore:
                 if bp[4] == "gtk-yes":
                     install_ok = True
         elif self.cfg.cur_bootloader == "grub2":
             if (
                 self.cfg.cur_boot_partition
                 and os.path.exists("/dev/{0}".format(self.cfg.cur_boot_partition))
                 and slt.getPartitionInfo(self.cfg.cur_boot_partition)
             ):
                 install_ok = True
             if install_ok:
                 partition = os.path.join("/dev", self.cfg.cur_boot_partition)
                 if slt.isMounted(partition):
                     mp = slt.getMountPoint(partition)
                     doumount = False
                 else:
                     mp = slt.mountDevice(partition)
                     doumount = True
                 grub2_edit_ok = os.path.exists(os.path.join(mp, "etc/default/grub"))
                 if doumount:
                     slt.umountDevice(mp)
     self.RadioLilo.set_sensitive(not self._editing)
     self.RadioGrub2.set_sensitive(not self._editing)
     self.ComboBoxMbr.set_sensitive(not self._editing)
     self.BootPartitionTreeview.set_sensitive(not self._custom_lilo)
     self.UpButton.set_sensitive(not self._editing and multiple)
     self.DownButton.set_sensitive(not self._editing and multiple)
     self.LiloUndoButton.set_sensitive(not self._editing and self._custom_lilo)
     self.LiloEditButton.set_sensitive(not self._editing and install_ok)
     self.Grub2EditButton.set_sensitive(grub2_edit_ok)
     self.ExecuteButton.set_sensitive(not self._editing and install_ok)