-
-
Notifications
You must be signed in to change notification settings - Fork 108
migrating Preferences and Messages to stand-alone version #1130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
so for the language display issue, i suspect it happened when i renamed it's fixed now |
|
Hi @AhmedMagedC Thank you for the PR! Sorry I got a little busy, hope to get to this soon! |
Stefterv
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @AhmedMagedC Thank you again for the work! It is heading very much in the right direction. I have added some comments as suggestions to help further improve
| */ | ||
| @JvmStatic | ||
| fun showMessage(title: String = "Message", message: String) { | ||
| if (Base.isCommandLine()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that the JOptionPane parts should stay and the println can be in the universal class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i understand you correctly, you wanna seperate the appearance of graphical messages via JOptionPane to be only used by app.Messages and a simple println only for the utils.Messages
but wouldn't that make an issue in utils module? as for example in processing.utils.settingslocation and processing.utils.Base
error messages via Messages.showError() wouldn't display a graphical message only just a console print. So is it accepctable? also bear in mind that i cannot use app.Messages for this purpose because i want the utils module along with the utils.preference class to be fully independent of app module
| load(new FileInputStream(preferencesFile)); | ||
|
|
||
| } catch (Exception ex) { | ||
| Messages.showError("Error reading preferences", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these could be transformed to normal errors and then catch and log them in the app classes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can do that. but that would depend on how we choose to implement utils.Messages
if we decided to keep the use of JOptionPane in utils.Messages then this delegation of catching and logging the errors in app rather than in utils wouldn't make much sense because we will use the same method but in different location
if we decided to remove JOptionPane and keep only the println then i can do that delegation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the build folder to the .gitignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already did in this commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but the build files themselves are still in the PR (see here for examples on how to clean this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay done!
Thanks for pointing this out, i though git would remove it automaticlly after adding it to .gitignore
what about the other points above?
|
Hi @AhmedMagedC Sorry it took me so long to take a look at your PR again! and again thank you for your efforts, it's helping me a lot trying figure out how to refactor some of these intertwined elements. Looking at your PR and #1164 I think it is important moving forward that we only migrate one class at a time. I would suggest that any functionality in the |
Hi @Stefterv , It's okay it's also the first time for me trying to refactor a codebase by decoupling tightly-coupled classes im not sure i follow you, also for the change of getting the setting folder for each OS is now independent of |
|
Yes exactly, instead of migrating |
|
Hi @Stefterv , Sorry for the late reply i was busy for the last couple of weeks i see now that we should currently focus on migrating for the paths, i dont undetstand why i should undo it |
|
Hi @AhmedMagedC! Again your work on this has been invaluable in figuring out a strategy for starting to untangle some of these parts. I’m recommending we tackle one class at a time to avoid regressions and the risk of having to undo a PR because of an unforeseen side effect in the existing code. For me, an important part of these decoupling steps is making the coupling between classes more visible. That way, we can gradually refine each class to have clearer inputs and outputs. |
d71cd9d to
3f36db5
Compare
Resolves #1104
Changes
Preferencesto:app:utilsmodule making it independent ofappmodule by also moving the functionalities that depends onapptoAppPreferencesclassMessagesclass to be able to use it (for example in debugging) in different areas of ProcessingUtilsinto:app:utils, because why keeping it inappit doesn't need any functionalities from there, and also can be used in:app:utilswithout the need to depend onappgetSettingsFolder()method for each platform from:appto:app:utils, without duplication the code i madeapp.Platformclass to depend onSettingsResolverin:app:utilsto get the correct location for each platformdefaults.txtnow by using JAR resource system instead ofPlatform.getContentFile()(which is also marked as deprecated in the codebase encouraging to migrate to JAR RS)Todo
Tests
I tried to compile and run, as for now preferences are loaded and saved correctly
but for some reason some languages aren't displayed properly like: arabic , chinese, but languages like: english, japanese properly displayed.
I will look into it, but any help or suggestion of why that happens is very much appreciated