Example #1
0
    def __init__(self, session, controller, parent=None):
        super(ControlPanel, self).__init__()
        self.session = session

        # Color Map
        self.colormap_editor = MaterialEditor(self)
        self.addTab(self.colormap_editor, "Color Map")

        # Geometry
        self.control_panel_manager = ControlPanelManager(session,
                                                         controller,
                                                         parent=parent)
        self.geometry_editor = LPyPanelWidget(
            parent=None,
            name="Control Panel",
            panelmanager=self.control_panel_manager)
        self.geometry_editor.view.setTheme(
            self.geometry_editor.view.WHITE_THEME)
        self.addTab(self.geometry_editor, "Geometry")

        # Scalars
        self.scalars_editor = ScalarEditor(self)
        self.addTab(self.scalars_editor, "Scalars")
Example #2
0
    def __init__(self, session, controller, parent=None):
        super(ControlPanel, self).__init__()
        self.session = session

        # Color Map
        self.colormap_editor = MaterialEditor(self)
        self.addTab(self.colormap_editor, "Color Map")

        # Geometry
        self.control_panel_manager = ControlPanelManager(session, controller, parent=parent)
        self.geometry_editor = LPyPanelWidget(
            parent=None, name="Control Panel", panelmanager=self.control_panel_manager
        )
        self.geometry_editor.view.setTheme(self.geometry_editor.view.WHITE_THEME)
        self.addTab(self.geometry_editor, "Geometry")

        # Scalars
        self.scalars_editor = ScalarEditor(self)
        self.addTab(self.scalars_editor, "Scalars")
Example #3
0
    def __init__(self):
        AbstractQtControlWidget.__init__(self)
        MaterialEditor.__init__(self, parent=None)

        # Signal used by "autoapply" method
        self.value_changed_signal = 'valueChanged()'
Example #4
0
class ControlPanel(QtGui.QTabWidget):
    """
    Widget to display control of the current project.
    Permit to manage control.
    Double-clic permit to edit control.
    """

    def __init__(self, session, controller, parent=None):
        super(ControlPanel, self).__init__()
        self.session = session

        # Color Map
        self.colormap_editor = MaterialEditor(self)
        self.addTab(self.colormap_editor, "Color Map")

        # Geometry
        self.control_panel_manager = ControlPanelManager(session, controller, parent=parent)
        self.geometry_editor = LPyPanelWidget(
            parent=None, name="Control Panel", panelmanager=self.control_panel_manager
        )
        self.geometry_editor.view.setTheme(self.geometry_editor.view.WHITE_THEME)
        self.addTab(self.geometry_editor, "Geometry")

        # Scalars
        self.scalars_editor = ScalarEditor(self)
        self.addTab(self.scalars_editor, "Scalars")

    def clear(self):
        self.geometry_editor.clear()
        n = len(self.scalars_editor.getScalars())
        for scalar in range(n):
            self.scalars_editor.deleteScalars()
        # self.colormap_editor = MaterialEditor(self)

    def update(self):
        """
        Get control from widget and put them into project
        """
        colors = self.colormap_editor.getTurtle().getColorList()
        self.session.project.control["color map"] = colors

        objects = self.geometry_editor.getObjects()
        for (manager, obj) in objects:
            if obj != list():
                obj, name = geometry_2_piklable_geometry(manager, obj)
                self.session.project.control[unicode(name)] = obj

        scalars = self.scalars_editor.getScalars()
        for scalar in scalars:
            self.session.project.control[unicode(scalar.name)] = scalar

    def load(self):
        """
        Get control from project and put them into widgets
        """
        self.clear()
        proj = self.session.project
        if not proj.control.has_key("color map"):
            proj.control["color map"] = self.colormap_editor.getTurtle().getColorList()
        if not proj.control["color map"]:
            proj.control["color map"] = self.colormap_editor.getTurtle().getColorList()
        i = 0
        logger.debug("Load Control color map: %s " % str(proj.control["color map"]))
        for color in proj.control["color map"]:
            self.colormap_editor.getTurtle().setMaterial(i, color)
            i += 1

        managers = get_managers()
        geom = []
        scalars = []

        for control in proj.control:
            logger.debug(str(proj.control[control]))
            if hasattr(proj.control[control], "__module__"):
                if proj.control[control].__module__ == "openalea.oalab.control.picklable_curves":
                    typename = proj.control[control].typename
                    proj.control[control].name = str(control)
                    manager = managers[typename]
                    geom.append((manager, proj.control[control]))
                elif str(control) != "color map":
                    scalars.append(proj.control[control])
            elif str(control) != "color map":
                scalars.append(proj.control[control])
        if geom is not list():
            logger.debug("Load Control Geom: %s " % str(geom))
            self.geometry_editor.setObjects(geom)
        if scalars is not list():
            logger.debug("Load Control Scalars: %s " % str(scalars))
            self.scalars_editor.setScalars(scalars)
Example #5
0
class ControlPanel(QtGui.QTabWidget):
    """
    Widget to display control of the current project.
    Permit to manage control.
    Double-clic permit to edit control.
    """
    def __init__(self, session, controller, parent=None):
        super(ControlPanel, self).__init__()
        self.session = session

        # Color Map
        self.colormap_editor = MaterialEditor(self)
        self.addTab(self.colormap_editor, "Color Map")

        # Geometry
        self.control_panel_manager = ControlPanelManager(session,
                                                         controller,
                                                         parent=parent)
        self.geometry_editor = LPyPanelWidget(
            parent=None,
            name="Control Panel",
            panelmanager=self.control_panel_manager)
        self.geometry_editor.view.setTheme(
            self.geometry_editor.view.WHITE_THEME)
        self.addTab(self.geometry_editor, "Geometry")

        # Scalars
        self.scalars_editor = ScalarEditor(self)
        self.addTab(self.scalars_editor, "Scalars")

    def clear(self):
        self.geometry_editor.clear()
        n = len(self.scalars_editor.getScalars())
        for scalar in range(n):
            self.scalars_editor.deleteScalars()
        #self.colormap_editor = MaterialEditor(self)

    def update(self):
        """
        Get control from widget and put them into project
        """
        colors = self.colormap_editor.getTurtle().getColorList()
        self.session.project.control["color map"] = colors

        objects = self.geometry_editor.getObjects()
        for (manager, obj) in objects:
            if obj != list():
                obj, name = geometry_2_piklable_geometry(manager, obj)
                self.session.project.control[unicode(name)] = obj

        scalars = self.scalars_editor.getScalars()
        for scalar in scalars:
            self.session.project.control[unicode(scalar.name)] = scalar

    def load(self):
        """
        Get control from project and put them into widgets
        """
        self.clear()
        proj = self.session.project
        if not proj.control.has_key("color map"):
            proj.control["color map"] = self.colormap_editor.getTurtle(
            ).getColorList()
        if not proj.control["color map"]:
            proj.control["color map"] = self.colormap_editor.getTurtle(
            ).getColorList()
        i = 0
        logger.debug("Load Control color map: %s " %
                     str(proj.control["color map"]))
        for color in proj.control["color map"]:
            self.colormap_editor.getTurtle().setMaterial(i, color)
            i += 1

        managers = get_managers()
        geom = []
        scalars = []

        for control in proj.control:
            logger.debug(str(proj.control[control]))
            if hasattr(proj.control[control], "__module__"):
                if proj.control[
                        control].__module__ == "openalea.oalab.control.picklable_curves":
                    typename = proj.control[control].typename
                    proj.control[control].name = str(control)
                    manager = managers[typename]
                    geom.append((manager, proj.control[control]))
                elif str(control) != "color map":
                    scalars.append(proj.control[control])
            elif str(control) != "color map":
                scalars.append(proj.control[control])
        if geom is not list():
            logger.debug("Load Control Geom: %s " % str(geom))
            self.geometry_editor.setObjects(geom)
        if scalars is not list():
            logger.debug("Load Control Scalars: %s " % str(scalars))
            self.scalars_editor.setScalars(scalars)
Example #6
0
    def __init__(self):
        AbstractQtControlWidget.__init__(self)
        MaterialEditor.__init__(self, parent=None)

        # Signal used by "autoapply" method
        self.value_changed_signal = 'valueChanged()'