settins + mainscreen 1/6
This commit is contained in:
parent
ba5c7773e8
commit
ddc89d1664
@ -0,0 +1,66 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from PySide import QtGui, QtCore
|
||||||
|
|
||||||
|
|
||||||
|
class MainWindow(QtGui.QWidget):
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super(MainWindow, self).__init__()
|
||||||
|
self.initUI()
|
||||||
|
|
||||||
|
def setup_left_top(self, Form):
|
||||||
|
Form.setObjectName("Form")
|
||||||
|
Form.resize(500, 300)
|
||||||
|
Form.setMinimumSize(QtCore.QSize(250, 100))
|
||||||
|
Form.setMaximumSize(QtCore.QSize(250, 100))
|
||||||
|
Form.setBaseSize(QtCore.QSize(2500, 100))
|
||||||
|
self.graphicsView = QtGui.QGraphicsView(Form)
|
||||||
|
self.graphicsView.setGeometry(QtCore.QRect(10, 20, 64, 64))
|
||||||
|
self.graphicsView.setMinimumSize(QtCore.QSize(64, 64))
|
||||||
|
self.graphicsView.setMaximumSize(QtCore.QSize(64, 64))
|
||||||
|
self.graphicsView.setBaseSize(QtCore.QSize(64, 64))
|
||||||
|
self.graphicsView.setObjectName("graphicsView")
|
||||||
|
self.label = QtGui.QLabel(Form)
|
||||||
|
self.label.setGeometry(QtCore.QRect(80, 30, 191, 17))
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setFamily("Times New Roman")
|
||||||
|
font.setPointSize(18)
|
||||||
|
font.setWeight(75)
|
||||||
|
font.setBold(True)
|
||||||
|
self.label.setFont(font)
|
||||||
|
self.label.setObjectName("label")
|
||||||
|
self.label_2 = QtGui.QLabel(Form)
|
||||||
|
self.label_2.setGeometry(QtCore.QRect(80, 60, 191, 17))
|
||||||
|
font = QtGui.QFont()
|
||||||
|
font.setFamily("Times New Roman")
|
||||||
|
font.setPointSize(16)
|
||||||
|
font.setWeight(50)
|
||||||
|
font.setBold(False)
|
||||||
|
self.label_2.setFont(font)
|
||||||
|
self.label_2.setObjectName("label_2")
|
||||||
|
self.graphicsView_2 = QtGui.QGraphicsView(Form)
|
||||||
|
self.graphicsView_2.setGeometry(QtCore.QRect(200, 34, 64, 64))
|
||||||
|
self.graphicsView_2.setMinimumSize(QtCore.QSize(32, 32))
|
||||||
|
self.graphicsView_2.setMaximumSize(QtCore.QSize(32, 32))
|
||||||
|
self.graphicsView_2.setBaseSize(QtCore.QSize(32, 32))
|
||||||
|
self.graphicsView_2.setObjectName("graphicsView_2")
|
||||||
|
|
||||||
|
def initUI(self):
|
||||||
|
|
||||||
|
grid = QtGui.QGridLayout()
|
||||||
|
name = QtGui.QWidget()
|
||||||
|
self.setup_left_top(name)
|
||||||
|
grid.addWidget(name, 0, 0)
|
||||||
|
|
||||||
|
self.setLayout(grid)
|
||||||
|
self.setMinimumSize(200, 200)
|
||||||
|
self.setGeometry(300, 300, 300, 200)
|
||||||
|
self.setWindowTitle('Toxygen')
|
||||||
|
self.show()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
app = QtGui.QApplication(sys.argv)
|
||||||
|
ex = MainWindow()
|
||||||
|
sys.exit(app.exec_())
|
@ -7,13 +7,13 @@ class Settings(object):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.path = Settings.get_default_path() + 'toxygen.json'
|
self.path = Settings.get_default_path() + 'toxygen.json'
|
||||||
# TODO: create new if old not found
|
|
||||||
if os.path.exists(self.path):
|
if os.path.exists(self.path):
|
||||||
with open(self.path) as fl:
|
with open(self.path) as fl:
|
||||||
data = fl.read()
|
data = fl.read()
|
||||||
self.data = json.loads(data)
|
self.data = json.loads(data)
|
||||||
else:
|
else:
|
||||||
self.create_default_settings()
|
self.create_default_settings()
|
||||||
|
self.save()
|
||||||
|
|
||||||
def create_default_settings(self):
|
def create_default_settings(self):
|
||||||
self.data = {
|
self.data = {
|
||||||
@ -40,6 +40,9 @@ class Settings(object):
|
|||||||
def __get__(self, attr):
|
def __get__(self, attr):
|
||||||
return self.data[attr]
|
return self.data[attr]
|
||||||
|
|
||||||
|
def __set__(self, attr, value):
|
||||||
|
self.data[attr] = value
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
text = json.dumps(self.data)
|
text = json.dumps(self.data)
|
||||||
with open(self.path, 'w') as fl:
|
with open(self.path, 'w') as fl:
|
||||||
|
Loading…
Reference in New Issue
Block a user