本文整理汇总了Python中paella.db.midlevel.StatementCursor.getall方法的典型用法代码示例。如果您正苦于以下问题:Python StatementCursor.getall方法的具体用法?Python StatementCursor.getall怎么用?Python StatementCursor.getall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类paella.db.midlevel.StatementCursor
的用法示例。
在下文中一共展示了StatementCursor.getall方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TableBrowser
# 需要导入模块: from paella.db.midlevel import StatementCursor [as 别名]
# 或者: from paella.db.midlevel.StatementCursor import getall [as 别名]
class TableBrowser(CList):
def __init__(self, conn):
self.cmd = StatementCursor(conn, name='TableBrowser')
CList.__init__(self, 'Tables', name='TableBrowser')
self.set_rows(self.cmd.tables(), ['table'])
self.set_row_select(self.__hello__)
self.statement = Statement('select')
def __hello__(self, listbox, row, column, event):
self.statement.table = listbox.get_selected_data()[0]['table']
table = self.statement.table
tb = CList(table, name=table)
rows = self.cmd.getall('*', table)
cols = []
if len(rows):
cols = rows[0].keys()
tb.set_rows(rows, cols)
tb.set_usize(400,200)
示例2: ColorThingyWindow
# 需要导入模块: from paella.db.midlevel import StatementCursor [as 别名]
# 或者: from paella.db.midlevel.StatementCursor import getall [as 别名]
class ColorThingyWindow(CommandBoxWindow):
def __init__(self, rgb, conn, name='ColorThingyWindow'):
CommandBoxWindow.__init__(self, name=name)
self.browser = ColorThingy(rgb)
self.rgb = rgb
self.cmd = StatementCursor(conn, 'themer')
self.theme = None
self.vbox.add(self.browser)
self.tbar.add_button('import', 'import', self.__ask_import__)
self.tbar.add_button('insert', 'insert', self.__ask_insert__)
self.tbar.add_button('update', 'update', self.__update_theme__)
self.tbar.add_button('save', 'save', self.__save_files__)
self._insert_box = None
self._import_box = None
def __ask_import__(self, *args):
if not self._import_box:
#print args
#print '__import__'
themes = self.cmd.getall(['theme'], 'themes')
self._import_box = CList('hello')
self._import_box.set_rows(themes)
self._import_box.set_ok(self.__import_ok__)
def __import_ok__(self, *args):
theme = self._import_box.listbox.get_selected_data()[0]['theme']
self._import_box.destroy()
self._import_box = None
rows = self.cmd.select(table=theme)
b = self.browser
b._style.quick_set(rows)
for e, sb in b._elements.items():
for s in sb.keys():
color = b._style.elements[e][s]
sb[s] = color.name
_bg_widget(sb[s].button, color)
self.theme = theme
def __ask_insert__(self, *args):
if not self._import_box:
self._insert_box = EntryDialog('please insert name')
self._insert_box.set_ok(self.__insert_ok__)
def __insert_ok__(self, *args):
style = self.browser._style
tname = self._insert_box.get()
self.theme = tname
table = ThemeTable(tname)
self.cmd.create_table(table)
self.cmd.insert('themes', {'theme':tname})
for row in style.to_irows():
self.cmd.insert(tname, row)
def __update_theme__(self, *args):
if self.theme:
for element, states in self.browser._style.to_urows():
self.cmd.update(self.theme, states, "element = '%s'" %element)
def __save_files__(self, *args):
colordict = Rgbdb()
tmpl = GtkrcTemplate(self.theme, theme_base, self.browser._style)
tmpl.write_files()