Example #1
0
File: ui.py Project: laoyin/nyf
 def __init__(self, label, page_or_tuple):
     self.label = force_utf8(label)
     if isinstance(page_or_tuple, Page):
         self.pages = (page_or_tuple, )
     else:
         self.pages = page_or_tuple
     self.uid = uuid.uuid4().hex[:8]
Example #2
0
 def __init__(self, label, page_or_tuple):
     self.label = force_utf8(label)
     if isinstance(page_or_tuple, Page):
         self.pages = (page_or_tuple, )
     else:
         self.pages = page_or_tuple
     self.uid = uuid.uuid4().hex[:8]
Example #3
0
File: ui.py Project: laoyin/nyf
    def __new__(cls, name, bases, attrs):
        new_class = super(UIDefiningClass, cls).__new__(cls, name, bases, attrs)

        #如果子类非抽象则需要算出uid
        if not new_class.__abstract__:
            if new_class.uid is None:
                new_class.uid = utils.uid(new_class.__name__)

        #添加类属性label
        if isinstance(new_class.label, six.string_types):
            new_class.label = force_utf8(new_class.label)
        elif type(new_class.label)==type(ugettext_lazy('')):
            pass
        else:
            new_class.label = new_class.uid
        return new_class
Example #4
0
    def __new__(cls, name, bases, attrs):
        new_class = super(UIDefiningClass, cls).__new__(cls, name, bases, attrs)

        #如果子类非抽象则需要算出uid
        if not new_class.__abstract__:
            if new_class.uid is None:
                new_class.uid = utils.uid(new_class.__name__)

        #添加类属性label
        if isinstance(new_class.label, six.string_types):
            new_class.label = force_utf8(new_class.label)
        elif type(new_class.label)==type(ugettext_lazy('')):
            pass
        else:
            new_class.label = new_class.uid
        return new_class