mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2025-05-18 07:06:44 +00:00
In the Folder Locker & Hider script:
1-An eye button was added to the password fields to show the password 2-The file name bug with spaces was fixed
This commit is contained in:
parent
163c7946b8
commit
2fc2e692ff
@ -87,9 +87,20 @@ class Application(tk.Frame):
|
|||||||
self.elabel['text'] = 'Enter Password'
|
self.elabel['text'] = 'Enter Password'
|
||||||
self.elabel.grid(row=1, column=0, pady=20)
|
self.elabel.grid(row=1, column=0, pady=20)
|
||||||
|
|
||||||
self.entry = tk.Entry(self.body)
|
self.entry = tk.Entry(self.body, show="*")
|
||||||
self.entry['textvariable'] = self.password
|
self.entry['textvariable'] = self.password
|
||||||
self.entry.grid(row=1, column=1, columnspan=2, pady=20)
|
self.entry.grid(row=1, column=1, columnspan=1, pady=20)
|
||||||
|
|
||||||
|
def toggle_password_visibility():
|
||||||
|
if self.entry['show'] == "":
|
||||||
|
self.entry['show'] = "*"
|
||||||
|
self.eye_button['text'] = "👁"
|
||||||
|
else:
|
||||||
|
self.entry['show'] = ""
|
||||||
|
self.eye_button['text'] = "👁"
|
||||||
|
|
||||||
|
self.eye_button = tk.Button(self.body, text="👁", width=2, command=toggle_password_visibility)
|
||||||
|
self.eye_button.place(x=315, y=86)
|
||||||
|
|
||||||
self.lock =tk.Button(self.body, bg='green', width=20)
|
self.lock =tk.Button(self.body, bg='green', width=20)
|
||||||
self.lock['text'] = f'Lock Folder'
|
self.lock['text'] = f'Lock Folder'
|
||||||
@ -128,9 +139,20 @@ class Application(tk.Frame):
|
|||||||
self.elabel['text'] = 'Enter Password'
|
self.elabel['text'] = 'Enter Password'
|
||||||
self.elabel.grid(row=1, column=0, columnspan=2, pady=(1,1))
|
self.elabel.grid(row=1, column=0, columnspan=2, pady=(1,1))
|
||||||
|
|
||||||
self.entry = tk.Entry(self.body)
|
self.entry = tk.Entry(self.body, show="*")
|
||||||
self.entry['textvariable'] = self.password
|
self.entry['textvariable'] = self.password
|
||||||
self.entry.grid(row=2, column=0, columnspan=2)
|
self.entry.place(x=53, y=96)
|
||||||
|
|
||||||
|
def toggle_password_visibility():
|
||||||
|
if self.entry['show'] == "":
|
||||||
|
self.entry['show'] = "*"
|
||||||
|
self.eye_button['text'] = "👁"
|
||||||
|
else:
|
||||||
|
self.entry['show'] = ""
|
||||||
|
self.eye_button['text'] = "👁"
|
||||||
|
|
||||||
|
self.eye_button = tk.Button(self.body, text="👁", width=2, command=toggle_password_visibility)
|
||||||
|
self.eye_button.place(x=180, y=92.5)
|
||||||
|
|
||||||
self.unlock =tk.Button(self.body, bg='green', width=20)
|
self.unlock =tk.Button(self.body, bg='green', width=20)
|
||||||
self.unlock['text'] = f'Unlock Folder'
|
self.unlock['text'] = f'Unlock Folder'
|
||||||
@ -210,8 +232,10 @@ class Application(tk.Frame):
|
|||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
root = tk.Tk()
|
root = tk.Tk()
|
||||||
root.geometry('400x305')
|
|
||||||
root.title('Folder Locker/Unlocker')
|
root.title('Folder Locker/Unlocker')
|
||||||
|
x = (root.winfo_screenwidth() - 400) // 2
|
||||||
|
y = (root.winfo_screenheight() - 300) // 2
|
||||||
|
root.geometry(f"{400}x{300}+{x}+{y}")
|
||||||
root.resizable(0,0)
|
root.resizable(0,0)
|
||||||
|
|
||||||
lock_icon = PhotoImage(file='icons/lock.png').subsample(2,2)
|
lock_icon = PhotoImage(file='icons/lock.png').subsample(2,2)
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import os
|
|
||||||
import json
|
import json
|
||||||
import shelve
|
import os
|
||||||
import random
|
import random
|
||||||
|
import shelve
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
def read_json():
|
def read_json():
|
||||||
json_file = 'files/locked_folders.json'
|
json_file = 'files/locked_folders.json'
|
||||||
if os.path.exists(json_file):
|
if os.path.exists(json_file):
|
||||||
@ -35,7 +36,7 @@ def lock(fpath, password):
|
|||||||
|
|
||||||
fname = os.path.basename(fpath)
|
fname = os.path.basename(fpath)
|
||||||
cwd = '/'.join(fpath.split('/')[:-1]) + '/'
|
cwd = '/'.join(fpath.split('/')[:-1]) + '/'
|
||||||
command1 = 'ren ' + fname + ' "Control Panel.{21EC2020-3AEA-1069-A2DD-' + key + '}"'
|
command1 = 'ren "' + fname + '" "Control Panel.{21EC2020-3AEA-1069-A2DD-' + key + '}"'
|
||||||
command2 = 'attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-' + key + '}"'
|
command2 = 'attrib +h +s "Control Panel.{21EC2020-3AEA-1069-A2DD-' + key + '}"'
|
||||||
|
|
||||||
dct = read_json()
|
dct = read_json()
|
||||||
@ -61,7 +62,7 @@ def unlock(fpath, password, key):
|
|||||||
fname = os.path.basename(fpath)
|
fname = os.path.basename(fpath)
|
||||||
cwd = '/'.join(fpath.split('/')[:-1]) + '/'
|
cwd = '/'.join(fpath.split('/')[:-1]) + '/'
|
||||||
command1 = 'attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-' + key + '}"'
|
command1 = 'attrib -h -s "Control Panel.{21EC2020-3AEA-1069-A2DD-' + key + '}"'
|
||||||
command2 = 'ren "Control Panel.{21EC2020-3AEA-1069-A2DD-' + key + '}" ' + fname
|
command2 = 'ren "Control Panel.{21EC2020-3AEA-1069-A2DD-' + key + '}" "' + fname + '"'
|
||||||
|
|
||||||
with shelve.open('files/pwd') as pwd_manager:
|
with shelve.open('files/pwd') as pwd_manager:
|
||||||
pass_ = pwd_manager[fname]
|
pass_ = pwd_manager[fname]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user