mirror of
https://github.com/jwinterm/RandomXStressGUI.git
synced 2026-10-17 05:41:41 +02:00
Update to get build working
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
dist/
|
||||||
|
build/
|
||||||
|
__pycache__/
|
||||||
|
main.spec
|
||||||
@@ -21,6 +21,13 @@ def enqueue_output(p, q):
|
|||||||
q.put_nowait(out.strip())
|
q.put_nowait(out.strip())
|
||||||
|
|
||||||
|
|
||||||
|
def resource_path(relative_path):
|
||||||
|
try:
|
||||||
|
base_path = sys._MEIPASS
|
||||||
|
except Exception:
|
||||||
|
base_path = os.path.abspath(".")
|
||||||
|
return os.path.join(base_path, relative_path)
|
||||||
|
|
||||||
class Window(Frame):
|
class Window(Frame):
|
||||||
|
|
||||||
def __init__(self, master=None):
|
def __init__(self, master=None):
|
||||||
@@ -30,8 +37,8 @@ class Window(Frame):
|
|||||||
self.p = None
|
self.p = None
|
||||||
self.q = queue.Queue()
|
self.q = queue.Queue()
|
||||||
self.threads = 4
|
self.threads = 4
|
||||||
self.imgStopped = ImageTk.PhotoImage(Image.open("notstress.jpg"))
|
self.imgStopped = ImageTk.PhotoImage(Image.open(resource_path("notstress.jpg")))
|
||||||
self.imgStarted = ImageTk.PhotoImage(Image.open("stress.jpg"))
|
self.imgStarted = ImageTk.PhotoImage(Image.open(resource_path("stress.jpg")))
|
||||||
self.checkbuttonvar = IntVar()
|
self.checkbuttonvar = IntVar()
|
||||||
self.init_window()
|
self.init_window()
|
||||||
|
|
||||||
@@ -82,14 +89,14 @@ class Window(Frame):
|
|||||||
self.threadsEntry.delete(0, 4)
|
self.threadsEntry.delete(0, 4)
|
||||||
self.threadsEntry.insert(0, self.threads)
|
self.threadsEntry.insert(0, self.threads)
|
||||||
if not self.checkbuttonvar.get():
|
if not self.checkbuttonvar.get():
|
||||||
self.p = subprocess.Popen([r"randomx-stress.exe", "-t", str(self.threads)],
|
self.p = subprocess.Popen([resource_path("randomx-stress.exe"), "-t", str(self.threads)],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
#shell=True,
|
#shell=True,
|
||||||
encoding='utf-8',
|
encoding='utf-8',
|
||||||
errors='replace')
|
errors='replace')
|
||||||
elif self.checkbuttonvar.get():
|
elif self.checkbuttonvar.get():
|
||||||
self.p = subprocess.Popen([r"randomx-stress.exe", "-t", str(self.threads), "-H"],
|
self.p = subprocess.Popen([resource_path("randomx-stress.exe"), "-t", str(self.threads), "-H"],
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
self.t = threading.Thread(target=enqueue_output, args=(self.p, self.q))
|
self.t = threading.Thread(target=enqueue_output, args=(self.p, self.q))
|
||||||
@@ -123,24 +130,26 @@ class Window(Frame):
|
|||||||
line = self.q.get_nowait()
|
line = self.q.get_nowait()
|
||||||
#newline = self.q.get(block=False)
|
#newline = self.q.get(block=False)
|
||||||
#newLine = newLine.decode('utf-8')
|
#newLine = newLine.decode('utf-8')
|
||||||
print(line)
|
#print(line)
|
||||||
try:
|
try:
|
||||||
#hashrate = line.split(' ')[0]
|
#hashrate = line.split(' ')[0]
|
||||||
hashrate = re.findall("\d+\.\d+", line)[0]
|
hashrate = re.findall("\d+\.\d+", line)[0]
|
||||||
print(hashrate)
|
#print(hashrate)
|
||||||
self.hashrateLabel.config(text="Hashrate: {0:.2f} h/s".format(float(hashrate)))
|
self.hashrateLabel.config(text="Hashrate: {0:.2f} h/s".format(float(hashrate)))
|
||||||
except:
|
except:
|
||||||
print("cant parse")
|
pass
|
||||||
|
# print("cant parse")
|
||||||
except:
|
except:
|
||||||
print("error")
|
pass
|
||||||
|
#print("error")
|
||||||
self.hashrateLabel.after(2000, self.refresh_hashrate)
|
self.hashrateLabel.after(2000, self.refresh_hashrate)
|
||||||
|
|
||||||
def client_exit(self):
|
def client_exit(self):
|
||||||
exit()
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
root = Tk()
|
root = Tk()
|
||||||
root.iconbitmap('./stress.ico')
|
root.iconbitmap(default=resource_path('stress.ico'))
|
||||||
root.geometry("400x300")
|
root.geometry("400x300")
|
||||||
|
|
||||||
app = Window(root)
|
app = Window(root)
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
block_cipher = None
|
||||||
|
|
||||||
|
|
||||||
|
a = Analysis(['main.py'],
|
||||||
|
pathex=['C:\\Users\\johnw\\src\\randomxstressgui'],
|
||||||
|
binaries=[],
|
||||||
|
datas=[('stress.jpg', '.'), ('notstress.jpg', '.'), ('randomx-stress.exe', '.'), ('stress.ico', '.')],
|
||||||
|
hiddenimports=[],
|
||||||
|
hookspath=[],
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
win_no_prefer_redirects=False,
|
||||||
|
win_private_assemblies=False,
|
||||||
|
cipher=block_cipher,
|
||||||
|
noarchive=False)
|
||||||
|
pyz = PYZ(a.pure, a.zipped_data,
|
||||||
|
cipher=block_cipher)
|
||||||
|
exe = EXE(pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.zipfiles,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name='main',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=True , icon='stress.ico')
|
||||||
Reference in New Issue
Block a user