def assignShot(self, artistShotDict): """ This will assign the shots to the artists. :param artistShotDict: :type artistShotDict: :return: :rtype: """ self.commentDict = dict() for key, val in artistShotDict.iteritems(): self.shotLists = list() artistName = key self.receiver = '{}@pcgi.com'.format(artistName) # self.commentDict[self.episode] = val self.shotLists = [x for x in val] for each in val: with ConnectDB(self.project) as newdBConn: # shotName = val msg = 'UPDATE `{0}` SET `{1}_artist_name`="{2}",`{3}_status`="NYS" WHERE `shots` = "{4}"'.format( self.episode, self.dept, artistName, self.dept, each) print '------------------------------------------------------' print msg print '------------------------------------------------------' newdBConn.execute(msg) self.mailScenarios('Assign')
def populateArtists(self): dept = self.dept_cb.currentText() dept = 'ani' if dept == 'Animation' else 'lay' artistList = list() with ConnectDB('users') as dbCur: dbCur.execute( 'SELECT `empname` FROM `emp` WHERE `empdepts` LIKE "%{0}%" ORDER BY `empid` ASC' .format(dept)) for eachArtist in dbCur.fetchall(): artistList.append(eachArtist[0])
def updateEpisode(self): projectName = self.project_cb.currentText() self.episode_cb.clear() if projectName == 'Select': return False self.episode_cb.addItem('Select') with ConnectDB(project=projectName) as dbCur: dbCur.execute('SHOW TABLES') for eachEpisode in dbCur: self.episode_cb.addItem(eachEpisode[0])
def getArtistList(self, model): artistList = list() self.allArtists = list() dept = 'ani' if self.dept_cb.currentText() == 'Animation' else 'lay' with ConnectDB('users') as dbConn: dbConn.execute( 'SELECT empname FROM `emp` WHERE `empdepts` LIKE "%{0}%" ORDER BY `empid` ASC' .format(dept)) for eachArtist in dbConn.fetchall(): artistList.append(eachArtist[0]) self.allArtists = artistList model.setStringList(artistList)
def makeShotsNew(self): project = self.project_cb.currentText() episode = self.episode_cb.currentText() dept = 'anim' if self.dept_cb.currentText() == 'Animation' else 'lay' for eachRow in self.getSelectedRows(): shotName = self.tableWidget.item(eachRow, 0).text() print 'Wiping the database for {}'.format(shotName) with ConnectDB(project) as newDBConn: msg = 'UPDATE `{0}` SET `{1}_status`=NULL, `{2}_artist_name`=NULL, `{3}_comments`=NULL WHERE `shots`' \ ' = "{4}"'.format(episode, dept, dept, dept, shotName) newDBConn.execute(msg) self.refreshTable()
def SFAShot(self): project = self.project_cb.currentText() episode = self.episode_cb.currentText() dept = 'anim' if self.dept_cb.currentText() == 'Animation' else 'lay' # get the selected rows. rows = list() for e in self.tableWidget.selectedIndexes(): if e.row() not in rows: rows.append(e.row()) for eachRow in rows: shotName = self.tableWidget.item(eachRow, 0).text() with ConnectDB(project) as newDBConn: msg = 'UPDATE `{0}` SET `{1}_status`="SFA" WHERE `shots` = "{2}"'.format( episode, dept, shotName) newDBConn.execute(msg) self.refreshTable()
def retakeShot(self, artistShotDict): """ This will add a retake to the shots with the retake comments. :param artistShotDict: :type artistShotDict: :return: :rtype: """ self.commentDict = dict() for key, val in artistShotDict.iteritems(): artistName = key self.receiver = artistName with ConnectDB(self.project) as newdBConn: for each in val: shotName, comment = each self.commentDict[shotName] = comment msg = 'UPDATE `{0}` SET `{1}_status`="TWIP", `{2}_comments`="{3}" WHERE `shots` = "{4}"'.format( self.episode, self.dept, self.dept, comment, shotName) newdBConn.execute(msg) self.mailScenarios('Retake')
def approveShot(self, artistShotDict): """ This will approve the shots. :param artistShotDict: :type artistShotDict: :return: :rtype: """ self.commentDict = dict() for key, val in artistShotDict.iteritems(): self.shotLists = list() artistName = key self.receiver = artistName self.shotLists = [x for x in val] with ConnectDB(self.project) as newdBConn: # shotName = val for each in val: msg = 'UPDATE `{0}` SET `{1}_status`="APP" WHERE `shots` = "{2}"'.format( self.episode, self.dept, each) print msg newdBConn.execute(msg) self.mailScenarios('Approve')
def updateTable(self): # print self.project_cb.currentText() self.populateArtists() dept = self.dept_cb.currentText() episode = self.episode_cb.currentText() if dept == 'Select': return False dept = 'anim' if dept == 'Animation' else 'lay' dbQuerry = 'SELECT `shots`, `Start_Frame`, `End_Frame`, `%s_artist_name`, `%s_status`, `Session_Status`, ' \ '`%s_startdate`, `%s_enddate`, `%s_publishdate`, `%s_comments` FROM `%s` ORDER BY `%s`.`shots` ASC' \ % (dept, dept, dept, dept, dept, dept, episode, episode) # dbData = None with ConnectDB(self.project_cb.currentText()) as dbCur: dbCur.execute(dbQuerry) self.dbData = dbCur.fetchall() headers = [ 'shots', 'Start_Frame', 'End_Frame', '%s_artist_name' % dept, '%s_status' % dept, 'Session_Status', '%s_startdate' % dept, '%s_enddate' % dept, '%s_publishdate' % dept, '%s_comments' % dept ] self.tableWidget.setRowCount(len(self.dbData)) self.tableWidget.setColumnCount(len(self.dbData[0])) for i, each in enumerate(headers): itm = QtGui.QTableWidgetItem(each) self.tableWidget.setHorizontalHeaderItem(i, itm) for row, eachRow in enumerate(self.dbData): for col, eachCol in enumerate(eachRow): itm = QtGui.QTableWidgetItem(eachCol) self.tableWidget.setItem(row, col, itm)
def reassignShot(self, artistShotDict): """ This will reassign the shots to the passed artists with a comment of why it's been reassigned. :param artistShotDict: :type artistShotDict: :return: :rtype: """ self.commentDict = dict() for key, val in artistShotDict.iteritems(): self.receiver = '{}@pcgi.com'.format(key) with ConnectDB(self.project) as newdBConn: artistName = key for each in val: shotName, comment = each self.commentDict[shotName] = comment msg = 'UPDATE `{0}` SET `{1}_artist_name`="{2}", `{3}_comments`=CONCAT(COALESCE({4}_comments,' \ ' ""), "{5}"), `{7}_status`="TWIP" WHERE `shots` = "{6}"'.format(self.episode, self.dept, artistName, self.dept, self.dept, comment, shotName, self.dept) newdBConn.execute(msg) self.mailScenarios('Reassign')