def __init__(self, parent=None, label=""): logging.debug(__name__ + ": __init__") BoxDecayView.__init__(self, parent) self._connections = {} self._colors = [Qt.red, Qt.green, Qt.blue, Qt.cyan, Qt.magenta] self._colorIndex = 0 PointToPointConnection.CONNECTION_THICKNESS = 2 self.setSortBeforeArranging(False) self._highlightedObjects = [] self._highlightedWidgets = []
def testExample(self): logging.debug(self.__class__.__name__ + ': testExample()') self.app = QApplication(sys.argv) self.window = QMainWindow() self.window.setWindowTitle("test BoxDecayView") self.window.resize(300, 300) self.app.setActiveWindow(self.window) self.window.show() self.scrollArea = ZoomableScrollArea(self.window) self.window.setCentralWidget(self.scrollArea) self.boxDecayView = BoxDecayView() self.scrollArea.setWidget(self.boxDecayView) accessor = TestDataAccessor() self.boxDecayView.setDataAccessor(accessor) self.boxDecayView.setDataObjects(accessor.topLevelObjects()) self.boxDecayView.setBoxContentScript("str(object.Label)") self.boxDecayView.updateContent() for w in self.boxDecayView.children(): if hasattr(w, "setDragable"): w.setDragable(True, True) if not hasattr(unittest, "NO_GUI_TEST"): self.app.exec_()
class BoxDecayViewTestCase(unittest.TestCase): def testExample(self): logging.debug(self.__class__.__name__ + ': testExample()') self.app = QApplication(sys.argv) self.window = QMainWindow() self.window.setWindowTitle("test BoxDecayView") self.window.resize(300,300) self.app.setActiveWindow(self.window) self.window.show() self.scrollArea = ZoomableScrollArea(self.window) self.window.setCentralWidget(self.scrollArea) self.boxDecayView = BoxDecayView() self.scrollArea.setWidget(self.boxDecayView) accessor=TestDataAccessor() self.boxDecayView.setDataAccessor(accessor) self.boxDecayView.setDataObjects(accessor.topLevelObjects()) self.boxDecayView.setBoxContentScript("str(object.Label)") self.boxDecayView.updateContent() for w in self.boxDecayView.children(): if hasattr(w, "setDragable"): w.setDragable(True, True) if not hasattr(unittest,"NO_GUI_TEST"): self.app.exec_()
def createBox(self, widgetParent, container, title, text): widget = BoxDecayView.createBox(self, widgetParent, container, title, text) widget.setToolTip( "Double click to display this module with its dependencies") return widget
def updateContent(self, overrideCheck=False): self._highlightedWidgets = [] ok = BoxDecayView.updateContent(self, overrideCheck) self.highlight() return ok
def createBox(self, widgetParent, container, title, text): widget = BoxDecayView.createBox(self, widgetParent, container, title, text) widget.setToolTip("Double click to display this module with its dependencies") return widget
def selection(self): return self.dataAccessor().read(BoxDecayView.selection(self))
def createBox(self, widgetParent, container, title, text): widget = BoxDecayView.createBox(self, widgetParent, container, title, text) if isinstance(widget, WidgetContainer): widget.setNotCollapsable() return widget