def __init__(self, mainEngine): QtGui.QWidget.__init__(self,None) StepWidget.__init__(self, mainEngine) self.gui = Ui_cd() self.gui.setupUi(self) self.connect(self.gui.comboDrive, QtCore.SIGNAL('currentIndexChanged(int)'), self.onDriveUpdated)
class Widget(QtGui.QWidget, StepWidget): heading = "Install from Pardus Live CD/DVD" cd = None gfxboot_cfg_file = "gfxboot.cfg" def __init__(self, mainEngine): QtGui.QWidget.__init__(self,None) StepWidget.__init__(self, mainEngine) self.gui = Ui_cd() self.gui.setupUi(self) self.connect(self.gui.comboDrive, QtCore.SIGNAL('currentIndexChanged(int)'), self.onDriveUpdated) def onEnter(self): self.populateCDs() def onDriveUpdated(self): pass version = self.determineCDVersion() if version: cdDrive = self.getSelectedCDDrive() self.gui.lblPath.setText("%s CD detected in %s successfully." % (version.name, cdDrive.DeviceID)) else: self.gui.lblPath.setText("Unrecognized Pardus CD in drive.") def populateCDs(self): self.gui.comboDrive.clear() self.mainEngine.compatibility.winPopulateCDs() cdDrives = self.mainEngine.compatibility.cds if not cdDrives or len(cdDrives) == 0: self.gui.lblPath.setText("No CD/DVD-ROM detected on your computer.") self.gui.comboDrive.setDisabled(True) else: self.gui.comboDrive.setDisabled(False) for cd in cdDrives: self.gui.comboDrive.addItem('%s %s' %(cd.DeviceID, cd.Name)) def getSelectedCDDrive(self): for cd in self.mainEngine.compatibility.cds: if cd.DeviceID == self.gui.comboDrive.currentText()[:2]: # TODO: TBD: First 2 letters of combobox is drive letter+colon. # This may fail in the future. return cd return None def isEmptyDrive(self, CD): """ Returns False if CD root is accessible. True if any IO, Permission errors occur. That means CD is not readable. """ try: return not isinstance(os.listdir(CD.DeviceID),list) # check i.e. f:\ except WindowsError, IOError: return True
class Widget(QtGui.QWidget, StepWidget): heading = "Install from Pardus Live CD/DVD" cd = None gfxboot_cfg_file = "gfxboot.cfg" def __init__(self, mainEngine): QtGui.QWidget.__init__(self, None) StepWidget.__init__(self, mainEngine) self.gui = Ui_cd() self.gui.setupUi(self) self.connect(self.gui.comboDrive, QtCore.SIGNAL("currentIndexChanged(int)"), self.onDriveUpdated) def onEnter(self): self.populateCDs() def onDriveUpdated(self): pass version = self.determineCDVersion() if version: cdDrive = self.getSelectedCDDrive() self.gui.lblPath.setText("%s CD detected in %s successfully." % (version.name, cdDrive.DeviceID)) else: self.gui.lblPath.setText("Unrecognized Pardus CD in drive.") def populateCDs(self): self.gui.comboDrive.clear() self.mainEngine.compatibility.winPopulateCDs() cdDrives = self.mainEngine.compatibility.cds if not cdDrives or len(cdDrives) == 0: self.gui.lblPath.setText("No CD/DVD-ROM detected on your computer.") self.gui.comboDrive.setDisabled(True) else: self.gui.comboDrive.setDisabled(False) for cd in cdDrives: self.gui.comboDrive.addItem("%s %s" % (cd.DeviceID, cd.Name)) def getSelectedCDDrive(self): for cd in self.mainEngine.compatibility.cds: if cd.DeviceID == self.gui.comboDrive.currentText()[:2]: # TODO: TBD: First 2 letters of combobox is drive letter+colon. # This may fail in the future. return cd return None def isEmptyDrive(self, CD): """ Returns False if CD root is accessible. True if any IO, Permission errors occur. That means CD is not readable. """ try: return not isinstance(os.listdir(CD.DeviceID), list) # check i.e. f:\ except WindowsError, IOError: return True
def __init__(self, mainEngine): QtGui.QWidget.__init__(self, None) StepWidget.__init__(self, mainEngine) self.gui = Ui_cd() self.gui.setupUi(self) self.connect(self.gui.comboDrive, QtCore.SIGNAL("currentIndexChanged(int)"), self.onDriveUpdated)