Initial attempt at wrapping qubit cpuminer with kivy gui

This commit is contained in:
jwinterm
2014-09-10 09:07:09 -05:00
commit 2b5365f28b
7 changed files with 131 additions and 0 deletions
BIN
View File
Binary file not shown.
+65
View File
@@ -0,0 +1,65 @@
#:kivy 1.8.0
<RootWidget>:
id: rootwidget
threadInput: threadInput
urlInput: urlInput
userAddress: userAddress
outputLabel: outputLabel
orientation: 'vertical'
padding: 30,30,30,30
Image:
size_hint: 1,0.5
source: 'logo_wide.png'
Label:
size_hint: 1,0.25
text: "Myriadcoin Qubit CPU Miner"
BoxLayout:
size_hint: 1,0.1
orientation: 'horizontal'
Label:
text: "Threads (max=# of cpu cores, min=1)"
TextInput:
id: threadInput
multiline: False
text: "1"
BoxLayout:
size_hint: 1,0.1
orientation: 'horizontal'
Label:
text: "Mining pool and port"
TextInput:
id: urlInput
multiline: False
text: "birdspool.no-ip.org:5567"
BoxLayout:
size_hint: 1,0.1
orientation: 'horizontal'
Label:
text: "Wallet address"
TextInput:
id: userAddress
multiline: False
text: "MG97oqVi6aAv3gsT4g27DNonoTYhYd5tXk"
BoxLayout:
padding: 0,30,0,30
size_hint: 1,0.35
orientation: 'horizontal'
Button:
text: "Start mining"
on_press: root.start_miner()
Button:
text: "Stop mining"
on_press: root.stop_miner()
Label:
id: outputLabel
size_hint: 1,0.2
+66
View File
@@ -0,0 +1,66 @@
#!/usr/bin/env python
from subprocess import PIPE, Popen
from threading import Thread
from Queue import Queue, Empty
from os import system
from kivy.app import App
from kivy.properties import ObjectProperty
from kivy.uix.boxlayout import BoxLayout
from kivy.config import Config
from kivy.clock import Clock
def enqueue_output(out, queue):
for line in iter(out.readline, b''):
queue.put(line)
out.close()
class RootWidget(BoxLayout):
"""Root Kivy box layout class"""
threadInput = ObjectProperty()
urlInput = ObjectProperty()
userAddress = ObjectProperty()
outputLabel = ObjectProperty()
p = None
q = Queue()
def __init__(self, **kwargs):
super(RootWidget, self).__init__(**kwargs)
def start_miner(self):
self.p = Popen(["QubitCPU32.exe", "-a", "qubit",
"-t", self.threadInput.text, "-o", self.urlInput.text,
"-u", self.userAddress.text, "-p", "x"],
stdout=PIPE,
stdin=PIPE,
bufsize=1)
t = Thread(target=enqueue_output, args=(self.p.stdout, self.q))
t.daemon = True # thread dies with the program
t.start()
Clock.schedule_interval(self.read_queue, 0.1)
def stop_miner(self):
system("taskkill /im QubitCPU32.exe /f")
# exit(0)
def read_queue(self, dt):
try:
line = self.q.get_nowait()
print line+line
self.outputLabel.text = line
except Empty:
pass
class KivyMiner(App):
def build(self):
return RootWidget()
if __name__ == '__main__':
Config.set('kivy', 'exit_on_escape', 0)
KivyMiner().run()
system("taskkill /im QubitCPU32.exe /f")
BIN
View File
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
View File
Binary file not shown.