Example #1
0
    def _handleGetImageList(self, payload):
        out      = []
        rootPath = AlloyEnvironment.getRootIconPath()
        folder   = payload['imageCategoryID']

        for image in os.listdir(os.path.join(rootPath, folder)):
            if image.split(u'.')[-1] not in [u'jpg', u'png']:
                continue
            out.append(folder + os.sep + image)

        return out
Example #2
0
    def __init__(self, **kwargs):
        """Creates a new instance of AlloyMainWindow."""
        PyGlassWindow.__init__(
            self,
            widgets={
                'main':AlloyHomeWidget
            },
            widgetID='main',
            title=u'Alloy',
            **kwargs
        )

        self.setStyleSheet(AlloyEnvironment.getStylesheet())
Example #3
0
    def _handleGetImageCategories(self, payload):
        out      = []
        rootPath = AlloyEnvironment.getRootIconPath()
        for p in os.listdir(rootPath):
            path = os.path.join(rootPath, p)
            if not os.path.isdir(path):
                continue

            items = os.listdir(path)
            if not items:
                continue

            out.append({'label':p[0].upper() + p[1:], 'id':p})

        return out
Example #4
0
 def getImage(self, imageID):
     image = AlloyEnvironment.getImage(unicode(imageID))
     if not image:
         image = AlloyEnvironment.getImage()
     return image
Example #5
0
# __init__.py
# (C)2012 http://www.ThreeAddOne.com
# Scott Ernst

from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session

from alloy.AlloyEnvironment import AlloyEnvironment

if AlloyEnvironment.DEVELOPMENT:
    print 'Creating engine: ' + str(AlloyEnvironment.getDatabaseURL())


try:
    engine = create_engine(AlloyEnvironment.getDatabaseURL())
except Exception, err:
    print 'DATABASE FAILURE: Unable to create engine for database'
    print 'Url:', AlloyEnvironment.getDatabaseURL()
    raise

try:
    Base = declarative_base(bind=engine)
except Exception, err:
    print 'DATABASE FAILURE: Unable to create database engine Base.'
    print 'Url:', AlloyEnvironment.getDatabaseURL()
    print 'Engine:', engine
    raise

try:
    Session = scoped_session(sessionmaker(bind=engine))