MCPcopy
hub / github.com/Sathvik-Rao/ClipCascade / mainloop

Method mainloop

ClipCascade_Desktop/src/cli/login.py:47–208  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

45 return False
46
47 def mainloop(self):
48 # save data to config
49 self.config.data["username"] = (
50 input(f"username [{self.config.data['username']}]: ")
51 or self.config.data["username"]
52 )
53
54 self.config.data["password"] = getpass.getpass("password: ")
55
56 server_url = (
57 input(f"server url [{self.config.data['server_url']}]: ")
58 or self.config.data["server_url"]
59 )
60 self.config.data["server_url"] = LoginForm.remove_trailing_slash(
61 server_url.strip()
62 )
63
64 self.config.data["cipher_enabled"] = LoginForm.str_to_bool(
65 input(
66 f"enabled encryption(recommended) [{LoginForm.bool_to_str(self.config.data['cipher_enabled'])}]: "
67 )
68 or LoginForm.bool_to_str(self.config.data["cipher_enabled"])
69 )
70
71 self.config.data["notification"] = LoginForm.str_to_bool(
72 input(
73 f"enabled notification [{LoginForm.bool_to_str(self.config.data['notification'])}]: "
74 )
75 or LoginForm.bool_to_str(self.config.data["notification"])
76 )
77
78 # extra fields
79 show_extra_fields = input(f"show extra fields [n]: ") or "n"
80 if not LoginForm.str_to_bool(show_extra_fields):
81 CustomDialog("Logging in...").mainloop()
82 return
83
84 # Validate hash_rounds
85 while True:
86 hash_rounds = input(
87 f"hash rounds [{self.config.data['hash_rounds']}]: "
88 ) or str(
89 ""
90 if self.config.data["hash_rounds"] is None
91 else str(self.config.data["hash_rounds"])
92 )
93 hash_rounds = hash_rounds.strip()
94
95 if not LoginForm.is_positive_integer(hash_rounds):
96 CustomDialog(
97 "Invalid Input\nHash Rounds must be a positive integer.",
98 msg_type="error",
99 )
100 continue
101
102 self.config.data["hash_rounds"] = int(hash_rounds)
103 break
104

Callers 15

notifyMethod · 0.45
__init__Method · 0.45
runMethod · 0.45
update_menuMethod · 0.45
open_webbrowserMethod · 0.45
_open_logsMethod · 0.45
_on_downloadMethod · 0.45
_on_logoffMethod · 0.45
on_loginMethod · 0.45

Calls 6

CustomDialogClass · 0.90
str_to_boolMethod · 0.80
bool_to_strMethod · 0.80
getMethod · 0.80
remove_trailing_slashMethod · 0.45
is_positive_integerMethod · 0.45

Tested by

no test coverage detected