Hi,
In the method bellow, when the method is recompiled, the presenter's text is still the same (i.e. select another method, then the modified method: the former source code is still presented). How to request an update of the presenter's text with the newer method source? sourceIn: composite ^ composite text title: 'Source code' translated; display: [ :aCompiledMethod | aCompiledMethod sourceCode ]; act: [ :presentation :compiledMethod | compiledMethod methodClass compile: presentation text] on: $s entitled: 'Save' translated Thanks Hilaire -- Dr. Geo http://drgeo.eu |
Hi, You should send #update to the presentation. By default the presentation does not update when an action is executed, as the action could be anything. sourceIn: composite ^ composite text title: 'Source code' translated; display: [ :aCompiledMethod | aCompiledMethod sourceCode ]; act: [ :presentation :compiledMethod | compiledMethod methodClass compile: presentation text. presentation update ] on: $s entitled: 'Save' translated Cheers, Andrei On Sun, Jul 2, 2017 at 7:47 PM, Hilaire <[hidden email]> wrote: Hi, |
Thanks
Le 02/07/2017 à 20:21, Andrei Chis a écrit : > You should send #update to the presentation. By default the > presentation does not update when an action is executed, as the action > could be anything. > -- Dr. Geo http://drgeo.eu |
Ah sorry no it is not working as expected.
When I saved a modified method, the presenter got its source text updated (good), but the morph view is reversed to its previous content. Here is the code I use, anything wrong in the code bellow? Thanks Hilaire sourceIn: composite ^ composite pharoMethod title: 'Source code' translated; smalltalkClass: [ :each | each methodClass]; display: [ :aCompiledMethod | aCompiledMethod sourceCode ]; act: [ :presentation :compiledMethod | compiledMethod methodClass compile: presentation text. presentation update.] on: $s entitled: 'Save' translated -- Dr. Geo http://drgeo.eu |
Sorry for the text formating, it was wrong, hope
it is better now:
-- Dr. Geo http://drgeo.eu -- Dr. Geo http://drgeo.eu |
In reply to this post by HilaireFernandes
If I'm not mistaken CompiledMethod instances are immutable. When you run 'compiledMethod methodClass compile: presentation text' another CompiledMethod object is created and installed in the methods dictionary. So in the display block 'aCompiledMethod' references the old method. To make this work you'll need to not reference the compiled method object directly or also refresh the list of methods. Cheers, Andrei On Mon, Jul 3, 2017 at 5:48 PM, Hilaire <[hidden email]> wrote: Ah sorry no it is not working as expected. |
I will be curious to know how to do that...
Le 03/07/2017 à 18:08, Andrei Chis a écrit : > 'aCompiledMethod' references the old method. To make this work you'll > need to not reference the compiled method object directly or also > refresh the list of methods. -- Dr. Geo http://drgeo.eu |
> El 03-07-2017, a las 22:28, Hilaire <[hidden email]> escribió: > > I will be curious to know how to do that… You may have a wrapper that holds the compiled method. So, the method list can hold your wrappers instead of compiled methods. Than your wrapper could listen to the system announcer for changes and updates its value accordingly. Or you can update your method list on according to changes in the system announcer. Check, SystemAnnouncer uniqueInstance on: MethodModified do: [ :ann | self inform: ann method printString, ‘ changed’ ]. Juraj > > > Le 03/07/2017 à 18:08, Andrei Chis a écrit : >> 'aCompiledMethod' references the old method. To make this work you'll >> need to not reference the compiled method object directly or also >> refresh the list of methods. > > -- > Dr. Geo > http://drgeo.eu > > > |
Le 03/07/2017 à 23:20, Juraj Kubelka a écrit : You may have a wrapper that holds the compiled method. So, the method list can hold your wrappers instead of compiled methods. Than your wrapper could listen to the system announcer for changes and updates its value accordingly. Or you can update your method list on according to changes in the system announcer. I really don't know how to hook this in the DrGeo script browser. The methods are displayed with this code. How to add a listener to update it? methodsIn: composite composite wrapper title: 'Methods' translated; show: [ :wrapper | wrapper fastList display: [ :aClass | aClass methods ]; format: [ :aCompiledMethod | aCompiledMethod selector asString ] ]. composite wrapper title: 'Script data' translated; show: [ :wrapper | wrapper fastList display: [ :aClass | aClass class methods ]; format: [ :aCompiledMethod | aCompiledMethod selector asString ] ]. composite onChangeOfPort: #activePresentation act: [ :presentation | (presentation pane port: #activePresentation) value ifNotNil: [ :activePresentation | ((browser paneNamed: #methods) port: #selection) value: (activePresentation defaultPane port: #selection) value ] ] Check, SystemAnnouncer uniqueInstance on: MethodModified do: [ :ann | self inform: ann method printString, ‘ changed’ ]. In Pharo6, it should be written: SystemAnnouncer uniqueInstance when: MethodModified do: [ :ann | self inform: ann method printString, ‘ changed’ ]. -- Dr. Geo http://drgeo.eu |
I added these lines of code, but it is not that yet: browser updateOn: GLMItemAdded from: #yourself; updateOn: GLMItemRemoved from: #yourself. -- Dr. Geo http://drgeo.eu |
May be my use case does not fit to Glamour, but I am tempted to think it does. I really need help on that to make progress. Thanks Hilaire Le 04/07/2017 à 23:08, Hilaire a
écrit :
-- Dr. Geo http://drgeo.eu |
Hi Hilaire,
I think it does fit your problem. However, I am not sure what the current problem is. Could you describe it again in more details? Cheers, Doru > On Jul 5, 2017, at 5:10 PM, Hilaire <[hidden email]> wrote: > > May be my use case does not fit to Glamour, but I am tempted to think it does. I really need help on that to make progress. > > Thanks > > Hilaire > > Le 04/07/2017 à 23:08, Hilaire a écrit : >> I added these lines of code, but it is not that yet: >> >> browser >> updateOn: GLMItemAdded from: #yourself; >> updateOn: GLMItemRemoved from: #yourself. >> >> > > -- > Dr. Geo > > http://drgeo.eu -- www.tudorgirba.com www.feenk.com "It's not how it is, it is how we see it." |
I think the issue is how to update a browser when a method is modified. There is a script: -=-=-=-=- browser := GLMTabulator new column: #one; column: #two; column: #three; yourself. browser transmit to: #one; andShow: [ :composite | composite fastList ]. browser transmit from: #one; to: #two; andShow: [ :composite | composite wrapper title: [ 'Instance' translated ]; show: [ :wrapper | wrapper fastList display: [ :aClass | aClass methods ]; format: [ :aCompiledMethod | aCompiledMethod selector asString ] ]. composite wrapper title: [ 'Class side' translated ]; show: [ :wrapper | wrapper fastList display: [ :aClass | aClass class methods ]; 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: #two) port: #selection) value: (activePresentation defaultPane port: #selection) value ] ] ]. browser transmit from: #two; to: #three; andShow: [ :composite | composite text display: [ :aCompiledMethod | aCompiledMethod sourceCode ]; updateOn: MethodModified from: [ SystemAnnouncer uniqueInstance ]. ]. browser openOn: Collection allSubclasses. -=-=-=-=- I have added the bold line from the previous post: http://forum.world.st/Custom-Glamour-browser-for-Dr-Geo-scripting-tp4952920p4953209.html But it is not perfect, because it does not keep the selection. Hilaire, it looks like you are going to end up with a simplified Nautilus/Calypso system editor. Maybe it is possible to take Calypso and find out how to simplify it for your needs? Well, I am writing it without understanding your goal :-) Cheers, Juraj
|
In reply to this post by Tudor Girba-2
Okay, I will try to describe it: First in Dr. Geo there is user scripting. The
idea is to let the user define a computing object he can plug on
a sketch. This object receive an arbitrary number of objects as
arguments selected from the sketch by mouse. This script object
is a class, subclass of DrGeoUserScript, and each use in a
geometric canvas create an instance. This video exposes this: http://www.dailymotion.com/video/x30amxd_introduction-to-scripting_tech Now, the script editing is done with Nautilus and it is a bit too overload for average user. What I want is a dedicated browser with more targeted information:
The attached screenshot shows the wished user interface as writen
with Glamour. Le 05/07/2017 à 19:24, Tudor Girba a
écrit :
However, I am not sure what the current problem is. Could you describe it again in more details? -- Dr. Geo http://drgeo.eu DrGeoBrowser.gif (32K) Download Attachment |
In reply to this post by Juraj Kubelka
2017-07-05 19:43 GMT+02:00 Juraj Kubelka <[hidden email]>:
I have some strange behavior with this example. Saving the edited method in this browser does not actually change the code shown in a "real" browser. Saving the edited method in a "real" browser may update the code in this browser, but sometimes not, and sometimes it even shows the code from a different method.
|
In reply to this post by Juraj Kubelka
For me it unselects the method, and it still
reverts the source code view with the previous source code method Le 05/07/2017 à 19:43, Juraj Kubelka a
écrit :
-- Dr. Geo http://drgeo.eu |
In reply to this post by Juraj Kubelka
Le 05/07/2017 à 19:43, Juraj Kubelka a écrit :
> I have added the bold line from the previous > post: http://forum.world.st/Custom-Glamour-browser-for-Dr-Geo-scripting-tp4952920p4953209.html > > But it is not perfect, because it does not keep the selection. > > Hilaire, it looks like you are going to end up with a simplified > Nautilus/Calypso system editor. > Maybe it is possible to take Calypso and find out how to simplify it > for your needs? > Well, I am writing it without understanding your goal :-) I read again carrefully your example and applied it to my case, and it does not work as I explained one week ago. And I am not sure I want to mess arround with Nautilus. I don't know what to do? Do you want a copy of my image to test it? Hilaire -- Dr. Geo http://drgeo.eu |
Hi,
I will try to follow up tomorrow. Cheers, Doru > On Jul 12, 2017, at 6:01 PM, Hilaire <[hidden email]> wrote: > > Le 05/07/2017 à 19:43, Juraj Kubelka a écrit : >> I have added the bold line from the previous >> post: http://forum.world.st/Custom-Glamour-browser-for-Dr-Geo-scripting-tp4952920p4953209.html >> >> But it is not perfect, because it does not keep the selection. >> >> Hilaire, it looks like you are going to end up with a simplified >> Nautilus/Calypso system editor. >> Maybe it is possible to take Calypso and find out how to simplify it >> for your needs? >> Well, I am writing it without understanding your goal :-) > > I read again carrefully your example and applied it to my case, and it > does not work as I explained one week ago. > And I am not sure I want to mess arround with Nautilus. > I don't know what to do? Do you want a copy of my image to test it? > > Hilaire > > -- > Dr. Geo > http://drgeo.eu > > > -- www.tudorgirba.com www.feenk.com "Problem solving should be focused on describing the problem in a way that makes the solution obvious." |
In reply to this post by HilaireFernandes
I can tell you that you do not want to play with nautilus :).
Stef On Wed, Jul 12, 2017 at 6:01 PM, Hilaire <[hidden email]> wrote: > Le 05/07/2017 à 19:43, Juraj Kubelka a écrit : >> I have added the bold line from the previous >> post: http://forum.world.st/Custom-Glamour-browser-for-Dr-Geo-scripting-tp4952920p4953209.html >> >> But it is not perfect, because it does not keep the selection. >> >> Hilaire, it looks like you are going to end up with a simplified >> Nautilus/Calypso system editor. >> Maybe it is possible to take Calypso and find out how to simplify it >> for your needs? >> Well, I am writing it without understanding your goal :-) > > I read again carrefully your example and applied it to my case, and it > does not work as I explained one week ago. > And I am not sure I want to mess arround with Nautilus. > I don't know what to do? Do you want a copy of my image to test it? > > Hilaire > > -- > Dr. Geo > http://drgeo.eu > > > |
In reply to this post by Tudor Girba-2
Ok, thanks Doru.
In case it can helpm I upload a DrGeo image[1] with all the involved code. Thanks Hilaire [1] https://www.dropbox.com/s/q06jihslvkzye8r/DrGeoBrowser.zip?dl=0 Le 12/07/2017 à 19:19, Tudor Girba a écrit : > Hi, > > I will try to follow up tomorrow. > > Cheers, > Doru > -- Dr. Geo http://drgeo.eu |
Free forum by Nabble | Edit this page |