本文整理汇总了Python中shotgun_api3.Shotgun.find_one方法的典型用法代码示例。如果您正苦于以下问题:Python Shotgun.find_one方法的具体用法?Python Shotgun.find_one怎么用?Python Shotgun.find_one使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类shotgun_api3.Shotgun
的用法示例。
在下文中一共展示了Shotgun.find_one方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addSrc
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
def addSrc():
repo = '/mnt/karramba'
shotFoldList = ['anim', 'comp', 'data', 'fx', 'light', 'out', 'src', 'tmp']
seqFoldList = ['anim', 'comp', 'data', 'fx', 'light', 'out', 'shots']
dataFoldList = ['cache', 'geo', 'render', 'shadowmap', 'sim', 'track', 'photonmap']
outFoldList = ['dailies', 'hires']
site = 'https://chimneypot.shotgunstudio.com'
scriptName = 'addSrc'
scriptKey = 'd7dac4e2c55faf486875dfb944ffc9d8e49a0c44'
sg = Shotgun(site, scriptName, scriptKey)
projList = sg.find('Project', [], ['name'])
for i in projList:
print 'id:' + str(i['id']) + ' ' + i['name']
prId = int(raw_input('Print project id:'))
proj = sg.find_one('Project', [['id','is',prId]], ['name'])
if not [x for x in os.listdir(repo) if x==proj['name']]:
print "Project doesn't exist in repository"
return
s = os.sep
prPath = repo + s + proj['name']
seqPath = prPath + s + 'film' + s + 'sequences'
seqList = os.listdir(prPath + s + 'src')
for i in seqList:
sequenceFold = prPath + s + 'film' + s + 'sequences'
os.makedirs(sequenceFold + s + i)
for j in seqFoldList:
os.makedirs(sequenceFold + s + i + s + j)
for d in dataFoldList:
os.makedirs(sequenceFold + s + i + s + 'data' + s + d)
for o in outFoldList:
os.makedirs(sequenceFold + s + i + s + 'out' + s + o)
shList = os.listdir(prPath + s + 'src' + s + i)
for sh in shList:
shFold = sequenceFold + s + i + s + 'shots'
os.makedirs(shFold + s + sh)
for f in shotFoldList:
os.makedirs(shFold + s + sh + s + f)
for ds in dataFoldList:
os.makedirs(shFold + s + sh + s + 'data' + s + ds)
for ot in outFoldList:
os.makedirs(shFold + s + sh + s + 'out' + s + ot)
shutil.move(prPath + s + 'src' + s + i + s + sh, shFold + s + sh + s + 'src')
os.system('ln -sf ' + shFold + s + sh + s + 'src ' + prPath + s + 'src' + s + i + s + sh)
示例2: main
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
def main(notebookName):
#Get your developer token here: https://www.evernote.com/api/DeveloperToken.action and put it here
dev_token = 'yourEvernoteDevKey'
#Put your Shotgun script details here
sg = Shotgun('https://yourSite.shotgunstudio.com','evernote-shotgun','yourScriptKey')
#Put the Shotgun HumanUser ID here for the person you want to appear as the Note's author in Shotgun
sgUserId = 45
sgUser = sg.find_one("HumanUser",[['id', 'is', sgUserId]])
#Establish a connection to Evernote and store note and user data
client = EvernoteClient(token=dev_token, sandbox=False)
userStore = client.get_user_store()
user = userStore.getUser()
noteStore = client.get_note_store()
#Check if the supplied notebook exists, and if it does, send to processNotebook()
print('\nFinding notebook')
notebooks = noteStore.listNotebooks()
notebookNames = [notebook.name for notebook in notebooks]
if notebookName not in notebookNames:
print('\nSorry, there are no notebooks in your account named {0}'.format(notebookName))
else:
for notebook in notebooks:
if notebook.name == notebookName:
print('\nProcessing notebook - BEGIN')
processNotebook(noteStore, notebook, sg, sgUser)
print('\nProcessing notebook - DONE\n')
else:
continue
示例3: _moveFilesToPublish
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
def _moveFilesToPublish(self):
base_url = "http://bubblebathbay.shotgunstudio.com"
script_name = 'playBlastPublisher'
api_key = '718daf67bfd2c7e974f24e7cbd55b86bb101c4e5618e6d5468bc4145840e4558'
sgsrv = Shotgun(base_url = base_url , script_name = script_name, api_key = api_key, ensure_ascii=True, connect=True)
selectedShots = [item.text(0) for item in self.treeWidgetItems if item.checkState(0)]
if selectedShots:
for each in selectedShots:
episode = each.split('sh')[0]
shotName = '%s_sh%s' % (each.split('sh')[0], each.split('sh')[1].split('Lay')[0])
self.publishPath = self.publishingPath(episode, shotName)
for root, dirs, files in os.walk(self.shFldPath):
for fl in sorted(files):
if fl.endswith('.mov') and fl == '%s.mov' % each:
srcPath = os.path.join(root,fl)
self.playblastName = fl
while os.path.exists(os.path.join(self.publishPath, fl)):
allFiles= os.listdir(self.publishPath)
publishFiles = []
if allFiles:
for allFile in allFiles:
if allFile.endswith('.mov'):
publishFiles.append(allFile)
versionNumber = int(sorted(publishFiles)[-1].split('.v')[1].split('.mov')[0])
versionNumber += 1
if versionNumber < 10:
publishFileName = '%sLayout.v%03d.mov' % (shotName.replace('_', ''), versionNumber)
self.publishPath = os.path.join(self.publishPath, publishFileName)
self.playblastName = os.path.basename(self.publishPath)
else:
publishFileName = '%sLayout.v%02d.mov' % (shotName.replace('_', ''), versionNumber)
self.publishPath = os.path.join(self.publishPath, publishFileName)
self.playblastName = os.path.basename(self.publishPath)
shutil.copy2(srcPath, self.publishPath)
publishMovPath = os.path.join(self.publishingPath(episode, shotName), self.playblastName)
getShotTasks = sgsrv.find_one('Shot', filters = [["code", "is", shotName]], fields=['id', 'tasks'])
for key, values in getShotTasks.iteritems():
if key == 'tasks':
for value in values:
if value['name'] == 'Layout':
self.taskId = value['id']
if self.publishPath.endswith('review'):
self.publishPath = os.path.join(self.publishPath,fl)
self.playblastName = fl
data = { 'project': {'type':'Project','id': 66},
'code': self.playblastName,
'description': 'Layout playblast published',
'sg_path_to_movie': publishMovPath,
'sg_status_list': 'rev',
'entity': {'type':'Shot', 'id':getShotTasks['id']},
'sg_task': {'type':'Task', 'id':self.taskId},
'user': {'type':'HumanUser', 'id':92} }
result = sgsrv.create('Version', data)
result2 = sgsrv.upload("Version", result['id'], publishMovPath, "sg_uploaded_movie")
print "Done"
示例4: get_app_store_credentials
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
def get_app_store_credentials(connection):
""" Return the validated script for this site to connect to the app store """
(script, key) = __get_app_store_key(connection)
# get the proxy string from the connection
proxy = get_proxy_from_connection(connection)
# connect to the app store
try:
sg_app_store = Shotgun(constants.SGTK_APP_STORE, script, key, http_proxy=proxy)
# pull down the full script information
app_store_script = sg_app_store.find_one(
"ApiUser",
[["firstname", "is", script]],
fields=["type", "firstname", "id", "salted_password"])
except Exception:
return None
return app_store_script
示例5: studioShotgun
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
class studioShotgun(object):
def __init__(self, path, name, key, project):
self.SERVER_PATH = path
self.SCRIPT_NAME = name
self.SCRIPT_KEY = key
self.project_id = project
self.sg = Shotgun(self.SERVER_PATH, self.SCRIPT_NAME, self.SCRIPT_KEY)
#----------------------------------------------------------------------
## set Project id by ID
def setProjectId(self, newId):
self.project_id = newId
#----------------------------------------------------------------------
## set Project id by ID
def setProjectName(self, name):
newId = 0
projects = self.sg.find('Project', [], ['name'])
for project in projects:
if project['name'] == name:
newId = project['id']
self.project_id = newId
#----------------------------------------------------------------------
## find asset by name
def findAssetByName(self, name):
fields = ['id', 'code', 'sg_asset_type', 'tasks']
filters = [['project', 'is', {'type': 'Project', 'id': self.project_id}], ['code', 'is', name]]
result = self.sg.find('Asset', filters, fields)
return result
#----------------------------------------------------------------------
## find shot by name
def findShotByName(self, episode, shot):
fields = ['id', 'code', 'sg_asset_type', 'tasks', 'sg_sequence']
filters = [['project', 'is', {'type': 'Project', 'id': self.project_id}], ['code', 'is', shot]]
result = self.sg.find('Shot', filters, fields)
for x in result:
name = x['sg_sequence']['name'].split('_')[0]
if name == episode:
return x
return []
#----------------------------------------------------------------------
## upload thumbnail to asset
def uploadThumbnail(self, asset, thumbnail):
upload = 0
asset = self.findAssetByName(asset)
if asset:
upload = self.sg.upload_thumbnail("Asset", asset[0]['id'], thumbnail)
return upload
#----------------------------------------------------------------------
## create new asset
def createAsset(self, asset, assetType, template, assetFile='', description=''):
## find asset
asset = self.findAssetByName(asset)
if not asset:
## create asset + task template
filters = [['code', 'is', template]]
template = self.sg.find_one('TaskTemplate', filters)
data = {'project': {'type': 'Project', 'id': self.project_id},
'code': asset,
'description': description,
'sg_asset_type': assetType,
'sg_url_perforce': assetFile,
'task_template': template}
asset = self.sg.create('Asset', data)
return asset
#----------------------------------------------------------------------
## update file path in asset
def updateAssetFilePath(self, asset, filename):
asset = self.findAssetByName(asset)
data = {'sg_url_perforce': filename}
asset = self.sg.update("Asset", asset[0]['id'], data)
return asset
#----------------------------------------------------------------------
## create new version
def createVersion(self, shotId, taskId, userId, filename, comment=''):
curTime = datetime.now().strftime('%Y.%m.%d_%H.%M')
fname = str(filename.split('/')[-1].split('.')[0]) + '_' + curTime
data = {'project': {'type': 'Project', 'id': self.project_id},
'code': fname,
'description': comment,
#.........这里部分代码省略.........
示例6: Shotgun
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
sg = Shotgun(url, script_name, key)
filename = "Z:/Groupes-cours/NAND999-A15-N01/Nature/assets/mod/.thumb/banc_02_full.jpg"
result = sg.upload("Version",1048,filename,"sg_uploaded_movie")
my_local_file = {
'attachment_links': [{'type':'Version','id':1048}],
'project': {'type':'Project','id':146}
}
asset = sg.find_one("Asset", [["code","is","afficheOeuvre"]], ["code"])
sg_user = sg.find_one('HumanUser', [['login', 'is', "houdon.thibault"]])
data = {
'project': {'type':'Project','id':project_id},
'note_links': [asset],
'user': sg_user,
'content':'Test',
'subject':"Thibault's Note on afficheOeuvre"
}
sg.create("Note", data)
#version = sg.create("Version", data)
示例7: connect
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
from shotgun_api3 import Shotgun
if True:
sg = connect()
else:
sg = Shotgun('http://127.0.0.1:8020', 'name', 'key')
print sg.server_info
proj = sg.create('Project', {'name': 'Mock Project Test'})
seq = sg.create('Sequence', {'code': 'AA', 'project': proj})
shot = sg.create('Shot', {'code': 'AA_001', 'sg_sequence': seq})
print proj
print seq
print shot
#
# print sg.find('Project', [('id', 'is_not', 0)], ['name'], order=[
# {'field_name': 'id', 'direction': 'asc'},
# ])
print sg._call_rpc('count', None)
exit()
print sg.create('Project', {'name': 'Test Project'})
print sg.count()
print sg.find_one('Project', [], order=[
{'field_name': 'id', 'direction': 'asc'},
], fields=['task_assignees'])
示例8: DownloadPlaylist
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
#.........这里部分代码省略.........
if self.ALL_Local.isChecked():
eachBox.setChecked(True)
else:
eachBox.setChecked(False)
def _searchDropDown(self):
self.playListDropDown.clear()
for eachPlayList in sorted(self.allPlayLists):
if str(self.playListSearchInput.text()) in eachPlayList['code']:
self.playListDropDown.addItem(eachPlayList['code'])
def updateList(self):
self.playListDropDown.clear()
for eachPlayList in sorted(self.allPlayLists):
self.playListDropDown.addItem(eachPlayList['code'])
def _setPlaylist(self):
"""
Set the playlist from the current pulldown
"""
for eachPlayList in self.allPlayLists:
if eachPlayList['code'] == self.playListDropDown.currentText():
print 'Fetching versions for %s now..' % eachPlayList['code']
self.playlist = eachPlayList
else:
pass
def _getVersionInfo(self, versionData):
"""
Function to process the version data from shotgun
If we are under darwin osx change the path to local to match our project drives so the path to local is correct for osx
"""
getVersInfo = self.sgsrv.find_one('Version', filters = [["id", "is", versionData['id']]], fields = ['code', 'sg_path_to_movie', 'sg_uploaded_movie'])
pathToLocal = getVersInfo['sg_path_to_movie']
## Process the osx pathToLocal
if sys.platform == 'darwin':
if pathToLocal:
pathToLocal = pathToLocal.replace('I:', '/_projects').replace("\\", "/")
getVersInfo['sg_path_to_movie'] = pathToLocal
## Now process the URL
try:
url = getVersInfo['sg_uploaded_movie']['url']
except TypeError:
url = None
return getVersInfo['code'], pathToLocal, url, getVersInfo
def _checkFiles(self):
self._clearLists()
os.system('cls')
#os.system('echo Checking Playlist: %s \n' % self.playListDropDown.currentText())
os.system('echo Looking for files on local drive....\n')
self.tempSGFiles = []
self.missingLocalFiles = []
self.missingLocalFilesDict = {}
self.onlineFilesDict = {}
self.badfiles = []
self.getVersions = []
self.playList = []
self.missingUploadedMoveMsg = 'MISSING UPLOADED MOVIE. THIS NEEDS TO BE FIXED. PLEASE CONTACT CO-ORD ABOUT THIS!'
######################################################
示例9: Shotgun
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
from docx import Document
from shotgun_api3 import Shotgun
# Setting up API for Shotgun
SERVER_PATH = ""
SCRIPT_NAME = ''
SCRIPT_KEY = ''
sg = Shotgun(SERVER_PATH, SCRIPT_NAME, SCRIPT_KEY)
# Tools used to Query the project name to their ID
proj = sg.find_one("Project", [["name", "is", "Walt Denny"]])
print proj
query = sg.schema_read()['Asset'].keys()
print query
print sg.schema_read()['Asset'].get('sg_rpm_number')
# Function to format the text that gets read by Note_Thread_Read
def formatted(x):
x.pop("type", None)
x.pop("id", None)
Name = x.get('created_by', {}).get('name')
Name2 = x.get('user', {}).get('name')
global thread
if 'content' in x:
if Name == None:
thread += "\n"
thread += str(Name2) + ":"
thread += "\n"
else:
thread += "\n"
thread += str(Name) + ":"
示例10: get_fact_data
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
def get_fact_data():
ret = {}
raw_facts = subprocess.Popen(["facter"], stdout=subprocess.PIPE).communicate()[0]
for line in raw_facts.split("\n"):
try: line.index("=>")
except: continue
#print "facter: %s" % line
(key, value) = line.split("=>")
#print "fkey: %s fvalue: %s" % ( key, value )
ret[key.strip()] = value.strip()
return ret
hostname = gethostname().split('.', 1)[0]
asset = sg.find_one("Asset",[['code','is',hostname]],['id'])
if not asset:
print "couldn't find asset"
else:
# if we find a valid asset, sync the facts for it
fact_data = get_fact_data()
for fact_name,fact_value in fact_data.items():
if not fact_name in facts_to_sync: continue
fact_data = {
'code': fact_name,
'sg_asset': {'type':'Asset', 'id':asset['id']},
'description': fact_value,
'project': {'type':'Project', 'id':178},
}
示例11: StoryboardFileManagement
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
#.........这里部分代码省略.........
myPath = QFileDialog(self, 'rootDir', 'O:/EPISODE DELIVERY').getExistingDirectory().replace('\\', '/')
else:
myPath = QFileDialog(self, 'rootDir', '/Volumes/LemonSky/OUT TO LEMONSKY/EPISODE DELIVERY').getExistingDirectory().replace('\\', '/')
except :
myPath = QFileDialog(self, 'rootDir', '').getExistingDirectory().replace('\\', '/')
## try to get the epNumber from a file
epNum = os.listdir(myPath)[0].split('_')[0]
if epNum:
self.epNumber.setText(epNum)
self.sourceInput.setText(myPath)
self.sourceFolder = str(myPath)
self.doFileCheckboxes(myPath)
def _versionUp(self, path):
return int(max(os.listdir(path)).split('.v')[-1].split('.mov')[0]) + 1
def addStoryboardVersionToShotgun(self, path, epName, shotName, verNum, fullVersPublishName):
"""
Function to add the audio asset to shotgun correctly for tasks etc and the pipeline to see it
"""
#self.shotNum = each.text().split('.mov')[0]
#self.addStoryboardVersionToShotgun(str(self.shotReviewDir), str(self.epName), self.shotNum, self.vNum, self.shotReviewFileName)
## Now start processing stuff..
self.epName = epName.lower()
self.shotName = shotName.lower()
self.boardName = fullVersPublishName.lower()
self.taskName = 'StoryBoard'
self.sg_version = verNum
self.pathToMovie = '%s%s' % (path, self.boardName)
## First find it the task exists
self.getShotTasks = self.sgsrv.find_one('Shot', filters = [["code", "is", self.shotName]], fields=['id', 'tasks'])
## Now check and see if the task we need is there...
self.tasks = []
self.taskList = []
if self.getShotTasks:
for eachTaskDict in self.getShotTasks['tasks']:
self.tasks.append(eachTaskDict['name'])
self.taskList.append(eachTaskDict)
if self.taskName not in self.tasks:
## Create new task for the shot
self.myNewTask = self.sgsrv.create(
'Task',
{
'project':
{
'type': 'Project',
'id': 66
},
'step': {
'type': 'Step',
'id': 72,
'name': 'StoryBoard'
},
'content': 'StoryBoard',
'sg_status_list': 'apr',
'template_task': {
'type': 'Task',
'id': 31333
}
}
)
示例12: __init__
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
class genericUtils:
def __init__(self):
self.sg = Shotgun('https://' + URL,name,API)
def getFields (self, entity):
'''get the fields for a type/entity as a list so we can pass it as an arg easily
this is used all the time to make sure we get all the fields that we may ever need for a type/entity
'''
allFields = []
fields = self.sg.schema_field_read(entity)
for field in fields:
allFields.append(field)
return allFields
def project (self, project):
'''Gets the Shotgun project name and ID
'''
retFields = self.getFields('Project')
project = project.replace('_', ' ')
return self.sg.find_one("Project", [["name", "is", project]], retFields )
def sequence (self, project, sequence):
'''Returns the shotgun sequence name and ID
Parameters : (project, sequence)
'''
retFields = self.getFields('Sequence')
return self.sg.find_one("Sequence", [["code", "is", sequence],['project','is',project]], retFields)
def shot (self, project, shot):
'''Returns the shotgun shot name and ID
Parameters : (project, shot)
'''
retFields = self.getFields('Shot')
return self.sg.find_one('Shot',[['code','is',shot],['project','is',project]],retFields)
def createProject (self, project):
'''Creates a project in Shotgun given a project name
Parameters : (project)
'''
filters = [['code','is','a']]
template = self.sg.find_one('Project',[['name','is','a']],['layout_project','id'])
data = {'name':project,
'layout_project': template
}
return self.sg.create('Project',data)
def createSequence (self, project, sequence):
'''Creates a sequence in shotgun given
Parameters : (project, sequence)
'''
data = {'project': {"type":"Project","id": project['id']},
'code': sequence}
return self.sg.create('Sequence', data)
def createShot (self, project, shot, seq='', taskTemplateName=''):
'''Creates a sequence in shotgun given
Parameters : (project, shot, seq='', taskTemplateName='Basic shot template'
'''
filters = [['code','is',taskTemplateName ]]
template = self.sg.find_one('TaskTemplate',filters)
data = { 'project': {"type":"Project","id": project['id']},
'code': shot,
'task_template' : template,
'description': '',
'self.sg_sequence': seq,
'self.sg_status_list': 'wtg' }
result = self.sg.create('Shot', data)
return result
def notesFind (self, shotID):
'''Find all notes on a shot
Parameters : (shotID)
Output : Note data :
['tasks', 'attachments', 'updated_at', 'replies', 'id', 'subject', 'playlist', '
addressings_to', 'created_by', 'content', 'sg_status_list', 'reply_content',
'updated_by', 'addressings_cc', 'read_by_current_user', 'user', 'note_links',
'created_at', 'sg_note_from', 'project', 'sg_note_type', 'tag_list']
'''
note = self.sg.find('Note',[['note_links','is', shotID]],['subject','content', 'created_at'],[{'field_name':'created_at','direction':'desc'}])
return note
def notesFindLatest (self, shotID):
'''Find the latest note on a shot
Parameters : (shotID)
Call with notesFindLatest(shot)['content'] for the note content only
Output : Note data:
['tasks', 'attachments', 'updated_at', 'replies', 'id', 'subject', 'playlist', '
addressings_to', 'created_by', 'content', 'sg_status_list', 'reply_content',
'updated_by', 'addressings_cc', 'read_by_current_user', 'user', 'note_links',
'created_at', 'sg_note_from', 'project', 'sg_note_type', 'tag_list']
'''
note = self.notesFind(shotID)[0]
return note
def notesCreate(self, project, shotID, subject, content):
'''Create a note for a shot given
Parameters : (project, shotID, subject, content)
Output : noteID
#.........这里部分代码省略.........
示例13: Shotgun
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
__author__ = 'andrew.willis'
from shotgun_api3 import Shotgun
sg = Shotgun("http://andrewwillish.shotgunstudio.com", "scriptTest", "8b7db88321b7c296541580d1659872d2e63527c040b37b4a2ca0eb47f9da04cb")
proj = sg.find_one("Project",[['name','is','KIKO']])
print sg.create("shot",{'code':'SEQ01','project':proj})
#sg.update('Shot',shot['id'],{"sg_status_list":"ip"})
#sg.delete("Shot", 1160)
示例14: get_maxTask
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
sh.col(0).width = 0x0ff0
sh.col(1).width = 0x0ff0
sh.col(2).width = 0x0ff0
sh.col(3).width = 0x0ff0
sh.col(4).width = 0x0ff0
sh.col(5).width = 0x0ff0
sh.col(6).width = 0x0ff0
sh.col(7).width = 0x0ff0
sh.col(8).width = 0x0ff0
sh.col(9).width = 0x0ff0
sh.col(10).width = 0x0ff0
#sh.row(0).write(col_0, 'Issue', HEADER_CELL)
for cont in sg.find('HumanUser',filters , fields):
maxTaskinaWeek = get_maxTask(cont['id']) # get max task for each artist for a week
AtrName = sg.find_one('HumanUser',[["id","is",cont['id']]],['name'])['name']
sh.write(row, 0, AtrName,ARTIST_CELL)
MaxTaskFirstPointer = row
#if (AtrName == "Gyaneshwar Reddy") :
rowRegister = row # save row initial value
columnRegister = column # save column initial value
for idx, val in enumerate(get_week(datetime.datetime.now().date() - datetime.timedelta(days=7))): #for d in get_week(datetime.datetime.now().date()):
total = 0
column = column + 1
if (val.isoformat() <= datetime.date.today().strftime("%Y-%m-%d")):
ret = sg.find('TimeLog',[['user','is',{"type":"HumanUser","id":cont['id']}],\
["date","is",val.isoformat()]], ["duration","entity"])
if (ret != []):
switchForTask = 1
示例15: Main
# 需要导入模块: from shotgun_api3 import Shotgun [as 别名]
# 或者: from shotgun_api3.Shotgun import find_one [as 别名]
#.........这里部分代码省略.........
self.tray_icon_log_id = ""
self.tray_message = ""
self.trayIcon.hide()
#self.tray_icon.messageClicked.connect(self.tray_icon_message_clicked)
self.trayIcon.activated.connect(self.tray_icon_clicked)
# Initialize modules and connections
AssetLoader.__init__(self)
self.ReferenceTab.__init__(self)
self.RenderTab.__init__(self)
self.CommentWidget.__init__(self)
self.WhatsNew.__init__(self)
self.PeopleTab.__init__(self)
self.WhatsNew.load_whats_new(self)
self.check_last_active()
#self.check_news_thread = CheckNews(self)
#self.connect(self.check_news_thread, QtCore.SIGNAL("check_last_active"), self.check_last_active)
#self.check_news_thread.daemon = True
#self.check_news_thread.start()
self.show()
#self.check_shotgun_time_log()
def check_shotgun_time_log(self):
self.username = "mbeaudoin"
peoples = {"acorbin":"Alexandre Corbin", "costiguy":"Chloé Ostiguy", "cgonnord":"Christopher Gonnord", "erodrigue":"Etienne Rodrigue", "fpasquarelli":"Francis Pasquarelli", "jberger":"Jérémy Berger", "lgregoire":"Laurence Grégoire", "lclavet":"Louis-Philippe Clavet", "mbeaudoin":"Mathieu Beaudoin", "mroz":"Maxime Roz", "thoudon":"Thibault Houdon", "vdelbroucq":"Valentin Delbroucq", "yjobin":"Yann Jobin", "yshan":"Yi Shan"}
user = peoples[self.username]
project = self.sg.find_one("Project", [["id", "is", self.sg_project_id]])
time_log = self.sg.find("TimeLog", [["date", "in_calendar_day", -1], ["project", "is", project]], ["user"])
people_logged = [log["user"]["name"] for log in time_log]
people_logged = list(set(people_logged))
if user not in people_logged:
time_log_window = QtGui.QDialog(self)
time_log_window.setWindowTitle("Add your time log entry")
layout = QtGui.QVBoxLayout(time_log_window)
descriptionLabel = QtGui.QLabel(time_log_window)
durationLabel = QtGui.QLabel(time_log_window)
descriptionLabel.setText("Description")
durationLabel.setText("Duration")
self.description = QtGui.QLineEdit(time_log_window)
self.duration = QtGui.QLineEdit(time_log_window)
addLogEntryBtn = QtGui.QPushButton(time_log_window)
addLogEntryBtn.setText("Add Time Log Entry")
addLogEntryBtn.clicked.connect(self.shotgun_add_time_log)
didntWorkBtn = QtGui.QPushButton(time_log_window)
didntWorkBtn.setText("I didn't work on this project yesterday.")
layout.addWidget(durationLabel)
layout.addWidget(self.duration)
layout.addWidget(descriptionLabel)
layout.addWidget(self.description)
layout.addWidget(addLogEntryBtn)
layout.addWidget(didntWorkBtn)
time_log_window.exec_()
def shotgun_add_empty_time_log(self):