|
|
@@ -31,10 +31,12 @@ class FormBotNew():
|
|
|
self.box_new["class"] = "container bg-secondary text-white p-3 border"
|
|
|
|
|
|
self.ent_login = document.createElement("input")
|
|
|
- self.ent_login["class"] = "col-9"
|
|
|
+ self.ent_login["class"] = "col"
|
|
|
+ self.ent_login["id"] = "bot_login"
|
|
|
|
|
|
self.ent_pass = document.createElement("input")
|
|
|
- self.ent_pass["class"] = "col-9"
|
|
|
+ self.ent_pass["class"] = "col"
|
|
|
+ self.ent_pass["id"] = "bot_pass"
|
|
|
|
|
|
self.add_container_new()
|
|
|
|
|
|
@@ -43,13 +45,14 @@ class FormBotNew():
|
|
|
print("FormBotNew.add_container_new()")
|
|
|
self.add_row_login()
|
|
|
self.add_row_pass()
|
|
|
+ self.add_row_btn()
|
|
|
self.div_new.appendChild(self.box_new)
|
|
|
|
|
|
def add_row_login(self) -> None:
|
|
|
"""Добавляет ряд логина"""
|
|
|
print("FormBotNew.add_row_login()")
|
|
|
row_login = document.createElement("div")
|
|
|
- row_login["class"] = "row"
|
|
|
+ row_login["class"] = "row p-3"
|
|
|
lbl_login = document.createElement("label")
|
|
|
lbl_login["class"] = "col-2"
|
|
|
lbl_login.text = "Логин"
|
|
|
@@ -63,7 +66,7 @@ class FormBotNew():
|
|
|
"""Добавляет ряд пароля"""
|
|
|
print("FormBotNew.add_row_pass()")
|
|
|
row_pass = document.createElement("div")
|
|
|
- row_pass["class"] = "row"
|
|
|
+ row_pass["class"] = "row p-3"
|
|
|
lbl_pass = document.createElement("label")
|
|
|
lbl_pass["class"] = "col-2"
|
|
|
lbl_pass.text = "Пароль"
|
|
|
@@ -73,6 +76,42 @@ class FormBotNew():
|
|
|
|
|
|
self.box_new.appendChild(row_pass)
|
|
|
|
|
|
+ def add_row_btn(self) -> None:
|
|
|
+ """добавляет ряд кнопок формы"""
|
|
|
+ row_btn = document.createElement("div")
|
|
|
+ row_btn["class"] = "row p-3"
|
|
|
+ lbl_btn = document.createElement("label")
|
|
|
+ lbl_btn["class"] = "col-6"
|
|
|
+ row_btn.appendChild(lbl_btn)
|
|
|
+
|
|
|
+ btn_cancel = document.createElement("button")
|
|
|
+ btn_cancel["class"] = "btn btn-dark col-3"
|
|
|
+ btn_cancel.text = "Отмена"
|
|
|
+ btn_cancel.bind("click", self.clear)
|
|
|
+ row_btn.appendChild(btn_cancel)
|
|
|
+
|
|
|
+ btn_add = document.createElement("button")
|
|
|
+ btn_add["class"] = "btn btn-primary col-3"
|
|
|
+ btn_add.text = "Добавить"
|
|
|
+ btn_add.bind("click", self.add)
|
|
|
+ row_btn.appendChild(btn_add)
|
|
|
+
|
|
|
+ self.box_new.appendChild(row_btn)
|
|
|
+
|
|
|
+ def add(self, event) -> None:
|
|
|
+ """Получает логин и пароль нового боты из формы"""
|
|
|
+ print("FormBotNew.clear()")
|
|
|
+ login = self.ent_login.value
|
|
|
+ _pass = self.ent_pass.value
|
|
|
+ print(f"FormBotNew.clear(): login={login}, " +
|
|
|
+ f"pass={_pass}, event={event}")
|
|
|
+ self.div_new.clear()
|
|
|
+
|
|
|
+ def clear(self, event) -> None:
|
|
|
+ """Зачищает форму логина"""
|
|
|
+ print("FormBotNew.clear()")
|
|
|
+ self.div_new.clear()
|
|
|
+
|
|
|
|
|
|
document["bot_list_update"].bind("click", bot_list_update)
|
|
|
document["bot_list_add"].bind("click", bot_list_add)
|