Update v1.12.py
This commit is contained in:
parent
f0ed580b2f
commit
f57e8b8b5b
|
@ -120,7 +120,7 @@ def MakeTkDPIAware(TKGUI):
|
||||||
TKGUI.TkScale = lambda v:int(float(v)*TKGUI.DPI_scaling)
|
TKGUI.TkScale = lambda v:int(float(v)*TKGUI.DPI_scaling)
|
||||||
TKGUI.TkGeometryScale = lambda s:TkGeometryScale(s,TKGUI.TkScale)
|
TKGUI.TkGeometryScale = lambda s:TkGeometryScale(s,TKGUI.TkScale)
|
||||||
if platform.system()=="Windows":
|
if platform.system()=="Windows":
|
||||||
MakeTkDPIAware(tk)
|
pass#MakeTkDPIAware(tk)
|
||||||
|
|
||||||
# Add some styling
|
# Add some styling
|
||||||
style = tkinter.ttk.Style()
|
style = tkinter.ttk.Style()
|
||||||
|
@ -146,10 +146,14 @@ inputLabel = tkinter.ttk.Label(
|
||||||
inputLabel.place(x=20,y=18)
|
inputLabel.place(x=20,y=18)
|
||||||
|
|
||||||
# Clear input file(s)
|
# Clear input file(s)
|
||||||
|
def clearInputs():
|
||||||
|
resetUI()
|
||||||
|
prompt.pack(expand=1,fill=tkinter.BOTH)
|
||||||
|
onDropLeave(None)
|
||||||
clearInput = tkinter.ttk.Button(
|
clearInput = tkinter.ttk.Button(
|
||||||
tk,
|
tk,
|
||||||
text="Clear",
|
text="Clear",
|
||||||
command = lambda:resetUI()
|
command=clearInputs
|
||||||
)
|
)
|
||||||
clearInput.place(x=400,y=12,width=60,height=28)
|
clearInput.place(x=400,y=12,width=60,height=28)
|
||||||
clearInput["state"] = "disabled"
|
clearInput["state"] = "disabled"
|
||||||
|
@ -238,7 +242,7 @@ cPasswordLabel["state"] = "disabled"
|
||||||
# Allow confirm password input to fill width
|
# Allow confirm password input to fill width
|
||||||
cPasswordFrame = tkinter.Frame(
|
cPasswordFrame = tkinter.Frame(
|
||||||
tk,
|
tk,
|
||||||
width=440,
|
width=418,
|
||||||
height=24
|
height=24
|
||||||
)
|
)
|
||||||
cPasswordFrame.place(x=20,y=168)
|
cPasswordFrame.place(x=20,y=168)
|
||||||
|
@ -253,6 +257,41 @@ cPasswordInput = tkinter.ttk.Entry(
|
||||||
cPasswordInput.grid(sticky="nesw")
|
cPasswordInput.grid(sticky="nesw")
|
||||||
cPasswordInput["state"] = "disabled"
|
cPasswordInput["state"] = "disabled"
|
||||||
|
|
||||||
|
# Check if passwords match
|
||||||
|
def doPasswordsMatch(key,which):
|
||||||
|
|
||||||
|
if which=="p":
|
||||||
|
matches = passwordInput.get()+key.char==cPasswordInput.get()
|
||||||
|
else:
|
||||||
|
matches = passwordInput.get()==cPasswordInput.get()+key.char
|
||||||
|
if passwordInput.get() and matches:
|
||||||
|
#passwordMatches["state"] = "normal"
|
||||||
|
passwordMatches.matchInt.set(1)
|
||||||
|
#passwordMatches["state"] = "disabled"
|
||||||
|
startBtn["state"] = "normal"
|
||||||
|
else:
|
||||||
|
#passwordMatches["state"] = "normal"
|
||||||
|
passwordMatches.matchInt.set(0)
|
||||||
|
#passwordMatches["state"] = "disabled"
|
||||||
|
startBtn["state"] = "disabled"
|
||||||
|
|
||||||
|
passwordInput.bind("<Key>",lambda key:doPasswordsMatch(key,"p"))
|
||||||
|
cPasswordInput.bind("<Key>",lambda key:doPasswordsMatch(key,"c"))
|
||||||
|
|
||||||
|
# Check box that indicates if password match
|
||||||
|
passwordMatches = tkinter.ttk.Checkbutton(
|
||||||
|
tk,
|
||||||
|
onvalue=1,
|
||||||
|
offvalue=0,
|
||||||
|
command=lambda:[
|
||||||
|
dummy.focus(),passwordMatches.matchInt.set(0 if passwordMatches.matchInt.get() else 1)
|
||||||
|
]
|
||||||
|
)
|
||||||
|
passwordMatches.matchInt = tkinter.IntVar(tk)
|
||||||
|
passwordMatches.config(variable=passwordMatches.matchInt)
|
||||||
|
passwordMatches.place(x=441,y=170)
|
||||||
|
#passwordMatches["state"] = "disabled"
|
||||||
|
|
||||||
# Prompt user for optional metadata
|
# Prompt user for optional metadata
|
||||||
metadataString = tkinter.StringVar(tk)
|
metadataString = tkinter.StringVar(tk)
|
||||||
metadataString.set(strings[0])
|
metadataString.set(strings[0])
|
||||||
|
@ -279,11 +318,10 @@ metadataFrame.config(bg="#e5eaf0")
|
||||||
metadataInput = tkinter.scrolledtext.ScrolledText(
|
metadataInput = tkinter.scrolledtext.ScrolledText(
|
||||||
metadataFrame,
|
metadataFrame,
|
||||||
exportselection=0,
|
exportselection=0,
|
||||||
height=5,
|
|
||||||
padx=5,
|
padx=5,
|
||||||
pady=5
|
pady=5
|
||||||
)
|
)
|
||||||
metadataInput.config(font=("Consolas",12))
|
metadataInput.config(font=("Consolas",10))
|
||||||
metadataInput.grid(row=0,column=0,sticky="nesw",padx=1,pady=1)
|
metadataInput.grid(row=0,column=0,sticky="nesw",padx=1,pady=1)
|
||||||
metadataInput.config(borderwidth=0)
|
metadataInput.config(borderwidth=0)
|
||||||
metadataInput.config(bg="#fbfcfc")
|
metadataInput.config(bg="#fbfcfc")
|
||||||
|
@ -300,7 +338,7 @@ metadataInput.bind(
|
||||||
def metadataBoxUI(what):
|
def metadataBoxUI(what):
|
||||||
if what=="in":
|
if what=="in":
|
||||||
if metadataInput.cget("bg")=="#ffffff":
|
if metadataInput.cget("bg")=="#ffffff":
|
||||||
metadataFrame.config(bg="#78a7e5")
|
metadataFrame.config(bg="#5294e2")
|
||||||
else:
|
else:
|
||||||
metadataFrame.config(bg="#d8ddea")
|
metadataFrame.config(bg="#d8ddea")
|
||||||
|
|
||||||
|
@ -414,6 +452,31 @@ version = tkinter.ttk.Label(
|
||||||
version["state"] = "disabled"
|
version["state"] = "disabled"
|
||||||
version.place(x=430,y=480)
|
version.place(x=430,y=480)
|
||||||
|
|
||||||
|
# Drag files window
|
||||||
|
prompt = tkinter.Frame(tk)
|
||||||
|
prompt.config(bg="#f5f6f7")
|
||||||
|
prompt.pack(expand=1,fill=tkinter.BOTH)
|
||||||
|
|
||||||
|
promptString = tkinter.StringVar(tk)
|
||||||
|
promptString.set("Drag and drop file(s) and folder(s) here.")
|
||||||
|
promptLabel = tkinter.ttk.Label(
|
||||||
|
prompt,
|
||||||
|
textvariable=promptString
|
||||||
|
)
|
||||||
|
promptLabel.place(x=135,y=306)
|
||||||
|
promptIconHor = tkinter.Frame(
|
||||||
|
prompt,
|
||||||
|
bg="#6f737d",
|
||||||
|
height=4
|
||||||
|
)
|
||||||
|
promptIconHor.place(x=208,y=256,width=64)
|
||||||
|
promptIconVer = tkinter.Frame(
|
||||||
|
prompt,
|
||||||
|
bg="#6f737d",
|
||||||
|
width=4
|
||||||
|
)
|
||||||
|
promptIconVer.place(x=238,y=226,height=64)
|
||||||
|
|
||||||
# Files have been dragged
|
# Files have been dragged
|
||||||
def filesDragged(draggedFiles):
|
def filesDragged(draggedFiles):
|
||||||
global inputFile,rs128,onlyFiles,mode,onlyFolders,allFiles
|
global inputFile,rs128,onlyFiles,mode,onlyFolders,allFiles
|
||||||
|
@ -513,6 +576,7 @@ def filesDragged(draggedFiles):
|
||||||
|
|
||||||
# Update UI
|
# Update UI
|
||||||
setEncryptionUI()
|
setEncryptionUI()
|
||||||
|
startBtn["state"] = "disabled"
|
||||||
|
|
||||||
# Update output box with appropriate name
|
# Update output box with appropriate name
|
||||||
if inputFile:
|
if inputFile:
|
||||||
|
@ -543,6 +607,8 @@ def filesDragged(draggedFiles):
|
||||||
else:
|
else:
|
||||||
inputString.set(inputFile.split("/")[-1]+suffix)
|
inputString.set(inputFile.split("/")[-1]+suffix)
|
||||||
|
|
||||||
|
prompt.pack_forget()
|
||||||
|
|
||||||
# UTF-8 decode error
|
# UTF-8 decode error
|
||||||
except UnicodeDecodeError:
|
except UnicodeDecodeError:
|
||||||
statusString.set(strings[20])
|
statusString.set(strings[20])
|
||||||
|
@ -559,8 +625,16 @@ def onDrop(e):
|
||||||
filesDragged(e.data)
|
filesDragged(e.data)
|
||||||
clearInput["state"] = "normal"
|
clearInput["state"] = "normal"
|
||||||
clearInput.config(cursor="hand2")
|
clearInput.config(cursor="hand2")
|
||||||
|
def onDropEnter(e):
|
||||||
|
promptIconHor.config(bg="#00a86b")
|
||||||
|
promptIconVer.config(bg="#00a86b")
|
||||||
|
def onDropLeave(e):
|
||||||
|
promptIconHor.config(bg="#6f737d")
|
||||||
|
promptIconVer.config(bg="#6f737d")
|
||||||
tk.drop_target_register(DND_FILES)
|
tk.drop_target_register(DND_FILES)
|
||||||
tk.dnd_bind("<<Drop>>",onDrop)
|
tk.dnd_bind("<<Drop>>",onDrop)
|
||||||
|
tk.dnd_bind("<<DropEnter>>",onDropEnter)
|
||||||
|
tk.dnd_bind("<<DropLeave>>",onDropLeave)
|
||||||
|
|
||||||
def work():
|
def work():
|
||||||
global inputFile,outputFile,working,mode,rs13,rs128,reedsolo
|
global inputFile,outputFile,working,mode,rs13,rs128,reedsolo
|
||||||
|
@ -1014,7 +1088,7 @@ def setEncryptionUI():
|
||||||
cPasswordLabel["state"] = "normal"
|
cPasswordLabel["state"] = "normal"
|
||||||
cPasswordString.set("Confirm password:")
|
cPasswordString.set("Confirm password:")
|
||||||
cPasswordInput["state"] = "normal"
|
cPasswordInput["state"] = "normal"
|
||||||
metadataFrame.config(bg="#d8ddea")
|
metadataFrame.config(bg="#cfd6e6")
|
||||||
metadataInput.config(bg="#ffffff")
|
metadataInput.config(bg="#ffffff")
|
||||||
metadataInput.config(fg="#000000")
|
metadataInput.config(fg="#000000")
|
||||||
metadataLabel["state"] = "normal"
|
metadataLabel["state"] = "normal"
|
||||||
|
|
Loading…
Reference in New Issue