-
Notifications
You must be signed in to change notification settings - Fork 0
/
turpo.py
executable file
·245 lines (202 loc) · 7.76 KB
/
turpo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
'''
T.U.R.P.O (Trustworthy Utility for Reliable Password Organisation) - A simple to use, feature-rich password management software.
Copyright (C) 2023 R Uthaya Murthy
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Contact Author : uthayamurthy2006@gmail.com
'''
import ttkbootstrap as ttk
from ttkbootstrap.constants import *
from PIL import Image, ImageTk
from modules.passwdmgr import PasswdMgr
from modules.settingsmgr import SettingsMgr
# Import Other Frames
from manage import Manage
from generate import Generate
from backup import Backup
from feedback import Feedback
from settings import Settings
from about import About
class TURPO(ttk.Frame):
def __init__(self, main, PATH):
super().__init__(main, bootstyle='Light')
self.pack(fill=BOTH, expand=YES)
self.app = main
self.PATH = PATH
self.current_window = 'home'
self.setting_cats = ['PM', 'PG', 'PB', 'PT'] # Setting Categories
# Images
logo = Image.open(PATH / 'assets' / 'logo.png')
img1 = Image.open(PATH / 'assets' / 'manage.png')
img2 = Image.open(PATH / 'assets' / 'generate.png')
img3 = Image.open(PATH / 'assets' / 'backup.png')
img4 = Image.open(PATH / 'assets' / 'feedback.png')
img5 = Image.open(PATH / 'assets' / 'settings.png')
img6 = Image.open(PATH / 'assets' / 'about.png')
self.images = [
ImageTk.PhotoImage(
logo.resize((64, 64)),
name='logo',
),
ImageTk.PhotoImage(
img1,
name='manage'
),
ImageTk.PhotoImage(
img2,
name='generate'
),
ImageTk.PhotoImage(
img3,
name='backup'
),
ImageTk.PhotoImage(
img4,
name='feedback'
),
ImageTk.PhotoImage(
img5,
name='settings'
),
ImageTk.PhotoImage(
img6,
name='about'
),
]
# Configure Rows and Columns
self.columnconfigure(0, weight=1)
self.columnconfigure(1, weight=10)
self.rowconfigure(0, weight=1)
self.rowconfigure(1, weight=10)
# Header
hdr1_frame = ttk.Frame(self, padding=0, bootstyle=DARK)
hdr1_frame.grid(row=0, column=0, sticky=NSEW)
hdr2_frame = ttk.Frame(self, padding=0, bootstyle=DARK)
hdr2_frame.grid(row=0, column=1, sticky=NSEW)
hdr_label = ttk.Label(
master=hdr1_frame,
image='logo',
bootstyle=(INVERSE, DARK)
)
hdr_label.pack(side=RIGHT)
logo_text = ttk.Label(
master=hdr2_frame,
text='T.U.R.P.O',
font=('Helventica', 30),
bootstyle=(INVERSE, DARK)
)
logo_text.pack(side=LEFT, fill=BOTH, expand=True, padx=10)
# Action Buttons
action_frame = ttk.Frame(self, bootstyle=INFO)
action_frame.grid(row=1, column=0, sticky=NSEW)
manage_btn = ttk.Button(
master=action_frame,
image='manage',
text='Manage Passwords',
compound=TOP,
bootstyle=INFO,
command=self.on_manage
)
manage_btn.pack(side=TOP, fill=BOTH, ipadx=10, ipady=10)
gen_btn = ttk.Button(
master=action_frame,
image='generate',
text='Generate New Password',
compound=TOP,
bootstyle=INFO,
command=self.on_generate
)
gen_btn.pack(side=TOP, fill=BOTH, ipadx=10, ipady=10)
backup_btn = ttk.Button(
master=action_frame,
image='backup',
text='Backup Your Passwords',
compound=TOP,
bootstyle=INFO,
command=self.on_backup
)
backup_btn.pack(side=TOP, fill=BOTH, ipadx=10, ipady=10)
feedback_btn = ttk.Button(
master=action_frame,
image='feedback',
text='Feedback',
compound=TOP,
bootstyle=INFO,
command=self.on_feedback
)
feedback_btn.pack(side=TOP, fill=BOTH, ipadx=10, ipady=10)
settings_btn = ttk.Button(
master=action_frame,
image='settings',
text='Settings',
compound=TOP,
bootstyle=INFO,
command=self.on_settings
)
settings_btn.pack(side=TOP, fill=BOTH, ipadx=10, ipady=10)
about_btn = ttk.Button(
master=action_frame,
image='about',
text='About',
compound=TOP,
bootstyle=INFO,
command=self.on_about
)
about_btn.pack(side=TOP, fill=BOTH, ipadx=10, ipady=10)
# # Main Frame
self.main_frame = ttk.Frame(self, bootstyle=LIGHT)
self.main_frame.grid(row=1, column=1, sticky=NSEW)
# Home Page Development - Reserved for later versions.
# lblh = ttk.Label(self.main_frame, text='Home Page Stuff', font=('Helventica', 22, 'bold'))
# lblh.pack(fill=BOTH)
self.PM = PasswdMgr(PATH / 'data', 'pwfile')
self.PM.read()
self.SM = SettingsMgr('settings.db', PATH / 'settings', self.setting_cats)
manage_btn.invoke() # Start Manage Screen
def clear_main_frame(self): # Removes all the Widgets in main
for widget in self.main_frame.winfo_children():
widget.destroy()
def on_manage(self):
if self.current_window != 'manage':
self.clear_main_frame()
self.main_frame = Manage(self, self.app, self.PATH, self.PM, self.SM)
self.main_frame.grid(row=1, column=1, sticky=NSEW)
self.current_window = 'manage'
def on_generate(self):
if self.current_window != 'generate':
self.clear_main_frame()
self.main_frame = Generate(self, self.PATH, self.SM)
self.main_frame.grid(row=1, column=1, columnspan=3, sticky=NSEW)
self.current_window = 'generate'
def on_backup(self):
if self.current_window != 'backup':
self.clear_main_frame()
self.main_frame = Backup(self, self.PM, self.SM)
self.main_frame.grid(row=1, column=1, sticky=NSEW)
self.current_window = 'backup'
def on_about(self):
if self.current_window != 'about':
self.clear_main_frame()
self.main_frame = About(self, self.PATH)
self.main_frame.grid(row=1, column=1, sticky=NSEW)
self.current_window = 'about'
def on_feedback(self):
if self.current_window != 'feedback':
self.clear_main_frame()
self.main_frame = Feedback(self, self.PATH)
self.main_frame.grid(row=1, column=1, sticky=NSEW)
self.current_window = 'feedback'
def on_settings(self):
if self.current_window != 'settings':
self.clear_main_frame()
self.main_frame = Settings(self, self.app, self.PATH, self.PM, self.SM)
self.main_frame.grid(row=1, column=1, sticky=NSEW)
self.current_window = 'settings'