Skip to content

Commit

Permalink
add Token Functieon and Ui Fix
Browse files Browse the repository at this point in the history
add store TokenFunction  to Mainui
Fix a Ui problem at Ref View
  • Loading branch information
nervYu committed Apr 22, 2020
1 parent cfeacfb commit ecdf069
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
2 changes: 2 additions & 0 deletions mainUi/BambooLaunch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 25 additions & 3 deletions mainUi/moudle/bambooBasicMoudle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -69,4 +69,26 @@ def getTaskDict(colum, ids):
taskList = getVer4User(ids[0], shotName, colum[n])
taskdict[taskType] = taskList
n += 1
return taskdict
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())

2 changes: 1 addition & 1 deletion mainUi/ui/bambooMainUi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit ecdf069

Please sign in to comment.