Re: [Pharo-dev] Trying to use Rubric in Nautilus ....
Ok we looked at it a lot :) But what is missing to use is how we can register the morph to the nautilus list so that when it changes we get invoked. In Nautilus this is self changed: #sourceCodeFrom: We tried to register via addDependent..... but it did not work. We will look again at RubSmalltalkMethodEditorModel But we need to declare how itget notified when the browser list changes too. Le 12/5/15 17:02, Alain Plantec via Pharo-dev a écrit :
We tried all kind of combinations.... modelEditor := (RubSmalltalkMethodEditorModel new client: self). widget := modelEditor newScrolledText. widget on: self text: #sourceCodeFrom: accept: #compileSource:notifying: readSelection: #contentsSelectionFrom: menu: #sourceCodeMenu:shifted:. self addDependent: modelEditor. self when: #sourceCodeFrom: send: #setText: to: modelEditor. widget beWrapped; beForSmalltalkCode; withLineNumbers; setText: self sourceCode; setTextSelector: #halt. ^ widget But we cannot get the editor or the widget to be invoked when the list changes. So we spent three hours on it so we should stop. We are missing just this bit. Stef
Announcements! replace self changed: #sourceCodeFrom:. with something like self announcer announce:RubTextSetInModel. ( I am not sure what RubXXAnouncement to use) 2015-05-12 17:14 GMT+02:00 stepharo <stepharo@free.fr>:
We tried all kind of combinations....
modelEditor := (RubSmalltalkMethodEditorModel new client: self). widget := modelEditor newScrolledText.
widget on: self text: #sourceCodeFrom: accept: #compileSource:notifying: readSelection: #contentsSelectionFrom: menu: #sourceCodeMenu:shifted:.
self addDependent: modelEditor. self when: #sourceCodeFrom: send: #setText: to: modelEditor.
widget beWrapped; beForSmalltalkCode; withLineNumbers; setText: self sourceCode; setTextSelector: #halt. ^ widget
But we cannot get the editor or the widget to be invoked when the list changes. So we spent three hours on it so we should stop. We are missing just this bit.
Stef
But nicolai I know announcement. Now the widgets of Nautilus do not use announcement so I do not know if I can simply replace self changed: #sourceCodeFrom: I do not know the implication of removing sourceCodeFrom: Le 12/5/15 17:41, Nicolai Hess a écrit :
Announcements!
replace self changed: #sourceCodeFrom:. with something like self announcer announce:RubTextSetInModel.
( I am not sure what RubXXAnouncement to use)
2015-05-12 17:14 GMT+02:00 stepharo <stepharo@free.fr <mailto:stepharo@free.fr>>:
We tried all kind of combinations....
modelEditor := (RubSmalltalkMethodEditorModel new client: self). widget := modelEditor newScrolledText.
widget on: self text: #sourceCodeFrom: accept: #compileSource:notifying: readSelection: #contentsSelectionFrom: menu: #sourceCodeMenu:shifted:.
self addDependent: modelEditor. self when: #sourceCodeFrom: send: #setText: to: modelEditor.
widget beWrapped; beForSmalltalkCode; withLineNumbers; setText: self sourceCode; setTextSelector: #halt. ^ widget
But we cannot get the editor or the widget to be invoked when the list changes. So we spent three hours on it so we should stop. We are missing just this bit.
Stef
2015-05-12 21:40 GMT+02:00 stepharo <stepharo@free.fr>:
But nicolai I know announcement. Now the widgets of Nautilus do not use announcement so I do not know if I can simply replace self changed: #sourceCodeFrom: I do not know the implication of removing sourceCodeFrom:
OK, I just thought rubric uses announcement in place of self changed: So, and now? Replace all self changed... with self sourceCodeArea setText ?
Le 12/5/15 17:41, Nicolai Hess a écrit :
Announcements!
replace self changed: #sourceCodeFrom:. with something like self announcer announce:RubTextSetInModel.
( I am not sure what RubXXAnouncement to use)
2015-05-12 17:14 GMT+02:00 stepharo <stepharo@free.fr>:
We tried all kind of combinations....
modelEditor := (RubSmalltalkMethodEditorModel new client: self). widget := modelEditor newScrolledText.
widget on: self text: #sourceCodeFrom: accept: #compileSource:notifying: readSelection: #contentsSelectionFrom: menu: #sourceCodeMenu:shifted:.
self addDependent: modelEditor. self when: #sourceCodeFrom: send: #setText: to: modelEditor.
widget beWrapped; beForSmalltalkCode; withLineNumbers; setText: self sourceCode; setTextSelector: #halt. ^ widget
But we cannot get the editor or the widget to be invoked when the list changes. So we spent three hours on it so we should stop. We are missing just this bit.
Stef
Attached a simple example (RubTextStuff.st). see the use of the RubTextAccepted announcement (RubTextStuff class>>example) to do things when the code is accepted in the view. now you can also have a look at RubMethodEditingExample when the selector change, then the code in the text view is changed: selector: aSymbol selector := aSymbol ifNotNil: [:sel |( sel copyWithout: Character cr) asSymbol]. self updateCodeWith: ''. self changed: #selector. self classToUse ifNotNil: [:cls | (cls selectors includes: selector) ifTrue: [self updateCodeWith: (cls sourceCodeAt: selector)]] updateCodeWith: someText. self textModel setText: someText. Cheers Alain
On 12 mai 2015, at 17:14, stepharo <stepharo@free.fr> wrote:
We tried all kind of combinations....
modelEditor := (RubSmalltalkMethodEditorModel new client: self). widget := modelEditor newScrolledText.
widget on: self text: #sourceCodeFrom: accept: #compileSource:notifying: readSelection: #contentsSelectionFrom: menu: #sourceCodeMenu:shifted:.
self addDependent: modelEditor. self when: #sourceCodeFrom: send: #setText: to: modelEditor.
widget beWrapped; beForSmalltalkCode; withLineNumbers; setText: self sourceCode; setTextSelector: #halt. ^ widget
But we cannot get the editor or the widget to be invoked when the list changes. So we spent three hours on it so we should stop. We are missing just this bit.
Stef
participants (3)
-
Alain Plantec -
Nicolai Hess -
stepharo