Improve import keys password popup

This commit is contained in:
miruka
2019-08-27 22:25:13 -04:00
parent 05b248e31a
commit ebfebbeae1
8 changed files with 160 additions and 34 deletions

View File

@@ -121,13 +121,21 @@ class Backend:
# General functions
@staticmethod
def hsluv(hue: int, saturation: int, lightness: int) -> List[float]:
# (0-360, 0-100, 0-100) -> [0-1, 0-1, 0-1]
return hsluv.hsluv_to_rgb([hue, saturation, lightness])
@staticmethod
def check_exported_keys_password(file_path: str, password: str) -> bool:
try:
nio.crypto.key_export.decrypt_and_read(file_path, password)
return True
except (FileNotFoundError, ValueError):
return False
async def load_settings(self) -> tuple:
from .config_files import Theme
settings = await self.ui_settings.read()