-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatchItConfigDialogClass.py
More file actions
131 lines (105 loc) · 4.04 KB
/
batchItConfigDialogClass.py
File metadata and controls
131 lines (105 loc) · 4.04 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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
import sys
import os
import configparser
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
class BatchItConfigDialog(QDialog):
def __init__(self, parent = None):
super().__init__(parent)
self.verticalLayout = QVBoxLayout(self)
self.gridLayoutControlls = QGridLayout()
self.lbl1 = QLabel()
self.lbl1.setText('3dsmax 2018 Path')
self.gridLayoutControlls.addWidget(self.lbl1, 0, 0, 1, 1)
self.btn1 = QPushButton("...")
self.btn1.setFixedWidth(35)
self.btn1.clicked.connect(lambda: self.getDir(self.le1))
self.le1 = QLineEdit()
self.le1.setReadOnly(True)
self.gridLayoutControlls.addWidget(self.btn1, 1, 1)
self.gridLayoutControlls.addWidget(self.le1, 1, 0)
self.lbl2 = QLabel()
self.lbl2.setText('3dsmax 2019 Path')
self.gridLayoutControlls.addWidget(self.lbl2, 2, 0, 1, 1)
self.btn2 = QPushButton("...")
self.btn2.setFixedWidth(35)
self.btn2.clicked.connect(lambda: self.getDir(self.le2))
self.le2 = QLineEdit()
self.le2.setReadOnly(True)
self.gridLayoutControlls.addWidget(self.btn2, 3, 1)
self.gridLayoutControlls.addWidget(self.le2, 3, 0)
self.lbl3 = QLabel()
self.lbl3.setText('3dsmax 2020 Path')
self.gridLayoutControlls.addWidget(self.lbl3, 4, 0, 1, 1)
self.btn3 = QPushButton("...")
self.btn3.setFixedWidth(35)
self.btn3.clicked.connect(lambda: self.getDir(self.le3))
self.le3 = QLineEdit()
self.le3.setReadOnly(True)
self.gridLayoutControlls.addWidget(self.btn3, 5, 1)
self.gridLayoutControlls.addWidget(self.le3, 5, 0)
self.lbl4 = QLabel()
self.lbl4.setText('3dsmax 2021 Path')
self.gridLayoutControlls.addWidget(self.lbl4, 6, 0, 1, 1)
self.btn4 = QPushButton("...")
self.btn4.setFixedWidth(35)
self.btn4.clicked.connect(lambda: self.getDir(self.le4))
self.le4 = QLineEdit()
self.le4.setReadOnly(True)
self.gridLayoutControlls.addWidget(self.btn4, 7, 1)
self.gridLayoutControlls.addWidget(self.le4, 7, 0)
self.gridLayoutOKCancel = QGridLayout()
self.okCancel = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.okButton = self.okCancel.button(QDialogButtonBox.Ok)
self.okButton.setEnabled(False)
self.okCancel.accepted.connect(self.okPressed)
self.okCancel.rejected.connect(self.cancelPressed)
self.gridLayoutOKCancel.addWidget(self.okCancel, 0, 0)
self.spacerItem = QSpacerItem(20, 0, QSizePolicy.Minimum, QSizePolicy.Expanding)
self.gridLayoutOKCancel.addItem(self.spacerItem, 1, 0)
self.verticalLayout.addLayout(self.gridLayoutControlls)
self.verticalLayout.addLayout(self.gridLayoutOKCancel)
self.setWindowTitle("batch It Configuration")
self.setModal(True)
self.setFixedWidth(400)
#self.setWindowIcon(_appIcon)
self.adjustSize()
self.setFixedHeight(self.height())
self.show()
@pyqtSlot()
def getDir(self, _widget):
#QFileDialog(parent, caption = QString(), QString &directory, QString &filter = QString())
dirPath = QFileDialog.getExistingDirectory(self, 'Select a directory', QDir.home().dirName(), QFileDialog.ShowDirsOnly)
if dirPath:
execPath = os.path.join(dirPath,'3dsmaxbatch.exe')
if os.path.isfile(execPath):
_widget.setText('"'+ execPath + '"')
if self.le1.text() != '' or self.le2.text() != '' or self.le3.text() != '' or self.le4.text() != '':
self.okButton.setEnabled(True)
@pyqtSlot()
def okPressed(self):
config = configparser.ConfigParser()
#config.read('batchItPy.ini')
#config.set('batchItSettings','3dsmax2018Path', self.le1.text())
config['3dsMaxPaths'] = {'2018':self.le1.text(),'2019':self.le2.text(),'2020':self.le3.text(),'2021':self.le4.text()}
with open('batchItPy.ini', 'w') as configfile:
config.write(configfile)
self.accept()
@pyqtSlot()
def cancelPressed(self):
self.reject()
#'''
#use
def main():
app = QApplication(sys.argv)
ex = BatchItConfigDialog()
var = ex.exec()
if var == 1:
print(var)
print(ex.le2.text())
print(ex.le1.text())
sys.exit(app.exec_())
if __name__ == '__main__':
main()
#'''