[Pharo-users] Some Spotter Questions

Sven Van Caekenberghe sven at stfx.eu
Thu Jan 28 04:15:22 EST 2016


Doru,

> On 27 Jan 2016, at 17:46, Tudor Girba <tudor at tudorgirba.com> wrote:
> 
> Hi,
> 
>> On Jan 27, 2016, at 4:54 PM, Sven Van Caekenberghe <sven at stfx.eu> wrote:
>> 
>> Hi,
>> 
>> I managed to add a spotter extension and preview, but I still have some questions.
> 
> Thank you! Can you describe the extension?

Not yet, but soon ;-)

>> Is there some global top level overview documentation about writing Spotter extensions ?
> 
> Only some blog posts:
> https://www.google.com/search?client=safari&rls=en&q=site:humane-assessment.com+GTSpotter

I found that, I also used Torsten's article:

https://medium.com/concerning-pharo/multiple-desktops-for-pharo-5cbc46f3179f

which is using GT tools in a nice/cool way.

Still, it is not enough.

> Writing a help is in progress. It would be very useful to drive it through your questions.
> 
> 
>> Is the only way to add a 'global/first' search extension by adding a method to class GTSpotter itself ?
> 
> Yes.
> 
> 
>> I don't see any other package do that (in a modular way), it feels a bit wrong compared to how modular the GT inspector is.
> 
> It is exactly the same design as the inspector. Every step in Spotter has an object as an input (like the inspector), and the first object when opening Spotter is an instance of GTSpotter.

It just felt strange to be the first to add an extension there.

>> Is there a way to reuse a GT inspector view as a preview ? I tried that but it did not work, but what I copied over was 99% identical.
> 
> Not yet. The problem is the missing 1% :)

Duplicating the functionality like we have to do today should ideally be avoided (see my example at the end).

>> Can you have tabs (multiple pages) in the preview ?
> 
> Not for now. At the moment, you can have multiple previews, and only the first one will be displayed.

OK

>> Is it possible to control on what tab an inspector opens when a matching item is clicked (like to maintain the same view as the preview) ?
> 
> No.
> 
> 
>> What are some best practices for the order, exact matches, fast searching, etc … ?
> 
> Not much. The best practice is to simply watch the usage, and try to accommodate the best way :).

It is very cool to be able to inspect the pragma and browse each usage as source code !

>> Is it possible to search in multiple ways (multiple properties), not just collection -> itemName -> GTFilterSubstring ? (Say I want to search all fields of an address object).
> 
> Of course. Take a look at the GTFilter hierarchy, and you can just write your own.
> 
> 
>> Searching for Color by name, or by RGB and other representations would seem like a good tutorial example (for me).
> 
> I am not sure I understand, but it sounds intriguing and I am looking for a case that we can use for a tutorial. Could you elaborate? Perhaps we can write this together.

GTSpotter>>#spotterForColorFor: aStep
  <spotterOrder: 20>
  aStep listProcessor
    title: 'Color';
    allCandidates: [ Color brickColorRegistry values ];
    itemName: [ :each | each name ];
    filter: GTFilterSubstring;
    wantsToDisplayOnEmptyQuery: false

Color>>#spotterPreviewColorIn: aComposite
  <spotterPreview: 0>
  aComposite custom: (BorderedMorph new color: self)

This works fine. 

Just for fun, I would also like to be able to search using CSS style color specs, like FFF or C0C0C0 (3 or 6 hex digits for RGB). How would that fit in ?  There is #asHexString, but I would like a bit more control and intelligence from my part: I want to write the test and there would only be one answer.

Sven

> Cheers,
> Doru
> 
> 
>> Thx,
>> 
>> Sven
> 
> --
> www.tudorgirba.com
> www.feenk.com
> 
> "Don't give to get. Just give."
> 
> 
> 
> 
> 
> 
> 





More information about the Pharo-users mailing list