Opened 10 years ago

Closed 8 years ago

Last modified 7 years ago

#2400 closed enhancement (fixed)

Object Chooser API awkward / too limited

Reported by: sascha_silbe Owned by: alsroot
Priority: Unspecified by Maintainer Milestone:
Component: Sugar Version: Git as of bugdate
Severity: Major Keywords:
Cc: Distribution/OS:
Bug Status: New

Description

The Object Chooser API is rather awkward to work with if one wants to let the user select a specific kind of object from the Journal. what_filter takes a single string which is either the bundle ID of an activity or the name of a generic MIME type collection (e.g. 'Audio'). There is no way to select objects

  1. that are not part of a predefined collection (e.g. a TIFF image as TIFF is not yet part of the 'Image' collection) or
  2. have a specific MIME type (e.g. only Ogg Vorbis audio files, but no MP3s).

From an API point of view, passing a query dictionary like we do in sugar.datastore.datastore.find() would be a good way to approach this. I'm not sure about the UI part, though: Currently we use the what_filter to preselect the "What" combo box. Some parts of a query dictionary translate more or less easily into the existing filters while others have no UI equivalent at all.

A compromise might be supporting only specific filters, but with a clean API. E.g. one of the mockups explains:

The object chooser supports some extra parameters from activities, including lists of filters and mime-types. The filter list specifies presets for the controls in the toolbar, for instance allowing an "insert image" button to automatically filter for all entries of type "image". A boolean for each specified filter determines whether or not the preset is locked, or remains adjustable by the child. The mime-type list specifies the formats which the activity can support. Items which do not match on this list and therefore cannot be selected are rendered with gray text, and do not receive a highlight on rollover.

Change History (3)

comment:1 Changed 8 years ago by dnarvaez

  • Component changed from journal to sugar

comment:2 Changed 8 years ago by godiard

  • Resolution set to fixed
  • Status changed from new to closed

This issue was improved with the last changes, allowing a better control about what filter. While is not possible select a specific mime type (like "MP3 files") I can't see a use case where we need that right now.

Also the filter_type parameter allow further extensions in the future.

Closing. We should open more specific requests if needed.

comment:3 Changed 7 years ago by dnarvaez

  • Milestone 1.0 deleted

Milestone 1.0 deleted

Note: See TracTickets for help on using tickets.