当前位置: 首页>>代码示例>>Python>>正文


Python Model.__model_from_definition__方法代码示例

本文整理汇总了Python中model.Model.__model_from_definition__方法的典型用法代码示例。如果您正苦于以下问题:Python Model.__model_from_definition__方法的具体用法?Python Model.__model_from_definition__怎么用?Python Model.__model_from_definition__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.Model的用法示例。


在下文中一共展示了Model.__model_from_definition__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ProjectDefinition

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import __model_from_definition__ [as 别名]

import gtk


import attrtypes as types
from model import Model, ModelGroup
from views import TreeObserver, PropertyPage
from persistency import IniFileObserver, load_model_from_ini

from exampleschema import AddressDefinition

# Creates a model class
Address = Model.__model_from_definition__(AddressDefinition)


class ProjectDefinition(object):
    __order__ = ['general', 'source', 'build', 'execution',
                 'testing', 'gui']

    class general:
        """General options relating to the project"""
        __order__ = ['name', 'filename',  'browse_directory']
        label = 'General'
        stock_id = gtk.STOCK_PREFERENCES

        class name:
            """The name you would like to refer to the project as"""
            label = 'Project Name'
            rtype = types.string
            default = 'unnamed'
开发者ID:BackupTheBerlios,项目名称:pida-svn,代码行数:32,代码来源:example.py

示例2: BlahBlah

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import __model_from_definition__ [as 别名]
class BlahBlah(object):
    def __init__(self):
        self._g = None
        self.f = None

    def get_g(self):
        return self._g

    def set_g(self, val):
        self._g = val

    g = property(get_g, set_g)


BlahModel = Model.__model_from_definition__(Blah)
LazySchemaModel = Model.__model_from_definition__(LazySchema)


class MockSingleObserver(BaseSingleModelObserver):
    def __model_notify__(self, *args):
        if hasattr(self, "notify"):
            self.notify(self, *args)


class MockMultiObserver(BaseMultiModelObserver):
    def __model_notify__(self, *args):
        if hasattr(self, "notify"):
            self.notify(self, *args)

    def set_model(self, model):
开发者ID:BackupTheBerlios,项目名称:pida-svn,代码行数:32,代码来源:tests.py

示例3: __markup__

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import __model_from_definition__ [as 别名]
        pass

    def __markup__(self):
        return self.feh__gah

class BlahBlah(object):
    def __init__(self):
        self._g = None
        self.f = None
    def get_g(self):
        return self._g
    def set_g(self, val):
        self._g = val
    g = property(get_g, set_g)

BlahModel = Model.__model_from_definition__(Blah)

class MockSingleObserver(BaseSingleModelObserver):

    def __model_notify__(self, *args):
        if hasattr(self, 'notify'):
            self.notify(self, *args)

class MockMultiObserver(BaseMultiModelObserver):

    def __model_notify__(self, *args):
        if hasattr(self, 'notify'):
            self.notify(self, *args)

    def set_model(self, model):
        self._current = model
开发者ID:BackupTheBerlios,项目名称:pida-svn,代码行数:33,代码来源:tests.py

示例4: Widget

# 需要导入模块: from model import Model [as 别名]
# 或者: from model.Model import __model_from_definition__ [as 别名]
import time, os, sys

from twisted.internet import task
from twisted.python import log, util

from nevow import athena, loaders, static, appserver,inevow,  tags as T

from model import Model, BaseSingleModelObserver, BaseMultiModelObserver,\
                  ModelGroup
from exampleschema import AddressDefinition

# Creates a model class
Address = Model.__model_from_definition__(AddressDefinition)
from persistency import IniFileObserver, load_model_from_ini
import attrtypes as types

class Widget(athena.LiveFragment):


    docFactory = loaders.xmlstr('''\
<div xmlns:nevow="http://nevow.com/ns/nevow/0.1"
     xmlns:athena="http://divmod.org/ns/athena/0.7"
     nevow:render="liveFragment">
     <div nevow:render="label" />
     <div nevow:render="widget">
     </div>
</div>
''')

    def set_model_attr(self, attr):
        self._model_attr = attr
开发者ID:BackupTheBerlios,项目名称:pida-svn,代码行数:33,代码来源:nevowinteg.py


注:本文中的model.Model.__model_from_definition__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。