def closeEvent(self, event): def unload(): for plugin in self.ui.plugins.values(): plugin.unload() self.__settings.setValue( u'splitters', self.ui.splitter.saveState() ) self.__settings.setValue(u'artistsView', self.ui.artists.view.horizontalHeader().saveState() ) self.__settings.setValue(u'albumsView', self.ui.albums.view.horizontalHeader().saveState() ) self.__settings.setValue(u'tracksView', self.ui.tracks.view.horizontalHeader().saveState() ) if self.db.modified: from interfaces.confirmation import ConfirmationDialog dialog = ConfirmationDialog() dialog.buttons.accepted.connect(self.save) dialog.buttons.accepted.connect(unload) dialog.buttons.rejected.connect(event.ignore) dialog.buttons.helpRequested.connect(unload) dialog.exec_() else: unload()
def closeEvent(self, event): def unload(): for plugin in self.ui.plugins.values(): plugin.unload() self.__settings.setValue(u'splitters', self.ui.splitter.saveState()) if self.library[5][0]: def save(): self.save() def reject(): event.ignore() from interfaces.confirmation import ConfirmationDialog dialog = ConfirmationDialog() dialog.buttons.accepted.connect(save) dialog.buttons.accepted.connect(unload) dialog.buttons.rejected.connect(reject) dialog.buttons.helpRequested.connect(unload) dialog.exec_() else: unload()