Fix this GUI bug once and for all

master
Arinerron 2018-04-22 21:54:51 -07:00
parent 4052a91f35
commit db2babac29
No known key found for this signature in database
GPG Key ID: 99383627861C62F0
1 changed files with 18 additions and 21 deletions

View File

@ -17,10 +17,6 @@
# Imports some useful libraries # Imports some useful libraries
import logger, config import logger, config
try:
from tkinter import *
except:
pass
import os, sqlite3, core import os, sqlite3, core
def sendMessage(): def sendMessage():
@ -59,37 +55,38 @@ def update():
def openGUI(): def openGUI():
import tkinter
global root, runningCheckDelay, runningCheckDelayCount, scrollbar, listedBlocks, nodeInfo, keyInfo, idText, idEntry, pubKeyEntry, listbox, daemonStatus, sendEntry global root, runningCheckDelay, runningCheckDelayCount, scrollbar, listedBlocks, nodeInfo, keyInfo, idText, idEntry, pubKeyEntry, listbox, daemonStatus, sendEntry
root = Tk() root = tkinter.Tk()
root.title("Onionr GUI") root.title("Onionr GUI")
runningCheckDelay = 5 runningCheckDelay = 5
runningCheckDelayCount = 4 runningCheckDelayCount = 4
scrollbar = Scrollbar(root) scrollbar = tkinter.Scrollbar(root)
scrollbar.pack(side=RIGHT, fill=Y) scrollbar.pack(side=tkinter.RIGHT, fill=tkinter.Y)
listedBlocks = [] listedBlocks = []
nodeInfo = Frame(root) nodeInfo = tkinter.Frame(root)
keyInfo = Frame(root) keyInfo = tkinter.Frame(root)
print(pluginapi.get_onionr().get_hostname()) print(pluginapi.get_onionr().get_hostname())
idText = pluginapi.get_onionr().get_hostname() idText = pluginapi.get_onionr().get_hostname()
idEntry = Entry(nodeInfo) idEntry = tkinter.Entry(nodeInfo)
Label(nodeInfo, text="Node Address: ").pack(side=LEFT) tkinter.Label(nodeInfo, text="Node Address: ").pack(side=tkinter.LEFT)
idEntry.pack() idEntry.pack()
idEntry.insert(0, idText.strip()) idEntry.insert(0, idText.strip())
idEntry.configure(state="readonly") idEntry.configure(state="readonly")
nodeInfo.pack() nodeInfo.pack()
pubKeyEntry = Entry(keyInfo) pubKeyEntry = tkinter.Entry(keyInfo)
Label(keyInfo, text="Public key: ").pack(side=LEFT) tkinter.Label(keyInfo, text="Public key: ").pack(side=tkinter.LEFT)
pubKeyEntry.pack() pubKeyEntry.pack()
pubKeyEntry.insert(0, pluginapi.get_core()._crypto.pubKey) pubKeyEntry.insert(0, pluginapi.get_core()._crypto.pubKey)
@ -97,19 +94,19 @@ def openGUI():
keyInfo.pack() keyInfo.pack()
sendEntry = Entry(root) sendEntry = tkinter.Entry(root)
sendBtn = Button(root, text='Send Message', command=sendMessage) sendBtn = tkinter.Button(root, text='Send Message', command=sendMessage)
sendEntry.pack(side=TOP, pady=5) sendEntry.pack(side=tkinter.TOP, pady=5)
sendBtn.pack(side=TOP) sendBtn.pack(side=tkinter.TOP)
listbox = Listbox(root, yscrollcommand=scrollbar.set, height=15) listbox = tkinter.Listbox(root, yscrollcommand=tkinter.scrollbar.set, height=15)
listbox.pack(fill=BOTH, pady=25) listbox.pack(fill=tkinter.BOTH, pady=25)
daemonStatus = Label(root, text="Onionr Daemon Status: unknown") daemonStatus = tkinter.Label(root, text="Onionr Daemon Status: unknown")
daemonStatus.pack() daemonStatus.pack()
scrollbar.config(command=listbox.yview) scrollbar.config(command=tkinter.listbox.yview)
root.after(2000, update) root.after(2000, update)
root.mainloop() root.mainloop()