예제 #1
0
def main():
    from camelot.admin.action.application import Application
    from camelot.view.main import main_action
    from camelot_example.application_admin import MyApplicationAdmin
    settings.append(example_settings)
    videostore = Application(MyApplicationAdmin())
    main_action(videostore)
예제 #2
0
 def test_import_settings(self):
     from camelot.core.conf import settings
     self.assertEqual( settings.get('FOO', None), None )
     self.assertRaises( AttributeError, lambda:settings.FOO )
     self.assertTrue( settings.CAMELOT_MEDIA_ROOT.endswith( 'media' ) )
     self.assertFalse( hasattr( settings, 'FOO' ) )
     
     class AdditionalSettings( object ):
         FOO = True
         
     settings.append( AdditionalSettings() )
     self.assertTrue( hasattr( settings, 'FOO' ) )
     try:
         settings.append_settings_module()
     except ImportError:
         pass
예제 #3
0
    def test_import_settings(self):
        from camelot.core.conf import settings
        self.assertEqual(settings.get('FOO', None), None)
        self.assertRaises(AttributeError, lambda: settings.FOO)
        self.assertTrue(settings.CAMELOT_MEDIA_ROOT.endswith('media'))
        self.assertFalse(hasattr(settings, 'FOO'))

        class AdditionalSettings(object):
            FOO = True

        settings.append(AdditionalSettings())
        self.assertTrue(hasattr(settings, 'FOO'))
        try:
            settings.append_settings_module()
        except ImportError:
            pass
예제 #4
0
def launch_meta_camelot():
    import sys
    from camelot.view.model_thread import construct_model_thread, get_model_thread
    from camelot.admin.action import GuiContext
    from PyQt4 import QtGui
    app = QtGui.QApplication([a for a in sys.argv if a])
    construct_model_thread()
    mt = get_model_thread()
    mt.start()
    settings.append(MetaSettings())
    new_project = CreateNewProject()
    gui_context = GuiContext()
    admin = MetaCamelotAdmin()
    admin.get_stylesheet()
    gui_context.admin = admin
    new_project.gui_run(gui_context)
    # keep app alive during running of app
    return app
예제 #5
0
파일: meta.py 프로젝트: Governa/Camelot
def launch_meta_camelot():
    import sys
    from camelot.view.model_thread import construct_model_thread, get_model_thread
    from camelot.admin.action import GuiContext
    from PyQt4 import QtGui
    app = QtGui.QApplication([a for a in sys.argv if a])
    construct_model_thread()
    mt = get_model_thread()
    mt.start()
    settings.append( MetaSettings() )
    new_project = CreateNewProject()
    gui_context = GuiContext()
    admin = MetaCamelotAdmin()
    admin.get_stylesheet()
    gui_context.admin = admin
    new_project.gui_run( gui_context )
    # keep app alive during running of app
    return app
예제 #6
0
    #     from sqlalchemy import create_engine
    #     return create_engine( 'postgresql://*****:*****@127.0.0.1/database' )

    def setup_model(self):
        """This function will be called at application startup, it is used to setup the model"""
        from camelot.core.sql import metadata
        from sqlalchemy.orm import configure_mappers
        metadata.bind = self.ENGINE()
        import camelot.model.authentication
        import camelot.model.i18n
        import camelot.model.memento
        import agenda.model
        configure_mappers()
        metadata.create_all()


my_settings = MySettings('Gustavo Leon y Marcos Castellanos',
                         'Agenda de Contactos')
settings.append(my_settings)
# end custom settings


def start_application():
    from camelot.view.main import main
    from agenda.application_admin import MyApplicationAdmin
    main(MyApplicationAdmin())


if __name__ == '__main__':
    start_application()
예제 #7
0
파일: main.py 프로젝트: Governa/Camelot
        # create the tables for all models, configure mappers first, to make
        # sure all deferred properties have been handled, as those could
        # create tables or columns
        #
        configure_mappers()
        metadata.create_all()
        from camelot.model.authentication import update_last_login
        update_last_login()
        # 
        # Load sample data with the fixure mechanism
        #
        from camelot_example.fixtures import load_movie_fixtures
        load_movie_fixtures()
        #
        # setup the views
        #
        from camelot_example.view import setup_views
        setup_views()

settings.append( ExampleSettings( 'camelot', 
                                  'videostore',
                                  data = 'videostore_2.sqlite') )

def main():
    from camelot.view.main import main
    from camelot_example.application_admin import MyApplicationAdmin
    main( MyApplicationAdmin() )
    
if __name__ == '__main__':
    main()
예제 #8
0
        from sqlalchemy import create_engine
        # static pool to preserve tables and data accross threads
        self.engine = create_engine( 'sqlite:///', poolclass = StaticPool )
        
    def setup_model( self ):
        from camelot.core.sql import metadata
        metadata.bind = self.ENGINE()
        from camelot.model import authentication
        from camelot.model import party
        from camelot.model import i18n
        from camelot.model import memento
        from camelot.model import fixture
        from camelot.model import batch_job
        import camelot_example.model

        from camelot_example.view import setup_views
        from camelot_example.fixtures import load_movie_fixtures
        from camelot.model.authentication import update_last_login
        from camelot.core.orm import setup_all
        setup_all(create_tables=True)
        setup_views()
        load_movie_fixtures()
        update_last_login()
    
    CAMELOT_MEDIA_ROOT = 'media'
    
    def ENGINE( self ):
        return self.engine
   
settings.append( TestSettings() )
예제 #9
0
    def setup_model(self):
        """This function will be called at application startup, it is used to 
        setup the model"""
        from camelot.core.sql import metadata
        from sqlalchemy.orm import configure_mappers

        metadata.bind = self.ENGINE()
        import camelot.model.authentication
        import camelot.model.i18n
        import camelot.model.memento
        import rms.model

        configure_mappers()
        metadata.create_all()


my_settings = MySettings("Roland", "Resource Management System")
settings.append(my_settings)
# end custom settings


def start_application():
    from camelot.view.main import main
    from rms.application_admin import MyApplicationAdmin

    main(MyApplicationAdmin())


if __name__ == "__main__":
    start_application()
예제 #10
0
def main():
    from camelot.view.main import main
    from camelot_example.application_admin import MiniApplicationAdmin
    settings.append(example_settings)
    main( MiniApplicationAdmin() )
예제 #11
0
        # create the tables for all models, configure mappers first, to make
        # sure all deferred properties have been handled, as those could
        # create tables or columns
        #
        configure_mappers()
        metadata.create_all()
        from camelot.model.authentication import update_last_login
        #update_last_login()
        # 
        # Load sample data with the fixure mechanism
        #
        from camelot_example.fixtures import load_movie_fixtures
        load_movie_fixtures()
        #
        # setup the views
        #
        from camelot_example.view import setup_views
        setup_views()

settings.append( ExampleSettings( 'camelot', 
                                  'videostore',
                                  data = 'videostore_2.sqlite') )

def main():
    from camelot.view.main import main
    from camelot_example.application_admin import MyApplicationAdmin
    main( MyApplicationAdmin() )
    
if __name__ == '__main__':
    main()
예제 #12
0
        # static pool to preserve tables and data accross threads
        self.engine = create_engine('sqlite:///', poolclass=StaticPool)

    def setup_model(self):
        from camelot.core.sql import metadata
        metadata.bind = self.ENGINE()
        from camelot.model import authentication
        from camelot.model import party
        from camelot.model import i18n
        from camelot.model import memento
        from camelot.model import fixture
        from camelot.model import batch_job
        import camelot_example.model

        from camelot_example.view import setup_views
        from camelot_example.fixtures import load_movie_fixtures
        from camelot.model.authentication import update_last_login
        from camelot.core.orm import setup_all
        setup_all(create_tables=True)
        setup_views()
        load_movie_fixtures()
        update_last_login()

    CAMELOT_MEDIA_ROOT = 'media'

    def ENGINE(self):
        return self.engine


settings.append(TestSettings())
예제 #13
0
        
#
# Setup a camelot application
#
from camelot.admin.application_admin import ApplicationAdmin
from camelot.admin.section import Section
from camelot.core.conf import settings

class AppAdmin( ApplicationAdmin ):
    
    def get_sections( self ):
        return [ Section( 'All tables', self, items = [Person] ) ]
    
class Settings(object):
    
    def ENGINE( self ):
        return engine
    
    def setup_model( self ):
        metadata.bind = engine
    
settings.append( Settings() )
app_admin = AppAdmin()

#
# Start the application 
#
if __name__ == '__main__':
    from camelot.view.main import main
    main( app_admin )