Esempio n. 1
0
 def __init__(self):
     super(PropertiesTool, self).__init__()
     self.scrollArea = QtWidgets.QScrollArea(self)
     self.scrollArea.setWidgetResizable(True)
     self.setWidget(self.scrollArea)
     self.propertiesWidget = PropertiesWidget()
     self.scrollArea.setWidget(self.propertiesWidget)
     self.setWindowTitle(self.uniqueName())
     self.fillDelegate = None
     self.propertiesWidget.spawnDuplicate.connect(self.onTearOffCopy)
Esempio n. 2
0
    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)
Esempio n. 3
0
class PropertiesTool(DockTool):
    """docstring for Properties tool."""
    def __init__(self):
        super(PropertiesTool, self).__init__()
        self.scrollArea = QtWidgets.QScrollArea(self)
        self.scrollArea.setWidgetResizable(True)
        self.setWidget(self.scrollArea)
        self.propertiesWidget = PropertiesWidget()
        self.scrollArea.setWidget(self.propertiesWidget)

        self.propertiesWidget.searchBoxLayout.removeWidget(self.propertiesWidget.lockCheckBox)
        self.addButton(self.propertiesWidget.lockCheckBox)
        self.propertiesWidget.searchBoxLayout.removeWidget(self.propertiesWidget.tearOffCopy)
        self.addButton(self.propertiesWidget.tearOffCopy)
        self.addButton(self.propertiesWidget.settingsButton)

        self.setWindowTitle(self.uniqueName())
        self.fillDelegate = None
        self.propertiesWidget.spawnDuplicate.connect(self.onTearOffCopy)

    def onTearOffCopy(self, *args, **kwargs):
        instance = self.pyFlowInstance.invokeDockToolByName("PyFlowBase", self.name())
        if self.fillDelegate is not None:
            instance.assignPropertiesWidget(self.fillDelegate)
        instance.setFloating(True)
        instance.resize(self.size())

    def clear(self):
        self.propertiesWidget.clear()

    def assignPropertiesWidget(self, propertiesFillDelegate):
        self.fillDelegate = propertiesFillDelegate
        propertiesFillDelegate(self.propertiesWidget)

    @staticmethod
    def getIcon():
        return QtGui.QIcon(":property_icon.png")

    @staticmethod
    def isSingleton():
        return False

    @staticmethod
    def toolTip():
        return "Properties editing and displaying"

    @staticmethod
    def name():
        return str("Properties")
Esempio n. 4
0
    def __init__(self):
        super(PropertiesTool, self).__init__()
        self.scrollArea = QtWidgets.QScrollArea(self)
        self.scrollArea.setWidgetResizable(True)
        self.setWidget(self.scrollArea)
        self.propertiesWidget = PropertiesWidget()
        self.scrollArea.setWidget(self.propertiesWidget)

        self.propertiesWidget.searchBoxLayout.removeWidget(self.propertiesWidget.lockCheckBox)
        self.addButton(self.propertiesWidget.lockCheckBox)
        self.propertiesWidget.searchBoxLayout.removeWidget(self.propertiesWidget.tearOffCopy)
        self.addButton(self.propertiesWidget.tearOffCopy)
        self.addButton(self.propertiesWidget.settingsButton)

        self.setWindowTitle(self.uniqueName())
        self.fillDelegate = None
        self.propertiesWidget.spawnDuplicate.connect(self.onTearOffCopy)
Esempio n. 5
0
class PropertiesTool(DockTool):
    """docstring for Properties tool."""
    def __init__(self):
        super(PropertiesTool, self).__init__()
        self.scrollArea = QtWidgets.QScrollArea(self)
        self.scrollArea.setWidgetResizable(True)
        self.setWidget(self.scrollArea)
        self.propertiesWidget = PropertiesWidget()
        self.scrollArea.setWidget(self.propertiesWidget)
        self.setWindowTitle(self.uniqueName())
        self.fillDelegate = None
        self.propertiesWidget.spawnDuplicate.connect(self.onTearOffCopy)

    def onTearOffCopy(self, *args, **kwargs):
        instance = self.canvas.parent.invokeDockToolByName(
            "PyflowBase", self.name())
        instance.assignPropertiesWidget(self.fillDelegate)
        instance.setFloating(True)
        instance.resize(self.size())

    def clear(self):
        self.propertiesWidget.clear()

    def assignPropertiesWidget(self, propertiesFillDelegate):
        self.fillDelegate = propertiesFillDelegate
        propertiesFillDelegate(self.propertiesWidget)

    @staticmethod
    def getIcon():
        return QtGui.QIcon(RESOURCES_DIR + "/property_icon.png")

    @staticmethod
    def isSingleton():
        return False

    @staticmethod
    def toolTip():
        return "Properties editing and displaying"

    @staticmethod
    def name():
        return str("Properties")
Esempio n. 6
0
    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 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)