diff options
Diffstat (limited to 'nephilim/winConnect.py')
-rw-r--r-- | nephilim/winConnect.py | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/nephilim/winConnect.py b/nephilim/winConnect.py index 45789ac..f88472b 100644 --- a/nephilim/winConnect.py +++ b/nephilim/winConnect.py @@ -12,8 +12,7 @@ class winConnect(QtGui.QWidget): mpclient = None settings = None - - def __init__(self,parent): + def __init__(self, parent): QtGui.QWidget.__init__(self, parent) self.settings = QtCore.QSettings(ORGNAME, APPNAME) self.txtHost = QtGui.QLineEdit(self.settings.value('MPD/host', QVariant('localhost')).toString()) @@ -36,10 +35,9 @@ class winConnect(QtGui.QWidget): self.setLayout(frame) self.resize(200,80) self.center() - doEvents() - self.mpclient.add_listener('onReady', self.onReady) - self.mpclient.add_listener('onConnect', self.onConnect) + self.connect(self.mpclient, QtCore.SIGNAL('ready'), self.onReady) + self.connect(self.mpclient, QtCore.SIGNAL('connected'), self.onConnect) def center(self): screen = QtGui.QDesktopWidget().screenGeometry() @@ -55,22 +53,19 @@ class winConnect(QtGui.QWidget): self.show() self.activateWindow() self.raise_() - doEvents() - def onConnect(self, params): + def onConnect(self): if self._timerID: self.killTimer(self._timerID) self._timerID=None self.lblInfo.setText('Connected!\nRestoring library and playlist ...') - doEvents() self.settings.setValue('MPD/host', QVariant(self.txtHost.text())) self.settings.setValue('MPD/port', QVariant(self.txtPort.text())) self.txtHost.setEnabled(False) self.txtPort.setEnabled(False) - doEvents() - def onReady(self, params): + def onReady(self): self.hide() def timerEvent(self, event): @@ -78,9 +73,7 @@ class winConnect(QtGui.QWidget): port = int(self.txtPort.text()) if self.txtPort.text() else None self.lblInfo.setText('Trying to connect to '+host+':'+str(port)+' ...') - doEvents() - self.mpclient.connect(host, port) - doEvents() + self.mpclient.connect_mpd(host, port) def windowActivationChange(self, bool): self.activateWindow() |