Created
September 7, 2011 13:39
-
-
Save sublimator/1200584 to your computer and use it in GitHub Desktop.
QP workaround
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf8 | |
#################################### IMPORTS ################################### | |
# Std Libs | |
import threading | |
import time | |
import sys | |
# Sublime | |
import sublime | |
import sublime_plugin | |
class fuck_it_up(sublime_plugin.WindowCommand): | |
'{"command": "fuck_it_up", "keys" : ["ctrl+alt+shift+f11"]},' | |
def run(self): | |
thread = InstallPackageThread(self.window) | |
thread.start() | |
sublime_deactive = False | |
kill_time = lambda: time.sleep(0.03) | |
class IsSublimeActive(sublime_plugin.EventListener): | |
def on_activated(self, view): | |
global sublime_deactive | |
sublime_deactive = False | |
def on_deactivated(self, view): | |
global sublime_deactive | |
sublime_deactive = True | |
class InstallPackageThread(threading.Thread): | |
def __init__(self, window): | |
self.window = window | |
threading.Thread.__init__(self) | |
def run(self): | |
for i in xrange(100): | |
kill_time() | |
sys.stdout.write('.') | |
def show_quick_panel(): | |
sublime.active_window().show_quick_panel([['foo'], ['bar']], self.on_done) | |
while sublime_deactive: | |
kill_time() | |
sys.stdout.write('.') | |
sublime.set_timeout(show_quick_panel, 0) | |
def on_done(self, num): | |
print num | |
################################################################################ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment