-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_printers.py
57 lines (47 loc) · 1.75 KB
/
get_printers.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
#!/usr/bin/python
# -*- coding: utf-8 -*-
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import printer_codes
class PrintersWizard(QDialog):
def __init__(self, printers,parent = None):
super(PrintersWizard, self).__init__(parent)
self.setWindowTitle('Escolher Impressoras')
self.toto = -1
mainLayout = QVBoxLayout(self)
mainLayout.addLayout(self.make_buttons(printers) )
# butoes
self.closeBtn = QPushButton('Fechar')
self.setSizeHeight(self.closeBtn,60)
self.connect(self.closeBtn, SIGNAL("clicked()"), self.closeBtn_click)
mainLayout.addWidget(self.closeBtn)
def make_buttons(self,data):
self.salesButtonsGroup = QButtonGroup()
totoLayout = QHBoxLayout()
for n in data:
btn = QPushButton(str(n[0]))
self.setSizes(btn, 60)
self.salesButtonsGroup.addButton(btn, int(n[0]))
totoLayout.addWidget(btn)
self.connect(self.salesButtonsGroup, SIGNAL("buttonClicked(int)"), self.button_group_click)
return totoLayout
def button_group_click(self,status_id):
self.toto = status_id
print('status_id',status_id)
self.close()
form = printer_codes.PrintersCodesWizard(status_id)
form.exec_()
self.close()
def closeBtn_click(self):
self.toto = -1
self.close()
def setSizes(self, object,value = 60):
object.setMaximumHeight (value)
object.setMinimumHeight(value)
object.setMaximumWidth(value+20)
object.setMinimumWidth(value)
def setSizeHeight(self, object, value):
object.setMaximumHeight(value)
object.setMinimumHeight(value)
if __name__ == '__main__':
pass