Esempio n. 1
0
 def defineBackgroundBrush(self):
     """ If container is collapsed use single background color.
     """
     if self._childrenVisible:
         ConnectableWidget.defineBackgroundBrush(self)
     else:
         self._backgroundBrush = self.penColor()
Esempio n. 2
0
 def defineBackgroundBrush(self):
     """ If container is collapsed use single background color.
     """
     if self._childrenVisible:
         ConnectableWidget.defineBackgroundBrush(self)
     else:
         self._backgroundBrush = self.penColor()
Esempio n. 3
0
 def showMenu(self):
     if self._collapseMenuButton:
         if self._childrenVisible and self._collapsable:
             self.menu().setEntryText(self._collapseMenuButton, "Collapse")
             #self._collapseMenuButton.setText("Collapse")
         else:
             self.menu().setEntryText(self._collapseMenuButton, "Expand")
             #self._collapseMenuButton.setText("Expand")
     ConnectableWidget.showMenu(self)
Esempio n. 4
0
 def showMenu(self):
     if self._collapseMenuButton:
         if self._childrenVisible and self._collapsable:
             self.menu().setEntryText(self._collapseMenuButton, "Collapse")
             #self._collapseMenuButton.setText("Collapse")
         else:
             self.menu().setEntryText(self._collapseMenuButton, "Expand")
             #self._collapseMenuButton.setText("Expand")
     ConnectableWidget.showMenu(self)
Esempio n. 5
0
 def __init__(self, parent=None):
     #logging.debug(__name__ + ": __init__()")
     self._childrenVisible = True
     self._autolayoutChildrenEnabled = False
     self._autosizeAdjustContainerPositionFlag = True
     self._collapseMenuButton = None
     self._collapsable=True
     self._hiddenChildren = []
     
     ConnectableWidget.__init__(self, parent)
     
     self.enableAutolayoutChildren(self.AUTOLAYOUT_CHILDREN_ENABLED)
     self.enableAdjustContainerPositionWhenAutosizing(self.AUTOSIZE_ADJUST_CONTAINER_POSITION)
     
     self.setShowCollapseMenu(True)
Esempio n. 6
0
    def __init__(self, parent=None):
        #logging.debug(__name__ + ": __init__()")
        self._childrenVisible = True
        self._autolayoutChildrenEnabled = False
        self._autosizeAdjustContainerPositionFlag = True
        self._collapseMenuButton = None
        self._collapsable = True
        self._hiddenChildren = []

        ConnectableWidget.__init__(self, parent)

        self.enableAutolayoutChildren(self.AUTOLAYOUT_CHILDREN_ENABLED)
        self.enableAdjustContainerPositionWhenAutosizing(
            self.AUTOSIZE_ADJUST_CONTAINER_POSITION)

        self.setShowCollapseMenu(True)
Esempio n. 7
0
 def createBox(self, widgetParent, container, title, text):
     """ Create a WidgetContainer or ConnectableWidget and set its properties.
     """
     if container:
         widget = BoxDecayContainer(widgetParent)
     else:
         widget = ConnectableWidget(widgetParent)
         widget.noRearangeContent()
         widget.setText(text)
         widget.textField().setOutputFlags(Qt.AlignLeft)
         widget.setShowPortNames(True)
     widget.setDragable(False)
     widget.setDeletable(False)
     widget.enableAutosizing(True, False)
     #        widget.ROUNDRECT_RADIUS=0
     #        widget.setColors(Qt.black,Qt.white,Qt.white)
     widget.setTitle(title)
     return widget
Esempio n. 8
0
    def testExample(self):
        logging.debug(self.__class__.__name__ + ': testExample()')
        self.app = QApplication(sys.argv)
        self.window = QMainWindow()
        self.window.setWindowTitle("test ConnectableWidget")
        self.app.setActiveWindow(self.window)
        self.window.resize(800, 600)
        self.window.show()

        widgets = []

        rowOneY = 10

        widget = ConnectableWidget(self.window, "empty")
        widget.move(10, rowOneY)
        widgets.append(widget)

        widget = ConnectableWidget(self.window, "with ports")
        widget.move(210, rowOneY)
        widget.addSinkPort("first sink port")
        widget.addSourcePort("first source port")
        widget.addSourcePort("second sourcePort")
        widgets.append(widget)

        widget = ConnectableWidget(self.window, "with port names")
        widget.move(410, rowOneY)
        widget.setShowPortNames(True)
        widget.addSinkPort("first sink port")
        widget.addSourcePort("first source port")
        widget.addSourcePort("second sourcePort")
        widgets.append(widget)

        # ________________________________ autocale _______________________________
        rowTwoY = 130

        widget = ConnectableWidget(self.window, "autocale")
        widget.move(10, rowTwoY)
        widget.enableAutosizing(True, False)
        widgets.append(widget)

        widget = ConnectableWidget(self.window, "with ports")
        widget.move(210, rowTwoY)
        widget.enableAutosizing(True, False)
        widget.addSinkPort("first sink port")
        widget.addSourcePort("first source port")
        widget.addSourcePort("second sourcePort")
        widgets.append(widget)

        widget = ConnectableWidget(self.window,
                                   "with port names sdfsdfg dfgsdf")
        widget.move(410, rowTwoY)
        widget.enableAutosizing(True, False)
        widget.setShowPortNames(True)
        widget.addSinkPort("first sink port")
        widget.addSourcePort("first source port")
        widget.addSourcePort("second sourcePort")
        widgets.append(widget)

        # ________________________ special _____________________
        rowThreeX = 230

        widget = ConnectableWidget(self.window)
        widget.move(10, rowThreeX)
        widget.enableAutosizing(True, False)
        widgets.append(widget)

        widget = ConnectableWidget(self.window)
        widget.move(80, rowThreeX)
        widget.enableAutosizing(True, False)
        widget.addSinkPort("first sink port")
        widget.addSourcePort("first source port")
        widget.addSourcePort("second sourcePort")
        widgets.append(widget)

        widget = ConnectableWidget(self.window)
        widget.move(150, rowThreeX)
        widget.enableAutosizing(True, False)
        widget.setText("with text")
        widgets.append(widget)

        widget = ConnectableWidget(self.window)
        widget.move(220, rowThreeX)
        widget.enableAutosizing(True, False)
        widget.setTitle("with title")
        widget.setText("with text")
        widgets.append(widget)

        widget = ConnectableWidget(self.window, "many ports")
        widget.move(410, rowThreeX)
        widget.enableAutosizing(True, False)
        widget.setShowPortNames(True)
        widget.addSinkPort("first sink port")
        widget.addSinkPort("another sink port")
        widget.addSinkPort("another sink port")
        widget.addSinkPort("another sink port")
        widget.addSinkPort("another sink port")
        widget.addSourcePort("first source port")
        widget.addSourcePort("second sourcePort")
        widget.addSourcePort("another sourcePort")
        widget.addSourcePort("another sourcePort")
        widget.addSourcePort("another sourcePort")
        widget.addSourcePort("another sourcePort")
        widget.addSourcePort("another sourcePort")
        widget.addSourcePort("another sourcePort")
        widget.addSourcePort("another sourcePort")
        widget.addSourcePort("another sourcePort")
        widget.addSourcePort("another sourcePort")
        widgets.append(widget)

        # _________________________ ports and text __________________________
        rowFourX = 300

        widget = ConnectableWidget(self.window)
        widget.move(10, rowFourX)
        widget.enableAutosizing(True, False)
        widget.setTitle("with title")
        widget.setText("with text")
        widget.addSinkPort("first sink port")
        widget.addSourcePort("first source port")
        widget.addSourcePort("second sourcePort")
        widgets.append(widget)

        widget = ConnectableWidget(self.window)
        widget.move(120, rowFourX)
        widget.enableAutosizing(True, False)
        widget.setShowPortNames(True)
        widget.setTitle("with port names and text")
        widget.setText("with text")
        widget.addSinkPort("first sink port")
        widget.addSourcePort("first source port")
        widget.addSourcePort("second sourcePort")
        widgets.append(widget)

        # _________________________ test __________________________
        rowFiveX = 370

        for widget in widgets:
            widget.scheduleRearangeContent()
            widget.show()

        if not hasattr(unittest, "NO_GUI_TEST"):
            self.app.exec_()
Esempio n. 9
0
 def testExample(self):
     logging.debug(self.__class__.__name__ +': testExample()')
     self.app = QApplication(sys.argv)
     self.window = QMainWindow()
     self.window.setWindowTitle("test ConnectableWidget")
     self.app.setActiveWindow(self.window)
     self.window.resize(800, 600)
     self.window.show()
     
     widgets = []
     
     rowOneY = 10
     
     widget = ConnectableWidget(self.window, "empty")
     widget.move(10, rowOneY)
     widgets.append(widget)
     
     widget = ConnectableWidget(self.window, "with ports")
     widget.move(210, rowOneY)
     widget.addSinkPort("first sink port")
     widget.addSourcePort("first source port")
     widget.addSourcePort("second sourcePort")
     widgets.append(widget)
     
     widget = ConnectableWidget(self.window, "with port names")
     widget.move(410, rowOneY)
     widget.setShowPortNames(True)
     widget.addSinkPort("first sink port")
     widget.addSourcePort("first source port")
     widget.addSourcePort("second sourcePort")
     widgets.append(widget)
     
     # ________________________________ autocale _______________________________
     rowTwoY = 130
             
     widget = ConnectableWidget(self.window, "autocale")
     widget.move(10, rowTwoY)
     widget.enableAutosizing(True, False)
     widgets.append(widget)
     
     widget = ConnectableWidget(self.window, "with ports")
     widget.move(210, rowTwoY)
     widget.enableAutosizing(True, False)
     widget.addSinkPort("first sink port")
     widget.addSourcePort("first source port")
     widget.addSourcePort("second sourcePort")
     widgets.append(widget)
     
     widget = ConnectableWidget(self.window, "with port names sdfsdfg dfgsdf")
     widget.move(410, rowTwoY)
     widget.enableAutosizing(True, False)
     widget.setShowPortNames(True)
     widget.addSinkPort("first sink port")
     widget.addSourcePort("first source port")
     widget.addSourcePort("second sourcePort")
     widgets.append(widget)
     
     # ________________________ special _____________________
     rowThreeX = 230
     
     widget = ConnectableWidget(self.window)
     widget.move(10, rowThreeX)
     widget.enableAutosizing(True, False)
     widgets.append(widget)
     
     widget = ConnectableWidget(self.window)
     widget.move(80, rowThreeX)
     widget.enableAutosizing(True, False)
     widget.addSinkPort("first sink port")
     widget.addSourcePort("first source port")
     widget.addSourcePort("second sourcePort")
     widgets.append(widget)
     
     widget = ConnectableWidget(self.window)
     widget.move(150, rowThreeX)
     widget.enableAutosizing(True, False)
     widget.setText("with text")
     widgets.append(widget)
     
     widget = ConnectableWidget(self.window)
     widget.move(220, rowThreeX)
     widget.enableAutosizing(True, False)
     widget.setTitle("with title")
     widget.setText("with text")
     widgets.append(widget)
     
     widget = ConnectableWidget(self.window, "many ports")
     widget.move(410, rowThreeX)
     widget.enableAutosizing(True, False)
     widget.setShowPortNames(True)
     widget.addSinkPort("first sink port")
     widget.addSinkPort("another sink port")
     widget.addSinkPort("another sink port")
     widget.addSinkPort("another sink port")
     widget.addSinkPort("another sink port")
     widget.addSourcePort("first source port")
     widget.addSourcePort("second sourcePort")
     widget.addSourcePort("another sourcePort")
     widget.addSourcePort("another sourcePort")
     widget.addSourcePort("another sourcePort")
     widget.addSourcePort("another sourcePort")
     widget.addSourcePort("another sourcePort")
     widget.addSourcePort("another sourcePort")
     widget.addSourcePort("another sourcePort")
     widget.addSourcePort("another sourcePort")
     widget.addSourcePort("another sourcePort")
     widgets.append(widget)
     
     # _________________________ ports and text __________________________
     rowFourX = 300
     
     
     widget = ConnectableWidget(self.window)
     widget.move(10, rowFourX)
     widget.enableAutosizing(True, False)
     widget.setTitle("with title")
     widget.setText("with text")
     widget.addSinkPort("first sink port")
     widget.addSourcePort("first source port")
     widget.addSourcePort("second sourcePort")
     widgets.append(widget)
     
     widget = ConnectableWidget(self.window)
     widget.move(120, rowFourX)
     widget.enableAutosizing(True, False)
     widget.setShowPortNames(True)
     widget.setTitle("with port names and text")
     widget.setText("with text")
     widget.addSinkPort("first sink port")
     widget.addSourcePort("first source port")
     widget.addSourcePort("second sourcePort")
     widgets.append(widget)
     
     # _________________________ test __________________________
     rowFiveX = 370
     
     
     
     for widget in widgets:
         widget.scheduleRearangeContent()
         widget.show()
     
     if not hasattr(unittest,"NO_GUI_TEST"):
         self.app.exec_()