Created
December 17, 2012 18:38
-
-
Save matovitch/4320735 to your computer and use it in GitHub Desktop.
Allow to get password in sublime text input panel. (ugly hack)
First gist...first python day...How I lived before ?
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
import sublime, sublime_plugin | |
import subprocess | |
pwd = "" | |
class MePasswordCommand(sublime_plugin.WindowCommand): | |
def run(self): | |
self.window.show_input_panel("password", "", self.on_input, self.getpwd, None) | |
def getpwd(self, password): | |
global pwd | |
chg = password.replace("*", "") | |
if len(password) < len(pwd): | |
pwd = pwd[:len(password)] | |
else: | |
pwd = pwd + chg | |
stars = "*" * len(password) | |
self.window.show_input_panel("Project name", stars, self.on_input, self.getpwd, None) | |
def on_input(self, password): | |
global pwd | |
if pwd.strip() == "": | |
self.panel("No password provided") | |
return | |
#Do Something with pwd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment