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


Python Book.barcode方法代码示例

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


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

示例1: get

# 需要导入模块: from models import Book [as 别名]
# 或者: from models.Book import barcode [as 别名]
 def get(self):
     db = getUtility(IRelationalDatabase)
     cr = db.cursor()
     barcode = self.book.barcode
     if barcode:
         cr.execute("""SELECT
                         id,
                         barcode,
                         author,
                         title
                       FROM books
                       WHERE barcode = ?""",
                    (barcode,))
     else:
         cr.execute("""SELECT
                         id,
                         barcode,
                         author,
                         title
                       FROM books""")
     rst = cr.fetchall()
     cr.close()
     books = []
     for record in rst:
         id = record['id']
         barcode = record['barcode']
         author = record['author']
         title = record['title']
         book = Book()
         book.id = id
         book.barcode = barcode
         book.author = author
         book.title = title
         books.append(book)
     return books
开发者ID:eugeneai,项目名称:ZCA,代码行数:37,代码来源:catalog.py

示例2: on_add_clicked

# 需要导入模块: from models import Book [as 别名]
# 或者: from models.Book import barcode [as 别名]
 def on_add_clicked(self, *args):
     barcode = self.ui.barcode.get_text()
     author = self.ui.author.get_text()
     title = self.ui.title.get_text()
     book = Book()
     book.barcode = barcode
     book.author = author
     book.title = title
     self.add(book)
     self.ui.list_store.append((book, barcode, author, title))
开发者ID:eugeneai,项目名称:ZCA,代码行数:12,代码来源:vc.py

示例3: initialize_lists

# 需要导入模块: from models import Book [as 别名]
# 或者: from models.Book import barcode [as 别名]
    def initialize_lists(self):
        cm=Gtk.ListStore(object, str, str, str)
        self.ui.catalog=cm
        self.ui.catalog_view.set_model(cm)
        for _ in range(3):
            b=Book()
            b.title="Brotherhood of the ring"
            b.author="J.R.R.Tolkien"
            b.barcode="123-1232"
            self.append_book(b)

        mm=Gtk.ListStore(object, int, str)
        self.ui.members=mm
        self.ui.member_view.set_model(mm)
        for _ in range(3):
            m=Member()
            m.name="Jim Carry"
            m.number=123
            self.append_member(m)
开发者ID:eugeneai,项目名称:ZCA,代码行数:21,代码来源:vc.py


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