本文整理汇总了Python中ui.UI.search方法的典型用法代码示例。如果您正苦于以下问题:Python UI.search方法的具体用法?Python UI.search怎么用?Python UI.search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui.UI
的用法示例。
在下文中一共展示了UI.search方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from ui import UI [as 别名]
# 或者: from ui.UI import search [as 别名]
#.........这里部分代码省略.........
continue
self.offset -= step
time.sleep(0.1)
elif key == ord('p'):
if len(self.present) == 0:
continue
self.stack.append([self.title, self.model, self.view, self.ctrl, self.offset, self.index])
self.title = self.present[0]
self.model = self.present[1]
self.view = self.present[2]
self.ctrl = self.present[3]
self.index = idx = self.player.play_id
self.offset = idx // step * step
elif key == ord('m'):
if view != 'menu':
self.stack.append([self.title, self.model, self.view, self.ctrl, self.offset, self.index])
self.title = self.stack[0][0]
self.model = self.stack[0][1]
self.view = self.stack[0][2]
self.ctrl = self.stack[0][3]
self.offset = self.stack[0][4]
self.index = self.stack[0][5]
elif key == ord('a'):
if view == 'songs' and ctrl is not 'collections':
self.ui.status(model['songs'][idx]['name'], 'Add', 5)
self.collections.append(model['songs'][idx])
elif key == ord('r'):
if ctrl == 'collections':
if length != 0:
self.ui.status(model['songs'][idx]['name'], 'Remove', 3)
self.model['songs'].pop(idx)
self.index = carousel(offset, min(length, offset + step) - 1, idx)
elif key == ord('c'):
self.stack.append([self.title, self.model, self.view, self.ctrl, self.offset, self.index])
self.title = 'Nada > nada 收藏'
self.collection()
elif key == ord('d'):
if view == 'songs':
self.downloader.download(model['songs'][idx])
self.play_vol = self.player.play_vol
self.play_id = self.player.play_id
self.ui.build(self.title, self.model, self.view, self.offset, self.index, self.step, self.play_vol,
self.play_id)
self.ui.screen.refresh()
self.player.stop()
self.database.save()
curses.endwin()
def control(self, idx):
self.stack.append([self.title, self.model, self.view, self.ctrl, self.offset, self.index])
ctrl = self.ctrl
if ctrl == 'menu':
self.menu(idx)
elif ctrl == 'vols':
self.vols(idx)
elif ctrl == 'vtype':
self.vtype(idx)
self.offset = 0
self.index = 0
def menu(self, idx):
if idx == 0:
self.title += ' > 最新期刊'
self.model = self.luoo.new()
self.view = 'vols'
self.ctrl = 'vols'
elif idx == 1:
self.title += ' > 分类期刊'
self.model = self.luoo.vtype()
self.view = 'vols'
self.ctrl = 'vtype'
elif idx == 2:
vol_id = self.ui.search('搜索期刊: ')
try:
self.model = self.luoo.vol(vol_id)
self.title += ' > 搜索期刊 > Vol.' + self.model['id'] + ' ' + self.model['title']
self.view = 'songs'
self.ctrl = 'songs'
except Exception, e:
self.model = []
elif idx == 3:
self.title += ' > 收藏夹'
self.collection()