Add terminal option
Adds ability to be used exclusively in the terminal by adding an integer as the first command line argument (e.g., "dicekey 7").
This commit is contained in:
parent
abeffc5fc2
commit
8a9e17ad0d
@ -25,7 +25,7 @@ from dicekey import diceware
|
|||||||
|
|
||||||
class App:
|
class App:
|
||||||
|
|
||||||
def __init__(self, master):
|
def __init__(self, master, passgen):
|
||||||
|
|
||||||
frame = tk.Frame(master, padx=50, pady=50)
|
frame = tk.Frame(master, padx=50, pady=50)
|
||||||
frame.pack()
|
frame.pack()
|
||||||
@ -34,20 +34,33 @@ class App:
|
|||||||
msg = tk.Label(frame, pady=15, font=("Arial", 16), text=msgtxt)
|
msg = tk.Label(frame, pady=15, font=("Arial", 16), text=msgtxt)
|
||||||
msg.pack()
|
msg.pack()
|
||||||
|
|
||||||
pwgen = diceware.Gen()
|
passwd = ' '.join(passgen.wordgen(7))
|
||||||
if pwgen.loadlist("dicekey/wordlist.asc"):
|
text = tk.Label(frame, font=("FreeMono", 16), text=passwd)
|
||||||
passwd = ' '.join(pwgen.wordgen(7))
|
text.pack()
|
||||||
text = tk.Label(frame, font=("FreeMono", 16), text=passwd)
|
|
||||||
text.pack()
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
root = tk.Tk()
|
pwgen = diceware.Gen()
|
||||||
root.wm_title("Dicekey - Passphrase Generator")
|
wordlist = pwgen.loadlist("dicekey/wordlist.asc")
|
||||||
app = App(root)
|
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
if wordlist:
|
||||||
|
if sys.argv[1].isdigit():
|
||||||
|
print ' '.join(pwgen.wordgen(int(sys.argv[1])))
|
||||||
|
else:
|
||||||
|
error = "Error: Argument '%s' is not an integer."
|
||||||
|
print error % (sys.argv[1])
|
||||||
|
else:
|
||||||
|
print "Error: Incomplete or missing word list."
|
||||||
|
|
||||||
|
else:
|
||||||
|
root = tk.Tk()
|
||||||
|
root.wm_title("Dicekey - Passphrase Generator")
|
||||||
|
app = App(root, pwgen)
|
||||||
|
|
||||||
|
root.mainloop()
|
||||||
|
|
||||||
root.mainloop()
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
2
setup.py
2
setup.py
@ -17,7 +17,7 @@
|
|||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
|
|
||||||
NAME = "Dicekey"
|
NAME = "Dicekey"
|
||||||
VERSION = "3.0.0-prealpha"
|
VERSION = "3.1.0-prealpha"
|
||||||
AUTHOR = "Kris Lamoureux"
|
AUTHOR = "Kris Lamoureux"
|
||||||
AUTHOR_EMAIL = "KrisPublicEmail@gmail.com"
|
AUTHOR_EMAIL = "KrisPublicEmail@gmail.com"
|
||||||
URL = "https://github.com/Kris619/Dicekey/"
|
URL = "https://github.com/Kris619/Dicekey/"
|
||||||
|
Loading…
Reference in New Issue
Block a user