migrationwizard.py
1 #!/usr/bin/env python2.7 2 from PyQt4 import QtCore, QtGui 3 4 class MigrationWizardIntroPage(QtGui.QWizardPage): 5 def __init__(self): 6 super(QtGui.QWizardPage, self).__init__() 7 self.setTitle("Migrating configuration") 8 9 label = QtGui.QLabel("This wizard will help you to migrate your configuration. " 10 "You can still keep using PyBitMessage once you migrate, the changes are backwards compatible.") 11 label.setWordWrap(True) 12 13 layout = QtGui.QVBoxLayout() 14 layout.addWidget(label) 15 self.setLayout(layout) 16 17 def nextId(self): 18 return 1 19 20 21 class MigrationWizardAddressesPage(QtGui.QWizardPage): 22 def __init__(self, addresses): 23 super(QtGui.QWizardPage, self).__init__() 24 self.setTitle("Addresses") 25 26 label = QtGui.QLabel("Please select addresses that you are already using with mailchuck. ") 27 label.setWordWrap(True) 28 29 layout = QtGui.QVBoxLayout() 30 layout.addWidget(label) 31 self.setLayout(layout) 32 33 def nextId(self): 34 return 10 35 36 37 class MigrationWizardGPUPage(QtGui.QWizardPage): 38 def __init__(self): 39 super(QtGui.QWizardPage, self).__init__() 40 self.setTitle("GPU") 41 42 label = QtGui.QLabel("Are you using a GPU? ") 43 label.setWordWrap(True) 44 45 layout = QtGui.QVBoxLayout() 46 layout.addWidget(label) 47 self.setLayout(layout) 48 49 def nextId(self): 50 return 10 51 52 53 class MigrationWizardConclusionPage(QtGui.QWizardPage): 54 def __init__(self): 55 super(QtGui.QWizardPage, self).__init__() 56 self.setTitle("All done!") 57 58 label = QtGui.QLabel("You successfully migrated.") 59 label.setWordWrap(True) 60 61 layout = QtGui.QVBoxLayout() 62 layout.addWidget(label) 63 self.setLayout(layout) 64 65 66 class Ui_MigrationWizard(QtGui.QWizard): 67 def __init__(self, addresses): 68 super(QtGui.QWizard, self).__init__() 69 70 self.pages = {} 71 72 page = MigrationWizardIntroPage() 73 self.setPage(0, page) 74 self.setStartId(0) 75 page = MigrationWizardAddressesPage(addresses) 76 self.setPage(1, page) 77 page = MigrationWizardGPUPage() 78 self.setPage(2, page) 79 page = MigrationWizardConclusionPage() 80 self.setPage(10, page) 81 82 self.setWindowTitle("Migration from PyBitMessage wizard") 83 self.adjustSize() 84 self.show()