Glamour: update presenter with new text

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
28 messages Options
12
Reply | Threaded
Open this post in threaded view
|

Re: Glamour: update presenter with new text

HilaireFernandes
Plus I understood it will be replace by Calypso, right?

May be hacking on Calypso would make sense, but there are several use
cases I want to explore with Glamour, so...


Le 12/07/2017 à 22:24, Stephane Ducasse a écrit :
> I can tell you that you do not want to play with nautilus :).
>
> Stef

--
Dr. Geo
http://drgeo.eu



Reply | Threaded
Open this post in threaded view
|

Re: Glamour: update presenter with new text

Denis Kudriashov

2017-07-13 9:00 GMT+02:00 Hilaire <[hidden email]>:
Plus I understood it will be replace by Calypso, right?

That's the plan.
 

May be hacking on Calypso would make sense, but there are several use
cases I want to explore with Glamour, so...

What exactly you are implementing?
Reply | Threaded
Open this post in threaded view
|

Re: Glamour: update presenter with new text

HilaireFernandes
Le 13/07/2017 à 10:01, Denis Kudriashov a écrit :
> What exactly you are implementing?
Browsers to edit Dr. Geo user script. Explained in a previous mail of
this thread.
The idea is to show the user the strict minimum, to reduce confusion.

Hilaire


--
Dr. Geo
http://drgeo.eu



Reply | Threaded
Open this post in threaded view
|

Re: Glamour: update presenter with new text

Tudor Girba-2
Hi,

I took a quick look. To get the methods properly update and selected when modifying code, you should use the reference to the method, and the not the compiled method.

Try this:

methodsIn: composite  
composite wrapper  title: 'Methods' translated;
show: [ :wrapper |
wrapper fastList 
display: [ :aClass | aClass methods collect: [ :m | m asRingDefinition ] ];
format: [ :aCompiledMethod | aCompiledMethod selector asString ] ].
composite wrapper title:  'Script data' translated;
show: [ :wrapper |
wrapper fastList 
display: [ :aClass | aClass class methods  collect:  [ :m | m asRingDefinition ] ];
format: [ :aCompiledMethod | aCompiledMethod selector asString ] ].
composite updateOn: MethodModified from: [ SystemAnnouncer uniqueInstance ].

composite onChangeOfPort: #activePresentation act: [ :presentation | 
(presentation pane port: #activePresentation) value ifNotNil: [ :activePresentation | 
((browser paneNamed: #methods) port: #selection) value: (activePresentation defaultPane port: #selection) value ] ].


Cheers,
Doru


On Jul 13, 2017, at 10:21 AM, Hilaire <[hidden email]> wrote:

Le 13/07/2017 à 10:01, Denis Kudriashov a écrit :
What exactly you are implementing?
Browsers to edit Dr. Geo user script. Explained in a previous mail of
this thread.
The idea is to show the user the strict minimum, to reduce confusion.

Hilaire


-- 
Dr. Geo
http://drgeo.eu




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

"From an abstract enough point of view, any two things are similar."




Reply | Threaded
Open this post in threaded view
|

Re: Glamour: update presenter with new text

HilaireFernandes

Thanks Doru, it works as a charm!

I don't think I could find it by myself, or I will have to become a Glamour expert.

To make it perfect, there is still a fix needed for the DrGeo script browser:

The class method 'scriptName' of each Dr. Geo script class returns a string, it used in the browser (and other place) to list meaningfully the script (and not use the generic class name).

Therefore, when the user edit this method, the script name listed in the left panel should be updated accordingly. I edit the code as bellow:

scriptsIn: constructor
    constructor fastList
        title: 'Scripts' translated;
        display: [ :organiser |  organiser ];
        format: #scriptName.
    constructor  updateOn: MethodModified from: [ SystemAnnouncer uniqueInstance ].


It gives the expected behaviour. Is it the right way to do it?

Thanks

Hilaire



Le 13/07/2017 à 11:50, Tudor Girba a écrit :

I took a quick look. To get the methods properly update and selected when modifying code, you should use the reference to the method, and the not the compiled method.


-- 
Dr. Geo
http://drgeo.eu
Reply | Threaded
Open this post in threaded view
|

Re: Glamour: update presenter with new text

Tudor Girba-2
Hi,

On Jul 14, 2017, at 9:52 AM, Hilaire <[hidden email]> wrote:

Thanks Doru, it works as a charm!

Great.

I don't think I could find it by myself, or I will have to become a Glamour expert.

Actually, this is not really related to Glamour, but to how CompiledMethods are dealt with by the system. A CompiledMethod is immutable, so every time you change a method, a new CompiledMethod object gets created. So, if the browser shows CompiledMethods, you will always see the old version. This would have been the same without Glamour as well. That is why you need to show a RingMethodDefinition which only holds a reference made by the name of the method that is resolved dynamically.


To make it perfect, there is still a fix needed for the DrGeo script browser:

The class method 'scriptName' of each Dr. Geo script class returns a string, it used in the browser (and other place) to list meaningfully the script (and not use the generic class name).

Therefore, when the user edit this method, the script name listed in the left panel should be updated accordingly. I edit the code as bellow:

scriptsIn: constructor
    constructor fastList
        title: 'Scripts' translated;
        display: [ :organiser |  organiser ];
        format: #scriptName.
    constructor  updateOn: MethodModified from: [ SystemAnnouncer uniqueInstance ].


It gives the expected behaviour. Is it the right way to do it?


constructor fastList creates a CompositePresentation that holds a ListPresentation. Think of a CompositePresentation as a morphic pane: it is a holder without much logic. The data you want to update is dealt with by ListPresentation. Thus, what you want to update is the list, not the whole composite.

scriptsIn: constructor
constructor fastList
title: 'Scripts' translated;
display: [ :organiser |  organiser ];
format: #scriptName;
updateOn: MethodModified from: [ SystemAnnouncer uniqueInstance ]
.

Cheers,
Doru



Thanks

Hilaire


Le 13/07/2017 à 11:50, Tudor Girba a écrit :

I took a quick look. To get the methods properly update and selected when modifying code, you should use the reference to the method, and the not the compiled method.


-- 
Dr. Geo

http://drgeo.eu

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

"Every successful trip needs a suitable vehicle."





Reply | Threaded
Open this post in threaded view
|

Re: Glamour: update presenter with new text

HilaireFernandes

Thanks for the updates on both the internal dependencies and the ListPresentation.

From this browser, I deduced a second simpler browser for only one script. It was easy to do so thanks to your tips (attached pic).

With this simpler script editor, when I open a script, I like it opens on the compute method, because it is a mandatory method in a script.

I was doing it like

    browser := Nautilus openOnClass: scriptClass selector: #compute.

I guess, there is a way to do so with the Glamour browser ?

Thanks

Hilaire

-- 
Dr. Geo
http://drgeo.eu

Edit script: Marque sur segment.gif (18K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Glamour: update presenter with new text

Tudor Girba-2
Hi Hilaire,

Sorry for the late reply.

Indeed, it should be possible to do this, but we have to look closer at your concrete code.

Here is an example:
browser := GLMTabulator new.
browser column: #one; column: #two.
browser transmit to: #one; andShow: [ :a |
a list display: [ :x | 1 to: x ] ].
browser transmit from: #one; to: #two; andShow: [ :a | a text ].
browser transmit 
fromOutsidePort: #explicitSelection;
to: #one port: #selection.
browser openOn: 42.
(browser pane port: #explicitSelection) value: 41

Essentially, you need to transmit the selection from the outside to the inside pane. Please note that once you pass the #explicitSelection to the #selection of pane #one, you also trigger the transmission from #one to #two, and this is why the 41 also appears in the text on the right hand side.

Does this help?

In the meantime, have you read this chapter:
?



Cheers,
Doru


On Jul 15, 2017, at 10:38 AM, Hilaire <[hidden email]> wrote:

Thanks for the updates on both the internal dependencies and the ListPresentation.

From this browser, I deduced a second simpler browser for only one script. It was easy to do so thanks to your tips (attached pic).

With this simpler script editor, when I open a script, I like it opens on the compute method, because it is a mandatory method in a script.

I was doing it like 

    browser := Nautilus openOnClass: scriptClass selector: #compute.

I guess, there is a way to do so with the Glamour browser ?

Thanks

Hilaire

-- 
Dr. Geo

http://drgeo.eu
<Edit script: Marque sur segment.gif>

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

"Every now and then stop and ask yourself if the war you're fighting is the right one."




12