/
gui.py
63 lines (50 loc) · 1.38 KB
/
gui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import sys,signal,os,threading
from threading import Thread
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt4.QtWebKit import *
from PyQt4.QtNetwork import *
from PyQt4 import QtGui, QtCore
import time
import server
import chancecoind
from lib import (config, util, exceptions, bitcoin, blocks)
from lib import (send, order, btcpay, bet, burn, cancel)
class ChancecoinThread(QtCore.QThread):
def __init__(self):
QtCore.QThread.__init__(self)
def run(self):
try:
chancecoind.set_options()
db = util.connect_to_db()
blocks.follow(db)
except:
pass
class ServerThread(QtCore.QThread):
def __init__(self):
QtCore.QThread.__init__(self)
def run(self):
server.start()
if getattr(sys, 'frozen', False):
file_frozen = sys.executable
else:
file_frozen = __file__
app = QApplication([])
app.setWindowIcon(QtGui.QIcon("./static/images/favicon.ico"))
win = QWidget()
win.resize(1200, 800)
win.setWindowTitle('Chancecoin')
layout = QVBoxLayout()
win.setLayout(layout)
s = ServerThread()
s.start()
c = ChancecoinThread()
c.start()
view = QWebView()
view.setUrl(QUrl("http://127.0.0.1:8080/"))
button = QtGui.QPushButton("Chancecoin Wallet")
button.clicked.connect(lambda: view.setUrl(QUrl("http://127.0.0.1:8080/")))
layout.addWidget(view)
layout.addWidget(button)
win.show()
app.exec_()