Skip to content

Instantly share code, notes, and snippets.

@sublimator
Created September 7, 2011 13:39
Show Gist options
  • Save sublimator/1200584 to your computer and use it in GitHub Desktop.
Save sublimator/1200584 to your computer and use it in GitHub Desktop.
QP workaround
#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('.')
print
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