feenkcom / gtoolkit

Glamorous Toolkit is the Moldable Development environment. It empowers you to make systems explainable through experiences tailored for each problem.
https://gtoolkit.com
MIT License
1.12k stars 49 forks source link

Users should be able to override the default phlow tools for their custom Lepiter Page Types. #4167

Open botwhytho opened 1 week ago

botwhytho commented 1 week ago

From Discord thread. Copying message content below.

LePage>>#asPhlowTool should delegate to LePageType hierarchy for the default (or custom) composite tools. Currently LePage>>#asLepiterPagePhlowToolFocusStatus: has the default composite tool defined as:

    ^ GtPhlowCompositeTool new
        addTool: (LePagePhlowTool new
            shouldFocusFirstSnippet: aBoolean;
            page: self);
        addTool: (GtPhlowTool default object: self)";
        addTool: (GtConnectorTool new object: self)"

This should be defined in LePageType and any subclass should be able to override I already have 2 packages that use Lepiter pages to store arbitrary json in custom snippets. It would be nice to turn the Lepiter pages these packages use into having custom page types so that when I open those pages they are displayed differently. I have a third use case I want to work on which is a kanban board in Gt. I would want to store a 'board' as a Lepiter page, with lists and cards as snippet hierarchies. The default display of that should be a kanban board view, NOT a normal Lepiter page. Currently it doesn't seem possible to do what I want without the above refactorings in Gt

botwhytho commented 2 days ago

@JurajKubelka mirroring some Discord comments here that are relevant:

The functionality to provide the hook point is pretty quick to implement, I can open a quick PR for that. What I think feenk might need to assist with:

  • Error handling & falling back to a sane default if one opens a database with an unknown page type
  • A collection of GtAdvices and/or page in the Gt book that explains the various methods one may need to define/override if creating a custom LePageType subclass. I have a dummy custom page type working right now but if I restart the image or reload the database, I get deserialization errors and Lepiter marks the file tied to that page corrupt

Have encountered multiple errors along the way that are not clear at the outset and have required me to override various methods as LePageType is an abstract-ish class