diff --git a/mainUi/BambooLaunch.py b/mainUi/BambooLaunch.py index ba89cb3..0a323bb 100644 --- a/mainUi/BambooLaunch.py +++ b/mainUi/BambooLaunch.py @@ -29,12 +29,14 @@ def __init__(self, parent=None): def logFunc(self): results = bbm.logIn(self.username.text(), self.passwd.text(), self.host.text()) if results[1] == 0 : + bbm.storeToken(results[2]) QMessageBox.information(self, "greet", results[0]) self.close() self.mainW = mainWindowT() self.mainW.show() else: QMessageBox.information(self, "Error", results[0]) + ''' Main Ui diff --git a/mainUi/moudle/bambooBasicMoudle.py b/mainUi/moudle/bambooBasicMoudle.py index a316cbf..85953bd 100644 --- a/mainUi/moudle/bambooBasicMoudle.py +++ b/mainUi/moudle/bambooBasicMoudle.py @@ -19,11 +19,11 @@ def logIn(userName, passwd, host): if you use http server just replace https to http ''' try: - gazu.log_in(userName, passwd) + token = gazu.log_in(userName, passwd) except: return ['Bad UserName or Password Refill Again', 1] else: - return ['Hello '+gazu.client.get_current_user()["first_name"], 0] + return ['Hello '+gazu.client.get_current_user()["first_name"], 0, token] def getProject4User(): @@ -69,4 +69,26 @@ def getTaskDict(colum, ids): taskList = getVer4User(ids[0], shotName, colum[n]) taskdict[taskType] = taskList n += 1 - return taskdict \ No newline at end of file + return taskdict + +def storeToken(token): + path = os.path.expanduser('~') + '\.bamboo' + mWorkPath = os.getcwd() + tokenPath = path + './token' + if not os.path.exists(path): + os.makedirs(tokenPath) + else: + if not os.path.exists(tokenPath): + os.makedirs(tokenPath) + else: + pass + os.chdir(tokenPath) + if os.path.isfile('token'): + os.remove('token') + tokenF = open('token', 'w', encoding='utf-8') + tokenStr = str(token) + tokenF.write(tokenStr) + tokenF.close() + os.chdir(mWorkPath) + print(os.getcwd()) + diff --git a/mainUi/ui/bambooMainUi.py b/mainUi/ui/bambooMainUi.py index df99365..c9dea0b 100644 --- a/mainUi/ui/bambooMainUi.py +++ b/mainUi/ui/bambooMainUi.py @@ -55,7 +55,7 @@ def setupUi(self, bambooMain): self.tab.setObjectName(u"tab") self.refTree = QTreeView(self.tab) self.refTree.setObjectName(u"refTree") - self.refTree.setGeometry(QRect(-1, -6, 511, 231)) + self.refTree.setGeometry(QRect(-2, -1, 511, 221)) self.tabArea01.addTab(self.tab, "") self.toolTab = QWidget() self.toolTab.setObjectName(u"toolTab")