HI all, recently I am using Qt Designer as a means to create a simple UI then incorporate it into another Python script so as to run it in Maya. Never knew that scripting can do lots of stuff until now…
Anyway, I am using a linux system, having saved all my files in /u/hst/tools/dev/testProject/src
And hence I have 2 files, testProjectUI and testProject
However, currently I am running into some problems and I shall list them below.
This is the codes of my UI that I have created and converted in Qt Designer.
class testProjectUI(object):
def setupUi(self, TestProject):
TestProject.setObjectName("TestProject")
TestProject.resize(410, 636)
self.ok_pushButton = QtGui.QPushButton(TestProject)
self.ok_pushButton.setGeometry(QtCore.QRect(200, 600, 98, 27))
self.ok_pushButton.setObjectName("ok_pushButton")
self.curItem_lineEdit = QtGui.QLineEdit(TestProject)
self.curItem_lineEdit.setGeometry(QtCore.QRect(130, 90, 113, 30))
self.curItem_lineEdit.setObjectName("curItem_lineEdit")
self.curItem_qLabel = QtGui.QLabel(TestProject)
self.curItem_qLabel.setGeometry(QtCore.QRect(20, 90, 91, 30))
self.curItem_qLabel.setObjectName("curItem_qLabel")
self.retranslateUi(TestProject)
QtCore.QMetaObject.connectSlotsByName(TestProject)
def retranslateUi(self, TestProject):
TestProject.setWindowTitle(QtGui.QApplication.translate("TestProject", "Test Project", None, QtGui.QApplication.UnicodeUTF8))
self.ok_pushButton.setText(QtGui.QApplication.translate("TestProject", "Ok", None, QtGui.QApplication.UnicodeUTF8))
self.curItem_qLabel.setText(QtGui.QApplication.translate("TestProject", "Current Shot", None, QtGui.QApplication.UnicodeUTF8))
When I tried running the following command in Maya:
from testProject.src import testProject
win = testProject.TestUi()
win.show()
- I was prompted with the error # ImportError: No module named src # when I am running my testProject script where I input in from testProject.src import testProject just before the class function
Am I wrting it wrong?
- If I am to add it an object into the curItem_lineEdit as I have named in my UI design, is it right for me to write it as:
Item = 'Trunks'
testProjectUI.curItem_lineEdit.setObjectName(Item)
Many thanks in advance for any answers or advices given!