-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstreamlit_main.py
More file actions
31 lines (27 loc) · 1.25 KB
/
Copy pathstreamlit_main.py
File metadata and controls
31 lines (27 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import streamlit as st
from web_auth import Timer
import sys
from loguru import logger
class Stream_app():
def page(self):
st.write('Autenticador Automatico para o IFRN')
login = st.text_input(label='Matricula')
password = st.text_input(label='Senha', type='password')
submit_button = st.button(label='Submit')
self.time_process = {'timer': None, 'loged': False}
def stop():
logger.debug('Parando o Clocker no Codigo main')
if self.time_process.get('timer') != None:
self.time_process.get('timer').stop_timer()
self.time_process.get('timer').clocker.join()
self.time_process.update({'timer': None})
logger.debug('Parando o Clocker no Codigo main')
st.stop()
if submit_button:
self.time_process.update({'loged': True})
st.write('Timer is running now, please click on button to Stop.')
st.button(label='Stop timer', on_click=stop)
if self.time_process.get('timer') == None:
self.time_process.update({'timer':Timer({'Login':login, 'Password':password})})
self.time_process.get('timer').start_timer()
Stream_app().page()