def GetAlive(mode): if mode == 'system': api = postshiftapi.Api() tm = api.GetLiveTime(keyList[-1]).get('livetime') return tm if mode == 'display': api = postshiftapi.Api() tm = api.GetLiveTime(keyList[-1]).get('livetime') messagebox.showinfo('Info', str(tm))
def delmail(): api = postshiftapi.Api() api.DeleteMail(keyList[-1]) root.title('PyTemp') clearButtons() ClearText() scrolls_clear() global th th._stop() del keyList[-1], api
def displayMessage(mID): scrolls_clear() api = postshiftapi.Api() message = api.GetText(keyList[-1], mID).get('message') print(message) text = tk.Text(width=60, height=20) text.place(x=500, y=20) textList.append(text) scroll = tk.Scrollbar(command=text.yview) scroll.pack(side=tk.RIGHT, fill=tk.Y) scrolls.append(scroll) text.config(yscrollcommand=scroll.set) text.insert(1.0, message)
def createmail(): name = simpledialog.askstring('Input', 'Give a name') api = postshiftapi.Api() MailData = api.CreateNew(name) print(MailData) mail = MailData.get('email') key = MailData.get('key') root.title('PyTemp - ' + mail) keyList.append(key) messagebox.showinfo( 'Mail', 'Mail: ' + mail + '\nKey: ' + key + '\nLiveTime: ' + str(GetAlive('system'))) global th th = threading.Thread(target=refreshList, args=()) th.start()
def setMessages(): global y api = postshiftapi.Api() if api.CheckInbox(keyList[-1]) == True: messages = api.GetList(keyList[-1]) for message in messages: subject = message.get('subject') fromuser = message.get('from') mID = message.get('id') btn = tk.Button(text='Subject: ' + subject + '\nFrom:' + fromuser, command=lambda e=mID: displayMessage(e), width=40, height=2) btn.place(x=0, y=y * 40) buttonList.append(btn) y += 1 y = 0
def UpdateLiveTime(): api = postshiftapi.Api() api.UpdateLiveTime(keyList[-1])