[Pyamp-cvs] pyamp/src pyamp.profile,NONE,1.1 pyamp.timings,NONE,1.1 listitem.py,1.3,1.4 optiondialog
Status: Alpha
Brought to you by:
sayap
Update of /cvsroot/pyamp/pyamp/src
In directory sc8-pr-cvs1:/tmp/cvs-serv17503/src
Modified Files:
listitem.py optiondialog.py pyamp.py songthread.py tooltip.py
Added Files:
pyamp.profile pyamp.timings
Log Message:
--- NEW FILE: pyamp.profile ---
(This appears to be a binary file; contents omitted.)
--- NEW FILE: pyamp.timings ---
(This appears to be a binary file; contents omitted.)
Index: listitem.py
===================================================================
RCS file: /cvsroot/pyamp/pyamp/src/listitem.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** listitem.py 26 Sep 2003 04:51:32 -0000 1.3
--- listitem.py 10 Jan 2004 19:11:19 -0000 1.4
***************
*** 31,64 ****
# Font and color settings for all ListItem's are stored as class variables
# for faster access
! config = Config.config()
! transparency = False
! normalBase = QColor()
! normalText = QColor()
! normalFont = QFont()
! selectedBase = QColor()
! selectedText = QColor()
! selectedFont = QFont()
! playingBase = QColor()
! playingText = QColor()
! playingFont = QFont()
! playSelBase = QColor()
! playSelText = QColor()
! playSelFont = QFont()
def readConfig(self):
! self.config.setGroup("appearance")
! self.transparency = self.config.readBoolEntry("transparency")
! self.normalBase = self.config.readColorEntry("normalBase")
! self.normalText = self.config.readColorEntry("normalText")
! self.normalFont = self.config.readFontEntry("normalFont")
! self.selectedBase = self.config.readColorEntry("selectedBase")
! self.selectedText = self.config.readColorEntry("selectedText")
! self.selectedFont = self.config.readFontEntry("selectedFont")
! self.playingBase = self.config.readColorEntry("playingBase")
! self.playingText = self.config.readColorEntry("playingText")
! self.playingFont = self.config.readFontEntry("playingFont")
! self.playSelBase = self.config.readColorEntry("playSelBase")
! self.playSelText = self.config.readColorEntry("playSelText")
! self.playSelFont = self.config.readFontEntry("playSelFont")
readConfig = classmethod(readConfig)
--- 31,64 ----
# Font and color settings for all ListItem's are stored as class variables
# for faster access
! _transparency = False
! _normalBase = QColor()
! _normalText = QColor()
! _normalFont = QFont()
! _selectedBase = QColor()
! _selectedText = QColor()
! _selectedFont = QFont()
! _playingBase = QColor()
! _playingText = QColor()
! _playingFont = QFont()
! _playSelBase = QColor()
! _playSelText = QColor()
! _playSelFont = QFont()
def readConfig(self):
! config = Config.config()
! config.setGroup("appearance")
! self._transparency = config.readBoolEntry("transparency")
! self._normalBase = config.readColorEntry("normalBase")
! self._normalText = config.readColorEntry("normalText")
! self._normalFont = config.readFontEntry("normalFont")
! self._selectedBase = config.readColorEntry("selectedBase")
! self._selectedText = config.readColorEntry("selectedText")
! self._selectedFont = config.readFontEntry("selectedFont")
! self._playingBase = config.readColorEntry("playingBase")
! self._playingText = config.readColorEntry("playingText")
! self._playingFont = config.readFontEntry("playingFont")
! self._playSelBase = config.readColorEntry("playSelBase")
! self._playSelText = config.readColorEntry("playSelText")
! self._playSelFont = config.readFontEntry("playSelFont")
readConfig = classmethod(readConfig)
***************
*** 105,124 ****
if self.isPlaying():
if self.isSelected():
! cg.setColor(QColorGroup.Highlight, self.playSelBase)
! cg.setColor(QColorGroup.HighlightedText, self.playSelText)
! p.setFont(self.playSelFont)
else:
! cg.setColor(QColorGroup.Base, self.playingBase)
! cg.setColor(QColorGroup.Text, self.playingText)
! p.setFont(self.playingFont)
elif self.isSelected():
! cg.setColor(QColorGroup.Highlight, self.selectedBase)
! cg.setColor(QColorGroup.HighlightedText, self.selectedText)
! p.setFont(self.selectedFont)
else:
! if not self.transparency:
! cg.setColor(QColorGroup.Base, self.normalBase)
! cg.setColor(QColorGroup.Text, self.normalText)
! p.setFont(self.normalFont)
QListViewItem.paintCell(self, p, cg, column, width, align)
--- 105,124 ----
if self.isPlaying():
if self.isSelected():
! cg.setColor(QColorGroup.Highlight, self._playSelBase)
! cg.setColor(QColorGroup.HighlightedText, self._playSelText)
! p.setFont(self._playSelFont)
else:
! cg.setColor(QColorGroup.Base, self._playingBase)
! cg.setColor(QColorGroup.Text, self._playingText)
! p.setFont(self._playingFont)
elif self.isSelected():
! cg.setColor(QColorGroup.Highlight, self._selectedBase)
! cg.setColor(QColorGroup.HighlightedText, self._selectedText)
! p.setFont(self._selectedFont)
else:
! if not self._transparency:
! cg.setColor(QColorGroup.Base, self._normalBase)
! cg.setColor(QColorGroup.Text, self._normalText)
! p.setFont(self._normalFont)
QListViewItem.paintCell(self, p, cg, column, width, align)
Index: optiondialog.py
===================================================================
RCS file: /cvsroot/pyamp/pyamp/src/optiondialog.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** optiondialog.py 26 Sep 2003 04:51:32 -0000 1.1
--- optiondialog.py 10 Jan 2004 19:11:19 -0000 1.2
***************
*** 22,25 ****
--- 22,26 ----
from fontbutton import FontButton
from listitem import ListItem
+ from songthread import Devices
from config import Config
***************
*** 28,31 ****
--- 29,37 ----
QTabDialog.__init__(self, parent)
self.config = Config.config()
+
+ self.playbackTab = QWidget(self)
+ self.createPlaybackTab()
+ self.addTab(self.playbackTab, "Playback")
+
self.appearanceTab = QWidget(self)
self.createAppearanceTab()
***************
*** 35,38 ****
--- 41,45 ----
self.setApplyButton()
self.connect(self, SIGNAL("applyButtonPressed()"), self.applyOptions)
+ self.connect(self.revertButton, SIGNAL("pressed()"), self.revertFonts)
# Manually apply to initialize settings
self.applyOptions()
***************
*** 55,61 ****
--- 62,89 ----
self.config.writeEntry("fade", self.fadeButton.color())
self.config.writeEntry("opacity", self.opacitySlider.value())
+ self.config.setGroup("playback")
+ device = Devices.keys()[Devices.values().index(self.deviceCombo.currentText())]
+ self.config.writeEntry("device", device)
ListItem.readConfig()
self.parent().playList.readConfig()
self.parent().playList.triggerUpdate()
+ self.parent().playList.songThread.setDevice(str(device))
+
+ def revertFonts(self):
+ self.normalBaseButton.setColor(KGlobalSettings.baseColor())
+ self.normalTextButton.setColor(KGlobalSettings.textColor())
+ self.normalFontButton.setFont(KGlobalSettings.generalFont())
+ self.selectedBaseButton.setColor(KGlobalSettings.highlightColor())
+ self.selectedTextButton.setColor(KGlobalSettings.highlightedTextColor())
+ self.selectedFontButton.setFont(KGlobalSettings.generalFont())
+ self.playingBaseButton.setColor(KGlobalSettings.highlightColor().dark())
+ self.playingTextButton.setColor(KGlobalSettings.highlightedTextColor())
+ self.playingFontButton.setFont(KGlobalSettings.generalFont())
+ self.playSelBaseButton.setColor(KGlobalSettings.highlightColor())
+ self.playSelTextButton.setColor(KGlobalSettings.highlightedTextColor())
+ font = KGlobalSettings.generalFont()
+ font.setItalic(True)
+ self.playSelFontButton.setFont(font)
+ self.applyOptions()
def createAppearanceTab(self):
***************
*** 107,113 ****
layout.setRowStretch(2, 1)
layout.setRowStretch(3, 1)
- font = self.config.readFontEntry("playingFont", KGlobalSettings.generalFont())
baseColor = self.config.readColorEntry("playingBase", KGlobalSettings.highlightColor().dark())
textColor = self.config.readColorEntry("playingText", KGlobalSettings.highlightedTextColor())
self.playingBaseButton = KColorButton(baseColor, playingBox)
self.playingTextButton = KColorButton(textColor, playingBox)
--- 135,141 ----
layout.setRowStretch(2, 1)
layout.setRowStretch(3, 1)
baseColor = self.config.readColorEntry("playingBase", KGlobalSettings.highlightColor().dark())
textColor = self.config.readColorEntry("playingText", KGlobalSettings.highlightedTextColor())
+ font = self.config.readFontEntry("playingFont", KGlobalSettings.generalFont())
self.playingBaseButton = KColorButton(baseColor, playingBox)
self.playingTextButton = KColorButton(textColor, playingBox)
***************
*** 160,166 ****
layout.addWidget(self.opacitySlider, 3, 1)
boxLayout.addWidget(normalBox, 0, 0)
boxLayout.addWidget(selectedBox, 0, 1)
boxLayout.addWidget(playingBox, 1, 0)
boxLayout.addWidget(playSelBox, 1, 1)
! boxLayout.addMultiCellWidget(transBox, 2, 2, 0, 1)
--- 188,215 ----
layout.addWidget(self.opacitySlider, 3, 1)
+ self.revertButton = KPushButton("Revert all to KDE settings", self.appearanceTab)
+
boxLayout.addWidget(normalBox, 0, 0)
boxLayout.addWidget(selectedBox, 0, 1)
boxLayout.addWidget(playingBox, 1, 0)
boxLayout.addWidget(playSelBox, 1, 1)
! boxLayout.addMultiCellWidget(self.revertButton, 2, 2, 0, 1, Qt.AlignCenter)
! boxLayout.addMultiCellWidget(transBox, 3, 3, 0, 1)
!
! def createPlaybackTab(self):
! boxLayout = QGridLayout(self.playbackTab)
! self.config.setGroup("playback")
!
! deviceBox = QGroupBox("Device", self.playbackTab)
! layout = QGridLayout(deviceBox, 2, 1, deviceBox.insideMargin(), 1)
! layout.setRowSpacing(0, 6)
! self.deviceCombo = KComboBox(deviceBox)
! self.deviceCombo.insertStrList(Devices.values())
! try:
! deviceStr = Devices[str(self.config.readEntry("device", Devices.keys()[0]))]
! except KeyError:
! deviceStr = Devices[Devices.keys()[0]]
! self.deviceCombo.setCurrentText(deviceStr)
! layout.addWidget(self.deviceCombo, 1, 0, Qt.AlignLeft)
!
! boxLayout.addWidget(deviceBox, 0, 0, Qt.AlignTop)
Index: pyamp.py
===================================================================
RCS file: /cvsroot/pyamp/pyamp/src/pyamp.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** pyamp.py 26 Sep 2003 05:21:00 -0000 1.4
--- pyamp.py 10 Jan 2004 19:11:19 -0000 1.5
***************
*** 16,19 ****
--- 16,21 ----
# along with Pyamp; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ import psyco
+ psyco.profile()
from qt import *
Index: songthread.py
===================================================================
RCS file: /cvsroot/pyamp/pyamp/src/songthread.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** songthread.py 5 Jan 2004 00:34:13 -0000 1.3
--- songthread.py 10 Jan 2004 19:11:19 -0000 1.4
***************
*** 18,25 ****
from qt import *
from time import sleep
! from ao import AudioDevice
from songfactory import SongFactory
class SongThread(QThread):
--- 18,44 ----
from qt import *
+ from kdecore import *
from time import sleep
! from ao import AudioDevice, aoError
from songfactory import SongFactory
+ Devices = {
+ "alsa09" : "ALSA",
+ "oss" : "OSS",
+ "esd" : "Esound",
+ "arts" : "aRts",
+ "alsa" : "ALSA pre 0.9",
+ }
+
+ for device in Devices.keys():
+ try:
+ AudioDevice(device)
+ except aoError:
+ print Devices[device], "not supported"
+ Devices.pop(device)
+ if not Devices:
+ print "No audio device available"
+ KApplication.exit()
+
class SongThread(QThread):
***************
*** 30,34 ****
NEXT_EVENT = 1001
TICK_EVENT = 1002
!
def __init__(self, receiver):
QThread.__init__(self)
--- 49,53 ----
NEXT_EVENT = 1001
TICK_EVENT = 1002
!
def __init__(self, receiver):
QThread.__init__(self)
***************
*** 68,78 ****
# Song factory return None for invalid song
if song is not None:
- #~ self.dev = ossaudiodev.open("w")
- #~ apply(self.dev.setparameters, song.getParameters())
- self.dev = AudioDevice('alsa09', rate=44100)
self.song = song
self.fullpath = fullpath
! def terminte(self):
self.terminated = True
--- 87,98 ----
# Song factory return None for invalid song
if song is not None:
self.song = song
self.fullpath = fullpath
! def setDevice(self, device):
! self.dev = AudioDevice(device, rate=44100)
! self.device = device
!
! def terminate(self):
self.terminated = True
Index: tooltip.py
===================================================================
RCS file: /cvsroot/pyamp/pyamp/src/tooltip.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** tooltip.py 26 Sep 2003 04:51:32 -0000 1.2
--- tooltip.py 10 Jan 2004 19:11:19 -0000 1.3
***************
*** 26,30 ****
fullpath = item.getFullpath()
song = SongFactory.newSong(fullpath)
- sample, bits, channels, format = song.getParameters()
bitrate = song.getBitrate()
length = song.getLength()
--- 26,29 ----
***************
*** 34,39 ****
+ "\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)
--- 33,38 ----
+ "\nLength: " + secondsToStr(length) \
+ "\nFile size: " + str(path.getsize(fullpath)) + " bytes" \
! + "\nSample Frequency: " + str(44100) + " Hz" \
+ "\nBitrate: " + str(bitrate) + " kb/s" \
! + "\nChannels: " + str(2)
self.tip(rect, text)
|