本文整理汇总了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
示例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))
示例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)