[Pyamp-cvs] pyamp/src tooltip.py,NONE,1.1 tooltip.pyc,NONE,1.1 mainwindow.py,1.4,1.5 mainwindow.pyc,
Status: Alpha
Brought to you by:
sayap
From: <sa...@us...> - 2003-09-20 20:06:34
|
Update of /cvsroot/pyamp/pyamp/src In directory sc8-pr-cvs1:/tmp/cvs-serv7421/src Modified Files: mainwindow.py mainwindow.pyc searchdialog.py searchdialog.pyc Added Files: tooltip.py tooltip.pyc Log Message: Keyboard navigation while searching; Added tooltip.py which I forgot to add in previous commit :P --- NEW FILE: tooltip.py --- # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # Pyamp is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Pyamp; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA from qt import * from os import path from songfactory import SongFactory from songtimer import secondsToStr class ToolTip(QToolTip): def __init__(self, playList): QToolTip.__init__(self, playList.viewport()) self.playList = playList def maybeTip(self, point): item = self.playList.itemAt(point) if item: fullpath = item.getFullpath() song = SongFactory.newSong(fullpath) sample, bits, channels, format = song.getParameters() bitrate = song.getBitrate() length = song.getLength() rect = self.playList.itemRect(item) text = fullpath \ +"\nLength: " + secondsToStr(length) \ + "\nFile size: " + str(path.getsize(fullpath)) + " bytes" \ + "\nSample Frequency: " + str(sample) + " Hz" \ + "\nBitrate: " + str(bitrate) + " kb/s" \ + "\nChannels: " + str(channels) self.tip(rect, text) --- NEW FILE: tooltip.pyc --- (This appears to be a binary file; contents omitted.) Index: mainwindow.py =================================================================== RCS file: /cvsroot/pyamp/pyamp/src/mainwindow.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mainwindow.py 20 Sep 2003 17:08:48 -0000 1.4 --- mainwindow.py 20 Sep 2003 20:06:30 -0000 1.5 *************** *** 417,425 **** self.connect(self.searchDialog.list, ! SIGNAL("doubleClicked(QListBoxItem *)"), ! self.playList.userSetSongFromSearch) ! ! self.connect(self.searchDialog.list, ! SIGNAL("returnPressed(QListBoxItem *)"), self.playList.userSetSongFromSearch) --- 417,421 ---- self.connect(self.searchDialog.list, ! SIGNAL("executed(QListBoxItem *)"), self.playList.userSetSongFromSearch) *************** *** 505,515 **** self.selectedItem = item self.contextMenu.popup(point) - - #~ def showSongInfo(): - #~ if self.selectedItem: - #~ fullpath = self.selectedItem.getFullpath() - #~ song = SongFactory.newSong(fullpath) - #~ sample, bitrate, channels, format = song.getParameters() - #~ length = song.getLength() def searchChanged(self, text): --- 501,504 ---- Index: mainwindow.pyc =================================================================== RCS file: /cvsroot/pyamp/pyamp/src/mainwindow.pyc,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 Binary files /tmp/cvsxOoN3f and /tmp/cvsgotZNl differ Index: searchdialog.py =================================================================== RCS file: /cvsroot/pyamp/pyamp/src/searchdialog.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** searchdialog.py 15 Sep 2003 11:38:13 -0000 1.2 --- searchdialog.py 20 Sep 2003 20:06:30 -0000 1.3 *************** *** 18,28 **** from qt import * class SearchDialog(QDialog): def __init__(self, parent): QDialog.__init__(self, parent) ! self.input = QLineEdit(self) self.input.setFocus() ! self.list = QListBox(self) w = QApplication.desktop().width() --- 18,29 ---- from qt import * + from kdeui import * class SearchDialog(QDialog): def __init__(self, parent): QDialog.__init__(self, parent) ! self.input = LineEdit(self) self.input.setFocus() ! self.list = KListBox(self) w = QApplication.desktop().width() *************** *** 45,46 **** --- 46,60 ---- if oldActive: self.close() + + class LineEdit(QLineEdit): + def keyPressEvent(self, event): + key = event.key() + list = self.parent().list + if key in [Qt.Key_Down, Qt.Key_Up, Qt.Key_Prior, Qt.Key_Next]: + list.keyPressEvent(event) + elif key == Qt.Key_Return: + item = list.selectedItem() + if item: + list.emitExecute(item, QPoint()) + else: + QLineEdit.keyPressEvent(self, event) \ No newline at end of file Index: searchdialog.pyc =================================================================== RCS file: /cvsroot/pyamp/pyamp/src/searchdialog.pyc,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsvQAwDj and /tmp/cvsejmk4s differ |