회원 로그인
정보기억 정보기억에 체크할 경우 다음접속시 아이디와 패스워드를 입력하지 않으셔도 됩니다.
그러나, 개인PC가 아닐 경우 타인이 로그인할 수 있습니다.
PC를 여러사람이 사용하는 공공장소에서는 체크하지 마세요.
소셜네트워크 서비스를 통해서 로그인하시면 별도의 로그인 절차없이 회원서비스를 이용하실 수 있습니다.


최근 게시물

1.언리얼 서밋 2018 다..

1.언리얼 서밋 2018 다..

언리얼 서밋 2018 다시보기
:
...

2018.05.25//read more

2.Unite Seoul 2..

2.Unite Seoul 2..

Unite Seoul 2018 아젠다...

2018.05.25//read more

3.php71.x86_64 ..

3.php71.x86_64 ..

php71.x86_64 설치 시 오류...

2018.05.24//read more

4.echo와 print_r..

4.echo와 print_r..

echo와 print_r 차이점:ph...

2018.05.19//read more

5.Alembic

5.Alembic

Alembic소스https://cod...

2018.05.17//read more


안정적인 DNS 서비스 DNSEver
DNS Powered by DNSEver.com


pyuic5 사용 for Maya

푸딩뱃살 | 2018.02.21 12:28 | 조회 199
pyuic5 사용 for Maya
:Qt Designer로 만든 .ui 파일을 .py 파일로 변환한다.

 마야2017 (Update4) 기준으로 작성되었다.

  • 이슈
    • Python 2.7.x를 사용
    • PyQt5를 사용 (보통 Python 3.x와 함께 사용된다.)
    • PyQt5의 충돌 문제가 있을 수 있으므로 마야에 맞게(PySide2) 변환된 py 스크립트 수정하기를 요망된다.
  • 준비
    1. C:\Program Files\Autodesk\Maya2017\Python 폴더의 pyuic5.bat 파일을 적당한 곳에 복사한다.
    2. pyuic5.bat 파일을 메모장으로 연다
    3. 절대 경로로 수정한다
      원본
      @m:\bin\mayapy.exe -m PyQt5.uic.pyuic %1 %2 %3 %4 %5 %6 %7 %8 %9
      수정
      C:\Progra~1\Autodesk\Maya2017\bin\mayapy.exe -m PyQt5.uic.pyuic %1 %2 %3 %4 %5 %6 %7 %8 %9
      또는 (bat에 드래그하여 변환할 경우)
      C:\Progra~1\Autodesk\Maya2017\bin\mayapy.exe -m PyQt5.uic.pyuic -x %1 -o %1
  • 변환
    1. ui파일을 bat파일이 있는 곳으로 넣는다.
    2. 명령 프롬프트를 실행한다.
      • 검색 cmd 실행 (관리자 실행은 cmd 입력 후 ctrl+shift 누른 상태에서 엔터)
      • 윈도우키+r키 cmd 실행
    3. 경로로 이동 후 변환한다.
      pyuic5.bat -x main_window.ui -o main_window.py


변환 예제
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'cleanInfluence.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(309, 169)
        self.centralwidget0 = QtWidgets.QWidget(MainWindow)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.centralwidget0.sizePolicy().hasHeightForWidth())
        self.centralwidget0.setSizePolicy(sizePolicy)
        self.centralwidget0.setMinimumSize(QtCore.QSize(300, 128))
        self.centralwidget0.setBaseSize(QtCore.QSize(0, 0))
        self.centralwidget0.setObjectName("centralwidget0")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget0)
        self.gridLayout.setContentsMargins(5, 5, 5, 5)
        self.gridLayout.setSpacing(6)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout2.setObjectName("horizontalLayout2")
        self.pushButton1 = QtWidgets.QPushButton(self.centralwidget0)
        self.pushButton1.setObjectName("pushButton1")
        self.horizontalLayout2.addWidget(self.pushButton1)
        self.pushButton2 = QtWidgets.QPushButton(self.centralwidget0)
        self.pushButton2.setObjectName("pushButton2")
        self.horizontalLayout2.addWidget(self.pushButton2)
        self.pushButton3 = QtWidgets.QPushButton(self.centralwidget0)
        self.pushButton3.setObjectName("pushButton3")
        self.horizontalLayout2.addWidget(self.pushButton3)
        self.gridLayout.addLayout(self.horizontalLayout2, 2, 0, 1, 1)
        self.progressBar0 = QtWidgets.QProgressBar(self.centralwidget0)
        self.progressBar0.setProperty("value", 0)
        self.progressBar0.setObjectName("progressBar0")
        self.gridLayout.addWidget(self.progressBar0, 4, 0, 1, 1)
        self.horizontalLayout0 = QtWidgets.QHBoxLayout()
        self.horizontalLayout0.setSpacing(6)
        self.horizontalLayout0.setObjectName("horizontalLayout0")
        self.label0 = QtWidgets.QLabel(self.centralwidget0)
        self.label0.setObjectName("label0")
        self.horizontalLayout0.addWidget(self.label0)
        self.horizontalSlider = QtWidgets.QSlider(self.centralwidget0)
        self.horizontalSlider.setMinimum(1)
        self.horizontalSlider.setMaximum(10)
        self.horizontalSlider.setProperty("value", 4)
        self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider.setObjectName("horizontalSlider")
        self.horizontalLayout0.addWidget(self.horizontalSlider)
        self.label1 = QtWidgets.QLabel(self.centralwidget0)
        self.label1.setObjectName("label1")
        self.horizontalLayout0.addWidget(self.label1)
        self.gridLayout.addLayout(self.horizontalLayout0, 0, 0, 1, 1)
        self.horizontalLayout1 = QtWidgets.QHBoxLayout()
        self.horizontalLayout1.setObjectName("horizontalLayout1")
        self.label3 = QtWidgets.QLabel(self.centralwidget0)
        self.label3.setObjectName("label3")
        self.horizontalLayout1.addWidget(self.label3)
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget0)
        self.lineEdit.setObjectName("lineEdit")
        self.horizontalLayout1.addWidget(self.lineEdit)
        self.pushButton0 = QtWidgets.QPushButton(self.centralwidget0)
        self.pushButton0.setObjectName("pushButton0")
        self.horizontalLayout1.addWidget(self.pushButton0)
        self.gridLayout.addLayout(self.horizontalLayout1, 1, 0, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem, 3, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget0)
        self.menubar0 = QtWidgets.QMenuBar(MainWindow)
        self.menubar0.setGeometry(QtCore.QRect(0, 0, 309, 21))
        self.menubar0.setObjectName("menubar0")
        self.menuEdit = QtWidgets.QMenu(self.menubar0)
        self.menuEdit.setObjectName("menuEdit")
        MainWindow.setMenuBar(self.menubar0)
        self.statusbar0 = QtWidgets.QStatusBar(MainWindow)
        self.statusbar0.setObjectName("statusbar0")
        MainWindow.setStatusBar(self.statusbar0)
        self.actionSave_Settings = QtWidgets.QAction(MainWindow)
        self.actionSave_Settings.setObjectName("actionSave_Settings")
        self.actionReset_Settings = QtWidgets.QAction(MainWindow)
        self.actionReset_Settings.setObjectName("actionReset_Settings")
        self.menuEdit.addAction(self.actionSave_Settings)
        self.menuEdit.addAction(self.actionReset_Settings)
        self.menubar0.addAction(self.menuEdit.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.pushButton1.setText(_translate("MainWindow", "PushButton"))
        self.pushButton2.setText(_translate("MainWindow", "PushButton"))
        self.pushButton3.setText(_translate("MainWindow", "PushButton"))
        self.label0.setText(_translate("MainWindow", "TextLabel"))
        self.label1.setText(_translate("MainWindow", "TextLabel"))
        self.label3.setText(_translate("MainWindow", "TextLabel"))
        self.pushButton0.setText(_translate("MainWindow", "PushButton"))
        self.menuEdit.setTitle(_translate("MainWindow", "Edit"))
        self.actionSave_Settings.setText(_translate("MainWindow", "Save Settings"))
        self.actionReset_Settings.setText(_translate("MainWindow", "Reset Settings"))

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())
임시 PySide2로 수정(하이라이트)
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'cleanInfluence.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!

from PySide2 import QtCore, QtGui, QtWidgets

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(309, 169)
        self.centralwidget0 = QtWidgets.QWidget(MainWindow)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.centralwidget0.sizePolicy().hasHeightForWidth())
        self.centralwidget0.setSizePolicy(sizePolicy)
        self.centralwidget0.setMinimumSize(QtCore.QSize(300, 128))
        self.centralwidget0.setBaseSize(QtCore.QSize(0, 0))
        self.centralwidget0.setObjectName("centralwidget0")
        self.gridLayout = QtWidgets.QGridLayout(self.centralwidget0)
        self.gridLayout.setContentsMargins(5, 5, 5, 5)
        self.gridLayout.setSpacing(6)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout2.setObjectName("horizontalLayout2")
        self.pushButton1 = QtWidgets.QPushButton(self.centralwidget0)
        self.pushButton1.setObjectName("pushButton1")
        self.horizontalLayout2.addWidget(self.pushButton1)
        self.pushButton2 = QtWidgets.QPushButton(self.centralwidget0)
        self.pushButton2.setObjectName("pushButton2")
        self.horizontalLayout2.addWidget(self.pushButton2)
        self.pushButton3 = QtWidgets.QPushButton(self.centralwidget0)
        self.pushButton3.setObjectName("pushButton3")
        self.horizontalLayout2.addWidget(self.pushButton3)
        self.gridLayout.addLayout(self.horizontalLayout2, 2, 0, 1, 1)
        self.progressBar0 = QtWidgets.QProgressBar(self.centralwidget0)
        self.progressBar0.setProperty("value", 0)
        self.progressBar0.setObjectName("progressBar0")
        self.gridLayout.addWidget(self.progressBar0, 4, 0, 1, 1)
        self.horizontalLayout0 = QtWidgets.QHBoxLayout()
        self.horizontalLayout0.setSpacing(6)
        self.horizontalLayout0.setObjectName("horizontalLayout0")
        self.label0 = QtWidgets.QLabel(self.centralwidget0)
        self.label0.setObjectName("label0")
        self.horizontalLayout0.addWidget(self.label0)
        self.horizontalSlider = QtWidgets.QSlider(self.centralwidget0)
        self.horizontalSlider.setMinimum(1)
        self.horizontalSlider.setMaximum(10)
        self.horizontalSlider.setProperty("value", 4)
        self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider.setObjectName("horizontalSlider")
        self.horizontalLayout0.addWidget(self.horizontalSlider)
        self.label1 = QtWidgets.QLabel(self.centralwidget0)
        self.label1.setObjectName("label1")
        self.horizontalLayout0.addWidget(self.label1)
        self.gridLayout.addLayout(self.horizontalLayout0, 0, 0, 1, 1)
        self.horizontalLayout1 = QtWidgets.QHBoxLayout()
        self.horizontalLayout1.setObjectName("horizontalLayout1")
        self.label3 = QtWidgets.QLabel(self.centralwidget0)
        self.label3.setObjectName("label3")
        self.horizontalLayout1.addWidget(self.label3)
        self.lineEdit = QtWidgets.QLineEdit(self.centralwidget0)
        self.lineEdit.setObjectName("lineEdit")
        self.horizontalLayout1.addWidget(self.lineEdit)
        self.pushButton0 = QtWidgets.QPushButton(self.centralwidget0)
        self.pushButton0.setObjectName("pushButton0")
        self.horizontalLayout1.addWidget(self.pushButton0)
        self.gridLayout.addLayout(self.horizontalLayout1, 1, 0, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem, 3, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget0)
        self.menubar0 = QtWidgets.QMenuBar(MainWindow)
        self.menubar0.setGeometry(QtCore.QRect(0, 0, 309, 21))
        self.menubar0.setObjectName("menubar0")
        self.menuEdit = QtWidgets.QMenu(self.menubar0)
        self.menuEdit.setObjectName("menuEdit")
        MainWindow.setMenuBar(self.menubar0)
        self.statusbar0 = QtWidgets.QStatusBar(MainWindow)
        self.statusbar0.setObjectName("statusbar0")
        MainWindow.setStatusBar(self.statusbar0)
        self.actionSave_Settings = QtWidgets.QAction(MainWindow)
        self.actionSave_Settings.setObjectName("actionSave_Settings")
        self.actionReset_Settings = QtWidgets.QAction(MainWindow)
        self.actionReset_Settings.setObjectName("actionReset_Settings")
        self.menuEdit.addAction(self.actionSave_Settings)
        self.menuEdit.addAction(self.actionReset_Settings)
        self.menubar0.addAction(self.menuEdit.menuAction())

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.pushButton1.setText(_translate("MainWindow", "PushButton"))
        self.pushButton2.setText(_translate("MainWindow", "PushButton"))
        self.pushButton3.setText(_translate("MainWindow", "PushButton"))
        self.label0.setText(_translate("MainWindow", "TextLabel"))
        self.label1.setText(_translate("MainWindow", "TextLabel"))
        self.label3.setText(_translate("MainWindow", "TextLabel"))
        self.pushButton0.setText(_translate("MainWindow", "PushButton"))
        self.menuEdit.setTitle(_translate("MainWindow", "Edit"))
        self.actionSave_Settings.setText(_translate("MainWindow", "Save Settings"))
        self.actionReset_Settings.setText(_translate("MainWindow", "Reset Settings"))


if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication.instance()
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    #sys.exit(app.exec_()) 종료 관련된 주석 처리
참고
217개(1/11페이지)
프로그래밍
번호 제목 글쓴이 조회 날짜
217 [PHP] echo와 print_r 차이점 푸딩뱃살 59 2018.05.19 03:10
216 [Python] 파이썬 GC(Garbage Collection) 첨부파일 푸딩뱃살 56 2018.04.25 15:47
215 [Python] if __name__ == '__main__': 푸딩뱃살 93 2018.04.16 17:52
214 [Python] 삼항 조건 연산자 (Ternary Operator) 푸딩뱃살 104 2018.04.16 17:41
213 [Python] Non-ASCII character 에러 푸딩뱃살 85 2018.04.16 16:49
212 [VisualStudio] Visual Studio Community 설치 파일 (다운로드형) 첨부파일 푸딩뱃살 44 2018.04.10 09:54
211 [Python] QProgressBar Stylesheet 푸딩뱃살 134 2018.03.20 15:15
210 [Python] 컨커런시(Concurrency) 첨부파일 푸딩뱃살 255 2018.03.14 12:36
209 [Python] 데코레이터(Decorator) @ 푸딩뱃살 135 2018.03.14 11:09
208 [Python] os.environ 푸딩뱃살 137 2018.03.02 18:05
207 [Python] A QApplication instance already exists. 푸딩뱃살 310 2018.02.21 16:44
>> [Python] pyuic5 사용 for Maya 푸딩뱃살 200 2018.02.21 12:28
205 [Qt] Qt Training - Qt Essentials Self-Study Pack 첨부파일 푸딩뱃살 98 2018.01.24 18:07
204 [Python] list형을 dictionary형으로 형변환 푸딩뱃살 217 2018.01.22 18:08
203 [Python] 개발 가상 환경을 위한 virtualenv 푸딩뱃살 185 2017.12.26 15:22
202 [Python] Qt.py .ui파일 불러오기 푸딩뱃살 312 2017.11.09 17:15
201 [Python] 환경 변수 추가 푸딩뱃살 234 2017.11.09 17:10
200 [Python] Anaconda 사용 푸딩뱃살 438 2017.08.28 17:51
199 [Python] url 인코딩/디코딩 푸딩뱃살 787 2017.08.12 19:23
198 [Python] Qt5(ui) to py 첨부파일 푸딩뱃살 486 2017.07.04 15:29