-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
118 lines (98 loc) · 4.23 KB
/
config.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# * IMPORTS *
# ***********
# ? Standard libraries
import pickle
# ? Text colored in CMD
from colored import fg
# * ------- *
# * CONFIG OBJECT *
# *****************
class Config:
def __init__(self):
# ? Variables
self.EMAIL = ''
self.PASSW = ''
self.SAVE_COOKIES = None
self.MAX_TIMEOUT = 15
self.TIME_ENTRY_MORNING = ""
self.TIME_DEPARTURE_MORNING = ""
self.TIME_ENTRY_AFTERNOON = ""
self.TIME_DEPARTURE_AFTERNOON = ""
self.TIME_ENTRY_BREAK = ""
self.TIME_DEPARTURE_BREAK = ""
# ? Text to show
def __str__(self):
# ? Color vars
light_color = fg('white')
primary_color = fg('light_green')
error_color = fg('red')
info_color = fg('light_blue')
success_color = fg('green')
if not self.SAVE_COOKIES:
is_cookies = error_color+"No"+light_color
else:
is_cookies = success_color+"Si"+light_color
# ? String to show
string = """
+----------+
| """+success_color+"""OPCIONES"""+light_color+""" |
+----------+
"""
string += info_color+"\n[1]"+ light_color +" EMAIL: "+success_color+str(self.EMAIL) + "\n"
string += info_color+"[2]"+ light_color +" CONTRASEÑA: "+success_color+str(self.PASSW) + "\n"
string += info_color+"[3]"+ light_color +" GUARDAR COOKIES: "+is_cookies + "\n"
string += info_color+"[4]"+ light_color +" TIEMPO DE ESPERA MÁXIMO (Solo modificar si tu conexión es lenta): "+success_color+str(self.MAX_TIMEOUT) + "s\n\n"
string += info_color+"[5]"+ light_color +" HORA DE ENTRADA POR LA MAÑANA: "+success_color+str(self.TIME_ENTRY_MORNING) + "\n"
string += info_color+"[6]"+ light_color +" HORA DE SALIDA POR LA MAÑANA: "+success_color+str(self.TIME_DEPARTURE_MORNING) + "\n\n"
string += info_color+"[7]"+ light_color +" HORA DE ENTRADA POR LA TARDE: "+success_color+str(self.TIME_ENTRY_AFTERNOON) + "\n"
string += info_color+"[8]"+ light_color +" HORA DE SALIDA POR LA TARDE: "+success_color+str(self.TIME_DEPARTURE_AFTERNOON) + "\n\n"
string += info_color+"[9]"+ light_color +" HORA DE ENTRADA DEL DESCANSO: "+success_color+str(self.TIME_ENTRY_BREAK) + "\n"
string += info_color+"[10]"+ light_color +" HORA DE SALIDA DEL DESCANSO: "+success_color+str(self.TIME_DEPARTURE_BREAK) + "\n"
string += info_color+"\n[0]"+ light_color +" VOLVER\n"
return string
# ? Getters
def get_email(self):
return self.EMAIL
def get_passw(self):
return self.PASSW
def get_save_cookies(self):
return self.SAVE_COOKIES
def get_max_timeout(self):
return self.MAX_TIMEOUT
def get_time_entry_morning(self):
return self.TIME_ENTRY_MORNING
def get_time_departure_morning(self):
return self.TIME_DEPARTURE_MORNING
def get_time_entry_afternoon(self):
return self.TIME_ENTRY_AFTERNOON
def get_time_departure_afternoon(self):
return self.TIME_DEPARTURE_AFTERNOON
def get_time_entry_break(self):
return self.TIME_ENTRY_BREAK
def get_time_departure_break(self):
return self.TIME_DEPARTURE_BREAK
# ? Setters
def set_email(self, value):
self.EMAIL = value
def set_passw(self, value):
self.PASSW = value
def set_save_cookies(self, value):
if (value == 'si'):
self.SAVE_COOKIES = True
elif (value == 'no'):
self.SAVE_COOKIES = False
def set_time_entry_morning(self, value):
self.TIME_ENTRY_MORNING = value
def set_time_departure_morning(self, value):
self.TIME_DEPARTURE_MORNING = value
def set_time_entry_afternoon(self, value):
self.TIME_ENTRY_AFTERNOON = value
def set_time_departure_afternoon(self, value):
self.TIME_DEPARTURE_AFTERNOON = value
def set_time_entry_break(self, value):
self.TIME_ENTRY_BREAK = value
def set_time_departure_break(self, value):
self.TIME_DEPARTURE_BREAK = value
def set_max_timeout(self, value):
self.MAX_TIMEOUT = value
# * ------- *