Ejemplo n.º 1
0
 def onLoginButtonClicked(self):
     company = unicode(self.tCompany.text())
     user = unicode(self.tAuthor.text())
     password = unicode(self.tPassword.text())
     
     if PillarsAssetClient.login(company, user, password):
         self.author = PillarsAssetClient.getAuthor(user)
         if self.author:
             PillarsUtils.writeCurrentAuthor(self.author)
         self.accept()
         self.close()
         return True
     else:
         return False
Ejemplo n.º 2
0
def getTasks(project_name, asset_name):
    url = r'http://%s/getTasks' % AssetServer
    parm = {}
    parm['project_name'] = project_name.encode('UTF-8')
    parm['asset_name'] = asset_name.encode('UTF-8')
    
    res = PillarsAssetClient.postAssetServer(url, parm, CookieFile)
    if res:
        try:
            task_list = json.loads(res)
            tasks = []
            for t_dic in task_list:
                task = PillarsCore.Task()
                task.load(t_dic)
                try:
                    v = int(string.atof(t_dic["version"]))
                    task.version = "%03d" % v
                except:
                    pass
                task.parent = asset_name
                tasks.append(task)
            return tasks
        except:
            return None
    else:
        return None
Ejemplo n.º 3
0
 def onGotoBarGoto(self):
     project_name = self.gotobar.getProject()
     asset_name = self.gotobar.getAsset()
     task_name = self.gotobar.getTask()
     
     self.assets = PillarsAssetClient.getAllAssets(project_name)
     self.tasks = PillarsAssetClient.getTasks(project_name, asset_name)
     self.updateAssetViewer()
     
     if self.assets:
         PillarsUtils.writeAssets(self.assets)
     if self.tasks:
         PillarsUtils.writeTasks(self.tasks)
     goto = PillarsCore.Goto(project_name, asset_name, task_name)
     PillarsUtils.writeGoto(goto)
     self.gotobar.setInfo("P:/Project/%s/%s/%s" % (goto.project, goto.asset, goto.task))
     print "Goto successful."
Ejemplo n.º 4
0
 def onProjButtonClick(self):
     proj_names = PillarsAssetClient.getAllProjectsByName()
     selui = SelectItemDialog(title = "Projects", items = proj_names)
     if selui.exec_() == QtGui.QDialog.Accepted:
         sel = selui.getSelected()
         self.tProj.setText(sel)
         self.tAsset.setText('')
         self.tTask.setText('')
         return True
     else:
         return False
Ejemplo n.º 5
0
 def onTaskButtonClick(self):
     project_name = unicode(self.tProj.text())
     asset_name = unicode(self.tAsset.text())
     if project_name and asset_name:
         task_names = PillarsAssetClient.getTasksByName(project_name, asset_name)
         selui = SelectItemDialog(title = "Tasks", items = task_names)
         if selui.exec_() == QtGui.QDialog.Accepted:
             sel = selui.getSelected()
             self.tTask.setText(sel)
             return True
         else:
             return False
Ejemplo n.º 6
0
 def onAssetButtonClick(self):
     project_name = unicode(self.tProj.text())
     if project_name:
         assets_names = PillarsAssetClient.getAllAssetsByName(project_name)
         selui = SelectItemDialog(title = "Assets", items = assets_names)
         if selui.exec_() == QtGui.QDialog.Accepted:
             sel = selui.getSelected()
             self.tAsset.setText(sel)
             self.tTask.setText('')
             return True
         else:
             return False
Ejemplo n.º 7
0
def getAuthor(author_name):
    url = r'http://%s/getAuthor' % AssetServer
    parm = {}
    parm['author_name'] = author_name.encode('UTF-8')
    
    res = PillarsAssetClient.postAssetServer(url, parm, CookieFile)
    if res:
        try:
            author_dic = json.loads(res)
            author = PillarsCore.Author()
            author.load(author_dic)
            return author
        except:
            return None
    else:
        return None
Ejemplo n.º 8
0
def getAllAssetNames(project_name):
    url = r'http://%s/getProjectAssets' % AssetServer
    parm = {}
    parm['project_name'] = project_name.encode('UTF-8')
    
    res = PillarsAssetClient.postAssetServer(url, parm, CookieFile)
    if res:
        try:
            asset_list = json.loads(res)
            assets_names = []
            for a in asset_list:
                assets_names.append(a.get("name", ""))
            return assets_names
        except:
            return None
    else:
        return None
Ejemplo n.º 9
0
def getAllProjectNames():
    url = r'http://%s/getAllProjects' % AssetServer
    parm = {}
    parm['project'] = 'all'
    
    res = PillarsAssetClient.postAssetServer(url, parm, CookieFile)
    if res:
        try:
            projs_list = json.loads(res)
            proj_names = []
            for proj_dic in projs_list:
                proj_names.append(proj_dic.get("name", ""))
            return proj_names
        except:
            return None
    else:
        return None
Ejemplo n.º 10
0
def getTaskNames(project_name, asset_name):
    url = r'http://%s/getTasks' % AssetServer
    parm = {}
    parm['project_name'] = project_name.encode('UTF-8')
    parm['asset_name'] = asset_name.encode('UTF-8')
    
    res = PillarsAssetClient.postAssetServer(url, parm, CookieFile)
    if res:
        try:
            task_list = json.loads(res)
            task_names = []
            for t_dic in task_list:
                task_names.append(t_dic.get('name', ''))
            return task_names
        except:
            return None
    else:
        return None
Ejemplo n.º 11
0
def getAllAssets(project_name):
    url = r'http://%s/getProjectAssets' % AssetServer
    parm = {}
    parm['project_name'] = project_name.encode('UTF-8')
    
    res = PillarsAssetClient.postAssetServer(url, parm, CookieFile)
    if res:
        try:
            asset_list = json.loads(res)
            assets = []
            for a in asset_list:
                asset = PillarsCore.Asset()
                asset.load(a)
                asset.setLocation(PillarsCore.getAssetPath(PillarsProjectDir, project_name, asset.group, asset.name))
                assets.append(asset)
            return assets
        except:
            return None
    else:
        return None
Ejemplo n.º 12
0
def login(company, username, password):
    login_url = 'http://%s/login/' % AssetServer
    if PillarsAssetClient.assetServerLogin(login_url, company.encode('UTF-8'), username, password, CookieFile):
        author = getAuthor(username)
        author.writeJson(AuthorFile)
    return True