Ejemplo n.º 1
0
 def __init__(self):
     warnings.warn(
         'MimeSources needs more work and needs to be put in a better place',
         RuntimeWarning,
         stacklevel=2)
     QMimeSourceFactory.__init__(self)
     self.addFilePath('/usr/share/wallpapers')
Ejemplo n.º 2
0
class ViewBrowser(KTextBrowser):
    def __init__(self, app, parent, doc):
        KTextBrowser.__init__(self, parent)
        self.setMimeSourceFactory(MimeSources())
        self.app = app
        self.db = app.db
        self.doc = doc(self.app)
        self.setNotifyClick(True)
        

    def setMimeSourceFactory(self, factory=None):
        if factory is None:
            self.mimes = QMimeSourceFactory()
            self.mimes.addFilePath('/usr/share/wallpapers')
        else:
            self.mimes = factory
        KTextBrowser.setMimeSourceFactory(self, self.mimes)

    def set_clause(self, clause):
        self.doc.set_clause(clause)
        self.setText(self.doc.toxml())

    def _split_url(self, url):
        action, context, id_ = str(url).split('.')
        return action, context, id_

    def _url_error(self, url):
            KMessageBox.information(self, 'called %s' % url)
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
0
    def data(self,abs_name):
        d = QMimeSourceFactory.data(self,abs_name)
        if d or abs_name.isNull():
            return d

        img = uic_findImage(abs_name)
        if not img.isNull():
            self.setImage(abs_name,img)

        return QMimeSourceFactory.data(self,abs_name)
Ejemplo n.º 6
0
 def setMimeSourceFactory(self, factory=None):
     if factory is None:
         self.mimes = QMimeSourceFactory()
         self.mimes.addFilePath('/usr/share/wallpapers')
     else:
         self.mimes = factory
     KTextBrowser.setMimeSourceFactory(self, self.mimes)
Ejemplo n.º 7
0
class ViewBrowser(KTextBrowser):
    def __init__(self, db, parent, doc):
        KTextBrowser.__init__(self, parent)
        self.setMimeSourceFactory(MimeSources())
        self.db = db
        self.doc = doc(self.db)
        self.setNotifyClick(True)
        

    def setMimeSourceFactory(self, factory=None):
        if factory is None:
            self.mimes = QMimeSourceFactory()
            self.mimes.addFilePath('/usr/share/wallpapers')
        else:
            self.mimes = factory
        KTextBrowser.setMimeSourceFactory(self, self.mimes)

    def set_clause(self, clause):
        self.doc.set_clause(clause)
        self.setText(self.doc.toxml())
Ejemplo n.º 8
0
def qCleanupImages_albumart():
    global factory

    if factory is not None:
        QMimeSourceFactory.defaultFactory().removeFactory(factory)
        factory = None
Ejemplo n.º 9
0
def qInitImages_albumart():
    global factory

    if factory is None:
        factory = MimeSourceFactory_albumart()
        QMimeSourceFactory.defaultFactory().addFactory(factory)
Ejemplo n.º 10
0
 def __init__(self):
     QMimeSourceFactory.__init__(self)
Ejemplo n.º 11
0
 def __init__(self):
     QMimeSourceFactory.__init__(self)
     self.addFilePath('/usr/share/wallpapers')
Ejemplo n.º 12
0
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;
Ejemplo n.º 13
0
 def __init__(self):
     QMimeSourceFactory.__init__(self)
     self.addFilePath('/usr/share/wallpapers')
Ejemplo n.º 14
0
 def __init__(self):
     warnings.warn('MimeSources needs more work and needs to be put in a better place',
                   RuntimeWarning, stacklevel=2)
     QMimeSourceFactory.__init__(self)
     self.addFilePath('/usr/share/wallpapers')
Ejemplo n.º 15
0
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()
Ejemplo n.º 16
0
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()