diff options
author | jerous <jerous@gmail.com> | 2008-06-01 00:30:16 +0200 |
---|---|---|
committer | jerous <jerous@gmail.com> | 2008-06-01 00:30:16 +0200 |
commit | 45461f8f9c847fd0086ba4f748d844be3d661432 (patch) | |
tree | 2764482a96a618572d0336470226d9aab37d732b /winMain.py | |
parent | 0441ad13cc3b68af1c2cbd6c6f6ea00eb9dcd806 (diff) |
removal of clLibrary
some comments
Diffstat (limited to 'winMain.py')
-rw-r--r-- | winMain.py | 36 |
1 files changed, 13 insertions, 23 deletions
@@ -1,5 +1,4 @@ from clMonty import monty -from clLibrary import Library from PyQt4 import QtGui, QtCore from traceback import * import time @@ -42,23 +41,15 @@ class winMain(QtGui.QWidget): " system tray object" sysTray=None - "Models" - " model of the lstLibrary" - mLibrary=None - "Other vars" - " array containing objects to disable/enable on disconnect/connect" - disableObjects=None - " current highlighted line" - curLine=None + " all objects which should be disabled when there is no connection" + controlObjects=None _timerID=None def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setWindowTitle("montypc - An MPD client") - self.curLine=None - " set GUI stuff" self.lstPlaylist=Playlist(parent, self, ['artist', 'title', 'album'], 'The Playlist' , self.onPlaylistDoubleClick, self.onPlaylistKeyPress) @@ -109,7 +100,7 @@ class winMain(QtGui.QWidget): self.resize(1024,960) - self.disableObjects=[self.lstPlaylist, self.lstLibrary, self.slrTime + self.controlObjects=[self.lstPlaylist, self.lstLibrary, self.slrTime , self.slrVolume , self.btnPlayPause, self.btnStop, self.btnPrevious , self.btnNext] @@ -129,7 +120,7 @@ class winMain(QtGui.QWidget): monty.addListener('onConnect', self.onConnect) monty.addListener('onDisconnect', self.onDisconnect) - self.enableObjects(self.disableObjects, False) + self.enableObjects(self.controlObjects, False) self.setWindowIcon(appIcon) # set icon in system tray self.sysTray=QtGui.QSystemTrayIcon(appIcon, parent) @@ -220,12 +211,13 @@ class winMain(QtGui.QWidget): return QtGui.QWidget.keyPressEvent(self, event) def onLibraryKeyPress(self, event): - " add selection, or entire library to playlist using ENTER-key" if event.key()==QtCore.Qt.Key_Enter or event.key()==QtCore.Qt.Key_Return: + # Add selection, or entire library to playlist using ENTER-key. self.addLibrarySelToPlaylist() return QtGui.QWidget.keyPressEvent(self, event) def enableObjects(self, objects, enable): + """Enables or disables all $objects""" for object in objects: object.setEnabled(enable) @@ -271,11 +263,7 @@ class winMain(QtGui.QWidget): doEvents() def initialiseData(self): - self.setStatus("Retrieving library ...") - doEvents() - self.mLibrary=Library() - doEvents() - + """Initialise the library, playlist and some other small things""" self.setStatus("Filling library ...") doEvents() self.fillLibrary() @@ -288,21 +276,22 @@ class winMain(QtGui.QWidget): self.setStatus("Doing the rest ...") doEvents() - self.enableObjects(self.disableObjects, True) + self.enableObjects(self.controlObjects, True) self.updatePlayingInfo() self.setStatus("") doEvents() def onDisconnect(self, params): - self.enableObjects(self.disableObjects, False) - + self.enableObjects(self.controlObjects, False) def fillPlaylist(self): + """Fill the playlist.""" self.lstPlaylist.update(monty.listPlaylist()) def fillLibrary(self): - self.lstLibrary.update(self.mLibrary.list()) + """Fill the library.""" + self.lstLibrary.update(monty.listLibrary()) def onLibraryDoubleClick(self): self.addLibrarySelToPlaylist() @@ -322,6 +311,7 @@ class winMain(QtGui.QWidget): monty.pause() elif status['state']=='stop': if self.lstPlaylist.getSelItemID()==-1: + # if nothing selected, set it on first row self.lstPlaylist.selectRow(0) self.onPlaylistDoubleClick() else: |