本文整理汇总了Python中database.DataBase.select_row方法的典型用法代码示例。如果您正苦于以下问题:Python DataBase.select_row方法的具体用法?Python DataBase.select_row怎么用?Python DataBase.select_row使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类database.DataBase
的用法示例。
在下文中一共展示了DataBase.select_row方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: spinner_thread
# 需要导入模块: from database import DataBase [as 别名]
# 或者: from database.DataBase import select_row [as 别名]
def spinner_thread(theme_index, data_dict):
'spinner object is activated in this thread'
def strip_space(data):
'''
replaces any white space
from a string with a '+'
'''
count = 0
while count < len(data) and data[count] == ' ':
count += 1
if count == len(data) :
return ''
data = data[count:]
word = ''
for i in range(len(data)):
if data[i] != ' ':
word += data[i]
count = 0
else:
count += 1
if count == 1:
word += '+'
if word[len(word) - 1] == '+':
word = word[0:len(word) - 1]
return word
if InputBox.query != '':
data_dict['text'] = InputBox.query
data_dict['language'] = {'en': 0, 'bn': 1}[InputBox.target]
table = (len(InputBox.query) > 1 and InputBox.query[1] != ' ') and \
InputBox.query[:2] or InputBox.query[:1]
database = DataBase()
row = database.select_row(table, InputBox.query)
if not row or not row[{'en': 1, 'bn': 2}[InputBox.target]]:
data_dict['widget'] = fetch_from_web(strip_space(InputBox.query),
InputBox.target, theme_index)
else:
data_dict['widget'] = fetch_from_database(row, InputBox.target,
theme_index)
gtk.main_quit()