Skip to content

Commit 4e88a3c

Browse files
committed
🚨 fix and format
1 parent fc8aef8 commit 4e88a3c

File tree

8 files changed

+14
-23
lines changed

8 files changed

+14
-23
lines changed

.vscode/settings.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"python.analysis.typeCheckingMode": "basic"
2+
"python.analysis.typeCheckingMode": "basic",
3+
"editor.formatOnSave": true,
4+
"[python]": {
5+
"editor.defaultFormatter": "charliermarsh.ruff"
6+
}
37
}

src/project_graph/__main__.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
from project_graph.tools.file_tools import read_file
3535

3636
try:
37-
import project_graph.assets.assets # type: ignore
38-
except:
37+
pass # type: ignore
38+
except ImportError:
3939
from PyQt5 import pyrcc_main
4040

4141
if not pyrcc_main.processResourceFile(
@@ -45,22 +45,19 @@
4545
):
4646
print("Failed to compile assets.rcc")
4747
exit(1)
48-
import project_graph.assets.assets # type: ignore
4948

5049
import os
5150

5251
from project_graph.camera import Camera
5352
from project_graph.data_struct.line import Line
5453
from project_graph.data_struct.number_vector import NumberVector
55-
from project_graph.data_struct.rectangle import Rectangle
5654
from project_graph.effect.effect_concrete import (
5755
EffectCircleExpand,
5856
EffectCuttingFlash,
5957
EffectRectangleFlash,
6058
EffectRectangleShrink,
6159
)
6260
from project_graph.effect.effect_manager import EffectManager
63-
from project_graph.entity.entity import Entity
6461
from project_graph.entity.entity_node import EntityNode
6562
from project_graph.node_manager import NodeManager
6663
from project_graph.paint.paint_elements import paint_details_data, paint_grid
@@ -441,7 +438,6 @@ def mouseMoveEvent(self, a0: QMouseEvent | None):
441438
point_world_location = self.camera.location_view2world(point_view_location)
442439

443440
if self.is_dragging:
444-
445441
if a0.buttons() == Qt.MouseButton.LeftButton:
446442
# 如果是左键,移动节点
447443
for node in self.drag_list:
@@ -483,14 +479,13 @@ def mouseMoveEvent(self, a0: QMouseEvent | None):
483479

484480
def mouseReleaseEvent(self, a0: QMouseEvent | None):
485481
assert a0 is not None
486-
point_view_location = NumberVector(a0.pos().x(), a0.pos().y())
487-
point_world_location = self.camera.location_view2world(point_view_location)
482+
# point_view_location = NumberVector(a0.pos().x(), a0.pos().y())
483+
# point_world_location = self.camera.location_view2world(point_view_location)
488484
self.is_dragging = False
489485

490486
if a0.button() == Qt.MouseButton.LeftButton:
491487
pass
492488
if a0.button() == Qt.MouseButton.RightButton:
493-
494489
# 结束连线
495490
if self.connect_from_node is not None and self.connect_to_node is not None:
496491
connect_result = self.node_manager.connect_node(

src/project_graph/data_struct/number_vector.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class NumberVector:
7-
87
def __init__(self, x: float, y: float):
98
self.x: float = x
109
self.y: float = y

src/project_graph/entity/entity_node.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
from typing import List
22
from uuid import uuid4
33

4-
from PyQt5.QtGui import QColor, QPainter
4+
from PyQt5.QtGui import QColor
55

6-
from project_graph.camera import Camera
76
from project_graph.data_struct.number_vector import NumberVector
8-
from project_graph.data_struct.text import Text
97
from project_graph.entity.entity import Entity
108
from project_graph.paint.paint_utils import PainterUtils
119
from project_graph.paint.paintables import Paintable, PaintContext
12-
from project_graph.tools.string_tools import get_size_by_text, get_width_by_file_name
10+
from project_graph.tools.string_tools import get_size_by_text
1311

1412

1513
class EntityNode(Entity):
@@ -89,7 +87,6 @@ def get_components(self) -> List[Paintable]:
8987
return super().get_components()
9088

9189
def paint(self, context: PaintContext):
92-
9390
# 绘制边框
9491
PainterUtils.paint_rect(
9592
context.painter.q_painter(),

src/project_graph/node_manager.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
from time import perf_counter_ns
1+
from PyQt5.QtGui import QColor
22

3-
from PyQt5.QtGui import QColor, QPainter
4-
5-
from project_graph.camera import Camera
63
from project_graph.data_struct.circle import Circle
74
from project_graph.data_struct.curve import ConnectCurve
85
from project_graph.data_struct.line import Line

src/project_graph/paint/paint_utils.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313

1414
class PainterUtils:
15-
1615
@staticmethod
1716
def paint_solid_path(
1817
painter: QPainter,

src/project_graph/paint/painters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from PyQt5.QtCore import QLineF, QPointF, QRectF
1+
from PyQt5.QtCore import QPointF, QRectF
22
from PyQt5.QtGui import QBrush, QColor, QPainter, QPen
33

44
from project_graph.data_struct.curve import ConnectCurve

src/project_graph/tools/string_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from PyQt5.QtGui import QFont, QFontMetrics, QPainter
1+
from PyQt5.QtGui import QFont, QFontMetrics
22

33

44
def get_width_by_file_name(file_name: str) -> int:

0 commit comments

Comments
 (0)