def onShow(self, settings): clearLayout(self.layout) properties = PropertiesWidget() properties.setLockCheckBoxVisible(False) properties.setTearOffCopyVisible(False) groupActions = defaultdict(list) for actionName, variants in InputManager().getData().items(): for action in variants: groupActions[action.group].append(action) for groupName, variants in groupActions.items(): category = CollapsibleFormWidget(headName=groupName) for inputActionVariant in variants: actionWidget = InputActionWidget( inputActionRef=inputActionVariant) actionWidget.setAction(inputActionVariant) category.addWidget(label=inputActionVariant.getName(), widget=actionWidget, maxLabelWidth=150) properties.addWidget(category) category.setCollapsed(True) self.layout.addWidget(properties) spacerItem = QSpacerItem(10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) self.layout.addItem(spacerItem)
def updateGraphTreeLocation(self, *args, **kwargs): location = self.canvasWidget.location() clearLayout(self.layoutGraphPath) spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.layoutGraphPath.addItem(spacerItem) for folderName in location: index = self.layoutGraphPath.count() - 1 btn = QPushButton(folderName) def onClicked(checked, name=None): self.canvasWidget.stepToCompound(name) btn.clicked.connect( lambda chk=False, name=folderName: onClicked(chk, name)) self.layoutGraphPath.insertWidget(index, btn) self.setCompoundPropertiesWidgetVisible( self.graphManager.activeGraph().depth() > 1)
def clear(self): if not self.isLocked(): clearLayout(self.contentLayout) self.searchBoxWidget.hide() self.lockCheckBox.setChecked(False)
def onShow(self, settings): clearLayout(self.layout) editableStyleSheet().loadPresests(THEMES_PATH) properties = PropertiesWidget() properties.lockCheckBox.hide() properties.tearOffCopy.hide() general = CollapsibleFormWidget(headName="General") bg = CollapsibleFormWidget(headName="BackGround") canvas = CollapsibleFormWidget(headName="Canvas") options = inspect.getmembers(editableStyleSheet()) for name, obj in options: if isinstance(obj, QtGui.QColor): inp = pyf_ColorSlider(type="int", alpha=len(list(obj.getRgbF())) == 4, startColor=list(obj.getRgbF())) inp.valueChanged.connect(lambda color, name=name, update=True: editableStyleSheet().setColor(name, color, update)) if name in ["TextColor", "MainColor", "TextSelectedColor", "ButtonsColor"]: general.addWidget(name, inp) elif name in ["InputFieldColor", "BgColor", "BgColorDarker", "BgColorBright", "BorderColor"]: bg.addWidget(name, inp) elif name in ["CanvasBgColor", "CanvastextColor", "CanvasGridColor", "CanvasGridColorDarker"]: canvas.addWidget(name, inp) elif isinstance(obj, list): if name in ["GridSizeFine", "GridSizeHuge"]: inp = pyf_Slider(self) inp.setValue(obj[0]) inp.valueChanged.connect(lambda color, name=name, update=True: editableStyleSheet().setColor(name, color,update) ) elif name in ["DrawNumbers"]: inp = QCheckBox() inp.setChecked(obj[0]) inp.stateChanged.connect(lambda color, name=name, update=True: editableStyleSheet().setColor(name, color,update) ) canvas.addWidget(name, inp) self.selector = QComboBox() for name in editableStyleSheet().presests.keys(): self.selector.addItem(name) if isinstance(settings, str): if settings in editableStyleSheet().presests: self.selector.setCurrentIndex(list(editableStyleSheet().presests.keys()).index(settings)) elif settings and settings.value('Theme_Name'): if settings.value('Theme_Name') in editableStyleSheet().presests: self.selector.setCurrentIndex(list(editableStyleSheet().presests.keys()).index(settings.value('Theme_Name'))) self.layout.addWidget(self.selector) self.selector.activated.connect(self.setPreset) general.setCollapsed(True) bg.setCollapsed(True) canvas.setCollapsed(True) properties.addWidget(general) properties.addWidget(bg) properties.addWidget(canvas) self.layout.addWidget(properties) spacerItem = QSpacerItem(10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) self.layout.addItem(spacerItem) lay = QHBoxLayout() pbSaveTheme = QPushButton("SaveTheme") pbSaveTheme.clicked.connect(self.saveTheme) pbSaveThemeAs = QPushButton("SaveThemeAs") pbSaveThemeAs.clicked.connect(self.saveThemeAs) pbDeleteTheme = QPushButton("RemoveTheme") pbDeleteTheme.clicked.connect(self.deleteTheme) lay.addWidget(pbSaveTheme) lay.addWidget(pbSaveThemeAs) lay.addWidget(pbDeleteTheme) self.layout.addLayout(lay)
def clearProperties(self): propertiesLayout = self.canvas.parent.propertiesLayout clearLayout(propertiesLayout)
def onShow(self, settings): clearLayout(self.layout) editableStyleSheet().loadPresets(THEMES_PATH) properties = PropertiesWidget() properties.setLockCheckBoxVisible(False) properties.setTearOffCopyVisible(False) general = CollapsibleFormWidget(headName="General") bg = CollapsibleFormWidget(headName="BackGround") canvas = CollapsibleFormWidget(headName="Canvas") connections = CollapsibleFormWidget(headName="Connections") lods = CollapsibleFormWidget(headName="LODS") lodMax = None lodWidgets = [] options = inspect.getmembers(editableStyleSheet()) for name, obj in options: if isinstance(obj, QtGui.QColor): inp = pyf_ColorSlider(type="int", alpha=len(list(obj.toTuple())) == 4, startColor=list(obj.toTuple())) inp.valueChanged.connect(lambda color, name=name, update=True: editableStyleSheet().setColor(name, color, update)) if name in ["TextColor", "MainColor", "TextSelectedColor", "ButtonsColor"]: general.addWidget(name, inp) elif name in ["InputFieldColor", "BgColor", "BgColorDarker", "BgColorBright", "BorderColor", "LoggerBgColor"]: bg.addWidget(name, inp) elif name in ["CanvasBgColor", "CanvastextColor", "CanvasGridColor", "CanvasGridColorDarker"]: canvas.addWidget(name, inp) elif isinstance(obj, list): if name in ["GridSizeFine", "GridSizeHuge", "ConnectionRoundness", "ConnectionOffset"]: inp = pyf_Slider(self) inp.setValue(obj[0]) inp.setMinimum(0) inp.setMaximum(1000.0) inp.valueChanged.connect(lambda color, name=name, update=False: editableStyleSheet().setColor(name, color, update)) elif name in ["DrawNumbers", "SetAppStyleSheet","DrawGrid"]: inp = QCheckBox() inp.setChecked(obj[0]) inp.stateChanged.connect(lambda color, name=name, update=True: editableStyleSheet().setColor(name, color, update)) elif name == "ConnectionMode": inp = QComboBox() for i in ConnectionTypes: inp.addItem(i.name) inp.setCurrentIndex(obj[0]) inp.currentIndexChanged.connect(lambda value, name=name, update=False: editableStyleSheet().setColor(name, value, update)) elif name in ["LOD_Number", "NodeSwitch", "ConnectionSwitch", "PinSwitch", "CanvasSwitch"]: inp = pyf_Slider(self, type="int") inp.setValue(obj[0]) if name != "LOD_Number": inp.setMinimum(0) inp.setMaximum(editableStyleSheet().LOD_Number[0]) lodWidgets.append(inp) else: lodMax = inp inp.setMinimum(0) inp.valueChanged.connect(lambda color, name=name, update=False: editableStyleSheet().setColor(name, color, update)) if name in ["ConnectionMode", "ConnectionRoundness","ConnectionOffset"]: connections.addWidget(name, inp) elif name == "SetAppStyleSheet": general.insertWidget(0, name, inp) elif name in ["NodeSwitch", "ConnectionSwitch", "PinSwitch", "CanvasSwitch"]: lods.addWidget(name, inp) elif name == "LOD_Number": lods.insertWidget(0, name, inp) else: canvas.addWidget(name, inp) for lod in lodWidgets: lodMax.valueChanged.connect(lod.setMaximum) self.selector = QComboBox() for name in editableStyleSheet().presets.keys(): self.selector.addItem(name) if self.currTheme is not None: self.selector.setCurrentIndex(self.currTheme) else: if isinstance(settings, str): if settings in editableStyleSheet().presets: self.selector.setCurrentIndex(list(editableStyleSheet().presets.keys()).index(settings)) elif settings and settings.value('Theme_Name'): if settings.value('Theme_Name') in editableStyleSheet().presets: self.selector.setCurrentIndex(list(editableStyleSheet().presets.keys()).index(settings.value('Theme_Name'))) self.currTheme = self.selector.currentIndex() self.layout.addWidget(self.selector) self.selector.activated.connect(self.setPreset) general.setCollapsed(True) bg.setCollapsed(True) canvas.setCollapsed(True) connections.setCollapsed(True) lods.setCollapsed(True) properties.addWidget(general) properties.addWidget(bg) properties.addWidget(canvas) properties.addWidget(connections) properties.addWidget(lods) self.layout.addWidget(properties) spacerItem = QSpacerItem(10, 10, QSizePolicy.Minimum, QSizePolicy.Expanding) self.layout.addItem(spacerItem) lay = QHBoxLayout() pbSaveTheme = QPushButton("SaveTheme") pbSaveTheme.clicked.connect(self.saveTheme) pbSaveThemeAs = QPushButton("SaveThemeAs") pbSaveThemeAs.clicked.connect(self.saveThemeAs) pbDeleteTheme = QPushButton("RemoveTheme") pbDeleteTheme.clicked.connect(self.deleteTheme) lay.addWidget(pbSaveTheme) lay.addWidget(pbSaveThemeAs) lay.addWidget(pbDeleteTheme) self.layout.addLayout(lay)