-
Notifications
You must be signed in to change notification settings - Fork 0
/
pui.py
43 lines (33 loc) · 1.22 KB
/
pui.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
import ahfklib as lib
from boardwidget import BoardWidget
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
import sys
def color_window_background(window, color):
window.setAutoFillBackground(True)
palette = window.palette()
palette.setColor(QPalette.Window, QColor(color))
window.setPalette(palette)
def color_widget_background(widget, color):
palette = widget.palette()
palette.setColor(QPalette.Active, QPalette.Base, QColor(color))
palette.setColor(QPalette.Inactive, QPalette.Base, QColor(color))
widget.setPalette(palette)
class MainWindow(QMainWindow):
def __init__(self, board=None, *args, **kwargs):
super().__init__(*args, **kwargs)
if board is not None:
self.board = board
else:
if lib.ahfk.last_board is not None:
self.board = lib.ahfk.last_board
else:
self.board = lib.new_board('default board')
self.setWindowTitle('ahfkanban - {}'.format(self.board.name))
widget = BoardWidget(self.board)
self.setCentralWidget(widget)
if __name__ == '__main__':
app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec_()