本文整理汇总了Python中ui.UI.loading方法的典型用法代码示例。如果您正苦于以下问题:Python UI.loading方法的具体用法?Python UI.loading怎么用?Python UI.loading使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ui.UI
的用法示例。
在下文中一共展示了UI.loading方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from ui import UI [as 别名]
# 或者: from ui.UI import loading [as 别名]
class Menu:
def __init__(self):
reload(sys)
sys.setdefaultencoding('UTF-8')
self.title = 'Nada'
self.model = ['最新期刊', '分类期刊', '搜索期刊', '收藏夹', '关于']
self.view = 'menu'
self.ctrl = 'menu'
self.offset = 0
self.index = 0
self.step = 10
self.play_id = -1
self.play_vol = -1
self.present = []
self.stack = []
self.player = Player()
self.ui = UI()
self.luoo = Luoo()
self.downloader = Downloader()
self.database = Database()
self.database.load()
self.collections = self.database.data['collections'][0]
self.screen = curses.initscr()
self.screen.keypad(1)
def start(self):
self.ui.build(self.title, self.model, self.view, self.offset, self.index, self.step, self.play_vol,
self.play_id)
self.stack.append([self.title, self.model, self.view, self.ctrl, self.offset, self.index])
while True:
title = self.title
model = self.model
view = self.view
ctrl = self.ctrl
offset = self.offset
index = idx = self.index
step = self.step
key = self.screen.getch()
self.ui.screen.refresh()
if view == 'songs':
length = len(model['songs'])
else:
length = len(model)
if key == ord('q'):
break
elif key == ord('k'):
if idx == offset:
if offset == 0:
continue
self.offset -= step
self.index = offset - 1
else:
self.index = carousel(offset, min(length, offset + step) - 1, idx - 1)
elif key == ord('j'):
if idx == min(length, offset + step) - 1:
if offset + step >= length:
continue
self.offset += step
self.index = offset + step
else:
self.index = carousel(offset, min(length, offset + step) - 1, idx + 1)
elif key == ord('u'):
if offset == 0:
continue
self.offset -= step
self.index = (index - step) // step * step
elif key == ord('i'):
if offset + step >= length:
continue
self.offset += step
self.index = (index + step) // step * step
elif key == ord('l'):
if self.view == 'songs':
continue
self.ui.loading()
self.control(idx)
self.index = 0
self.offset = 0
elif key == ord('h'):
if len(self.stack) == 1:
continue
up = self.stack.pop()
self.title = up[0]
#.........这里部分代码省略.........