-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtaborder.py
38 lines (31 loc) · 1.02 KB
/
taborder.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
import PyQt4.QtGui as gui
import PyQt4.QtCore as core
#import qtify_maya_window as qtfy
import sys
from functools import partial
#parent = qtfy.getMayaWindow()
def printme(k):
print k
class MyDialog(gui.QDialog):
def __init__(self, numBtns=5):
super(MyDialog, self).__init__(parent=None)
self.layout = gui.QVBoxLayout(self)
self.btns = []
self.edits = []
for i in range(numBtns):
edit = gui.QLineEdit()
btn = gui.QPushButton()
btn.clicked.connect(partial(printme, i))
self.btns.append(btn)
self.edits.append(edit)
self.layout.addWidget(edit)
self.layout.addWidget(btn)
self.setLayout(self.layout)
self.setFocusPolicy( core.Qt.StrongFocus)
for i in reversed(range(numBtns)):
if i >= 1:
self.setTabOrder(self.btns[i-1], self.edits[i])
self.setTabOrder(self.edits[i], self.btns[i])
app = gui.QApplication(sys.argv)
win = MyDialog()
win.exec_()