def __init__(self, label, path, length=200): super().__init__() self.path = path self.layout = QHBoxLayout() self.layout.addWidget(QLabel(label)) self.edit = QLineEdit() self.edit.setFixedWidth(length) self.edit.setText(str(Settings.get(path))) self.layout.addWidget(self.edit) self.setLayout(self.layout)
def __init__(self): super().__init__() values = Settings.get(["view", "default_color"]) self.defbutton = QPushButton("Mech") self.defbutton.clicked.connect(self.set_default) labels = "RGBA" self.edits = [QLineEdit() for i in range(4)] for e in self.edits: e.setFixedWidth(30) self.layout = QHBoxLayout() for i in range(4): self.edits[i].setText(str(values[i])) self.layout.addWidget( TableField(ltext=labels[i], wdg=self.edits[i], llen=30)) self.layout.addStretch() self.layout.addWidget(self.defbutton) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.addWidget(QWidget()) self.setLayout(self.layout)
def apply(self): values = tuple([float(e.text()) for e in self.edits]) # if values != Settings.get(["view", "default_color"]): # print("You should reevaluate script for color applying") Settings.set(["view", "default_color"], values)
def restore(self): self.check.setCheckState(2 if Settings.get(self.path) == "true" else 0)
def apply(self): Settings.set(self.path, self.check.checkState() != 0)
def apply(self): Settings.set(self.path, self.edit.text())
def save_all(self): for a in self.appliers: a.apply() Settings.store()
def default_color(): return Color(Settings.get(["view", "default_color"]))