Skip to content

Commit

Permalink
Solved issue of wrong line-width cause by accidental removal of lines…
Browse files Browse the repository at this point in the history
… from api object list
  • Loading branch information
QuimMoya committed Jul 8, 2024
1 parent 3c87907 commit 9241521
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
20 changes: 8 additions & 12 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def clean_segments(self) -> None:
Remove all segments from the scene
"""
for segment in self.segments_list:
self.editor.remove_from_scene(segment)
self.editor.remove_only_graphic_element(segment)

self.segments_list = list()

Expand Down Expand Up @@ -259,6 +259,8 @@ def redraw_segments(self) -> None:

self.update_connectors()

self.editor.Update_widths()

def substation_to(self):
return self.editor.graphics_manager.query(elm=self.api_object.get_substation_to())

Expand Down
11 changes: 11 additions & 0 deletions src/GridCal/Gui/Diagrams/MapWidget/grid_map_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,13 @@ def add_to_scene(self, graphic_object: ALL_MAP_GRAPHICS = None) -> None:

self.map.diagram_scene.addItem(graphic_object)

def remove_only_graphic_element(self, graphic_object: ALL_MAP_GRAPHICS = None) -> None:
"""
Removes only the graphic elements, not the api_object
:param graphic_object: Graphic object associated
"""
self.map.diagram_scene.removeItem(graphic_object)

def remove_from_scene(self, graphic_object: ALL_MAP_GRAPHICS = None) -> None:
"""
Add item to the diagram and the diagram scene
Expand Down Expand Up @@ -813,6 +820,10 @@ def wheelEvent(self, event: QWheelEvent):

# SANTIAGO: NO TOCAR ESTO ES EL COMPORTAMIENTO DESEADO

self.Update_widths()

def Update_widths(self):

max_zoom = self.map.max_level
min_zoom = self.map.min_level
zoom = self.map.zoom_factor
Expand Down

0 comments on commit 9241521

Please sign in to comment.