123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- EnyoFriend subclass: #Eris
- instanceVariableNames: ''
- category: 'Eris'!
- !Eris methodsFor: 'actions'!
- doIt
- ^self eval: self dollar richText getValue
- !
- clear
- self dollar richText setValue: ''
- !
- eval: aString
- | compiler node |
- compiler := Compiler new.
- node := compiler parseExpression: aString.
- node isParseFailure ifTrue: [
- ^self warn: 'Ehrm, you are a Smalltalk n00b, right?' button: 'Yup'].
- ^compiler loadExpression: aString.
- !
- printString
- ^''
- !
- warn: aString button: caption
- | block popup |
- block := [popup close].
- <props = {kind: 'ModalDialog', caption: 'Parsing error', components: [
- {kind: 'Control', content: aString, className: 'enyo-text-error warning-icon'},
- {kind: 'Button', caption: caption, onclick: 'closePopup', style: 'margin-top:10px'}],
- closePopup: block}>.
- popup := enyo create: props.
- popup openAtCenter
- !
- print: aString
- self dollar richText setValue: (self dollar richText getValue), ' ', aString
- !
- quack
- "(self kind: 'Sound'; src: 'DuckQwaq.wav'; create) play"
- (enyo create: (Dictionary new at: 'kind' put: 'Sound'; at: 'src' put: 'DuckQwaq.wav'; yourself)) play
- !
- printIt
- self print: self doIt printString
- ! !
- !Eris methodsFor: 'initialization'!
- initialize
- | props doItBlock printItBlock quackBlock clearBlock |
- super initialize.
- doItBlock := [self doIt].
- printItBlock := [self printIt].
- quackBlock := [self quack].
- clearBlock := [self clear].
- <props = {kind: 'VFlexBox', components: [
- {kind: 'PageHeader', content: 'Eris'},
- {kind: 'RowGroup', caption: 'Workspace', components: [
- {kind: 'RichText', richContent: false,
- value: 'Put some funky Jtalk code here...',
- autoWordComplete: false, spellcheck: false, autocorrect: false,
- autoCapitalize: 'lowercase', alwaysLooksFocused: true
- },
- {kind: 'Toolbar', components: [
- {caption: 'Do it', onclick: 'doit'},
- {caption: 'Print it', onclick: 'printit'},
- {caption: 'Clear', onclick: 'clear'},
- {kind: 'Spacer'},
- {caption: 'Quack!', onclick: 'quack'}]}]}],
- doit: doItBlock,
- printit: printItBlock,
- quack: quackBlock,
- clear: clearBlock}>.
- ui := enyo create: props.
- ! !
|