Beispiel #1
0
    def contextHandler(self, contentPanel, tp):
        viewName = contentPanel.viewName

        def handler(event):
            menu = ContextMenu.getMenu(self, None, None, (viewName, ))

            if menu is not None:
                contentPanel.PopupMenu(menu)

            event.Skip()

        if ContextMenu.hasMenu(self, None, None, (viewName, )):
            sizer = tp.GetHeaderContentSizer()
            sizer.AddStretchSpacer()
            # Add menu
            header_menu = wx.StaticText(tp.GetHeaderPanel(),
                                        wx.ID_ANY,
                                        "\u2630",
                                        size=wx.Size((10, -1)))
            sizer.Add(header_menu, 0, wx.EXPAND | wx.RIGHT, 5)

            header_menu.Bind(wx.EVT_CONTEXT_MENU, handler)
            header_menu.Bind(wx.EVT_LEFT_UP, handler)

        return handler
Beispiel #2
0
    def updateControls(self, layout=True):
        if layout:
            self.Freeze()
        self._clearStoredValues()
        view = self.graphFrame.getView()
        self.ySubSelection.Clear()
        self.xSubSelection.Clear()
        for yDef in view.yDefs:
            self.ySubSelection.Append(self.formatLabel(yDef), yDef)
        self.ySubSelection.SetSelection(0)
        self.ySubSelection.Enable(len(view.yDefs) > 1)
        for xDef in view.xDefs:
            self.xSubSelection.Append(self.formatLabel(xDef), xDef)
        self.xSubSelection.SetSelection(0)
        self.xSubSelection.Enable(len(view.xDefs) > 1)

        # Vectors
        self._setVectorDefaults()
        if view.srcVectorDef is not None:
            self.srcVector.Show(True)
            self.srcVectorLabel.Show(True)
            self.srcVectorLabel.SetLabel(view.srcVectorDef.label)
        else:
            self.srcVector.Show(False)
            self.srcVectorLabel.Show(False)
        if view.tgtVectorDef is not None:
            self.tgtVector.Show(True)
            self.tgtVectorLabel.Show(True)
            self.tgtVectorLabel.SetLabel(view.tgtVectorDef.label)
        else:
            self.tgtVector.Show(False)
            self.tgtVectorLabel.Show(False)

        # Source and target list
        self.refreshColumns(layout=False)
        self.targetList.Show(view.hasTargets)

        # Inputs
        self._updateInputs(storeInputs=False)

        # Context icon
        self.contextIcon.Show(
            ContextMenu.hasMenu(self, None, None, (view.internalName, )))

        if layout:
            self.graphFrame.Layout()
            self.graphFrame.UpdateWindowSize()
            self.Thaw()
Beispiel #3
0
    def updateControls(self, layout=True):
        if layout:
            self.Freeze()
        self._clearStoredValues()
        view = self.graphFrame.getView()

        self.refreshAxeLabels()

        # Vectors
        self._setVectorDefaults()
        if view.srcVectorDef is not None:
            self.srcVector.Show(True)
            self.srcVectorLabel.Show(True)
            self.srcVectorLabel.SetLabel(view.srcVectorDef.label)
        else:
            self.srcVector.Show(False)
            self.srcVectorLabel.Show(False)
        if view.tgtVectorDef is not None:
            self.tgtVector.Show(True)
            self.tgtVectorLabel.Show(True)
            self.tgtVectorLabel.SetLabel(view.tgtVectorDef.label)
        else:
            self.tgtVector.Show(False)
            self.tgtVectorLabel.Show(False)

        # Source and target list
        self.refreshColumns(layout=False)
        self.targetList.Show(view.hasTargets)

        # Inputs
        self._updateInputs(storeInputs=False)

        # Context icon
        self.contextIcon.Show(
            ContextMenu.hasMenu(self, None, None, (view.internalName, )))

        if layout:
            self.graphFrame.Layout()
            self.graphFrame.UpdateWindowSize()
            self.Thaw()