def addQtImagePath(localPath): """ Adds path where Qt can look for images. @param localPath: Path on the local file system. @type localPath: C{unicode} """ QMimeSourceFactory.defaultFactory().addFilePath(localPath)
def qCleanupImages_albumart(): global factory if factory is not None: QMimeSourceFactory.defaultFactory().removeFactory(factory) factory = None
def qInitImages_albumart(): global factory if factory is None: factory = MimeSourceFactory_albumart() QMimeSourceFactory.defaultFactory().addFactory(factory)
import os from locale import getdefaultlocale from qt import QMimeSourceFactory __all__ = ['appdir', 'language', 'encoding', 'config'] appdir = os.path.dirname(__path__[0]) try: language, encoding = getdefaultlocale() except ValueError: language, encoding = None, None def config(group=None): """ Return the master KConfig object for "lilykderc", or a KConfigGroup (wrapper) object if a group name is given. """ from lilykde.util import kconfig k = kconfig("lilykderc", False, False) return group and k.group(group) or k QMimeSourceFactory.defaultFactory().addFilePath( os.path.join(appdir, "pics")) # kate: indent-width 4;
from pytweek import tweekframe, prefs class EnvError(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) tweek_base_dir = getenv("TWEEK_BASE_DIR") if not tweek_base_dir: raise EnvError, "TWEEK_BASE_DIR environment variable not set" # Construct the path to the images that will be loaded by the GUI. image_dir = path.join(tweek_base_dir, "share", "tweek", "python", "images") # Set up PyQt. app = QApplication(sys.argv) # XXX: Is there a cleaner way to define a QStringList from Python? QMimeSourceFactory.defaultFactory().setFilePath(QStringList(image_dir)) # Load the user's preferences file. If it does not exist, it will be created. prefs = prefs.GlobalPreferences("/home/patrick/.tweekrc") prefs.parse() frame = tweekframe.TweekFrame() # XXX: This is a hack because I am lame. frame.globalPrefs = prefs frame.subjMgrList = [] frame.show() app.exec_loop()
class EnvError(Exception): def __init__(self, value): self.value = value def __str__(self): return repr(self.value) tweek_base_dir = getenv("TWEEK_BASE_DIR") if not tweek_base_dir: raise EnvError, "TWEEK_BASE_DIR environment variable not set" # Construct the path to the images that will be loaded by the GUI. image_dir = path.join(tweek_base_dir, "share", "tweek", "python", "images") # Set up PyQt. app = QApplication(sys.argv) # XXX: Is there a cleaner way to define a QStringList from Python? QMimeSourceFactory.defaultFactory().setFilePath(QStringList(image_dir)) # Load the user's preferences file. If it does not exist, it will be created. prefs = prefs.GlobalPreferences("/home/patrick/.tweekrc") prefs.parse() frame = tweekframe.TweekFrame() # XXX: This is a hack because I am lame. frame.globalPrefs = prefs frame.subjMgrList = [] frame.show() app.exec_loop()