mirror of
https://github.com/jwinterm/kivy-cpuminer.git
synced 2026-10-28 06:28:52 +01:00
Initial attempt at wrapping qubit cpuminer with kivy gui
This commit is contained in:
Binary file not shown.
@@ -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
|
||||
@@ -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")
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
Binary file not shown.
Reference in New Issue
Block a user