Beispiel #1
0
        if self.stack.currentIndex() == 0:
            self.on_shutdown()
            return QDialog.accept(self)
        try:
            close = self.commit()
        except AbortCommit:
            return
        if close:
            self.on_shutdown()
            return QDialog.accept(self)
        self.hide_plugin()

    def reject(self):
        if self.stack.currentIndex() == 0 or self.close_after_initial:
            self.on_shutdown()
            return QDialog.reject(self)
        self.hide_plugin()


if __name__ == '__main__':
    from calibre.gui2 import Application
    from calibre.gui_launch import init_dbus
    init_dbus()
    app = Application([])
    app
    gui = init_gui()

    p = Preferences(gui)
    p.exec_()
    gui.shutdown()
Beispiel #2
0
        else:
            self.hide_plugin()

    def restore_defaults(self, *args):
        self.showing_widget.restore_defaults()

    def closeEvent(self, *args):
        gprefs.set('preferences_window_geometry',
                bytearray(self.saveGeometry()))
        if self.committed:
            self.gui.must_restart_before_config = self.must_restart
            self.gui.tags_view.recount()
            self.gui.create_device_menu()
            self.gui.set_device_menu_items_state(bool(self.gui.device_connected))
            self.gui.bars_manager.apply_settings()
            self.gui.bars_manager.update_bars()
            self.gui.build_context_menus()

        return QMainWindow.closeEvent(self, *args)

if __name__ == '__main__':
    from calibre.gui2 import Application
    app = Application([])
    app
    gui = init_gui()

    p = Preferences(gui)
    p.show()
    app.exec_()
    gui.shutdown()