def __init__(self, *args, **kwargs): QtGui.QWizardPage.__init__(self, *args, **kwargs) self.ui = Ui_keymethod() self.ui.setupUi(self) self.group = group = QtGui.QButtonGroup() for radio in self.children(): if type(radio) == QtGui.QRadioButton: group.addButton(radio)
class MethodPage(QtGui.QWizardPage): def __init__(self, *args, **kwargs): QtGui.QWizardPage.__init__(self, *args, **kwargs) self.ui = Ui_keymethod() self.ui.setupUi(self) self.group = group = QtGui.QButtonGroup() for radio in self.children(): if type(radio) == QtGui.QRadioButton: group.addButton(radio) def initializePage(self): self.found = Undertaker.check( str('near://' + self.wizard().get_tombfile())) or [] box = self.ui.radio_layout for key in self.found: radio = QtGui.QRadioButton('Automatically found: ' + key, parent=self) radio.setChecked(True) radio.setProperty('path', key) box.insertWidget(0, radio) self.group.addButton(radio) def nextId(self): '''Virtual method reimplemented to decide next page''' if self.ui.fs.isChecked(): keyfile = QtGui.QFileDialog.getOpenFileName( self.wizard(), 'Key file', filter="Tomb keys (*.tomb.key);;Buried keys (*.jpeg)") if keyfile: #TODO: check if this really is a success :) if Tomb.open(self.wizard().get_tombfile(), keyfile): #bugs when wrong password return TombOpenWizard.SUCCESS_PAGE #else: #TODO: should alert the user that we failed return TombOpenWizard.METHOD_PAGE if self.ui.usb.isChecked(): return TombOpenWizard.USB_PAGE print self.group.checkedButton().property('path').toPyObject() return TombOpenWizard.SUCCESS_PAGE
class MethodPage(QtGui.QWizardPage): def __init__(self, *args, **kwargs): QtGui.QWizardPage.__init__(self, *args, **kwargs) self.ui = Ui_keymethod() self.ui.setupUi(self) self.group = group = QtGui.QButtonGroup() for radio in self.children(): if type(radio) == QtGui.QRadioButton: group.addButton(radio) def initializePage(self): self.found = Undertaker.check( str('near://' + self.wizard().get_tombfile()) ) or [] box = self.ui.radio_layout for key in self.found: radio = QtGui.QRadioButton('Automatically found: ' + key, parent=self) radio.setChecked(True) radio.setProperty('path', key) box.insertWidget(0, radio) self.group.addButton(radio) def nextId(self): '''Virtual method reimplemented to decide next page''' if self.ui.fs.isChecked(): keyfile = QtGui.QFileDialog.getOpenFileName(self.wizard(), 'Key file', filter="Tomb keys (*.tomb.key);;Buried keys (*.jpeg)") if keyfile: #TODO: check if this really is a success :) if Tomb.open(self.wizard().get_tombfile(), keyfile): #bugs when wrong password return TombOpenWizard.SUCCESS_PAGE #else: #TODO: should alert the user that we failed return TombOpenWizard.METHOD_PAGE if self.ui.usb.isChecked(): return TombOpenWizard.USB_PAGE print self.group.checkedButton().property('path').toPyObject() return TombOpenWizard.SUCCESS_PAGE