Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@SteffenHeu
Copy link
Member

Hi Tomas,

I moved most of the appearance settings from the individual plot's constructors to the theme settings.

Best
Steffen

@tomas-pluskal
Copy link
Member

Awesome, thanks a lot!

@tomas-pluskal
Copy link
Member

The palette setup dialog looks a little chaotic, especially when resized:
Screen Shot 2020-03-11 at 21 12 38
How about adding some labels to the components and arranging them into a grid?
Also, it currently accepts empty Name, which I think it shouldn't.

@tomas-pluskal
Copy link
Member

I am not sure why we need the "Add default" button. The default palettes should always be there and non-changeable. You can also remove the "Color palettes (color blindness mode)" parameter.

@SteffenHeu
Copy link
Member Author

grafik
This is how it looks now.

I think removing the blindness parameter should be a different PR.

@tomas-pluskal
Copy link
Member

I think you can remove the blindness parameter in this PR, and instead make three (not one) default palettes, which correspond to the different settings of the old blindness parameter.

Regarding adding colors, perhaps it would make sense to place the Color, Add color, and Remove color components right under the color palette. The Name parameter can be in the top. And the Accept and Cancel buttons can be in the bottom.
By the way, how does the Cancel button work? If you add a color to the palette and then click Cancel, the color is removed again?

@SteffenHeu
Copy link
Member Author

Regarding the cancel button:
Yes, the palette gets cloned for the picker dialog. If it gets changed and accepted it is replaced, if canceled nothing happens.

@robinschmid
Copy link
Member

Looks great. Can you drag and drop the colors to change the order?

@SteffenHeu
Copy link
Member Author

Looks great. Can you drag and drop the colors to change the order?

Yes you can.

Without the abbreviations the component would get pretty large I think.

@tomas-pluskal
Copy link
Member

Thanks @SteffenHeu !
Please set the minimum size of the palette editing Stage, otherwise it can be resized too small.
Screen Shot 2020-03-20 at 22 53 51
Also would be nice to add some padding around the Ok Cancel buttons and separate them by a horizontal line (in other words, use identical layout to the ParameterSetupDialog).

Removing all colors from the palette leads to exceptions and weird behavior.

By the way, with your current code I see these errors during MZmine startup. Please check the code for loading/saving of the values.

[22:50:28|WARNING|io.github.mzmine.util.color.SimpleColorPalette]: java.lang.IllegalArgumentException: Invalid color specification
[22:50:28|WARNING|io.github.mzmine.util.color.SimpleColorPalette]: Could not load positve/negative colors of Normal. Setting default colors
[22:50:28|WARNING|io.github.mzmine.util.color.SimpleColorPalette]: java.lang.IllegalArgumentException: Invalid color specification
[22:50:28|WARNING|io.github.mzmine.util.color.SimpleColorPalette]: Could not load positve/negative colors of Deuteranopia. Setting default colors
[22:50:28|WARNING|io.github.mzmine.util.color.SimpleColorPalette]: java.lang.IllegalArgumentException: Invalid color specification
[22:50:28|WARNING|io.github.mzmine.util.color.SimpleColorPalette]: Could not load positve/negative colors of Protanopia. Setting default colors
[22:50:28|WARNING|io.github.mzmine.util.color.SimpleColorPalette]: java.lang.IllegalArgumentException: Invalid color specification
[22:50:28|WARNING|io.github.mzmine.util.color.SimpleColorPalette]: Could not load positve/negative colors of Tritanopia. Setting default colors
[22:50:28|WARNING|io.github.mzmine.util.color.SimpleColorPalette]: java.lang.IllegalArgumentException: Invalid color specification
[22:50:28|WARNING|io.github.mzmine.util.color.SimpleColorPalette]: Could not load positve/negative colors of Deuternopia. Setting default colors
[22:50:28|WARNING|io.github.mzmine.util.color.SimpleColorPalette]: java.lang.IllegalArgumentException: Invalid color specification
[22:50:28|WARNING|io.github.mzmine.util.color.SimpleColorPalette]: Could not load positve/negative colors of . Setting default colors

@SteffenHeu
Copy link
Member Author

SteffenHeu commented Mar 20, 2020

@tomas-pluskal The warnings you are receiving are intended behaviour. They should be caused, because you have older versions of the color palettes saved in your xml files, that did not contain the neg/pos/neu colors. So the values cannot be read from the xml.

The exception is handled here: https://github.com/SteffenHeu/mzmine3/blob/bbef859edeb36e993e4b22057c18c84474fdb2e0/src/main/java/io/github/mzmine/util/color/SimpleColorPalette.java#L288
`public void loadFromXML(Element xmlElement) {
this.setName(xmlElement.getAttribute(NAME_ATTRIBUTE));
String text = xmlElement.getTextContent();

String pos = xmlElement.getAttribute(POS_ATTRIBUTE);
String neg = xmlElement.getAttribute(NEG_ATTRIBUTE);
String neu = xmlElement.getAttribute(NEU_ATTRIBUTE);

Color clrPos, clrNeg, clrNeu;

try {
  text = text.substring(1, text.length() - 1);
  text = text.replaceAll("\\s", "");
  String[] clrs = text.split(",");
  for (String clr : clrs) {
    delegate.add(Color.web(clr));
  }
} catch (Exception e) {
  logger.warning(e.toString());
  logger.warning("Could not load color palette " + name + ". Setting default colors.");
  this.addAll(
      ColorsFX.getSevenColorPalette(Vision.DEUTERANOPIA, true));
}

try {
  clrPos = Color.web(pos);
  clrNeg = Color.web(neg);
  clrNeu = Color.web(neu);
} catch (Exception e) {
  logger.warning(e.toString());
  logger.warning(
      "Could not load positve/negative colors of " + name + ". Setting default colors.");
  clrPos = ColorsFX.getPositiveColor(Vision.DEUTERANOPIA);
  clrNeg = ColorsFX.getNegativeColor(Vision.DEUTERANOPIA);
  clrNeu = ColorsFX.getNeutralColor();
}`

Should i remove the logging of the error message itself and just log that the color was not loaded?

delegate.add(Color.web(clr));
}
} catch (Exception e) {
logger.warning(e.toString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When logging an exception (Throwable), please use this method:
https://docs.oracle.com/en/java/javase/13/docs/api/java.logging/java/util/logging/Logger.html#log(java.util.logging.Level,java.lang.String,java.lang.Throwable)
That way you can log the error message and the exception at the same time.

double y = this.sceneToLocal(exit).getY();
int rows = (int) ((RECT_HEIGHT * palette.size()) / getWidth() + 1);

logger.info("rows: " + rows);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please clean up these messages, they are not informative enough to be logged at INFO level

x = (x < 0) ? 0 : x;
y = (y < 0) ? 0 : y;
y = (y / RECT_HEIGHT <= rows) ? y : rows;
logger.info("y: " + y);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here

@tomas-pluskal
Copy link
Member

tomas-pluskal commented Mar 21, 2020

Awesome improvements!

I noticed this warning when I opened the dialog:

[9:04:37|INFO|io.github.mzmine.gui.mainwindow.MainMenuController]: Showing the Preferences dialog
[9:04:37|WARNING|io.github.mzmine.parameters.parametertypes.colorpalette.ColorPaletteComponent]: Value of ColorPaletteComponent was set to a value not contained in the items. This might lead to unexpected behaviour.

I just opened the dialog after starting MZmine, so I think this should not cause a warning.

By the way, you could indicate the drag&drop procedure visually using the setDragView() and setOpacity() functions. See here:
https://github.com/mzmine/mzmine3/blob/master/src/main/java/io/github/mzmine/util/javafx/DraggableListCell.java#L48
https://github.com/mzmine/mzmine3/blob/master/src/main/java/io/github/mzmine/util/javafx/DraggableListCell.java#L62

@tomas-pluskal
Copy link
Member

I also noticed these log messages, which probably should be more informative:

[10:41:08|INFO|io.github.mzmine.util.color.SimpleColorPalette]: [palette: null]

@SteffenHeu
Copy link
Member Author

SteffenHeu commented Mar 22, 2020

By the way, you could indicate the drag&drop procedure visually using the setDragView() and setOpacity() functions. See here:
https://github.com/mzmine/mzmine3/blob/master/src/main/java/io/github/mzmine/util/javafx/DraggableListCell.java#L48
https://github.com/mzmine/mzmine3/blob/master/src/main/java/io/github/mzmine/util/javafx/DraggableListCell.java#L62

Thanks @tomas-pluskal, that made me understand how the drag & drop works properly. I will change the whole drag & drop implementation now to make it proper!

Edit: Where exactly are you getting that
[10:41:08|INFO|io.github.mzmine.util.color.SimpleColorPalette]: [palette: null]
message? I remember seeing it some time ago, but i thought i fixed it already.

worked fine once, afterwards this exception happened
Exception in thread "JavaFX Application Thread" java.lang.IllegalStateException: Cannot start drag and drop on node that is not in scene
- before, it was not possible to move a color to the end
  - move method was simplified in the process

- d&d problem was that the rectangles were updated before the d&d was finished. this lead to the old ones not being in the scene
@tomas-pluskal
Copy link
Member

Thanks @SteffenHeu, I think it looks great now!

I noticed the "Show data points" button shows the data points in white color, could you please check why that happens?
Screen Shot 2020-03-25 at 22 48 54

@tomas-pluskal
Copy link
Member

Thanks @SteffenHeu ! Are you still working on this or is it ready for merging?

@SteffenHeu
Copy link
Member Author

I'd say it's ready. We might find some bugsor inconsistencies at some point, but they can be fixed then.

@tomas-pluskal
Copy link
Member

Thanks @SteffenHeu ! It's a great addition.

@tomas-pluskal tomas-pluskal merged commit c66687c into mzmine:master Apr 1, 2020
@SteffenHeu SteffenHeu deleted the chartstuff branch May 8, 2020 14:42
robinschmid added a commit that referenced this pull request Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants