Browse Source

monochromatic: handles more cases, less messages

Johann ELSASS 3 years ago
parent
commit
8861442b04
1 changed files with 10 additions and 7 deletions
  1. 10 7
      resources/scripts/channels_monochromatic.py

+ 10 - 7
resources/scripts/channels_monochromatic.py

@@ -2,13 +2,13 @@
 # (fr) Canaux > Rendre monochrome
 # (fr) Canaux > Rendre monochrome
 # (es) Canales > Hacer monocromático
 # (es) Canales > Hacer monocromático
 # (de) Kanäle > Monochromatisch machen
 # (de) Kanäle > Monochromatisch machen
-from lazpaint import image, dialog, layer, filters
+from lazpaint import image, dialog, layer, filters, colors
 
 
 translation = dialog.select_translation(
 translation = dialog.select_translation(
-  en = {"Remove this layer to remove hue": "Remove this layer to remove hue", "This is not a chromatic channel": "This is not a chromatic channel"}, 
-  fr = {"Remove this layer to remove hue": "Supprimer ce calque pour enlever la teinte", "This is not a chromatic channel": "Ce n'est pas un canal chromatique"}, 
-  es = {"Remove this layer to remove hue": "Elimina esta capa para eliminar el tono", "This is not a chromatic channel": "Este no es un canal cromático"}, 
-  de = {"Remove this layer to remove hue": "Diese Ebene entfernen, um den Farbton zu entfernen", "This is not a chromatic channel": "Dies ist kein chromatischer Kanal"},  
+  en = {"This is not a chromatic channel": "This is not a chromatic channel"},
+  fr = {"This is not a chromatic channel": "Ce n'est pas un canal chromatique"},
+  es = {"This is not a chromatic channel": "Este no es un canal cromático"},
+  de = {"This is not a chromatic channel": "Dies ist kein chromatischer Kanal"},
   )
   )
   
   
 channel = layer.get_registry("split-channel")
 channel = layer.get_registry("split-channel")
@@ -19,8 +19,11 @@ elif channel == "G" or channel == "M":
 elif channel == "B" or channel == "Y":
 elif channel == "B" or channel == "Y":
   source = "blue"
   source = "blue"
 elif channel == "H":
 elif channel == "H":
-  dialog.show_message(translation["Remove this layer to remove hue"])
-  exit()  
+  layer.fill(colors.GRAY)
+  exit()
+elif channel is None:
+  colors.grayscale()
+  exit()
 else:
 else:
   dialog.show_message(translation["This is not a chromatic channel"])
   dialog.show_message(translation["This is not a chromatic channel"])
   exit()
   exit()