def handle_thread(thread, msg=None, counter=0, direction=1, width=8):
if thread.is_alive():
next = counter + direction
if next > width:
direction = -1
elif next < 0:
direction = 1
bar = [' '] * (width + 1)
bar[counter] = '='
counter += direction
status('%s [%s]' % (msg, ''.join(bar)))
sublime.set_timeout(lambda: handle_thread(thread, msg, counter,
direction, width), 100)
else:
status(' ok ')
# # Code lifted from https://github.com/randy3k/ProjectManager/blob/master/pm.py
# def subl(args=[]):
# # learnt from SideBarEnhancements
# executable_path = sublime.executable_path()
# print('executable_path: '+ executable_path)
# if sublime.platform() == 'linux':
# subprocess.Popen([executable_path] + [args])
# if sublime.platform() == 'osx':
# app_path = executable_path[:executable_path.rfind(".app/") + 5]
# executable_path = app_path + "Contents/SharedSupport/bin/subl"
# subprocess.Popen([executable_path] + args)
# if sublime.platform() == "windows":
# def fix_focus():
# window = sublime.active_window()
# view = window.active_view()
# window.run_command('focus_neighboring_group')
# window.focus_view(view)
# sublime.set_timeout(fix_focus, 300)
##########################################################################################
#Python Util
##########################################################################################
评论列表
文章目录