aboutsummaryrefslogtreecommitdiff
path: root/Core/Scripts/Interfaces/ART_RigHistoryUI.py
blob: 20540e69498ae643614c132047bdcc8e4c75bfe1 (plain) (blame)
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
132
133
134
135
136
'''
Created on Aug 26, 2015

@author: jeremy.ernst
'''

from ThirdParty.Qt import QtGui, QtCore, QtWidgets
import maya.cmds as cmds
import os, json
import System.utils as utils




class ART_RigHistoryUI():
    #Original Author: Jeremy Ernst

    def __init__(self, mainUI):

        #get the directory path of the tools
        settings = QtCore.QSettings("Epic Games", "ARTv2")
        self.toolsPath = settings.value("toolsPath")
        self.iconsPath = settings.value("iconPath")
        self.scriptPath = settings.value("scriptPath")
        self.projectPath = settings.value("projectPath")


        self.mainUI = mainUI
        self.rigData = []
        self.warnings = 0
        self.errors = 0

        #images
        self.imageBkgrd =  utils.returnFriendlyPath(os.path.join(self.iconsPath, "System/toolbar_background.png"))
        self.imageBtnBkrd =  utils.returnFriendlyPath(os.path.join(self.iconsPath, "System/blue_field_background.png"))
        self.frameBackground =  utils.returnFriendlyPath(os.path.join(self.iconsPath, "System/field_background.png"))


        #build the UI
        if cmds.window("ART_RigHistWin", exists = True):
            cmds.deleteUI("ART_RigHistWin", wnd = True)

        self.buildUI()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def buildUI(self):
        #Original Author: Jeremy Ernst

        #create the main window
        self.mainWin = QtWidgets.QMainWindow(self.mainUI)
        self.mainWin.setStyleSheet("background-color: rgb(0, 0, 0);, color: rgb(0,0,0);")

        styleSheetFile = utils.returnNicePath(self.toolsPath, "Core/Scripts/Interfaces/StyleSheets/mainScheme.qss")
        f = open(styleSheetFile, "r")
        self.style = f.read()
        f.close()

        self.mainWin.setStyleSheet(self.style)


        #create the main widget
        self.mainWidget = QtWidgets.QWidget()
        self.mainWin.setCentralWidget(self.mainWidget)

        #set qt object name
        self.mainWin.setObjectName("ART_RigHistWin")
        self.mainWin.setWindowTitle("Rig History")

        #font
        headerFont = QtGui.QFont()
        headerFont.setPointSize(8)
        headerFont.setBold(True)

        #set size policy
        mainSizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)

        #create the mainLayout for the rig creator UI
        self.layout = QtWidgets.QVBoxLayout(self.mainWidget)


        self.mainWin.resize(400, 240)
        self.mainWin.setSizePolicy(mainSizePolicy)
        self.mainWin.setMinimumSize(QtCore.QSize( 400, 240 ))
        self.mainWin.setMaximumSize(QtCore.QSize( 400, 240 ))

        #create the QFrame for this page
        self.background = QtWidgets.QFrame()
        self.layout.addWidget(self.background)
        self.mainLayout = QtWidgets.QVBoxLayout(self.background)
        self.background.setObjectName("epic")


        #detailed information
        self.infoText = QtWidgets.QTextEdit()
        self.mainLayout.addWidget(self.infoText)
        self.infoText.setMinimumSize(QtCore.QSize( 360, 200 ))
        self.infoText.setMaximumSize(QtCore.QSize( 360, 200 ))
        self.infoText.setReadOnly(True)
        self.infoText.setWordWrapMode(QtGui.QTextOption.WordWrap)

        #show the window
        self.mainWin.show()

        self.getHistory()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def getHistory(self):


        characterNode = "ART_RIG_ROOT"
        data = json.loads(cmds.getAttr(characterNode + ".versionNote"))

        for each in data:

            version = each[0]
            info = each[1]
            user = each[2]

            self.infoText.setTextColor(QtGui.QColor(236,217,0))
            self.infoText.append("Version #: " + str(version))
            self.infoText.setTextColor(QtGui.QColor(255,255,255))
            self.infoText.append("Description: " + info)
            self.infoText.setTextColor(QtGui.QColor(0,255,0))
            self.infoText.append("User: " + user + "\n\n")