PySimpleSQL / pysimplesql

SQLite3 binding for PySimpleGUI
GNU Lesser General Public License v3.0
47 stars 16 forks source link

Use Placeholder “*Required, eg:” + domain default for Input,Multiline #317

Closed ssweber closed 1 year ago

ssweber commented 1 year ago

This is an idea I’m working on:

I’ve found it’s relatively easy to subclass Input/Multiline to add placeholder capability.

when you focus-in, the placeholder is deleted. If you focus-out with no-input, placeholder is filled back in.

Instead of pre-filling domain defaults (when a default is not provided in the database column), we would add the required + example domain default directly to the widget.

we override get() to only return actual input, not if state is with_placeholder.

Thoughts on this?

ssweber commented 1 year ago

https://github.com/PySimpleSQL/pysimplesql/assets/57631333/05643799-6dd5-44f6-b624-9eabad3ba31d

ssweber commented 1 year ago

this second video shows how it would look like if we got rid of the bright red markers. Again, we’d have to figure out a way to indicate required combo/checkboxes

https://github.com/PySimpleSQL/pysimplesql/assets/57631333/4743b2f9-55b4-4d73-9e9e-ac824c6362bb

ssweber commented 1 year ago

After playing around with this, I’d recommend:

1) keep the not-null markers 2) only prefill not-null fields that have defaults set in database, - not_null_defaults become placeholder suggestions, rather than what is automatically inserted into dataset.rows 3) enable “Required” or whatever is set in lang.placeholder_not_null for not-null sg.inputs and sg.multiline 4) default to this new ss.PlaceholderInput, in fields, but users could opt out by specifying sg.Input

ssweber commented 1 year ago

I added a basic version of this, that just automatically adds "*Required" if you delete any pre-filled text in notnull fields to #313

ssweber commented 1 year ago

I’m going to enhance, to allow the optional null default to by Langformat-ed onto the end of the “*Required” text.

the names for these enhanced widgets are way too long though - maybe we can call them just Input and Multiline?