Skip to content

Commit fc95c85

Browse files
committed
Enhance ABListEditDialog with improved UX features and drag-and-drop support
1 parent 2af2a9d commit fc95c85

2 files changed

Lines changed: 336 additions & 49 deletions

File tree

activity_browser/actions/method/method_rename.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import bw2data as bd
77

8-
from activity_browser import signals
8+
from activity_browser import application, signals
99
from activity_browser.ui import widgets
1010
from activity_browser.actions.base import ABAction, exception_dialogs
1111

@@ -56,7 +56,11 @@ def run(method_name: tuple[str] | list[tuple[str]]):
5656
method = bd.Method(method_name)
5757

5858
# open dialog to get new name
59-
dialog = widgets.ABListEditDialog(method_name)
59+
dialog = widgets.ABListEditDialog(
60+
method_name,
61+
title="Rename Impact Category",
62+
parent=application.main_window
63+
)
6064
dialog.exec_()
6165

6266
# if dialog was cancelled, do nothing
@@ -66,6 +70,9 @@ def run(method_name: tuple[str] | list[tuple[str]]):
6670
new_name = dialog.get_data(as_tuple=True)
6771

6872
# check new name validity
73+
if new_name == method_name:
74+
return # no change
75+
6976
if len(new_name) == 0:
7077
raise RuntimeError("Method name cannot be empty.")
7178

0 commit comments

Comments
 (0)