Example #1
0
    def _save_xml(self, p):
        cp = CanvasParser(p)

        for tag in ('laser', 'stage', 'turbo', 'getter',
                    'ionpump','gauge',
                    'spectrometer', 'tank', 'pipette'):
            for ei in cp.get_elements(tag):
                self._set_element_color(ei)
                self._set_element_translation(ei)

        for ei in cp.get_elements('valve'):
            self._set_element_translation(ei)

        for ei in cp.get_elements('connection'):
            # name = ei.text.strip()
            start = ei.find('start').text.strip()
            end = ei.find('end').text.strip()
            name = '{}_{}'.format(start, end)

            obj = self.scene.get_item(name)
            for t, tt in ((obj.clear_vorientation, 'vertical',),
                          (obj.clear_horientation, 'horizontal')):
                if t and obj.get('orientation') == tt:
                    ei.set('orientation', '')

                    # if obj.clear_vorientation and obj.orientation=='vertical':
                    # ei.set('orientation', '')
                    # if obj.clear_orientation and obj.orientation=='':
                    # ei.set('orientation', '')

        # p = os.path.join(os.path.dirname(p, ), 'test.xml')
        cp.save()
Example #2
0
    def _save_button_fired(self):
        cp = CanvasParser(self.path)

        for o in self._valve_changes:
            for t in SWITCH_TAGS:
                elem = next(
                    (s
                     for s in cp.get_elements(t) if s.text.strip() == o.name),
                    None)
                if elem:
                    t = elem.find('translation')
                    t.text = '{},{}'.format(o.x, o.y)
                    break

        for o in self._rect_changes:
            for t in RECT_TAGS:
                elem = next(
                    (s
                     for s in cp.get_elements(t) if s.text.strip() == o.name),
                    None)
                if elem:
                    t = elem.find('translation')
                    t.text = '{},{}'.format(o.x, o.y)
                    t = elem.find('dimension')
                    t.text = '{},{}'.format(o.width, o.height)
                    break

        cp.save()
Example #3
0
    def _save_xml(self, p):
        cp = CanvasParser(p)

        for tag in ('laser', 'stage', 'spectrometer'):
            for ei in cp.get_elements(tag):
                self._set_element_color(ei)
                self._set_element_translation(ei)

        for ei in cp.get_elements('valve'):
            self._set_element_translation(ei)

        for ei in cp.get_elements('connection'):
            # name = ei.text.strip()
            start = ei.find('start').text.strip()
            end = ei.find('end').text.strip()
            name = '{}_{}'.format(start, end)

            obj = self.scene.get_item(name)
            for t, tt in ((
                    obj.clear_vorientation,
                    'vertical',
            ), (obj.clear_horientation, 'horizontal')):
                if t and obj.get('orientation') == tt:
                    ei.set('orientation', '')

                    # if obj.clear_vorientation and obj.orientation=='vertical':
                    # ei.set('orientation', '')
                    # if obj.clear_orientation and obj.orientation=='':
                    # ei.set('orientation', '')

        # p = os.path.join(os.path.dirname(p, ), 'test.xml')
        cp.save()
Example #4
0
    def _save_xml(self, p):
        cp = CanvasParser(p)

        for tag in ("laser", "stage", "turbo", "getter", "ionpump", "gauge", "spectrometer", "tank", "pipette"):
            for ei in cp.get_elements(tag):
                self._set_element_color(ei)
                self._set_element_translation(ei)

        for ei in cp.get_elements("valve"):
            self._set_element_translation(ei)

        for ei in cp.get_elements("connection"):
            # name = ei.text.strip()
            start = ei.find("start").text.strip()
            end = ei.find("end").text.strip()
            name = "{}_{}".format(start, end)

            obj = self.scene.get_item(name)
            for t, tt in ((obj.clear_vorientation, "vertical"), (obj.clear_horientation, "horizontal")):
                if t and obj.get("orientation") == tt:
                    ei.set("orientation", "")

                    # if obj.clear_vorientation and obj.orientation=='vertical':
                    # ei.set('orientation', '')
                    # if obj.clear_orientation and obj.orientation=='':
                    # ei.set('orientation', '')

        # p = os.path.join(os.path.dirname(p, ), 'test.xml')
        cp.save()
Example #5
0
    def _save_xml(self, p):
        cp = CanvasParser(p)

        for tag in ('laser', 'stage', 'spectrometer'):
            for ei in cp.get_elements(tag):
                self._set_element_color(ei)
                self._set_element_translation(ei)

        for ei in cp.get_elements('valve'):
            self._set_element_translation(ei)

        for ei in cp.get_elements('connection'):
            name = ei.text.strip()
            obj = self.scene.get_item(name)
            if obj.clear_orientation:
                ei.set('orientation', '')

        p = os.path.join(os.path.dirname(p, ), 'test.xml')
        cp.save()
Example #6
0
    def _save_xml(self, p):
        cp = CanvasParser(p)

        for tag in ('laser', 'stage', 'spectrometer'):
            for ei in cp.get_elements(tag):
                self._set_element_color(ei)
                self._set_element_translation(ei)

        for ei in cp.get_elements('valve'):
            self._set_element_translation(ei)

        for ei in cp.get_elements('connection'):
            name = ei.text.strip()
            obj = self.scene.get_item(name)
            if obj.clear_orientation:
                ei.set('orientation', '')

        p = os.path.join(os.path.dirname(p, ), 'test.xml')
        cp.save()