util.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:SalesforceXyTools 作者: exiahuang 项目源码 文件源码
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
##########################################################################################
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号