figenc

[RADIOACTIVE] rsa and symmetric key encryption scripts and executables
git clone git://git.figbert.com/figenc.git
Log | Files | Refs | README

commit c9a3195ebadb5252c999bff2af30cb846e441d17
parent d79de8b31a34c95fd7e6c742614e5c94ea4526ed
Author: FIGBERT <figbertwelner@gmail.com>
Date:   Tue, 23 Jul 2019 11:41:23 -0700

Adding a basic settings page, changing settings.json to the default settings, adding tips, and more

Diffstat:
MScripts/app_launcher.py | 49+++++++++++++++++++++++++++----------------------
MScripts/figENC.py | 4++--
MScripts/settings.json | 2+-
AScripts/settings.py | 134+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
MScripts/tips.json | 3++-
5 files changed, 166 insertions(+), 26 deletions(-)

diff --git a/Scripts/app_launcher.py b/Scripts/app_launcher.py @@ -2,8 +2,8 @@ from sys import platform from random import choice from json import load import tkinter as tk -from tkinter import ttk from figENC import App +from settings import SettingsApp class Launcher(): @@ -12,7 +12,7 @@ class Launcher(): self.root.wm_title("figENC") self.canvas = tk.Canvas( self.root, - height=125, + height=100, width=450 ) self.canvas.pack(fill=tk.BOTH, expand=True) @@ -21,7 +21,7 @@ class Launcher(): self.header = tk.Label( self.frame, text="Loading application...", - font=("Arial", "10"), + font=("Arial", "12"), bg="#1A181C", fg="#F2DAFF", pady="5" @@ -30,23 +30,22 @@ class Launcher(): self.subheader = tk.Label( self.frame, text=self.pick_tip(), - font=("Arial", "8"), + font=("Arial", "10"), bg="#1A181C", fg="#B494C7" ) self.subheader.pack(side=tk.TOP) - self.progressbar = ttk.Progressbar(self.frame, orient="horizontal", length=300, mode="determinate") - self.progressbar.pack(side=tk.TOP) - self.button_frame = tk.Frame(self.frame, bg="#1A181C", pady=10) + self.button_frame = tk.Frame(self.frame, bg="#1A181C", pady=5) self.button_frame.pack(side=tk.TOP) if platform == "darwin": self.launch_button = tk.Button( self.button_frame, - fg="#B494C7", + fg="#643181", text="Launch App", - font=("Arial", "8"), - highlightthickness=0, - highlightbackground="#1A181C" + font=("Arial", "10"), + highlightthickness=5, + highlightbackground="#1A181C", + command=lambda: self.launch_app(self.root) ) else: self.launch_button = tk.Button( @@ -54,16 +53,18 @@ class Launcher(): fg="#B494C7", bg="#643181", text="Launch App", - font=("Arial", "8") + font=("Arial", "10"), + command=lambda: self.launch_app(self.root) ) if platform == "darwin": self.settings_button = tk.Button( self.button_frame, - fg="#B494C7", + fg="#643181", text="Settings", - font=("Arial", "8"), - highlightthickness=0, - highlightbackground="#1A181C" + font=("Arial", "10"), + highlightbackground="#1A181C", + highlightthickness=5, + command=lambda: self.open_settings(self.root) ) else: self.settings_button = tk.Button( @@ -71,7 +72,8 @@ class Launcher(): fg="#B494C7", bg="#643181", text="Settings", - font=("Arial", "8") + font=("Arial", "10"), + command=lambda: self.open_settings(self.root) ) self.launch_button.pack(side=tk.LEFT) self.settings_button.pack(side=tk.RIGHT) @@ -83,11 +85,14 @@ class Launcher(): self.tip = "Tip: " + choice(self.tips) return self.tip - def open_settings(self): - pass - - def launch_app(self): - pass + def open_settings(self, root): + SettingsApp() + + def launch_app(self, root): + with open("settings.json") as settings_file: + settings = load(settings_file) + root.destroy() + App(settings["font_size"], settings["scroll"]) Launcher() \ No newline at end of file diff --git a/Scripts/figENC.py b/Scripts/figENC.py @@ -509,4 +509,4 @@ class App(): rsa_key(passkey, save_folder) -App(14, False) -\ No newline at end of file +#App(14, False) +\ No newline at end of file diff --git a/Scripts/settings.json b/Scripts/settings.json @@ -1,4 +1,4 @@ { "font_size": 16, - "scroll": true + "scroll": false } \ No newline at end of file diff --git a/Scripts/settings.py b/Scripts/settings.py @@ -0,0 +1,133 @@ +from sys import platform +import tkinter as tk +import json + +class SettingsApp(): + + def __init__(self): + with open("settings.json") as settings_file: + self.settings = json.load(settings_file) + self.root = tk.Tk() + self.root.wm_title("figENC - Settings") + self.canvas = tk.Canvas( + self.root, + height=400, + width=700 + ) + self.canvas.pack(fill=tk.BOTH, expand=True, side=tk.LEFT) + self.frame = tk.Frame(self.canvas, bg="#1A181C") + self.frame.place(relwidth=1, relheight=1) + self.header = tk.Label( + self.frame, + text="Settings", + justify=tk.CENTER, + font=("Arial", str(self.settings["font_size"] + 2)), + bg="#643181", + fg="#F2DAFF", + pady=2 + ) + self.header.pack(fill=tk.X) + + self.font_frame = tk.Frame(self.frame, bg="#1A181C") + self.font_frame.pack(side=tk.TOP, fill=tk.BOTH, pady=10) + self.font_label = tk.Label( + self.font_frame, + text="Font Size:", + justify=tk.LEFT, + font=("Arial", str(self.settings["font_size"])), + bg="#1A181C", + fg="#F2DAFF", + pady=2 + ) + self.font_label.pack(side=tk.LEFT) + self.font_options_selector = tk.Menubutton( + self.font_frame, + font=("Arial", str(self.settings["font_size"] - 2)), + text=str(self.settings["font_size"]), + bg="#1A181C" + ) + self.font_options = tk.Menu( + self.font_options_selector, + tearoff=0, + title=str(self.settings["font_size"]) + ) + self.font_options.add_radiobutton(label="12", variable=tk.IntVar()) + self.font_options.add_radiobutton(label="14", variable=tk.IntVar()) + self.font_options.add_radiobutton(label="16", variable=tk.IntVar()) + self.font_options.add_radiobutton(label="18", variable=tk.IntVar()) + self.font_options.add_radiobutton(label="20", variable=tk.IntVar()) + self.font_options.add_radiobutton(label="24", variable=tk.IntVar()) + self.font_options.add_radiobutton(label="32", variable=tk.IntVar()) + self.font_options_selector.pack(side=tk.LEFT) + self.font_options_selector["menu"] = self.font_options + + scroll_bool = "on" if self.settings["scroll"] else "off" + self.scroll_frame = tk.Frame(self.frame, bg="#1A181C") + self.scroll_frame.pack(side=tk.TOP, fill=tk.BOTH, pady=10) + self.scroll_label = tk.Label( + self.scroll_frame, + text="Scrollbar:", + justify=tk.LEFT, + font=("Arial", str(self.settings["font_size"])), + bg="#1A181C", + fg="#F2DAFF", + pady=2 + ) + self.scroll_label.pack(side=tk.LEFT) + self.scroll_options_selector = tk.Menubutton( + self.scroll_frame, + font=("Arial", str(self.settings["font_size"] - 2)), + text=scroll_bool, + bg="#1A181C" + ) + self.scroll_options = tk.Menu( + self.scroll_options_selector, + tearoff=0, + title=scroll_bool + ) + self.scroll_options.add_radiobutton( + label="off", + variable=tk.IntVar(), + value=False + ) + self.scroll_options.add_radiobutton( + label="on", + variable=tk.IntVar(), + value=True + ) + self.scroll_options_selector.pack(side=tk.LEFT) + self.scroll_options_selector["menu"] = self.scroll_options + + self.save_frame = tk.Frame(self.frame, bg="#1A181C") + self.save_frame.pack(side=tk.BOTTOM, fill=tk.BOTH, pady=5, padx=5) + if platform == "darwin": + self.save_button = tk.Button( + self.save_frame, + fg="#643181", + text="Save", + font=("Arial", str(self.settings["font_size"] - 2)), + highlightbackground="#1A181C", + padx=5, + command=lambda: self.export(self.root) + ) + else: + self.save_button = tk.Button( + self.save_frame, + fg="#B494C7", + bg="#643181", + text="Save", + font=("Arial", str(self.settings["font_size"] - 2)), + padx=5, + command=lambda: self.export(self.root) + ) + self.save_button.pack(side=tk.LEFT) + + self.root.mainloop() + + def export(self, root): + with open("settings.json", "w") as write_file: + json.dump(self.settings, write_file, indent=4, sort_keys=True) + print(self.settings) + root.destroy() + +#SettingsApp() +\ No newline at end of file diff --git a/Scripts/tips.json b/Scripts/tips.json @@ -8,5 +8,6 @@ "keys generated by figENC are PEM-compatible, and should\nwork with other encryption programs.", "figENC uses a unique encryption algorithm to provide\nRSA encryption to files of any size.", "figENC uses multilayer encryption. To encrypt or decrypt, you need\nat least two of the three keys.", - "figENC's RSA encryption is military grade, and has never been broken\nby hackers or governments." + "figENC's RSA encryption is military grade, and has never been broken\nby hackers or governments.", + "fonts in figENC are relative – there's one font size in settings,\nand other sizes are determined based on that selection" ] \ No newline at end of file