Skip to content

Commit f686683

Browse files
committed
Update dev version
Update dev version * Rename variable
1 parent 891f2fd commit f686683

File tree

5 files changed

+40
-41
lines changed

5 files changed

+40
-41
lines changed

je_editor/git/commit_graph.py

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@
77

88
@dataclass
99
class CommitNode:
10-
sha: str
11-
author: str
12-
date: str
13-
message: str
14-
parents: List[str]
15-
lane: int = -1 # assigned later
16-
10+
commit_sha: str
11+
author_name: str
12+
commit_date: str
13+
commit_message: str
14+
parent_shas: List[str]
15+
lane_index: int = -1 # assigned later
1716

1817
@dataclass
1918
class CommitGraph:
@@ -24,14 +23,14 @@ def build(self, commits: List[Dict], refs: Dict[str, str]) -> None:
2423
# commits are topo-ordered by git log --topo-order; we keep it.
2524
self.nodes = [
2625
CommitNode(
27-
sha=c["sha"],
28-
author=c["author"],
29-
date=c["date"],
30-
message=c["message"],
31-
parents=c["parents"],
26+
commit_sha=c["sha"],
27+
author_name=c["author"],
28+
commit_date=c["date"],
29+
commit_message=c["message"],
30+
parent_shas=c["parents"],
3231
) for c in commits
3332
]
34-
self.index = {n.sha: i for i, n in enumerate(self.nodes)}
33+
self.index = {n.commit_sha: i for i, n in enumerate(self.nodes)}
3534
self._assign_lanes()
3635

3736
def _assign_lanes(self) -> None:
@@ -46,30 +45,30 @@ def _assign_lanes(self) -> None:
4645
# If any active lane points to this commit, use that lane
4746
lane_found = None
4847
for lane, sha in list(active.items()):
49-
if sha == node.sha:
48+
if sha == node.commit_sha:
5049
lane_found = lane
5150
break
5251

5352
if lane_found is None:
5453
if free_lanes:
55-
node.lane = free_lanes.pop(0)
54+
node.lane_index = free_lanes.pop(0)
5655
else:
57-
node.lane = 0 if not active else max(active.keys()) + 1
56+
node.lane_index = 0 if not active else max(active.keys()) + 1
5857
else:
59-
node.lane = lane_found
58+
node.lane_index = lane_found
6059

6160
# Update active: current node consumes its lane, parents occupy lanes
6261
# Remove the current sha from any lane that pointed to it
6362
for lane, sha in list(active.items()):
64-
if sha == node.sha:
63+
if sha == node.commit_sha:
6564
del active[lane]
6665

6766
# First parent continues in the same lane; others go to free/new lanes
68-
if node.parents:
69-
first = node.parents[0]
70-
active[node.lane] = first
67+
if node.parent_shas:
68+
first = node.parent_shas[0]
69+
active[node.lane_index] = first
7170
# Side branches
72-
for p in node.parents[1:]:
71+
for p in node.parent_shas[1:]:
7372
# Pick a free lane or new one
7473
if free_lanes:
7574
pl = free_lanes.pop(0)

je_editor/pyside_ui/git/graph_view.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,16 @@ def _redraw(self):
8484

8585
edge_pen = QPen(EDGE_COLOR, 2)
8686
for row, node in enumerate(self.graph.nodes):
87-
if not node.parents:
87+
if not node.parent_shas:
8888
continue
89-
x0 = self._lane_x(node.lane)
89+
x0 = self._lane_x(node.lane_index)
9090
y0 = self._row_y(row)
91-
for p in node.parents:
91+
for p in node.parent_shas:
9292
if p not in self.graph.index:
9393
continue
9494
prow = self.graph.index[p]
9595
parent_node = self.graph.nodes[prow]
96-
x1 = self._lane_x(parent_node.lane)
96+
x1 = self._lane_x(parent_node.lane_index)
9797
y1 = self._row_y(prow)
9898
path = QPainterPath(QPointF(x0, y0))
9999
ctrl_y = (y0 + y1) / 2.0
@@ -103,20 +103,20 @@ def _redraw(self):
103103
self._scene.addItem(edge_item)
104104

105105
for row, node in enumerate(self.graph.nodes):
106-
cx = self._lane_x(node.lane)
106+
cx = self._lane_x(node.lane_index)
107107
cy = self._row_y(row)
108108

109109
circle = QGraphicsEllipseItem(
110110
QRectF(cx - NODE_RADIUS, cy - NODE_RADIUS, NODE_RADIUS * 2, NODE_RADIUS * 2)
111111
)
112-
circle.setBrush(QBrush(lane_color(node.lane)))
112+
circle.setBrush(QBrush(lane_color(node.lane_index)))
113113
circle.setPen(QPen(Qt.PenStyle.NoPen))
114114
circle.setToolTip(self.language_wrapper_get(
115115
"git_graph_tooltip_commit"
116-
).format(short=node.sha[:7],
117-
author=node.author,
118-
date=node.date,
119-
msg=node.message))
116+
).format(short=node.commit_sha[:7],
117+
author=node.author_name,
118+
date=node.commit_date,
119+
msg=node.commit_message))
120120
self._scene.addItem(circle)
121121

122122
label_item = QGraphicsSimpleTextItem(str(row + 1))
@@ -126,7 +126,7 @@ def _redraw(self):
126126

127127
self._scene.setSceneRect(
128128
QRectF(-40, 0,
129-
self._lane_x(max(n.lane for n in self.graph.nodes) + 1) + self._padding,
129+
self._lane_x(max(n.lane_index for n in self.graph.nodes) + 1) + self._padding,
130130
self._row_y(len(self.graph.nodes)) + self._padding)
131131
)
132132

je_editor/utils/multi_language/english.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@
110110
"tab_menu_stackoverflow_tab_name": "Stackoverflow",
111111
"tab_menu_ipython_tab_name": "IPython(Jupyter)",
112112
"tab_menu_chat_ui_tab_name": "ChatUI",
113-
"tab_menu_git_client_tab_name": "GitClient",
114-
"tab_menu_git_branch_tree_view_tab_name": "GitBranchTreeView",
115-
"tab_menu_variable_inspector_tab_name": "VariableInspector",
116-
"tab_menu_console_widget_tab_name": "ConsoleWidget",
113+
"tab_menu_git_client_tab_name": "Git Client",
114+
"tab_menu_git_branch_tree_view_tab_name": "Git BranchTreeViewer",
115+
"tab_menu_variable_inspector_tab_name": "Variable Inspector",
116+
"tab_menu_console_widget_tab_name": "Console Widget",
117117
# Text Menu
118118
"text_menu_label": "Text",
119119
"text_menu_label_font": "Font",

je_editor/utils/multi_language/traditional_chinese.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@
104104
"tab_menu_stackoverflow_tab_name": "Stackoverflow",
105105
"tab_menu_ipython_tab_name": "IPython(Jupyter)",
106106
"tab_menu_chat_ui_tab_name": "ChatUI",
107-
"tab_menu_git_client_tab_name": "GitClient",
108-
"tab_menu_git_branch_tree_view_tab_name": "GitBranchTreeView",
109-
"tab_menu_variable_inspector_tab_name": "VariableInspector",
107+
"tab_menu_git_client_tab_name": "Git Client",
108+
"tab_menu_git_branch_tree_view_tab_name": "Git BranchTreeViewer",
109+
"tab_menu_variable_inspector_tab_name": "Variable Inspector",
110110
"tab_menu_console_widget_tab_name": "ConsoleWidget",
111111
# Text Menu
112112
"text_menu_label": "文字",

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
66

77
[project]
88
name = "je_editor_dev"
9-
version = "0.0.233"
9+
version = "0.0.234"
1010
authors = [
1111
{ name = "JE-Chen", email = "[email protected]" },
1212
]

0 commit comments

Comments
 (0)