New App: Notes

Started by Mario, August 11, 2017, 07:39:51 PM

Previous topic - Next topic

Mario

I wanted a real-life sample for working with Attributes and Metadata. And I was looking for an example which can be enhanced later to support speech input (dictating text), as the corresponding HTML5 technologies mature.

So, I cam up with the Notes App (click to zoom):



The app loads/stores text either from the XMP description tag or a text Attribute.
This can be controlled via the Option page the user reaches via the Gear button.



Although the app looks simple, it is not. It combines several techniques which are useful for a broad range of apps.
I have commented the code extensively, which should allow interested users to borrow what they need for their own apps.

Some of the techniques shown in this app:

+ Loading and saving per-user settings

+ Loading/Storing data from/to Attributes

+ Loading/Storing data from/to metadata

+ Loading a list of available Attributes in the database and allowing the user to select one

+ Creating an Attribute Set and Attributes from scratch (this is new in IMatch 2017.8.4 and later). I have also updated the Attributes Sample app for that release.

+ Monitoring IMatch for file window events (to know when the selection has changed)

+ Monitoring IMWS for events, to know when Attribute data or the Attribute schema changes.

+ Monitoring the user typing, to know when to save the text back.
The app automatically saves changes back when the user stops typing for more than 1 second. This reduces the risk of data loss and frees the user from having to press Save buttons or similar.

+ Spell checking is available via the built-in spell checking in the Chromium browser.

+ Using an external style sheets to control font-size dynamically (for easier viewing)

+ Using a fancy font, loaded from a open source handwriting TTF font file shipped with the app. Just for show, really. You can also switch to the default font.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Jingo

Thanks Mario - looks really cool and I'm sure the comments within the app will help us application developers for sure!

Will this be made available in the next release?  Thx - Andy.

BanjoTom

This app looks VERY useful!  Thanks for the constant improvements, Mario!
— Tom, in Lexington, Kentucky, USA

Mario

Quote from: Jingo on August 11, 2017, 11:03:21 PM
Will this be made available in the next release?  Thx - Andy.

Yes, I think so.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Mario

I have reworked this app over the past days, changing my mind several times. Making changes to the new /schema endpoints, even adding a new feature to IMatch Attributes!

While it is possible to create this app to work with arbitrary Attribute Sets, it complicates things a lot. If the app would use an Attribute Set which is also updated by the user, the app would have to deal with many special cases...

For example, if a user selects multiple files, the Attribute set can have a different number of records for each file. Some files have no records, others have 1 or 10. Which of these records to update with the Note?

One workable approach would be to load existing data and searching for a record that matches the Note before the user has changed it. Then update this instance, else add another record. Doable, but it would complicate the script and would make it less useful an an example.

I decided to use a dedicated Attribute set if the user configures the app to use Attributes (instead of the XMP description). If the Set does not exist, it is automatically created with the new v1/attributes/schema/set/create endpoint.

Further, I've added a new "Hidden Set" option to IMatch Attributes. If a set is created to be a hidden set, it is not visible in the IMatch Attributes Panel. The hidden option can be set/updated from apps and also by the user on Edit > Preferences > Edit Attributes. The user can always un-hide hidden sets if he wants to see the contents or needs to fix something  ;)

Hidden Attribute Sets make it easier for apps to manage 'app-private' data in Attribute Sets.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook