class PrefsViewerDialog(SizePersistedDialog):
    def __init__(self, gui, namespace):
        SizePersistedDialog.__init__(self, gui, 'Prefs Viewer dialog')
        self.setWindowTitle('Preferences for: ' + namespace)

        self.db = gui.current_db
        self.namespace = namespace
        self._init_controls()
        self.resize_dialog()

        self._populate_settings()

        if self.keys_list.count():
            self.keys_list.setCurrentRow(0)

    def _init_controls(self):
        layout = QVBoxLayout(self)
        self.setLayout(layout)

        ml = QHBoxLayout()
        layout.addLayout(ml, 1)

        self.keys_list = QListWidget(self)
        self.keys_list.setSelectionMode(QAbstractItemView.SingleSelection)
        self.keys_list.setFixedWidth(150)
        self.keys_list.setAlternatingRowColors(True)
        ml.addWidget(self.keys_list)
        self.value_text = QTextEdit(self)
        self.value_text.setTabStopWidth(24)
        self.value_text.setReadOnly(True)
        ml.addWidget(self.value_text, 1)

        button_box = QDialogButtonBox(QDialogButtonBox.Ok)
        button_box.accepted.connect(self.accept)
        button_box.setCenterButtons(True)
        layout.addWidget(button_box)

    def _populate_settings(self):
        self.keys_list.clear()
        ns_prefix = 'namespaced:%s:' % self.namespace
        keys = sorted([
            k[len(ns_prefix):] for k in six.iterkeys(self.db.prefs)
            if k.startswith(ns_prefix)
        ])
        for key in keys:
            self.keys_list.addItem(key)
        self.keys_list.setMinimumWidth(self.keys_list.sizeHintForColumn(0))
        self.keys_list.currentRowChanged[int].connect(
            self._current_row_changed)

    def _current_row_changed(self, new_row):
        if new_row < 0:
            self.value_text.clear()
            return
        key = unicode(self.keys_list.currentItem().text())
        val = self.db.prefs.get_namespaced(self.namespace, key, '')
        self.value_text.setPlainText(self.db.prefs.to_raw(val))
Ejemplo n.º 2
0
class _ResponsesTab(QTabWidget):
    """Tab which shows all module and shell responses."""
    def __init__(self):
        super().__init__()

        layout = QVBoxLayout()
        self._output_field = QTextEdit()

        self._output_field.setTextInteractionFlags(Qt.NoTextInteraction)
        self._output_field.setPlaceholderText("Please wait for responses...")

        layout.addWidget(self._output_field)
        self.setLayout(layout)

    def clear(self):
        """Clears all output."""
        self._output_field.clear()

    def output(self, text: str):
        """Adds a line to the output field."""
        self._output_field.append(text)
Ejemplo n.º 3
0
class App(QWidget):
    def __init__(self):
        super().__init__()
        self.title = 'Knowledge Extraction'
        self.left = 20
        self.top = 20
        self.width = 640
        self.height = 400
        self.initUI()

    def initUI(self):
        self.setWindowTitle(self.title)
        self.setGeometry(self.left, self.top, self.width, self.height)

        # create textboxs
        self.textbox1 = QTextEdit(self)
        self.textbox1.move(40, 40)
        self.textbox1.resize(560, 80)
        self.textbox1.setPlainText(
            'The company fabricates plastic chairs.')  # set an example

        self.textbox2 = QTextEdit(self)
        self.textbox2.move(40, 230)
        self.textbox2.resize(560, 80)

        # Create a button in the window
        self.button1 = QPushButton('Get triple', self)
        self.button1.move(500, 160)

        # connect button to function on_click
        self.button1.clicked.connect(self.on_click)

        # set button2 to clear textbox1
        self.button2 = QPushButton('Clear', self)
        self.button2.move(420, 160)
        self.button2.clicked.connect(self.clear_click)

        # show must be the last
        self.show()

    @pyqtSlot()
    def on_click(self):
        self.textbox2.clear()
        textboxValue = self.textbox1.toPlainText()
        pre_relation = svm_pre(textboxValue,
                               utils_path='../baseline_svm/utils')
        entities = get_entities(textboxValue)
        triple = entities[0] + ' - ' + pre_relation[0] + ' - ' + entities[1]
        self.textbox2.setPlainText(triple)

    @pyqtSlot()
    def clear_click(self):
        self.textbox1.clear()
        self.textbox2.clear()
Ejemplo n.º 4
0
class PrefsViewerDialog(SizePersistedDialog):

    def __init__(self, gui, namespace):
        SizePersistedDialog.__init__(self, gui, _('Prefs Viewer dialog'))
        self.setWindowTitle(_('Preferences for: ')+namespace)

        self.gui = gui
        self.db = gui.current_db
        self.namespace = namespace
        self._init_controls()
        self.resize_dialog()

        self._populate_settings()

        if self.keys_list.count():
            self.keys_list.setCurrentRow(0)

    def _init_controls(self):
        layout = QVBoxLayout(self)
        self.setLayout(layout)

        ml = QHBoxLayout()
        layout.addLayout(ml, 1)

        self.keys_list = QListWidget(self)
        self.keys_list.setSelectionMode(QAbstractItemView.SingleSelection)
        self.keys_list.setFixedWidth(150)
        self.keys_list.setAlternatingRowColors(True)
        ml.addWidget(self.keys_list)
        self.value_text = QTextEdit(self)
        self.value_text.setTabStopWidth(24)
        self.value_text.setReadOnly(True)
        ml.addWidget(self.value_text, 1)

        button_box = QDialogButtonBox(QDialogButtonBox.Ok)
        button_box.accepted.connect(self.accept)
        self.clear_button = button_box.addButton(_('Clear'), QDialogButtonBox.ResetRole)
        self.clear_button.setIcon(get_icon('trash.png'))
        self.clear_button.setToolTip(_('Clear all settings for this plugin'))
        self.clear_button.clicked.connect(self._clear_settings)

        if DEBUG:
            self.edit_button = button_box.addButton(_('Edit'), QDialogButtonBox.ResetRole)
            self.edit_button.setIcon(get_icon('edit_input.png'))
            self.edit_button.setToolTip(_('Edit settings.'))
            self.edit_button.clicked.connect(self._edit_settings)

            self.save_button = button_box.addButton(_('Save'), QDialogButtonBox.ResetRole)
            self.save_button.setIcon(get_icon('save.png'))
            self.save_button.setToolTip(_('Save setting for this plugin'))
            self.save_button.clicked.connect(self._save_settings)
            self.save_button.setEnabled(False)
        layout.addWidget(button_box)

    def _populate_settings(self):
        self.keys_list.clear()
        ns_prefix = self._get_ns_prefix()
        keys = sorted([k[len(ns_prefix):] for k in self.db.prefs.iterkeys()
                       if k.startswith(ns_prefix)])
        for key in keys:
            self.keys_list.addItem(key)
        self.keys_list.setMinimumWidth(self.keys_list.sizeHintForColumn(0))
        self.keys_list.currentRowChanged[int].connect(self._current_row_changed)

    def _current_row_changed(self, new_row):
        if new_row < 0:
            self.value_text.clear()
            return
        key = unicode(self.keys_list.currentItem().text())
        val = self.db.prefs.get_namespaced(self.namespace, key, '')
        self.value_text.setPlainText(self.db.prefs.to_raw(val))

    def _get_ns_prefix(self):
        return 'namespaced:%s:'% self.namespace

    def _edit_settings(self):
        from calibre.gui2.dialogs.confirm_delete import confirm
        message = '<p>' + _('Are you sure you want to edit settings in this library for this plugin?') + '</p>' \
                  + '<p>' + _('The FanFicFare team does not support hand edited configurations.') + '</p>'
        if confirm(message, self.namespace+'_edit_settings', self):
            self.save_button.setEnabled(True)
            self.edit_button.setEnabled(False)
            self.value_text.setReadOnly(False)

    def _save_settings(self):
        from calibre.gui2.dialogs.confirm_delete import confirm
        message = '<p>' + _('Are you sure you want to save this setting in this library for this plugin?') + '</p>' \
                  + '<p>' + _('Any settings in other libraries or stored in a JSON file in your calibre plugins folder will not be touched.') + '</p>' \
                  + '<p>' + _('You must restart calibre afterwards.') + '</p>'
        if not confirm(message, self.namespace+'_save_settings', self):
            return
        ns_prefix = self._get_ns_prefix()
        key = unicode(self.keys_list.currentItem().text())
        self.db.prefs.set_namespaced(self.namespace, key,
                                     self.db.prefs.raw_to_object(self.value_text.toPlainText()))
        d = info_dialog(self, 'Settings saved',
                        '<p>' + _('All settings for this plugin in this library have been saved.') + '</p>' \
                        + '<p>' + _('Please restart calibre now.') + '</p>',
                        show_copy_button=False)
        b = d.bb.addButton(_('Restart calibre now'), d.bb.AcceptRole)
        b.setIcon(QIcon(I('lt.png')))
        d.do_restart = False
        def rf():
            d.do_restart = True
        b.clicked.connect(rf)
        d.set_details('')
        d.exec_()
        b.clicked.disconnect()
        self.close()
        if d.do_restart:
            self.gui.quit(restart=True)

    def _clear_settings(self):
        from calibre.gui2.dialogs.confirm_delete import confirm
        message = '<p>' + _('Are you sure you want to clear your settings in this library for this plugin?') + '</p>' \
                  + '<p>' + _('Any settings in other libraries or stored in a JSON file in your calibre plugins folder will not be touched.') + '</p>' \
                  + '<p>' + _('You must restart calibre afterwards.') + '</p>'
        if not confirm(message, self.namespace+'_clear_settings', self):
            return
        ns_prefix = self._get_ns_prefix()
        keys = [k for k in self.db.prefs.iterkeys() if k.startswith(ns_prefix)]
        for k in keys:
            del self.db.prefs[k]
        self._populate_settings()
        d = info_dialog(self, 'Settings deleted',
                        '<p>' + _('All settings for this plugin in this library have been cleared.') + '</p>' \
                        + '<p>' + _('Please restart calibre now.') + '</p>',
                        show_copy_button=False)
        b = d.bb.addButton(_('Restart calibre now'), d.bb.AcceptRole)
        b.setIcon(QIcon(I('lt.png')))
        d.do_restart = False
        def rf():
            d.do_restart = True
        b.clicked.connect(rf)
        d.set_details('')
        d.exec_()
        b.clicked.disconnect()
        self.close()
        if d.do_restart:
            self.gui.quit(restart=True)
Ejemplo n.º 5
0
class PrefsViewerDialog(SizePersistedDialog):

    def __init__(self, gui, namespace):
        super(PrefsViewerDialog, self).__init__(gui, _('Prefs Viewer dialog'))
        self.setWindowTitle(_('Preferences for: ') + namespace)

        self.gui = gui
        self.db = gui.current_db
        self.namespace = namespace
        self._init_controls()
        self.resize_dialog()

        self._populate_settings()

        if self.keys_list.count():
            self.keys_list.setCurrentRow(0)

    def _init_controls(self):
        layout = QVBoxLayout(self)
        self.setLayout(layout)

        ml = QHBoxLayout()
        layout.addLayout(ml, 1)

        self.keys_list = QListWidget(self)
        self.keys_list.setSelectionMode(QAbstractItemView.SingleSelection)
        self.keys_list.setFixedWidth(150)
        self.keys_list.setAlternatingRowColors(True)
        ml.addWidget(self.keys_list)
        self.value_text = QTextEdit(self)
        self.value_text.setTabStopWidth(24)
        self.value_text.setReadOnly(False)
        ml.addWidget(self.value_text, 1)

        button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        button_box.accepted.connect(self._apply_changes)
        button_box.rejected.connect(self.reject)
        self.clear_button = button_box.addButton(_('Clear'), QDialogButtonBox.ResetRole)
        self.clear_button.setIcon(get_icon('trash.png'))
        self.clear_button.setToolTip(_('Clear all settings for this plugin'))
        self.clear_button.clicked.connect(self._clear_settings)
        layout.addWidget(button_box)

    def _populate_settings(self):
        self.keys_list.clear()
        ns_prefix = self._get_ns_prefix()
        keys = sorted([k[len(ns_prefix):] for k in list(self.db.prefs.keys())
                       if k.startswith(ns_prefix)])
        for key in keys:
            self.keys_list.addItem(key)
        self.keys_list.setMinimumWidth(self.keys_list.sizeHintForColumn(0))
        self.keys_list.currentRowChanged[int].connect(self._current_row_changed)

    def _current_row_changed(self, new_row):
        if new_row < 0:
            self.value_text.clear()
            return
        key = unicode(self.keys_list.currentItem().text())
        val = self.db.prefs.get_namespaced(self.namespace, key, '')
        self.value_text.setPlainText(self.db.prefs.to_raw(val))

    def _get_ns_prefix(self):
        return 'namespaced:%s:'% self.namespace

    def _apply_changes(self):
        from calibre.gui2.dialogs.confirm_delete import confirm
        message = '<p>Are you sure you want to change your settings in this library for this plugin?</p>' \
                  '<p>Any settings in other libraries or stored in a JSON file in your calibre plugins ' \
                  'folder will not be touched.</p>' \
                  '<p>You must restart calibre afterwards.</p>'
        if not confirm(message, self.namespace+'_clear_settings', self):
            return

        val = self.db.prefs.raw_to_object(unicode(self.value_text.toPlainText()))
        key = unicode(self.keys_list.currentItem().text())
        self.db.prefs.set_namespaced(self.namespace, key, val)

        restart = prompt_for_restart(self, 'Settings changed',
                           '<p>Settings for this plugin in this library have been changed.</p>'
                           '<p>Please restart calibre now.</p>')
        self.close()
        if restart:
            self.gui.quit(restart=True)

    def _clear_settings(self):
        from calibre.gui2.dialogs.confirm_delete import confirm
        message = '<p>Are you sure you want to clear your settings in this library for this plugin?</p>' \
                  '<p>Any settings in other libraries or stored in a JSON file in your calibre plugins ' \
                  'folder will not be touched.</p>' \
                  '<p>You must restart calibre afterwards.</p>'
        if not confirm(message, self.namespace+'_clear_settings', self):
            return

        ns_prefix = self._get_ns_prefix()
        keys = [k for k in list(self.db.prefs.keys()) if k.startswith(ns_prefix)]
        for k in keys:
            del self.db.prefs[k]
        self._populate_settings()
        restart = prompt_for_restart(self, _('Settings deleted'),
                           _('<p>All settings for this plugin in this library have been cleared.</p>') +
                           _('<p>Please restart calibre now.</p>'))
        self.close()
        if restart:
            self.gui.quit(restart=True)
Ejemplo n.º 6
0
class PrefsViewerDialog(SizePersistedDialog):
    def __init__(self, gui, namespace):
        SizePersistedDialog.__init__(self, gui, _('Prefs Viewer dialog'))
        self.setWindowTitle(_('Preferences for: ') + namespace)

        self.gui = gui
        self.db = gui.current_db
        self.namespace = namespace
        self._init_controls()
        self.resize_dialog()

        self._populate_settings()

        if self.keys_list.count():
            self.keys_list.setCurrentRow(0)

    def _init_controls(self):
        layout = QVBoxLayout(self)
        self.setLayout(layout)

        ml = QHBoxLayout()
        layout.addLayout(ml, 1)

        self.keys_list = QListWidget(self)
        self.keys_list.setSelectionMode(QAbstractItemView.SingleSelection)
        self.keys_list.setFixedWidth(150)
        self.keys_list.setAlternatingRowColors(True)
        ml.addWidget(self.keys_list)
        self.value_text = QTextEdit(self)
        self.value_text.setTabStopWidth(24)
        self.value_text.setReadOnly(True)
        ml.addWidget(self.value_text, 1)

        button_box = QDialogButtonBox(QDialogButtonBox.Ok)
        button_box.accepted.connect(self.accept)
        self.clear_button = button_box.addButton(_('Clear'),
                                                 QDialogButtonBox.ResetRole)
        self.clear_button.setIcon(get_icon('trash.png'))
        self.clear_button.setToolTip(_('Clear all settings for this plugin'))
        self.clear_button.clicked.connect(self._clear_settings)

        if DEBUG:
            self.edit_button = button_box.addButton(_('Edit'),
                                                    QDialogButtonBox.ResetRole)
            self.edit_button.setIcon(get_icon('edit_input.png'))
            self.edit_button.setToolTip(_('Edit settings.'))
            self.edit_button.clicked.connect(self._edit_settings)

            self.save_button = button_box.addButton(_('Save'),
                                                    QDialogButtonBox.ResetRole)
            self.save_button.setIcon(get_icon('save.png'))
            self.save_button.setToolTip(_('Save setting for this plugin'))
            self.save_button.clicked.connect(self._save_settings)
            self.save_button.setEnabled(False)
        layout.addWidget(button_box)

    def _populate_settings(self):
        self.keys_list.clear()
        ns_prefix = self._get_ns_prefix()
        keys = sorted([
            k[len(ns_prefix):] for k in six.iterkeys(self.db.prefs)
            if k.startswith(ns_prefix)
        ])
        for key in keys:
            self.keys_list.addItem(key)
        self.keys_list.setMinimumWidth(self.keys_list.sizeHintForColumn(0))
        self.keys_list.currentRowChanged[int].connect(
            self._current_row_changed)

    def _current_row_changed(self, new_row):
        if new_row < 0:
            self.value_text.clear()
            return
        key = unicode(self.keys_list.currentItem().text())
        val = self.db.prefs.get_namespaced(self.namespace, key, '')
        self.value_text.setPlainText(self.db.prefs.to_raw(val))

    def _get_ns_prefix(self):
        return 'namespaced:%s:' % self.namespace

    def _edit_settings(self):
        from calibre.gui2.dialogs.confirm_delete import confirm
        message = '<p>' + _('Are you sure you want to edit settings in this library for this plugin?') + '</p>' \
                  + '<p>' + _('The FanFicFare team does not support hand edited configurations.') + '</p>'
        if confirm(message, self.namespace + '_edit_settings', self):
            self.save_button.setEnabled(True)
            self.edit_button.setEnabled(False)
            self.value_text.setReadOnly(False)

    def _save_settings(self):
        from calibre.gui2.dialogs.confirm_delete import confirm
        message = '<p>' + _('Are you sure you want to save this setting in this library for this plugin?') + '</p>' \
                  + '<p>' + _('Any settings in other libraries or stored in a JSON file in your calibre plugins folder will not be touched.') + '</p>' \
                  + '<p>' + _('You must restart calibre afterwards.') + '</p>'
        if not confirm(message, self.namespace + '_save_settings', self):
            return
        ns_prefix = self._get_ns_prefix()
        key = unicode(self.keys_list.currentItem().text())
        self.db.prefs.set_namespaced(
            self.namespace, key,
            self.db.prefs.raw_to_object(self.value_text.toPlainText()))
        d = info_dialog(self, 'Settings saved',
                        '<p>' + _('All settings for this plugin in this library have been saved.') + '</p>' \
                        + '<p>' + _('Please restart calibre now.') + '</p>',
                        show_copy_button=False)
        b = d.bb.addButton(_('Restart calibre now'), d.bb.AcceptRole)
        b.setIcon(QIcon(I('lt.png')))
        d.do_restart = False

        def rf():
            d.do_restart = True

        b.clicked.connect(rf)
        d.set_details('')
        d.exec_()
        b.clicked.disconnect()
        self.close()
        if d.do_restart:
            self.gui.quit(restart=True)

    def _clear_settings(self):
        from calibre.gui2.dialogs.confirm_delete import confirm
        message = '<p>' + _('Are you sure you want to clear your settings in this library for this plugin?') + '</p>' \
                  + '<p>' + _('Any settings in other libraries or stored in a JSON file in your calibre plugins folder will not be touched.') + '</p>' \
                  + '<p>' + _('You must restart calibre afterwards.') + '</p>'
        if not confirm(message, self.namespace + '_clear_settings', self):
            return
        ns_prefix = self._get_ns_prefix()
        keys = [
            k for k in six.iterkeys(self.db.prefs) if k.startswith(ns_prefix)
        ]
        for k in keys:
            del self.db.prefs[k]
        self._populate_settings()
        d = info_dialog(self, 'Settings deleted',
                        '<p>' + _('All settings for this plugin in this library have been cleared.') + '</p>' \
                        + '<p>' + _('Please restart calibre now.') + '</p>',
                        show_copy_button=False)
        b = d.bb.addButton(_('Restart calibre now'), d.bb.AcceptRole)
        b.setIcon(QIcon(I('lt.png')))
        d.do_restart = False

        def rf():
            d.do_restart = True

        b.clicked.connect(rf)
        d.set_details('')
        d.exec_()
        b.clicked.disconnect()
        self.close()
        if d.do_restart:
            self.gui.quit(restart=True)
class PrefsViewerDialog(SizePersistedDialog):

    def __init__(self, gui, namespace):
        SizePersistedDialog.__init__(self, gui, 'Prefs Viewer dialog')
        self.setWindowTitle('Preferences for: '+namespace)

        self.gui = gui
        self.db = gui.current_db
        self.namespace = namespace
        self._init_controls()
        self.resize_dialog()

        self._populate_settings()

        if self.keys_list.count():
            self.keys_list.setCurrentRow(0)

    def _init_controls(self):
        layout = QVBoxLayout(self)
        self.setLayout(layout)

        ml = QHBoxLayout()
        layout.addLayout(ml, 1)

        self.keys_list = QListWidget(self)
        self.keys_list.setSelectionMode(QAbstractItemView.SingleSelection)
        self.keys_list.setFixedWidth(150)
        self.keys_list.setAlternatingRowColors(True)
        ml.addWidget(self.keys_list)
        self.value_text = QTextEdit(self)
        self.value_text.setTabStopWidth(24)
        self.value_text.setReadOnly(False)
        ml.addWidget(self.value_text, 1)

        button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        button_box.accepted.connect(self._apply_changes)
        button_box.rejected.connect(self.reject)
        self.clear_button = button_box.addButton('Clear', QDialogButtonBox.ResetRole)
        self.clear_button.setIcon(get_icon('trash.png'))
        self.clear_button.setToolTip('Clear all settings for this plugin')
        self.clear_button.clicked.connect(self._clear_settings)
        layout.addWidget(button_box)

    def _populate_settings(self):
        self.keys_list.clear()
        ns_prefix = self._get_ns_prefix()
        keys = sorted([k[len(ns_prefix):] for k in self.db.prefs.iterkeys()
                       if k.startswith(ns_prefix)])
        for key in keys:
            self.keys_list.addItem(key)
        self.keys_list.setMinimumWidth(self.keys_list.sizeHintForColumn(0))
        self.keys_list.currentRowChanged[int].connect(self._current_row_changed)

    def _current_row_changed(self, new_row):
        if new_row < 0:
            self.value_text.clear()
            return
        key = unicode(self.keys_list.currentItem().text())
        val = self.db.prefs.get_namespaced(self.namespace, key, '')
        self.value_text.setPlainText(self.db.prefs.to_raw(val))

    def _get_ns_prefix(self):
        return 'namespaced:%s:'% self.namespace

    def _apply_changes(self):
        from calibre.gui2.dialogs.confirm_delete import confirm
        message = '<p>Are you sure you want to change your settings in this library for this plugin?</p>' \
                  '<p>Any settings in other libraries or stored in a JSON file in your calibre plugins ' \
                  'folder will not be touched.</p>' \
                  '<p>You must restart calibre afterwards.</p>'
        if not confirm(message, self.namespace+'_clear_settings', self):
            return

        val = self.db.prefs.raw_to_object(unicode(self.value_text.toPlainText()))
        key = unicode(self.keys_list.currentItem().text())
        self.db.prefs.set_namespaced(self.namespace, key, val)

        restart = prompt_for_restart(self, 'Settings changed',
                           '<p>Settings for this plugin in this library have been changed.</p>'
                           '<p>Please restart calibre now.</p>')
        self.close()
        if restart:
            self.gui.quit(restart=True)

    def _clear_settings(self):
        from calibre.gui2.dialogs.confirm_delete import confirm
        message = '<p>Are you sure you want to clear your settings in this library for this plugin?</p>' \
                  '<p>Any settings in other libraries or stored in a JSON file in your calibre plugins ' \
                  'folder will not be touched.</p>' \
                  '<p>You must restart calibre afterwards.</p>'
        if not confirm(message, self.namespace+'_clear_settings', self):
            return

        ns_prefix = self._get_ns_prefix()
        keys = [k for k in self.db.prefs.iterkeys() if k.startswith(ns_prefix)]
        for k in keys:
            del self.db.prefs[k]
        self._populate_settings()
        restart = prompt_for_restart(self, 'Settings deleted',
                           '<p>All settings for this plugin in this library have been cleared.</p>'
                           '<p>Please restart calibre now.</p>')
        self.close()
        if restart:
            self.gui.quit(restart=True)