[Pharo-users] Some Spotter Questions

Tudor Girba tudor at tudorgirba.com
Sun Jan 31 02:14:29 EST 2016


Hi,


> On Jan 28, 2016, at 10:15 AM, Sven Van Caekenberghe <sven at stfx.eu> wrote:
> 
> 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 ;-)

Ok, great :).


>>> 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.

Agreed.


>> 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.

We were also thinking of adding an extra discovery mechanism for any class with a special pragma, but at the moment it worked fine like this.


>>> 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).

Of course :). The problem is that Spotter is built on another infrastructure than the Inspector. We will consolidate both in one in the future.


>>> 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 !

:). Actually, I use this as an example for people that do not use Pharo. Annotations are incredibly wide-spread today, and no IDE has a first-class search for annotations. Funny, no?


>>> 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. 

Nice idea. This could work well. Now, to be able to cover all Spotter functionality, we would also need to find a way to have a meaningful processor when diving in a Color object. Any idea?

How about, searching for similar colors?


> 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.

That is even cooler. This would exemplify how to build a custom filter.

Cheers,
Doru


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

--
www.tudorgirba.com
www.feenk.com

"Every thing should have the right to be different."








More information about the Pharo-users mailing list