def loadLib(self): """Loads the currently selected library. Emits 'adddock' signal if successful with a LibraryTree class as its widget. """ p = ProgressWin(self, 0, translate('MusicLib', 'Loading music library...'), False) p.show() t = PuddleThread(self._loadLib, self) t.start() while t.isRunning(): QApplication.processEvents() library = t.retval p.close() QApplication.processEvents() if isinstance(library, basestring): error_msg = library msg = translate('MusicLib', 'An error occured while loading the %1 library: <b>%2</b>') msg = msg.arg(self.currentlib['name']).arg(error_msg) QMessageBox.critical(self, translate('Defaults', "Error"), msg, QMessageBox.Ok, QMessageBox.NoButton, QMessageBox.NoButton) else: dialog = partial(LibraryDialog, library) self.emit(SIGNAL('adddock'), translate('MusicLib', 'Music Library'), dialog, RIGHTDOCK) self.close()
def saveSettings(self, parent=None): if parent is None: self._library.save() else: win = ProgressWin(None, 0, translate('MusicLib', 'Saving music library...'), False) win.show() QApplication.processEvents() thread = PuddleThread(lambda: self._library.save(), parent) thread.start() while thread.isRunning(): QApplication.processEvents() QApplication.processEvents() win.close() QApplication.processEvents()
def loadLib(self): """Loads the currently selected library. Emits 'adddock' signal if successful with a LibraryTree class as its widget. """ p = ProgressWin(self, 0, translate('MusicLib', 'Loading music library...'), False) p.show() t = PuddleThread(self._loadLib, self) t.start() while t.isRunning(): QApplication.processEvents() library = t.retval p.close() QApplication.processEvents() if isinstance(library, basestring): error_msg = library msg = translate( 'MusicLib', 'An error occured while loading the %1 library: <b>%2</b>') msg = msg.arg(self.currentlib['name']).arg(error_msg) QMessageBox.critical(self, translate('Defaults', "Error"), msg, QMessageBox.Ok, QMessageBox.NoButton, QMessageBox.NoButton) else: dialog = partial(LibraryDialog, library) self.emit(SIGNAL('adddock'), translate('MusicLib', 'Music Library'), dialog, RIGHTDOCK) self.close()