'If the user cancels before Tor finishes connecting, ask if they want to
quit, or open settings.'

def _tor_connection_canceled(self):

    common.log('OnionShareGui', '_tor_connection_canceled')
    def ask():
        a = Alert(strings._('gui_tor_connection_ask', True), QtWidgets.QMessageBox.Question, buttons=QtWidgets.QMessageBox.NoButton, autostart=False)
        settings_button = QtWidgets.QPushButton(strings._('gui_tor_connection_ask_open_settings', True))
        quit_button = QtWidgets.QPushButton(strings._('gui_tor_connection_ask_quit', True))
        a.addButton(settings_button, QtWidgets.QMessageBox.AcceptRole)
        a.addButton(quit_button, QtWidgets.QMessageBox.RejectRole)
        a.setDefaultButton(settings_button)
        a.exec_()
        if (a.clickedButton() == settings_button):
            common.log('OnionShareGui', '_tor_connection_canceled', 'Settings    button    clicked')
            self.open_settings()
        if (a.clickedButton() == quit_button):
            common.log('OnionShareGui', '_tor_connection_canceled', 'Quit    button    clicked')
            QtCore.QTimer.singleShot(1, self.qtapp.quit)
    QtCore.QTimer.singleShot(100, ask)
