Go back to old style button enable/disable
This commit is contained in:
1 parent
0ec9bd89a6
commit
c4b93e622b
1 file changed
+2
-30
@@ -210,40 +210,12 @@ class LoginForm:
|
|||||||
if token or clear_all:
|
if token or clear_all:
|
||||||
self._token_entry.clear()
|
self._token_entry.clear()
|
||||||
|
|
||||||
def enable(
|
|
||||||
self,
|
|
||||||
login: Optional[bool] = None,
|
|
||||||
password: Optional[bool] = None,
|
|
||||||
token: Optional[bool] = None,
|
|
||||||
button: Optional[bool] = None,
|
|
||||||
):
|
|
||||||
if login is not None:
|
|
||||||
if login:
|
|
||||||
self._login_entry.enable()
|
|
||||||
else:
|
|
||||||
self._login_entry.disable()
|
|
||||||
if password is not None:
|
|
||||||
if password:
|
|
||||||
self._pass_entry.enable()
|
|
||||||
else:
|
|
||||||
self._pass_entry.disable()
|
|
||||||
if token is not None:
|
|
||||||
if token:
|
|
||||||
self._token_entry.enable()
|
|
||||||
else:
|
|
||||||
self._token_entry.disable()
|
|
||||||
if button is not None:
|
|
||||||
if button:
|
|
||||||
self._button.config(state="normal")
|
|
||||||
else:
|
|
||||||
self._button.config(state="disabled")
|
|
||||||
|
|
||||||
async def ask_login(self) -> LoginData:
|
async def ask_login(self) -> LoginData:
|
||||||
self._manager.print("Please log in.")
|
self._manager.print("Please log in.")
|
||||||
self._confirm.clear()
|
self._confirm.clear()
|
||||||
self.enable(button=True)
|
self._button.config(state="normal")
|
||||||
await self._confirm.wait()
|
await self._confirm.wait()
|
||||||
self.enable(button=False)
|
self._button.config(state="disabled")
|
||||||
data = LoginData(self._login_entry.get(), self._pass_entry.get(), self._token_entry.get())
|
data = LoginData(self._login_entry.get(), self._pass_entry.get(), self._token_entry.get())
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user