예제 #1
0
파일: vertex.py 프로젝트: gbaty/openalea
    def mouseDoubleClickEvent(self, event):
        if event.button() == qt.QtCore.Qt.LeftButton:
            # Read settings
            try:
                localsettings = Settings()
                str = localsettings.get("UI", "DoubleClick")
            except:
                str = "['open']"

            operator = GraphOperator(graph=self.graph(),
                                     graphScene=self.scene())
            operator.set_vertex_item(self)

            if('open' in str):
                operator(fName="vertex_open")()
            elif('run' in str):
                operator(fName="vertex_run")()
예제 #2
0
    def mouseDoubleClickEvent(self, event):
        if event.button() == qt.QtCore.Qt.LeftButton:
            # Read settings
            try:
                localsettings = Settings()
                str = localsettings.get("UI", "DoubleClick")
            except:
                str = "['open']"

            operator = GraphOperator(graph=self.graph(),
                                     graphScene=self.scene())
            operator.set_vertex_item(self)

            if ('open' in str):
                operator(fName="vertex_open")()
            elif ('run' in str):
                operator(fName="vertex_run")()
예제 #3
0
파일: vertex.py 프로젝트: gbaty/openalea
    def contextMenuEvent(self, event):
        """ Context menu event : Display the menu"""
        self.setSelected(True)

        operator = GraphOperator(graph=self.graph(),
                                 graphScene=self.scene())
        operator.vertexType = GraphicalVertex
        operator.set_vertex_item(self)
        widget = operator.get_sensible_parent()
        menu = qtutils.AleaQMenu(widget)
        items = self.scene().get_selected_items(GraphicalVertex)

        menu.addAction(operator("Run", menu, "vertex_run"))
        menu.addAction(operator("Open Widget", menu, "vertex_open"))
        if isinstance(self.vertex(), compositenode.CompositeNode):
            menu.addAction(operator("Inspect composite node", menu, "vertex_composite_inspect"))
        menu.addSeparator()
        menu.addAction(operator("Delete", menu, "vertex_remove"))
        menu.addAction(operator("Reset", menu, "vertex_reset"))
        menu.addAction(operator("Replace By", menu, "vertex_replace"))
        menu.addAction(operator("Reload", menu, "vertex_reload"))
        menu.addSeparator()
        menu.addAction(operator("Caption", menu, "vertex_set_caption"))
        menu.addAction(operator("Show/Hide ports", menu, "vertex_show_hide_ports"))
        menu.addSeparator()

        action = operator("Mark as User Application", menu, "vertex_mark_user_app")
        action.setCheckable(True)
        action.setChecked(bool(self.vertex().user_application))
        menu.addAction(action)

        action = operator("Lazy", menu, "vertex_set_lazy")
        action.setCheckable(True)
        action.setChecked(self.vertex().lazy)
        menu.addAction(action)

        action = operator("Block", menu, "vertex_block")
        action.setCheckable(True)
        action.setChecked(self.vertex().block)
        menu.addAction(action)

        menu.addAction(operator("Internals", menu, "vertex_edit_internals"))
        menu.addSeparator()

        alignMenu = menu.addMenu("Align...")
        alignMenu.setDisabled(True)
        if len(items) > 1:
            alignMenu.setDisabled(False)
            alignMenu.addAction(operator("Align horizontally", menu, "graph_align_selection_horizontal"))
            alignMenu.addAction(operator("Align left", menu, "graph_align_selection_left"))
            alignMenu.addAction(operator("Align right", menu, "graph_align_selection_right"))
            alignMenu.addAction(operator("Align centered", menu, "graph_align_selection_mean"))
            alignMenu.addAction(operator("Distribute horizontally", menu, "graph_distribute_selection_horizontally"))
            alignMenu.addAction(operator("Distribute vertically", menu, "graph_distribute_selection_vertically"))

        # The colouring
        colorMenu = menu.addMenu("Color...")
        colorMenu.addAction(operator("Set user color...", colorMenu, "graph_set_selection_color"))
        # check if the current selection is coloured and tick the
        # menu item if an item of the selection uses the user color.
        action = operator("Use user color", colorMenu, "graph_use_user_color")
        action.setCheckable(True)
        action.setChecked(False)
        for i in items:
            if i.vertex().get_ad_hoc_dict().get_metadata("useUserColor"):
                action.setChecked(True)
                break
        colorMenu.addAction(action)

        # display the menu...
        menu.move(event.screenPos())
        menu.show()
        event.accept()
예제 #4
0
    def contextMenuEvent(self, event):
        """ Context menu event : Display the menu"""
        self.setSelected(True)

        operator = GraphOperator(graph=self.graph(), graphScene=self.scene())
        operator.vertexType = GraphicalVertex
        operator.set_vertex_item(self)
        widget = operator.get_sensible_parent()
        menu = qtutils.AleaQMenu(widget)
        items = self.scene().get_selected_items(GraphicalVertex)

        menu.addAction(operator("Run", menu, "vertex_run"))
        menu.addAction(operator("Open Widget", menu, "vertex_open"))
        if isinstance(self.vertex(), compositenode.CompositeNode):
            menu.addAction(
                operator("Inspect composite node", menu,
                         "vertex_composite_inspect"))
        menu.addSeparator()
        menu.addAction(operator("Delete", menu, "vertex_remove"))
        menu.addAction(operator("Reset", menu, "vertex_reset"))
        menu.addAction(operator("Replace By", menu, "vertex_replace"))
        menu.addAction(operator("Reload", menu, "vertex_reload"))
        menu.addSeparator()
        menu.addAction(operator("Caption", menu, "vertex_set_caption"))
        menu.addAction(
            operator("Show/Hide ports", menu, "vertex_show_hide_ports"))
        menu.addSeparator()

        action = operator("Mark as User Application", menu,
                          "vertex_mark_user_app")
        action.setCheckable(True)
        action.setChecked(bool(self.vertex().user_application))
        menu.addAction(action)

        action = operator("Lazy", menu, "vertex_set_lazy")
        action.setCheckable(True)
        action.setChecked(self.vertex().lazy)
        menu.addAction(action)

        action = operator("Block", menu, "vertex_block")
        action.setCheckable(True)
        action.setChecked(self.vertex().block)
        menu.addAction(action)

        menu.addAction(operator("Internals", menu, "vertex_edit_internals"))
        menu.addSeparator()

        alignMenu = menu.addMenu("Align...")
        alignMenu.setDisabled(True)
        if len(items) > 1:
            alignMenu.setDisabled(False)
            alignMenu.addAction(
                operator("Align horizontally", menu,
                         "graph_align_selection_horizontal"))
            alignMenu.addAction(
                operator("Align left", menu, "graph_align_selection_left"))
            alignMenu.addAction(
                operator("Align right", menu, "graph_align_selection_right"))
            alignMenu.addAction(
                operator("Align centered", menu, "graph_align_selection_mean"))
            alignMenu.addAction(
                operator("Distribute horizontally", menu,
                         "graph_distribute_selection_horizontally"))
            alignMenu.addAction(
                operator("Distribute vertically", menu,
                         "graph_distribute_selection_vertically"))

        # The colouring
        colorMenu = menu.addMenu("Color...")
        colorMenu.addAction(
            operator("Set user color...", colorMenu,
                     "graph_set_selection_color"))
        # check if the current selection is coloured and tick the
        # menu item if an item of the selection uses the user color.
        action = operator("Use user color", colorMenu, "graph_use_user_color")
        action.setCheckable(True)
        action.setChecked(False)
        for i in items:
            if i.vertex().get_ad_hoc_dict().get_metadata("useUserColor"):
                action.setChecked(True)
                break
        colorMenu.addAction(action)

        # display the menu...
        menu.move(event.screenPos())
        menu.show()
        event.accept()