-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Support enabling encryption by enabling checkbox and inserting password - Do the same when restoring encrypted backup - libutilities funcs now have a new password parameter
- Loading branch information
Showing
3 changed files
with
72 additions
and
10 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import flet as ft | ||
|
||
class Encrypt(ft.UserControl): | ||
|
||
def build(self): | ||
|
||
self.encrypt_checkbox = ft.Checkbox( | ||
fill_color={ft.MaterialState.HOVERED: ft.colors.LIGHT_BLUE}, on_change=self.enable_checkbox, | ||
tooltip="Enable encryption" | ||
) | ||
|
||
self.password_field = ft.TextField( | ||
password=True, can_reveal_password=True, disabled=True, width=250, height=40, | ||
content_padding=ft.padding.only(bottom=15, left=10), hint_text="Encryption password" | ||
) | ||
|
||
return ft.Row([self.encrypt_checkbox, self.password_field], spacing=10, alignment="center") | ||
|
||
|
||
def enable_checkbox(self,e): | ||
|
||
if self.encrypt_checkbox.value: | ||
|
||
self.password_field.disabled=False | ||
self.update() | ||
|
||
else: | ||
|
||
self.password_field.disabled=True | ||
self.update() | ||
|
||
def get_pwd(self): | ||
|
||
if self.encrypt_checkbox.value: | ||
|
||
if len(self.password_field.value) > 0: | ||
|
||
return self.password_field.value |