本文整理汇总了Python中ui.Ui类的典型用法代码示例。如果您正苦于以下问题:Python Ui类的具体用法?Python Ui怎么用?Python Ui使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Ui类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
reload(sys)
sys.setdefaultencoding("UTF-8")
self.config = Config()
self.datatype = "main"
self.title = "网易云音乐"
self.datalist = ["排行榜", "艺术家", "新碟上架", "精选歌单", "我的歌单", "DJ节目", "每日推荐", "私人FM", "搜索", "帮助"]
self.offset = 0
self.index = 0
self.storage = Storage()
self.storage.load()
self.collection = self.storage.database["collections"][0]
self.player = Player()
self.player.playing_song_changed_callback = self.song_changed_callback
self.cache = Cache()
self.ui = Ui()
self.netease = NetEase()
self.screen = curses.initscr()
self.screen.keypad(1)
self.step = 10
self.stack = []
self.djstack = []
self.userid = self.storage.database["user"]["user_id"]
self.username = self.storage.database["user"]["nickname"]
self.resume_play = True
self.at_playing_list = False
signal.signal(signal.SIGWINCH, self.change_term)
signal.signal(signal.SIGINT, self.send_kill)
self.START = time.time()
开发者ID:RockHong,项目名称:netease-music-cli-player,代码行数:29,代码来源:menu.py
示例2: effect
def effect(self):
"""If there is an original element, store it. Open the GUI."""
self.orig, self.orig_src = self.get_original()
self.ui = Ui(self.render, self.orig_src, self.get_settings())
self.ui.main()
开发者ID:janoliver,项目名称:inktex,代码行数:7,代码来源:inktex_cls.py
示例3: __init__
def __init__(self):
reload(sys)
sys.setdefaultencoding('UTF-8')
self.data_type = 'main'
# Title of the application
self.title = '网易云音乐'
# Main-menu list
self.data_list = ['排行榜', '艺术家', '新碟上架', '精选歌单', '我的歌单', 'DJ节目', '打碟', '收藏', '搜索', '帮助']
# Which page of the data_list is displayed (data_list may be displayed in multiple pages
self.page_index = 0
# The index of the current selected line
self.current_line_index = 0
self.present_songs = []
self.player = Player()
self.ui = Ui()
self.netease = NetEase()
self.screen = curses.initscr()
self.screen.keypad(1)
self.page_size = 10 # The number of lines that can be displayed on one page.
self.stack = []
self.dj_stack = []
self.user_id = None
self.user_name = None
# Read in the collection and account in flavor.json
try:
config_file = file(Constant.conf_dir + "/flavor.json", 'r')
data = json.loads(config_file.read())
self.collection = data['collection']
self.account = data['account']
config_file.close()
except:
self.collection = []
self.account = {}
开发者ID:manfred-exz,项目名称:musicbox,代码行数:34,代码来源:menu.py
示例4: __init__
def __init__(self):
reload(sys)
sys.setdefaultencoding('UTF-8')
self.config = Config()
self.datatype = 'main'
self.title = 'NetEase Music'
self.datalist = ['Charts', 'Artists', 'New Songs', 'Songs', 'My Songs', 'Radio Stations', 'Recommended',
'Personal Radio', 'Search', 'Help']
self.offset = 0
self.index = 0
self.storage = Storage()
self.storage.load()
self.collection = self.storage.database['collections'][0]
self.player = Player()
self.player.playing_song_changed_callback = self.song_changed_callback
self.cache = Cache()
self.ui = Ui()
self.netease = NetEase()
self.screen = curses.initscr()
self.screen.keypad(1)
self.step = 10
self.stack = []
self.djstack = []
self.userid = self.storage.database['user']['user_id']
self.username = self.storage.database['user']['nickname']
self.resume_play = True
self.at_playing_list = False
signal.signal(signal.SIGWINCH, self.change_term)
signal.signal(signal.SIGINT, self.send_kill)
self.START = time.time()
开发者ID:Zorgodon,项目名称:musicbox,代码行数:30,代码来源:menu.py
示例5: __init__
def __init__(self):
reload(sys)
sys.setdefaultencoding('UTF-8')
self.datatype = 'main'
self.title = '网易云音乐'
self.datalist = ['排行榜', '艺术家', '新碟上架', '精选歌单', '我的歌单', 'DJ节目', '打碟', '收藏', '搜索', '帮助']
self.offset = 0
self.index = 0
self.presentsongs = []
self.player = Player()
self.ui = Ui()
self.netease = NetEase()
self.screen = curses.initscr()
self.screen.keypad(1)
self.step = 10
self.stack = []
self.djstack = []
self.userid = None
self.username = None
self.resume_play = True
signal.signal(signal.SIGWINCH, self.change_term)
signal.signal(signal.SIGINT, self.send_kill)
try:
sfile = file(Constant.conf_dir + "/flavor.json", 'r')
data = json.loads(sfile.read())
self.collection = data['collection']
self.account = data['account']
self.presentsongs = data['presentsongs']
sfile.close()
except:
self.collection = []
self.account = {}
self.presentsongs = []
self.resume_play = False
开发者ID:GarfieldLinux,项目名称:musicbox,代码行数:35,代码来源:menu.py
示例6: __init__
def __init__(self):
reload(sys)
sys.setdefaultencoding("UTF-8")
self.datatype = "main"
self.title = "网易云音乐"
self.datalist = ["排行榜", "艺术家", "新碟上架", "精选歌单", "我的歌单", "DJ节目", "打碟", "收藏", "搜索", "帮助"]
self.offset = 0
self.index = 0
self.storage = Storage()
self.storage.load()
self.collection = self.storage.database["collections"][0]
self.player = Player()
self.ui = Ui()
self.netease = NetEase()
self.screen = curses.initscr()
self.screen.keypad(1)
self.step = 10
self.stack = []
self.djstack = []
self.userid = None
self.username = None
self.resume_play = True
signal.signal(signal.SIGWINCH, self.change_term)
signal.signal(signal.SIGINT, self.send_kill)
self.START = time.time()
开发者ID:garfieldjty,项目名称:musicbox,代码行数:25,代码来源:menu.py
示例7: __init__
def __init__(self):
reload(sys)
sys.setdefaultencoding('UTF-8')
self.datatype = 'main'
self.title = '网易云音乐'
self.datalist = ['排行榜', '艺术家', '新碟上架', '精选歌单', '我的歌单', 'DJ节目', '打碟', '收藏', '搜索', '帮助']
self.offset = 0
self.index = 0
self.presentsongs = []
self.player = Player()
self.ui = Ui()
self.netease = NetEase()
self.screen = curses.initscr()
self.screen.keypad(1)
self.step = STEP
self.stack = []
self.djstack = []
self.userid = None
self.username = None
try:
sfile = file(home + "/netease-musicbox/flavor.json",'r')
data = json.loads(sfile.read())
self.collection = data['collection']
self.account = data['account']
sfile.close()
except:
self.collection = []
self.account = {}
开发者ID:josephok,项目名称:NetEase-MusicBox,代码行数:28,代码来源:menu.py
示例8: __init__
def __init__(self):
self.ui = Ui()
self.datatype = 'songs'
self.popen_handler = None
# flag stop, prevent thread start
self.playing_flag = False
self.pause_flag = False
self.songs = []
self.idx = 0
开发者ID:blindFS,项目名称:NetEase-MusicBox,代码行数:9,代码来源:player.py
示例9: Menu
class Menu():
def __init__(self):
reload(sys)
sys.setdefaultencoding('utf8')
self.const = util.Constant()
self.datalist = ['搜索歌曲', '搜索艺术家']
self.datatype = 'main'
self.lib = Library()
self.offset = 0
self.page = 0
self.player = vlc.VLC()
self.START = time.time()
self.step = 10
self.title = 'KANraoke'
self.screen = curses.initscr()
self.ui = Ui()
signal.signal(signal.SIGWINCH, self.change_term)
signal.signal(signal.SIGINT, self.send_kill)
def change_term(self, signum, frame):
self.screen.clear()
self.screen.refresh()
def send_kill(self, signum, fram):
curses.endwin()
sys.exit()
def start(self):
self.ui.display_list(self.datatype, self.title, self.datalist, self.offset, self.page, self.step, self.START)
while True:
self.screen.timeout(500)
key = self.screen.getch()
# key = self.screen.getkey()
# if key != -1:
# print key
self.screen.refresh()
# break
# if key == -1:
# self.ui.update_size()
self.ui.display_list(self.datatype, self.title, self.datalist, self.offset, self.page, self.step, self.START)
pass
开发者ID:herooutman,项目名称:Kanraoke,代码行数:42,代码来源:menu_curses.py
示例10: InkTex
class InkTex(inkex.Effect):
"""
Our main class, derived from inkex.Effect. It wraps the other classes and
implements the effect() function.
"""
def __init__(self):
inkex.Effect.__init__(self)
# the original (i.e., selected) svg element and the newly created one
# including the original LaTeX source.
self.orig = None
self.orig_src = None
self.new = None
self.new_src = None
def effect(self):
"""If there is an original element, store it. Open the GUI."""
self.orig, self.orig_src = self.get_original()
self.ui = Ui(self.render, self.orig_src, self.get_settings())
self.ui.main()
def render(self, tex, settings):
"""Execute the rendering and, upon errors, send them to the UI"""
self.new_src = tex
self.store_settings(settings)
with Converter(self) as renderer:
try:
self.new = renderer.render(self.new_src, settings)
self.copy_styles()
self.store_src_information()
self.append_or_replace()
return True
except Exception, e:
self.ui.log(e.message)
开发者ID:janoliver,项目名称:inktex,代码行数:40,代码来源:inktex_cls.py
示例11: __init__
def __init__(self):
self.ui = Ui()
self.popen_handler = None
# flag stop, prevent thread start
self.playing_flag = False
self.pause_flag = False
self.process_length = 0
self.process_location = 0
self.process_first = False
self.storage = Storage()
self.info = self.storage.database["player_info"]
self.songs = self.storage.database["songs"]
self.playing_id = -1
开发者ID:garfieldjty,项目名称:musicbox,代码行数:13,代码来源:player.py
示例12: __init__
def __init__(self):
self.ui = Ui()
self.datatype = 'songs'
self.popen_handler = None
# flag stop, prevent thread start
self.playing_flag = False
self.pause_flag = False
self.songs = []
self.idx = 0
self.next_music_p=False #播放下一曲标志
self.stop_sub=False #结束自动播放下一曲,手动选择播放``
self.mplayer_controller=os.path.join(tempfile.mkdtemp(),'mplayer_controller')
os.mkfifo(self.mplayer_controller) #临时文件``
开发者ID:dream1986,项目名称:musicbox-1,代码行数:13,代码来源:player.py
示例13: main
def main():
ui = Ui()
details = ui.get_details()
status = admin.register(details,ui)
if status == True:
ui.display( "registration successed")
else:
ui.display("registration failed")
开发者ID:sundarrajans,项目名称:Alien-registration,代码行数:8,代码来源:main.py
示例14: __init__
def __init__(self):
self.ui = Ui()
self.datatype = 'songs'
self.popen_handler = None
# flag stop, prevent thread start
self.playing_flag = False
self.pause_flag = False
self.songs = []
self.idx = 0
self.volume = 60
self.process_length = 0
self.process_location = 0
self.process_first = False
self.playing_mode = 0
开发者ID:hushulin,项目名称:musicbox,代码行数:14,代码来源:player.py
示例15: __init__
def __init__(self):
self.config = Config()
self.ui = Ui()
self.popen_handler = None
# flag stop, prevent thread start
self.playing_flag = False
self.pause_flag = False
self.process_length = 0
self.process_location = 0
self.process_first = False
self.storage = Storage()
self.info = self.storage.database["player_info"]
self.songs = self.storage.database["songs"]
self.playing_id = -1
self.cache = Cache()
self.mpg123_parameters = self.config.get_item("mpg123_parameters")
开发者ID:sunyton,项目名称:musicbox,代码行数:16,代码来源:player.py
示例16: __init__
def __init__(self):
reload(sys)
sys.setdefaultencoding('utf8')
self.const = util.Constant()
self.datalist = ['搜索歌曲', '搜索艺术家']
self.datatype = 'main'
self.lib = Library()
self.offset = 0
self.page = 0
self.player = vlc.VLC()
self.START = time.time()
self.step = 10
self.title = 'KANraoke'
self.screen = curses.initscr()
self.ui = Ui()
signal.signal(signal.SIGWINCH, self.change_term)
signal.signal(signal.SIGINT, self.send_kill)
开发者ID:herooutman,项目名称:Kanraoke,代码行数:17,代码来源:menu_curses.py
示例17: __init__
def __init__(self):
reload(sys)
sys.setdefaultencoding('UTF-8')
self.datatype = 'main'
self.title = '网易云音乐'
self.datalist = ['排行榜', '艺术家', '新碟上架', '精选歌单', '我的歌单', 'DJ节目', '打碟', '收藏', '搜索', '帮助']
self.offset = 0
self.index = 0
self.presentsongs = []
self.player = Player()
self.ui = Ui()
self.netease = NetEase()
self.screen = curses.initscr()
self.screen.keypad(1)
self.step = 10
self.stack = []
self.djstack = []
self.userid = None
self.username = None
self.play_show_flag=False #定时器用,跳到播放歌曲
self.interrupt_handler=None
self.delay=10
self.play_p=False #歌曲播放标记
self.kill_p=0 #kill线程标记
self.run_p=False #定时运行标记
self.index_c=False #定时完成标志
self.key=[None,None] #存储按键值及按键时的时间
self.next=False #下一曲切换标记
self.play_time_str='0'
self.play_time_str_p=True #获取播放时间进程标记
self.play_length_str='0' #歌曲总长度
self.idx_idx=-1 #get_play_*函数用,保存上一个歌曲序列
self.mplayer_start_finished=False #mplayer获取歌曲完成标志
self.bar_p=False
try:
sfile = file(Constant.conf_dir + "/flavor.json",'r')
data = json.loads(sfile.read())
self.collection = data['collection']
self.account = data['account']
sfile.close()
except:
self.collection = []
self.account = {}
开发者ID:dream1986,项目名称:musicbox-1,代码行数:44,代码来源:menu.py
示例18: main
def main():
open_canvas()
global mainback
mainback = Mainback()
global start
start = False
while(start == False):
handle_events()
clear_canvas()
mainback.draw()
update_canvas()
delay(0.08)
#클래스 선언
global hero
hero = Hero()
rabbit = Rabbit()
rabbit_group = [Rabbit() for i in range(600)]
land = Land()
wood = Wood()
global torch
torch = Torch()
global fire
fire = Fire()
eskimo = Eskimo()
attack_fire = Attack_fire()
attack_fire_group = [Attack_fire() for i in range(100)]
background = BackGround()
global ui
ui = Ui()
firewood = Firewood()
firewood_group = [Firewood() for i in range(600)]
#변수 선언
rabbit_group_counter = 0
rabbit_group_collision_counter = 0
attack_group_counter = 0
attack_group_update_counter = 0
attack_group_collision_counter = 0
rabbit_alive_counter = 0
attack_group_alive_check = False
attack_group_alive_counter = 0
attack_group_limit = 20
rabbit_group_draw_counter = 0
firewood_num_counter = 0
firewood_num_update_counter = 0
firewood_collide_counter = 0
rabbit_group_counter2 = 0
rabbit_jump = False
rabbit_num = 10
firewood_num = 10
rack_block = 0
eskimo_counter = 0
global running
running = True
while running:
#핸들 이벤트
handle_events()
#업데이트
hero.update()
background.update()
land.update()
wood.update()
fire.update()
torch.update()
eskimo.update()
ui.update(hero.x, hero.y, hero.ability)
for rabbit in rabbit_group: # 토끼 업데이트
if(rabbit_group_counter == rabbit_num):
rabbit_group_counter = 0
break
if(rabbit.alive):
rabbit.update()
rabbit_group_counter += 1
# for rabbit in rabbit_group: # 토끼 업데이트
# if(rabbit_group_counter2 == 1):
# print("%d" % rabbit.x)
# break
# rabbit_group_counter2 += 1
for attack_fire in attack_fire_group: # 공격불 업데이트
if(attack_group_update_counter == hero.attack_num):
attack_fire.init_direction()
attack_fire.alive = True # 공격불이 활성화 됨
attack_fire.init_fire()
attack_group_update_counter = 0
break
if(attack_fire.alive):
attack_fire.update()
attack_group_update_counter += 1
#.........这里部分代码省略.........
开发者ID:SpaceKingJo,项目名称:project,代码行数:101,代码来源:main.py
示例19: __init__
class Player:
def __init__(self):
self.ui = Ui()
self.datatype = 'songs'
self.popen_handler = None
# flag stop, prevent thread start
self.playing_flag = False
self.pause_flag = False
self.songs = []
self.idx = 0
def popen_recall(self, onExit, popenArgs):
"""
Runs the given args in a subprocess.Popen, and then calls the function
onExit when the subprocess completes.
onExit is a callable object, and popenArgs is a lists/tuple of args that
would give to subprocess.Popen.
"""
def runInThread(onExit, popenArgs):
self.popen_handler = subprocess.Popen(['mpg123', popenArgs], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
self.popen_handler.wait()
if self.playing_flag:
self.idx = carousel(0, len(self.songs)-1, self.idx+1 )
onExit()
return
thread = threading.Thread(target=runInThread, args=(onExit, popenArgs))
thread.start()
# returns immediately after the thread starts
return thread
def recall(self):
self.playing_flag = True
item = self.songs[ self.idx ]
self.ui.build_playinfo(item['song_name'], item['artist'], item['album_name'])
self.popen_recall(self.recall, item['mp3_url'])
def play(self, datatype, songs, idx):
# if same playlists && idx --> same song :: pause/resume it
self.datatype = datatype
if datatype == 'songs' or datatype == 'djchannels':
if idx == self.idx and songs == self.songs:
if self.pause_flag:
self.resume()
else:
self.pause()
else:
if datatype == 'songs' or datatype == 'djchannels':
self.songs = songs
self.idx = idx
# if it's playing
if self.playing_flag:
self.switch()
# start new play
else:
self.recall()
# if current menu is not song, pause/resume
else:
if self.playing_flag:
if self.pause_flag:
self.resume()
else:
self.pause()
else:
pass
# play another
def switch(self):
self.stop()
# wait process be killed
time.sleep(0.01)
self.recall()
def stop(self):
if self.playing_flag and self.popen_handler:
self.playing_flag = False
self.popen_handler.kill()
def pause(self):
self.pause_flag = True
os.kill(self.popen_handler.pid, signal.SIGSTOP)
item = self.songs[ self.idx ]
self.ui.build_playinfo(item['song_name'], item['artist'], item['album_name'], pause=True)
def resume(self):
self.pause_flag = False
os.kill(self.popen_handler.pid, signal.SIGCONT)
item = self.songs[ self.idx ]
self.ui.build_playinfo(item['song_name'], item['artist'], item['album_name'])
def next(self):
self.stop()
time.sleep(0.01)
self.idx = carousel(0, len(self.songs)-1, self.idx+1 )
self.recall()
#.........这里部分代码省略.........
开发者ID:Alexis374,项目名称:NetEase-MusicBox,代码行数:101,代码来源:player.py
示例20: __init__
class Menu:
def __init__(self):
reload(sys)
sys.setdefaultencoding('UTF-8')
self.datatype = 'main'
self.title = '网易云音乐'
self.datalist = ['排行榜', '艺术家', '新碟上架', '精选歌单', '我的歌单', 'DJ节目', '打碟', '收藏', '搜索', '帮助']
self.offset = 0
self.index = 0
self.storage = Storage()
self.storage.load()
self.collection = self.storage.database['collections'][0]
self.player = Player()
self.cache = Cache()
self.ui = Ui()
self.netease = NetEase()
self.screen = curses.initscr()
self.screen.keypad(1)
self.step = 10
self.stack = []
self.djstack = []
self.userid = None
self.username = None
self.resume_play = True
signal.signal(signal.SIGWINCH, self.change_term)
signal.signal(signal.SIGINT, self.send_kill)
self.START = time.time()
def change_term(self, signum, frame):
self.ui.screen.clear()
self.ui.screen.refresh()
def send_kill(self, signum, fram):
self.player.stop()
self.cache.quit()
self.storage.save()
curses.endwin()
sys.exit()
def start(self):
self.START = time.time() // 1
self.ui.build_menu(self.datatype, self.title, self.datalist, self.offset, self.index, self.step, self.START)
self.ui.build_process_bar(self.player.process_location, self.player.process_length, self.player.playing_flag,
self.player.pause_flag, self.storage.database['player_info']['playing_mode'])
self.stack.append([self.datatype, self.title, self.datalist, self.offset, self.index])
while True:
datatype = self.datatype
title = self.title
datalist = self.datalist
offset = self.offset
idx = index = self.index
step = self.step
stack = self.stack
djstack = self.djstack
self.screen.timeout(500)
key = self.screen.getch()
self.ui.screen.refresh()
# term resize
if key == -1:
self.ui.update_size()
self.player.update_size()
# 退出
if key == ord('q'):
break
# 退出并清除用户信息
if key == ord('w'):
self.storage.database['user'] = {
"username": "",
"password": "",
}
break
# 上移
elif key == ord('k'):
self.index = carousel(offset, min(len(datalist), offset + step) - 1, idx - 1)
self.START = time.time()
# 下移
elif key == ord('j'):
self.index = carousel(offset, min(len(datalist), offset + step) - 1, idx + 1)
self.START = time.time()
# 数字快捷键
elif ord('0') <= key <= ord('9'):
if self.datatype == 'songs' or self.datatype == 'djchannels' or self.datatype == 'help':
continue
idx = key - ord('0')
self.ui.build_menu(self.datatype, self.title, self.datalist, self.offset, idx, self.step, self.START)
self.ui.build_loading()
self.dispatch_enter(idx)
self.index = 0
self.offset = 0
# 向上翻页
elif key == ord('u'):
if offset == 0:
continue
#.........这里部分代码省略.........
开发者ID:pastorgod,项目名称:musicbox,代码行数:101,代码来源:menu.py
注:本文中的ui.Ui类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论