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


Python Group.fav方法代码示例

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


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

示例1: insertExampleData

# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import fav [as 别名]
    def insertExampleData(self):
        self.getSession()
        g1 = Group("Group 1")
        g2 = Group("Group 2")
        g2.fav = True

        t1 = Track("Bob", "Hello World!", False, 1)
        t2 = Track("Joe", "How are you doing?", True, 3)
        t3 = Track("Jim", "Can't stop dancing", False, 5)
        t4 = Track("Tom", "A simple melody", True, 9)

        gt1_1 = GroupTrack(1, 0, 100)
        gt1_1.track = t1
        gt1_2 = GroupTrack(2, 100, 200)
        gt1_2.track = t2
        g1.grouptracks.append(gt1_1)
        g1.grouptracks.append(gt1_2)

        gt2_2 = GroupTrack(1, 0, 200)
        gt2_2.track = t2
        gt2_3 = GroupTrack(2, 200, 150)
        gt2_3.track = t3
        g2.grouptracks.append(gt2_2)
        g2.grouptracks.append(gt2_3)

        self.session.add_all([g1, g2, t1, t2, t3, t4, gt1_1, gt1_2, gt2_2, gt2_3])
        self.session.commit()
开发者ID:janhradek,项目名称:regaudio,代码行数:29,代码来源:model.py

示例2: newgroup

# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import fav [as 别名]
    def newgroup(self, name):
        '''
        create a group and insert it to the list in the position
        '''
        self._checksession()

        g = Group(name)
        g.fav = True
        self.lst.append(g)
        self.session.add(g)
        self.session.commit()

        self.resort()

        return self.lst.index(g)
开发者ID:janhradek,项目名称:regaudio,代码行数:17,代码来源:model.py

示例3: store

# 需要导入模块: from model.group import Group [as 别名]
# 或者: from model.group.Group import fav [as 别名]
    def store(self, stats):
        '''
        store every item in the list according to the data in it
        this might create a group, grouptracks and tracks
        '''
        ss = self.model.getSession()

        gg = None
        if not self.name is None and self.name.strip() != "":
            gg = Group(self.name)
            gg.fav = self.fav
            ss.add(gg)
            ss.flush()
            ss.merge(gg) # merge the idno

        for ee in self.lst:
            tt = None
            if ee.track == True:
                tt = ee.createTrack()
                ss.add(tt)
                stats.inctotal()

            elif ee.track != None:
                ee.applyToTrack()
                tt = ee.track

            if tt != None and gg != None:
                gt = ee.createGroupTrack()
                ss.add(gt)
                gt.track = tt
                gg.grouptracks.append(gt)

        ss.commit()

        if gg:
            if ((gg.idno is None) or (gg.idno == 0) or (not isinstance(gg.idno, int))):
                raise Exception("IDNO == None or something else")
            return gg.idno
        return None
开发者ID:janhradek,项目名称:regaudio,代码行数:41,代码来源:importdata.py


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