aboutsummaryrefslogtreecommitdiff
path: root/Core/Scripts/Interfaces/ART_Help.py
blob: 5e4ef8403dbbfb6026b006abc578e9a528fe989c (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
from ThirdParty.Qt import QtGui, QtCore, QtWidgets
from functools import partial
import maya.cmds as cmds
import os
import System.utils as utils

#Original Author: Jeremy Ernst


class ART_HelpMovie():
    def __init__(self, mainUI, moviePath):
        #Original Author: Jeremy Ernst

        #get the directory path of the tools
        settings = QtCore.QSettings("Epic Games", "ARTv2")
        self.toolsPath = settings.value("toolsPath")
        self.projectPath = settings.value("projectPath")
        self.iconsPath = settings.value("iconPath")
        self.mainUI = mainUI
        
        #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_HelpMovieWin", exists = True):
            cmds.deleteUI("ART_HelpMovieWin", wnd = True)
            
        self.buildHelpMovieUI(moviePath)
    

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    def buildHelpMovieUI(self, moviePath):
        #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);")
        self.mainWin.setMinimumSize(660,520)
        self.mainWin.setMaximumSize(660,520)
        
        #create the main widget
        self.mainWidget = QtWidgets.QWidget()
        self.mainWin.setCentralWidget(self.mainWidget)
        
        #create the qFrame so we can have a background
        self.frame = QtWidgets.QFrame(self.mainWidget)
        self.frame.setStyleSheet("background-color: rgb(0,0,0);")
        self.frame.setMinimumSize(660,520)
        self.frame.setMaximumSize(660,520)
        
        #set qt object name
        self.mainWin.setObjectName("ART_HelpMovieWin")
        self.mainWin.setWindowTitle("Help")

        #font
        headerFont = QtGui.QFont()
        headerFont.setPointSize(10)
        headerFont.setBold(True)
        
        #create the mainLayout for the rig creator UI
        self.layout = QtWidgets.QVBoxLayout(self.frame)
        
        #set up the screen
        self.movie_screen = QtWidgets.QLabel()
        
        # expand and center the label 
        self.movie_screen.setAlignment(QtCore.Qt.AlignCenter)
        self.layout.addWidget(self.movie_screen)
        
        
        #buttons and button layout
        self.buttonlayout = QtWidgets.QHBoxLayout()
        self.layout.addLayout(self.buttonlayout)
        
        spacer = QtWidgets.QSpacerItem(60,0)
        self.buttonlayout.addSpacerItem(spacer)
        
        self.playBtn = QtWidgets.QPushButton("Close")
        self.buttonlayout.addWidget(self.playBtn)
        self.playBtn.clicked.connect(partial(self.close))
        self.playBtn.setStyleSheet("background-image: url(" + self.imageBtnBkrd + ");background-color: rgb(25, 175, 255);")
        self.playBtn.setMinimumHeight(40)
        self.playBtn.setMaximumHeight(40)
        self.playBtn.setFont(headerFont)
        
        spacer = QtWidgets.QSpacerItem(60,0)
        self.buttonlayout.addSpacerItem(spacer)
        
        
        #set movie from file path
        self.movie = QtGui.QMovie(moviePath, QtCore.QByteArray()) 
        self.movie.setCacheMode(QtGui.QMovie.CacheAll) 
        self.movie.setSpeed(100) 
        self.movie_screen.setMovie(self.movie)
        
        self.movie.start()
        
        
        #show
        self.mainWin.show()

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

        if cmds.window("ART_HelpMovieWin", exists = True):
            cmds.deleteUI("ART_HelpMovieWin", wnd = True)