-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipeline_modal.py
52 lines (41 loc) · 1.97 KB
/
pipeline_modal.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
import PySimpleGUI as sg
import re
class Pipeline_modal:
"""
"""
def __init__(self, methods, args):
self._layout = [[sg.Text('PIPELINE DE PROCESSAMENTO', justification='center', font=('Helvetica', 20))]]
position = 0
for method, arg in zip(methods, args):
self._layout.append([sg.Text(method[0], justification='center', size=(50,1)),
sg.Button("Remover", key=f'-remove_{position}-', button_color=('white', 'red')),
sg.Button("Manter", key=f'-keep_{position}-', button_color=('black', 'yellow'), visible=False)])
position += 1
colunaNomes = []
colunaValor = []
for name, value in arg.items():
colunaNomes.append([sg.Text(name.strip('-').replace('_', ' '))])
colunaValor.append([sg.Text(value)])
self._layout.append([sg.Column(colunaNomes), sg.Column(colunaValor)])
self._layout.append([sg.HorizontalSeparator()])
def open_window(self):
window = sg.Window("Pipeline de Processamento", self._layout, modal=True)
remove = list()
while True:
event, values = window.read()
if event == sg.WIN_CLOSED or event == '-cancel-':
break
if '-remove' in event:
numero = re.search(r'\d+', event).group()
position = int(numero)
remove.append(position)
window[event].Update(visible=False)
window[f'-keep_{position}-'].Update(visible=True)
if '-keep' in event:
numero = re.search(r'\d+', event).group()
position = int(numero)
remove.remove(position)
window[event].Update(visible=False)
window[f'-remove_{position}-'].Update(visible=True)
window.close()
return remove