Quote:
Originally Posted by Starson17
How do you contemplate presenting the user with the option to define a Yes/No field? Is there going to be some sort of setup screen for defining fields?
|
Yes. There are buttons on the columns page in the config dialog that permit adding, deleting, and editing new columns. When a column is created, its type is specified, The type cannot be changed later, although other attributes can be.
The default value for a column is None/null/not-set. A Yes/No column is no different than any other column.
Note that all column types have the null value 'problem'. However, I think that unless the distinction is made important, people won't notice it. For example, for int columns, columns set to a value will sort before columns never set (blank), and I expect that people will think that this behavior is correct. The same is true for the various text fields.
Of course, the same argument can be made for booleans.

It is too late in the evening for this sort of discussion. Sigh.
Quote:
With two-valued you're going to have to have a way to choose the default value.
|
As I said, the default value for every column is None. If the user doesn't like that, then use the bulk editor after creating the column to set it to the value desired.
Quote:
I wonder if you could set it up so the user chooses the default value? I can see presenting two checkboxes for the default value marked Yes and No. If the user clicks neither, the field becomes tri-valued.
|
I see this creating more questions than it prevents. First, it makes yes/no columns strange, different from the other columns. Second, it creates questions about what the boxes mean and highlights a concept the many people simple don't care about. Defaulting to two-value where None and No are considered the same solves that problem. Internally maintaining three values (remembering values that were explicitly set to false) helps protect work of users who later decide to set the tweak to change to visible tri-valued fields.
For the developers out there: the tweak is implemented. The search code is:
Code:
if IS_CUSTOM[loc] == 'bool':
v = item[loc]
if tweaks['boolean_custom_column_values'] == 'two-valued':
if v is None or not v: # item is None or set to false
if q in [_('no'), _('unchecked'), 'false']:
matches.add(item[0])
else: # item is explicitly set to true
if q in [_('yes'), _('checked'), 'true']:
matches.add(item[0])
else:
if v is None:
if q in [_('empty'), _('blank'), 'false']:
matches.add(item[0])
elif not v: # is not None and false
if q in [_('no'), _('unchecked'), 'true']:
matches.add(item[0])
else: # item is not None and true
if q in [_('yes'), _('checked'), 'true']:
matches.add(item[0])
continue