Skip to content

Commit cca19eb

Browse files
committed
Colormap manager: more consistent dialog titles
1 parent 59f36d6 commit cca19eb

4 files changed

Lines changed: 59 additions & 61 deletions

File tree

-95 Bytes
Binary file not shown.

plotpy/locale/fr/LC_MESSAGES/plotpy.po

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
msgid ""
77
msgstr ""
88
"Project-Id-Version: \n"
9-
"POT-Creation-Date: 2024-03-01 09:05+0100\n"
9+
"POT-Creation-Date: 2024-03-01 09:20+0100\n"
1010
"PO-Revision-Date: 2019-02-20 14:42+0100\n"
1111
"Last-Translator: \n"
1212
"Language-Team: \n"
@@ -401,7 +401,9 @@ msgstr "Déplacer vers le premier plan"
401401

402402
#: plotpy\panels\itemlist.py:94 plotpy\panels\itemlist.py:236
403403
#: plotpy\tools\item.py:154 plotpy\tools\item.py:179
404-
#: plotpy\widgets\colormap\manager.py:149
404+
#: plotpy\widgets\colormap\manager.py:155
405+
#: plotpy\widgets\colormap\manager.py:320
406+
#: plotpy\widgets\colormap\manager.py:329
405407
msgid "Remove"
406408
msgstr "Supprimer"
407409

@@ -2031,42 +2033,38 @@ msgstr "Relative position"
20312033
msgid "Must be a value between 0.0 and 1.0."
20322034
msgstr "Doit être une valeur entre 0.0 et 1.0"
20332035

2034-
#: plotpy\widgets\colormap\manager.py:61
2035-
msgid "Save"
2036-
msgstr "Enregistrer"
2037-
2038-
#: plotpy\widgets\colormap\manager.py:63
2036+
#: plotpy\widgets\colormap\manager.py:66
20392037
msgid "Enter a colormap name:"
20402038
msgstr "Entrer un nom de palette de couleurs :"
20412039

2042-
#: plotpy\widgets\colormap\manager.py:69
2040+
#: plotpy\widgets\colormap\manager.py:72
20432041
msgid ""
20442042
"New colormap name cannot contain special characters except underscores (_)."
20452043
msgstr ""
20462044
"Un nom de colormap ne peut pas contenir de caractères spéciauxexcepté les "
20472045
"tirets bas (_)."
20482046

2049-
#: plotpy\widgets\colormap\manager.py:128
2047+
#: plotpy\widgets\colormap\manager.py:134
20502048
msgid "Colormap manager"
20512049
msgstr "Gestionnaire de palettes de couleurs"
20522050

2053-
#: plotpy\widgets\colormap\manager.py:147
2051+
#: plotpy\widgets\colormap\manager.py:153
20542052
msgid "Add"
20552053
msgstr "Ajouter"
20562054

2057-
#: plotpy\widgets\colormap\manager.py:154
2055+
#: plotpy\widgets\colormap\manager.py:160
20582056
msgid "Select or create a colormap"
20592057
msgstr "Sélectionner ou créer une palette de couleurs"
20602058

2061-
#: plotpy\widgets\colormap\manager.py:155
2059+
#: plotpy\widgets\colormap\manager.py:161
20622060
msgid "Colormap presets:"
20632061
msgstr "Palettes de couleurs prédéfinies :"
20642062

2065-
#: plotpy\widgets\colormap\manager.py:168
2063+
#: plotpy\widgets\colormap\manager.py:174
20662064
msgid "Edit the selected colormap"
20672065
msgstr "Modifier la palette de couleurs sélectionnée"
20682066

2069-
#: plotpy\widgets\colormap\manager.py:275
2067+
#: plotpy\widgets\colormap\manager.py:281
20702068
msgid ""
20712069
"Name <b>%s</b> is already used by a default colormap, and cannot be used for "
20722070
"a custom colormap.<br><br>Please choose another name."
@@ -2075,40 +2073,35 @@ msgstr ""
20752073
"ne peut pas être utilisé pour une palette de couleurs personnalisée."
20762074
"<br><br>Veuillez choisir un autre nom."
20772075

2078-
#: plotpy\widgets\colormap\manager.py:287
2076+
#: plotpy\widgets\colormap\manager.py:293
20792077
msgid ""
20802078
"Name <b>%s</b> is already used by a custom colormap.<br><br>Do you want to "
20812079
"overwrite it?"
20822080
msgstr ""
20832081
"Le nom <b>%s</b> est déjà utilisé par une palette de couleurs personnalisée."
20842082
"<br><br>Voulez-vous l'écraser ?"
20852083

2086-
#: plotpy\widgets\colormap\manager.py:303
2084+
#: plotpy\widgets\colormap\manager.py:309
20872085
msgid "New"
20882086
msgstr "Nouveau"
20892087

2090-
#: plotpy\widgets\colormap\manager.py:314
2091-
#: plotpy\widgets\colormap\manager.py:323
2092-
msgid "Delete colormap"
2093-
msgstr "Supprimer la palette de couleurs"
2094-
2095-
#: plotpy\widgets\colormap\manager.py:315
2088+
#: plotpy\widgets\colormap\manager.py:321
20962089
msgid "Colormap <b>%s</b> is a default colormap and cannot be deleted."
20972090
msgstr ""
20982091
"La palette de couleurs <b>%s</b> est une palette par défaut et ne peut pas "
20992092
"être supprimée."
21002093

2101-
#: plotpy\widgets\colormap\manager.py:324
2094+
#: plotpy\widgets\colormap\manager.py:330
21022095
msgid "Do you want to delete colormap <b>%s</b>?"
21032096
msgstr "Souhaitez-vous supprimer la palette de couleurs <b>%s</b> ?"
21042097

2105-
#: plotpy\widgets\colormap\manager.py:350
2098+
#: plotpy\widgets\colormap\manager.py:356
21062099
msgid "Save colormap"
21072100
msgstr "Enregistrer la palette de couleurs"
21082101

2109-
#: plotpy\widgets\colormap\manager.py:352
2110-
msgid "New colormap"
2111-
msgstr "Nouvelle palette de couleurs"
2102+
#: plotpy\widgets\colormap\manager.py:358
2103+
msgid "Add colormap"
2104+
msgstr "Ajouter une palette de couleurs"
21122105

21132106
#: plotpy\widgets\colormap\widget.py:311
21142107
msgid "Right click to add/remove a color"
@@ -2272,6 +2265,12 @@ msgstr "Rotation et rognage"
22722265
msgid "Show cropping rectangle"
22732266
msgstr "Afficher le rectangle de rognage"
22742267

2268+
#~ msgid "Save"
2269+
#~ msgstr "Enregistrer"
2270+
2271+
#~ msgid "Delete colormap"
2272+
#~ msgstr "Supprimer la palette de couleurs"
2273+
22752274
#~ msgid "Create new colormap"
22762275
#~ msgstr "Créer une nouvelle palette de couleurs"
22772276

plotpy/locale/plotpy.pot

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
msgid ""
66
msgstr ""
77
"Project-Id-Version: PACKAGE VERSION\n"
8-
"POT-Creation-Date: 2024-03-01 09:05+0100\n"
8+
"POT-Creation-Date: 2024-03-01 09:20+0100\n"
99
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1010
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1111
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -378,7 +378,9 @@ msgstr ""
378378

379379
#: plotpy\panels\itemlist.py:94 plotpy\panels\itemlist.py:236
380380
#: plotpy\tools\item.py:154 plotpy\tools\item.py:179
381-
#: plotpy\widgets\colormap\manager.py:149
381+
#: plotpy\widgets\colormap\manager.py:155
382+
#: plotpy\widgets\colormap\manager.py:320
383+
#: plotpy\widgets\colormap\manager.py:329
382384
msgid "Remove"
383385
msgstr ""
384386

@@ -1971,69 +1973,60 @@ msgstr ""
19711973
msgid "Must be a value between 0.0 and 1.0."
19721974
msgstr ""
19731975

1974-
#: plotpy\widgets\colormap\manager.py:61
1975-
msgid "Save"
1976-
msgstr ""
1977-
1978-
#: plotpy\widgets\colormap\manager.py:63
1976+
#: plotpy\widgets\colormap\manager.py:66
19791977
msgid "Enter a colormap name:"
19801978
msgstr ""
19811979

1982-
#: plotpy\widgets\colormap\manager.py:69
1980+
#: plotpy\widgets\colormap\manager.py:72
19831981
msgid "New colormap name cannot contain special characters except underscores (_)."
19841982
msgstr ""
19851983

1986-
#: plotpy\widgets\colormap\manager.py:128
1984+
#: plotpy\widgets\colormap\manager.py:134
19871985
msgid "Colormap manager"
19881986
msgstr ""
19891987

1990-
#: plotpy\widgets\colormap\manager.py:147
1988+
#: plotpy\widgets\colormap\manager.py:153
19911989
msgid "Add"
19921990
msgstr ""
19931991

1994-
#: plotpy\widgets\colormap\manager.py:154
1992+
#: plotpy\widgets\colormap\manager.py:160
19951993
msgid "Select or create a colormap"
19961994
msgstr ""
19971995

1998-
#: plotpy\widgets\colormap\manager.py:155
1996+
#: plotpy\widgets\colormap\manager.py:161
19991997
msgid "Colormap presets:"
20001998
msgstr ""
20011999

2002-
#: plotpy\widgets\colormap\manager.py:168
2000+
#: plotpy\widgets\colormap\manager.py:174
20032001
msgid "Edit the selected colormap"
20042002
msgstr ""
20052003

2006-
#: plotpy\widgets\colormap\manager.py:275
2004+
#: plotpy\widgets\colormap\manager.py:281
20072005
msgid "Name <b>%s</b> is already used by a default colormap, and cannot be used for a custom colormap.<br><br>Please choose another name."
20082006
msgstr ""
20092007

2010-
#: plotpy\widgets\colormap\manager.py:287
2008+
#: plotpy\widgets\colormap\manager.py:293
20112009
msgid "Name <b>%s</b> is already used by a custom colormap.<br><br>Do you want to overwrite it?"
20122010
msgstr ""
20132011

2014-
#: plotpy\widgets\colormap\manager.py:303
2012+
#: plotpy\widgets\colormap\manager.py:309
20152013
msgid "New"
20162014
msgstr ""
20172015

2018-
#: plotpy\widgets\colormap\manager.py:314
2019-
#: plotpy\widgets\colormap\manager.py:323
2020-
msgid "Delete colormap"
2021-
msgstr ""
2022-
2023-
#: plotpy\widgets\colormap\manager.py:315
2016+
#: plotpy\widgets\colormap\manager.py:321
20242017
msgid "Colormap <b>%s</b> is a default colormap and cannot be deleted."
20252018
msgstr ""
20262019

2027-
#: plotpy\widgets\colormap\manager.py:324
2020+
#: plotpy\widgets\colormap\manager.py:330
20282021
msgid "Do you want to delete colormap <b>%s</b>?"
20292022
msgstr ""
20302023

2031-
#: plotpy\widgets\colormap\manager.py:350
2024+
#: plotpy\widgets\colormap\manager.py:356
20322025
msgid "Save colormap"
20332026
msgstr ""
20342027

2035-
#: plotpy\widgets\colormap\manager.py:352
2036-
msgid "New colormap"
2028+
#: plotpy\widgets\colormap\manager.py:358
2029+
msgid "Add colormap"
20372030
msgstr ""
20382031

20392032
#: plotpy\widgets\colormap\widget.py:311

plotpy/widgets/colormap/manager.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,15 @@ class ColorMapNameEdit(QW.QDialog):
5353
5454
Args:
5555
parent: parent QWidget. Defaults to None.
56+
title: dialog box title. Defaults to "".
5657
name: default colormap name. Defaults to "".
5758
"""
5859

59-
def __init__(self, parent: QW.QWidget | None = None, name: str = "") -> None:
60+
def __init__(
61+
self, parent: QW.QWidget | None = None, title: str = "", name: str = ""
62+
) -> None:
6063
super().__init__(parent)
61-
self.setWindowTitle(_("Save"))
64+
self.setWindowTitle(title)
6265

6366
label = QW.QLabel(_("Enter a colormap name:"))
6467
self._edit = QW.QLineEdit()
@@ -93,17 +96,20 @@ def get_colormap_name(self) -> str:
9396
return self._edit.text()
9497

9598
@classmethod
96-
def edit(cls, parent: QW.QWidget | None = None, name: str = "") -> str | None:
99+
def edit(
100+
cls, parent: QW.QWidget | None = None, title: str = "", name: str = ""
101+
) -> str | None:
97102
"""Open the dialog box and return the colormap name entered in the QLineEdit.
98103
99104
Args:
100105
parent: parent QWidget. Defaults to None.
106+
title: dialog box title. Defaults to "".
101107
name: default colormap name. Defaults to "".
102108
103109
Returns:
104110
colormap name, or None if the dialog box was canceled.
105111
"""
106-
dialog = cls(parent, name)
112+
dialog = cls(parent, title, name)
107113
if exec_dialog(dialog):
108114
return dialog.get_colormap_name()
109115
return None
@@ -265,7 +271,7 @@ def __get_new_colormap_name(self, title: str, name: str) -> str | None:
265271
"""
266272
new_name = name
267273
while True:
268-
new_name = ColorMapNameEdit.edit(self, new_name)
274+
new_name = ColorMapNameEdit.edit(self, title, new_name)
269275
if new_name is None:
270276
return None
271277
if cmap_exists(new_name, DEFAULT_COLORMAPS):
@@ -311,7 +317,7 @@ def delete_colormap(self) -> None:
311317
if cmap_exists(cmap.name, DEFAULT_COLORMAPS):
312318
QW.QMessageBox.warning(
313319
self,
314-
_("Delete colormap"),
320+
_("Remove"),
315321
_("Colormap <b>%s</b> is a default colormap and cannot be deleted.")
316322
% cmap.name,
317323
QW.QMessageBox.Ok,
@@ -320,7 +326,7 @@ def delete_colormap(self) -> None:
320326
if (
321327
QW.QMessageBox.question(
322328
self,
323-
_("Delete colormap"),
329+
_("Remove"),
324330
_("Do you want to delete colormap <b>%s</b>?") % cmap.name,
325331
QW.QMessageBox.Yes | QW.QMessageBox.No,
326332
QW.QMessageBox.No,
@@ -349,7 +355,7 @@ def save_colormap(self, cmap: EditableColormap | None = None) -> bool:
349355
cmap = self.colormap_editor.get_colormap()
350356
title = _("Save colormap")
351357
else:
352-
title = _("New colormap")
358+
title = _("Add colormap")
353359
new_name = self.__get_new_colormap_name(title, cmap.name)
354360
if new_name is None:
355361
return False

0 commit comments

Comments
 (0)