def addLayers(self, final_n): """Add layers until the number of layers equals final_n.""" if final_n > settings.max_number_of_layers: return if final_n >= len(self.layers): for i in range(final_n - len(self.layers) + 1): layer = Surface.create(self) layer.atom_types = self.substrate_atom_types layer.hide() self.layers.append(layer)
def __init__(self, parent): super(MolecularScene, self).__init__(parent) self.surface = Surface.create(self) self.surface.atom_types = settings.surface_atom_types[:] self.substrate_atom_types = settings.substrate_atom_types[:] self.layers = [self.surface] self.addLayers(settings.number_of_layers) self.current_layer_i = 0 self.current_layer = self.layers[self.current_layer_i] self.peek_layer = None self.selection_box = None self.drag_border = None self.draw_mode = DRAW_ALL self.updateSceneRect() self.update()