From b674c1a0fbc4612e65139fc0f4f6d0b0a41329cb Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Mon, 31 Aug 2009 15:12:45 +0200 Subject: switch to PyQt4 API v2 for QStrings --- nephilim/common.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'nephilim/common.py') diff --git a/nephilim/common.py b/nephilim/common.py index b0dac33..2663fa6 100644 --- a/nephilim/common.py +++ b/nephilim/common.py @@ -20,6 +20,7 @@ from PyQt4 import QtCore, QtGui, QtNetwork import socket import logging import os +import re socket.setdefaulttimeout(8) @@ -60,14 +61,12 @@ class Button(QtGui.QPushButton): icon.addFile(iconPath, QtCore.QSize(self.iconSize, self.iconSize)) self.setIcon(icon) -def expand_tags(str, expanders): - #ensure that str is QString - str = QtCore.QString(str) +def expand_tags(string, expanders): for expander in expanders: - str = expander.expand_tags(str) + string = expander.expand_tags(string) #remove unexpanded tags - return str.replace(QtCore.QRegExp('\\$\\w+'), '') + return re.sub('\$\w+', '', string) def generate_metadata_path(song, dir_tag, file_tag): """Generate dirname and (db files only) full file path for reading/writing metadata files @@ -86,8 +85,8 @@ def generate_metadata_path(song, dir_tag, file_tag): class MetadataFetcher(QtCore.QObject): """A basic class for metadata fetchers. Provides a fetch(song) function, - emits a finished(song, metadata) signal when done; lyrics is either a QString, - Python unicode string or None if not found.""" + emits a finished(song, metadata) signal when done; lyrics is either a Python + unicode string or None if not found.""" #public, read-only logger = None name = '' -- cgit v1.2.3