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

Skip to content

Conversation

@ananasmoe
Copy link
Member

No description provided.

@THEGOLDENPRO
Copy link
Member

Nice, going to do some changes. (just in-case you have outstanding commits)

@THEGOLDENPRO
Copy link
Member

THEGOLDENPRO commented Nov 13, 2024

dammit, with serde there's no way to generate toml with comments like this?

@THEGOLDENPRO
Copy link
Member

I think I might just create a template then because I also want it in a specific format.
image

@ananasmoe
Copy link
Member Author

image
It looks like this for me whar

@ananasmoe
Copy link
Member Author

Also i forgot to do image.loading

@THEGOLDENPRO
Copy link
Member

image It looks like this for me whar

I changed it, I wanted keys like info_box_toggle to be separate like info_box.toggle.

@ananasmoe
Copy link
Member Author

Ohhh, i didn't see the dots, i thought they were underscores.

… image.loading, add image.loading.gui, begin improving error handling
@THEGOLDENPRO
Copy link
Member

ohhhh question mark error handling ohhh rust.

image

@THEGOLDENPRO
Copy link
Member

truely unbreakable...

image

@THEGOLDENPRO THEGOLDENPRO linked an issue Nov 13, 2024 that may be closed by this pull request
@THEGOLDENPRO
Copy link
Member

THEGOLDENPRO commented Nov 13, 2024

Alright I'm done with my commits.

It's just that right now the .expect() you chained after Key::from_name will cause roseate to panic and crash if the user set a keybind that is invalid for egui.

Instead of crashing I would like it to send a toast to the user stating that the key bind is invalid but before we can do that I think we first need to create a separate struct for managing toasts so we just pass a reference of that to functions instead of passing &mut toasts everywhere. Also I planned to move the log_and_toasts function to that struct too.

@THEGOLDENPRO
Copy link
Member

perfect

image

@THEGOLDENPRO
Copy link
Member

THEGOLDENPRO commented Nov 14, 2024

One problem with this that I'm realizing now: If we release a new version of roseate that has some new toml fields, toml::from_str::<Config>(&value)? will fail to deserialize it causing all the toml keys to fallback to default values.

This isn't good, is there a way to get toml::from_str to not do that and just return the default value for that missing toml field?

Obviously at the moment toml::from_str doesn't know our default values so it can't determine that alone, maybe there's something with serde that allows as to set a default value individually for each field.

@THEGOLDENPRO
Copy link
Member

Maybe #[serde(default)] but fuck this I'm going to sleep.

@THEGOLDENPRO
Copy link
Member

Idk try it, remove some toml key in your config.toml and see if you get an error. If you do then it's not working.

@ananasmoe
Copy link
Member Author

I tested it and it works.

@ananasmoe
Copy link
Member Author

This works fine for me.

image

@THEGOLDENPRO
Copy link
Member

Idk I tested it by adding a mistyped version of info box toggle:

info_box.togle = "I"

Maybe try that

@THEGOLDENPRO
Copy link
Member

Yeah this won't work, the serde docs even say it only works on structs, so I'm guessing it works when the entire struct is missing but not a value in the struct which sucks.

I think we should just use a get method at this point but if we still want nicely structured configs in the codebase figment looks a little promising.

https://www.reddit.com/r/rust/s/0SUBf7FRFA

@ananasmoe
Copy link
Member Author

I know how i could fix it.

I'll push that fix in an hour or two.

@ananasmoe
Copy link
Member Author

So this should be fixed what you experienced.

@THEGOLDENPRO
Copy link
Member

Yeah I knew this was a way to fix it but ughh it's ugly but ughh it works. They are planning to add support for something like default = false and etc but they still haven't added it.

I think I'm just gonna move these structs and functions into separate files under some config/mod.rs directory or something.

@ananasmoe
Copy link
Member Author

I put all structs into a folder named models.

@ananasmoe
Copy link
Member Author

@THEGOLDENPRO at this point you can make a new devlog.

@THEGOLDENPRO
Copy link
Member

THEGOLDENPRO commented Nov 16, 2024

when I'm done with my multi-threaded journey

the current time says it all

@THEGOLDENPRO
Copy link
Member

I'm not sure about marginal allowance yet 🤔

I was thinking of humanizing that config more by hiding it behind something like this:

[image.optimizations]
downsampling.mode = "strict"

but I'm still thinking about the values these strings will correspond to... well I'm still thinking about EVERYTHING so I'm not sure yet.

@ananasmoe
Copy link
Member Author

tbh i would just keep it like that and add a note: if you don't know what you're doing then don't touch it.

# recommended to set this to "false" as it will lead to the GUI freezing each time you try to zoom in/out.
dynamic.lazy_loading = true

[ui_settings]
Copy link
Member

Choose a reason for hiding this comment

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

we can shorten this down to just ui

Copy link
Member

@THEGOLDENPRO THEGOLDENPRO Nov 16, 2024

Choose a reason for hiding this comment

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

already done in my commit btw, I did a lot of refactoring so be ready for merge conflicts if you changed anything 💀

@THEGOLDENPRO
Copy link
Member

tbh i would just keep it like that and add a note: if you don't know what you're doing then don't touch it.

I'm gonna leave marginal allowance out for now as the image optimization stuff is still very work in progress and I have a lot of changes for this portion of the code in some uncommitted commits so this config won't last long anyways.

Also I'll be merging this now.

@THEGOLDENPRO THEGOLDENPRO merged commit aacdf85 into main Nov 17, 2024
@THEGOLDENPRO THEGOLDENPRO deleted the feat/toml-config branch November 17, 2024 00:27
@ananasmoe
Copy link
Member Author

@THEGOLDENPRO when new dev log dropping

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.

Add TOML configuration.

3 participants