Beispiel #1
0
 def _load_holder_positions(self, holes):
     self.irradiated_positions = []
     if holes:
         with dirty_ctx(self):
             with no_update(self):
                 self.irradiated_positions = [
                     IrradiatedPosition(hole=int(c), pos=(x, y))
                     for x, y, r, c in holes
                 ]
Beispiel #2
0
 def _load_holder_positons_from_file(self, name):
     p = os.path.join(self._get_map_path(), name)
     self.irradiated_positions = []
     with open(p, 'r') as f:
         line = f.readline()
         nholes, _diam = line.split(',')
         self.irradiated_positions = [
             IrradiatedPosition(hole=ni + 1) for ni in range(int(nholes))
         ]
Beispiel #3
0
    def _load_holder_positions(self, holder):
        self.irradiated_positions = []
        geom = holder.geometry
        if geom:
            self.initialized = False
            self.irradiated_positions = [IrradiatedPosition(hole=c + 1, pos=(x, y))
                                         for c, (x, y, r) in iter_geom(geom)]
            self.initialized = True


        elif holder.name:
            self._load_holder_positons_from_file(holder.name)
Beispiel #4
0
 def _load_holder_positions(self, holder):
     self.irradiated_positions = []
     geom = holder.geometry
     with dirty_ctx(self):
         if geom:
             with no_update(self):
                 self.irradiated_positions = [
                     IrradiatedPosition(hole=c + 1, pos=(x, y))
                     for c, (x, y, r) in iter_geom(geom)
                 ]
         elif holder.name:
             self._load_holder_positons_from_file(holder.name)
 def recover(self):
     irradiation = self.irradiation
     level = self.level
     if irradiation and level:
         p = os.path.join(paths.hidden_dir,
                          'backup.{}.{}.yaml'.format(irradiation, level))
         with open(p, 'r') as rfile:
             self.irradiated_positions = [
                 IrradiatedPosition(**pos) for pos in yaml.load(rfile)
             ]
     else:
         self.information_dialog('No recover file for {}'.format(
             irradiation, level))
 def factory(li, pp):
     rri = IrradiatedPosition()
     self._sync_position(pp, rri, include_canvas=False)
     rri.level = li
     rri.irradiation = irradname
     return rri