示例#1
0
    name = "List grid demo"
    description = """\
This table shows a basic grid generated from lists - it has customized order of columns."""

    def get_grid(self):
        """
        basic demo
        """

        g = ListGrid(list_data,
                     columns=[1, 3, 2, 0],
                     column_labels=["One", "Three", "Two", "Zero"])
        return g


demos = subclasses_only(_DemoBase, globals())

#demos = [BasicDemo, CustomColumnDemo]


#### Utility functions ####
def url(urlpath, **params):
    # This should be a helper and I think it's defined somewhere but I
    # can't think of where.
    return urlpath + "?" + urllib.parse.urlencode(params)


def write_file(dir, filename, content):
    print("... writing '%s'" % filename)
    path = os.path.join(dir, filename)
    f = open(path, "w")
示例#2
0
def test_subclasses_only_with_exclude():
    subclasses = subclasses_only(Tea, globals(), [Black, Green])
    subclasses.sort(key=by_name)
    control = [EarlGrey, EnglishBreakfast, JasminePearl, Sencha]
    eq_(subclasses, control)
示例#3
0
    
class ListDemo(_DemoBase):
    name = "List grid demo"
    description = """\
This table shows a basic grid generated from lists - it has customized order of columns."""

    def get_grid(self):
        """
        basic demo
        """
        
        g = ListGrid(list_data, columns=[1, 3, 2, 0],
            column_labels=["One", "Three", "Two", "Zero"])
        return g
    
demos = subclasses_only(_DemoBase, globals())

#demos = [BasicDemo, CustomColumnDemo]

#### Utility functions ####
def url(urlpath, **params):
    # This should be a helper and I think it's defined somewhere but I
    # can't think of where.
    return urlpath + "?" + urllib.urlencode(params)

def write_file(dir, filename, content):
    print "... writing '%s'" % filename
    path = os.path.join(dir, filename)
    f = open(path, "w")
    f.write(content)
    f.close()
示例#4
0
def test_subclasses_only():
    subclasses = subclasses_only(DummyBase, globals())
    subclasses.sort(key=by_name)
    control = [Subclass1, Subclass2]
    eq_(subclasses, control)