예제 #1
0
    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()
예제 #2
0
파일: musiclib.py 프로젝트: korala1968/tago
    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()
예제 #3
0
 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()
예제 #4
0
파일: musiclib.py 프로젝트: korala1968/tago
 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()
예제 #5
0
                return self.tagsource.retrieve(item.itemData)
            except RetrievalError, e:
                self.emit(SIGNAL("statusChanged"), 
                    translate("WebDB", 'An error occured: %1').arg(unicode(e)))
                return
            except Exception, e:
                traceback.print_exc()
                self.emit(SIGNAL("statusChanged"),
                    translate("WebDB", 'An unhandled error occured: %1').arg(unicode(e)))
                return

        item.retrieving = True
        thread = PuddleThread(fetch_func, self)
        self.emit(SIGNAL("statusChanged"), translate("WebDB", "Retrieving album tracks..."))
        thread.start()
        while thread.isRunning():
            QApplication.processEvents()
        val = thread.retval
        if val:
            info, tracks = val
            fillItem(item, info, tracks, self.trackPattern)
            self.emit(SIGNAL("statusChanged"), translate("WebDB", "Retrieval complete."))
            item.retrieving = False
        else:
            if not item.childCount():
                self.emit(SIGNAL('collapse'), index)
        self.emit(SIGNAL('retrievalDone()'))

    def hasChildren(self, index):
        item = index.internalPointer()
        if not item:
예제 #6
0
                    translate("WebDB", 'An error occured: %1').arg(unicode(e)))
                return
            except Exception, e:
                traceback.print_exc()
                self.emit(
                    SIGNAL("statusChanged"),
                    translate("WebDB", 'An unhandled error occured: %1').arg(
                        unicode(e)))
                return

        item.retrieving = True
        thread = PuddleThread(fetch_func, self)
        self.emit(SIGNAL("statusChanged"),
                  translate("WebDB", "Retrieving album tracks..."))
        thread.start()
        while thread.isRunning():
            QApplication.processEvents()
        val = thread.retval
        if val:
            info, tracks = val
            fillItem(item, info, tracks, self.trackPattern)
            self.emit(SIGNAL("statusChanged"),
                      translate("WebDB", "Retrieval complete."))
            item.retrieving = False
        else:
            if not item.childCount():
                self.emit(SIGNAL('collapse'), index)
        self.emit(SIGNAL('retrievalDone()'))

    def hasChildren(self, index):
        item = index.internalPointer()