~diegosarmentero/ubuntuone-windows-installer/847796

« back to all changes in this revision

Viewing changes to ubuntuone_installer/gui/qt/gui.py

- Uninstall when the user chooses "Disagree & uninstall" (LP: #829361).

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
    setup_account_ui,
72
72
)
73
73
 
 
74
from ubuntuone_installer.gui.qt import utils
74
75
from ubuntuone_installer.gui.qt.are_you_sure import AreYouSure
75
76
from ubuntuone_installer.gui.qt.currentuser import CurrentUserController
76
77
from ubuntuone_installer.gui.qt.folders import FoldersPage
109
110
    def initializePage(self):
110
111
        """Setup UI details."""
111
112
        # Set the right texts and connections for buttons
112
 
        self.setButtonText(QtGui.QWizard.NextButton, _("Agree && Install"))
 
113
        self.setButtonText(QtGui.QWizard.NextButton, _("Agree && continue"))
113
114
        self.setButtonText(QtGui.QWizard.CancelButton,
114
 
            _("Disagree && Cancel"))
115
 
        self.setButtonText(QtGui.QWizard.CustomButton1, _("&Print"))
 
115
            _("Disagree && uninstall"))
116
116
 
117
117
        # This is just to catch an exception thrown when nothing
118
118
        # is connected to the signal. It's not an exceptional
122
122
        except TypeError:
123
123
            pass
124
124
 
125
 
        self.wizard().customButtonClicked.connect(self.print_document)
126
 
 
127
125
        self.wizard().setButtonLayout([
128
126
            QtGui.QWizard.CancelButton,
129
127
            QtGui.QWizard.BackButton,
130
128
            QtGui.QWizard.Stretch,
131
 
            QtGui.QWizard.CustomButton1,
132
129
            QtGui.QWizard.NextButton,
133
130
            QtGui.QWizard.FinishButton])
134
131
 
135
 
    def print_document(self, button_id):
136
 
        """Print the document displayed in textBrowser."""
137
 
        if button_id == QtGui.QWizard.CustomButton1:
138
 
            document = self.ui.textBrowser.document()
139
 
            printer = QtGui.QPrinter(QtGui.QPrinter.HighResolution)
140
 
 
141
 
            dialog = QtGui.QPrintDialog(printer, self)
142
 
 
143
 
            dialog.setWindowTitle(_("Send to printer"))
144
 
            if dialog.exec_() != QtGui.QDialog.Accepted:
145
 
                return
146
 
            printer.setFullPage(True)
147
 
            printer.setPageSize(QtGui.QPrinter.A4)
148
 
            document.print_(printer)
149
 
 
150
132
    def nextId(self):
151
133
        """Return next page's ID."""
152
134
        if self._next_id is None:
478
460
            else:
479
461
                cp_path = "ubuntuone-control-panel-qt"
480
462
            subprocess.Popen([cp_path, ])
 
463
        elif self.currentId() == self.LICENSE_PAGE_ID:
 
464
            if not AreYouSure(self).exec_():
 
465
                utils.uninstall_application()
 
466
            else:
 
467
                return
481
468
        elif self.currentId() != self.CONGRATULATIONS_PAGE:
482
469
            if AreYouSure(self).exec_():
483
470
                return