Skip to content
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

envvars-dialog: Allow to paste var=value and fix validation #3679

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jntesteves
Copy link
Contributor

@jntesteves jntesteves commented Jan 7, 2025

  • Rework the envvars dialog to allow copy/pasting complete variable assignments instead of having to input first the name and later the value.
  • Fix the input validation which had some inverted logic and make it behave as expected.
  • Make the panel leaner by removing unnecessary headers and periods at the end of labels.
  • Port to AdwDialog

image

* Rework the envvars dialog to allow copy/pasting complete variable assignments instead of having to input first the name and later the value.
* Fix the input validation which had some inverted logic and make it behave as expected.
* Make the panel leaner by removing unnecessary headers and periods at the end of labels.
@jntesteves jntesteves force-pushed the sane-envvars-dialog branch from fae1add to 35c77c5 Compare January 7, 2025 00:42
Traverse AdwEntryRow's widget tree to remove visibility of the title labels and change alignment of the text entry to center.

This implementation is tightly coupled with the internal representation of AdwEntryRow. Checks were added to prevent crashing if that representation changes, but in such case the layout may get askew.
@jntesteves jntesteves force-pushed the sane-envvars-dialog branch from 8b17cfc to a711a4f Compare January 8, 2025 02:50
@jntesteves jntesteves marked this pull request as ready for review January 8, 2025 02:57
action: "action(window.close)";
}
}
template $EnvVarsDialog: Adw.Dialog {
Copy link
Member

Choose a reason for hiding this comment

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

I think it'd be best to change the name of the dialog to BottlesEnvironmentVariablesDialog. It's definitely long, but I think avoid abbreviations helps the readability. Prefixing with Bottles is also important because libadwaita and GTK follow the same convention.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those libs use their namespaces because they are shared across many projects, but I don't think we need to do that in client code, it's all obviously Bottles, the prefix is unnecessary IMO. I used just EnvironmentVariablesDialog like the rest of our classes, I think that's better.

Copy link
Member

@TheEvilSkeleton TheEvilSkeleton Jan 9, 2025

Choose a reason for hiding this comment

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

Fair enough. I personally prefer the namespace for consistency reasons and increased readability in the inspector, but I guess I will have to change it back to how it was everywhere else

bottles/frontend/windows/envvars.py Outdated Show resolved Hide resolved
bottles/frontend/windows/envvars.py Outdated Show resolved Hide resolved
@@ -2,12 +2,12 @@ using Gtk 4.0;
using Adw 1;

template $EnvVarEntry: Adw.EntryRow {
Copy link
Member

Choose a reason for hiding this comment

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

This should be renamed to BottlesEnvironmentVariableEntry.

@jntesteves jntesteves force-pushed the sane-envvars-dialog branch 2 times, most recently from 704fc2b to 56f959d Compare January 9, 2025 03:19
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.

2 participants