Adding "live" debug options to notebooks from the UI.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2017-05-03 11:17:44 +00:00
parent 0337bd7993
commit 43e236e998
4 changed files with 91 additions and 65 deletions

View File

@ -303,13 +303,13 @@ GrafoscopioDockingBar class >> initialize [
{ #category : #'graphical interface' } { #category : #'graphical interface' }
GrafoscopioDockingBar class >> messageAbout [ GrafoscopioDockingBar class >> messageAbout [
"Shows the author, license, sponsors and main contributors to the project and point to further documentation on the web" "I show the author(s), license, sponsors and main contributors to the project
and point to further documentation on the web"
LongMessageDialogWindow new LongMessageDialogWindow new
entryText: entryText:
'_.:| Grafoscopio |:._', '_.:| Grafoscopio |:._',
(String with: Character cr), (String with: Character cr),
'(c) Copyright 2014-2016 by Offray Vladimir Luna Cárdenas', '(c) Copyright 2014-2017 by Offray Vladimir Luna Cárdenas',
(String with: Character cr), (String with: Character cr),
'Covered under MIT license.', 'Covered under MIT license.',
(String with: Character cr), (String with: Character cr),
@ -367,15 +367,20 @@ GrafoscopioDockingBar class >> messageNotImplementedYet [
"Shows that a feature is not implemeted and point to further documentation on the web" "Shows that a feature is not implemeted and point to further documentation on the web"
UIManager default abort: UIManager default abort:
'Esta funcionalidad aún no está implementada!', 'This functionality is not implemented yet!',
(String with: Character cr), (String with: Character cr),
'Para información sobre futuras versiones, por favor visite: ', 'For more information about future releases, please visit: ',
(String with: Character cr), (String with: Character cr),
(String with: Character cr), (String with: Character cr),
'http://mutabit.com/grafoscopio', 'http://mutabit.com/grafoscopio',
(String with: Character cr), (String with: Character cr),
(String with: Character cr) (String with: Character cr)
title: 'No implementado aún'. title: 'To be implemented'.
]
{ #category : #'graphical interface' }
GrafoscopioDockingBar class >> messageUpdateNotDone [
self inform: 'Update not done, by user request.'
] ]
{ #category : #'graphical interface' } { #category : #'graphical interface' }
@ -441,7 +446,7 @@ GrafoscopioDockingBar class >> start [
updateMenu := MenuMorph new. updateMenu := MenuMorph new.
updateMenu updateMenu
add: 'Grafoscopio' target: self selector: #updateGrafoscopioUI; add: 'Grafoscopio' target: self selector: #updateGrafoscopioUI;
add: 'Documentation' target: GrafoscopioDocumentation selector: #updateAll; add: 'Documentation' target: GrafoscopioDocumentation selector: #updateAllUI;
add: 'DataViz package' target: self selector: #updateDatavizUI; add: 'DataViz package' target: self selector: #updateDatavizUI;
add: 'Notebooks places' target: GrafoscopioDocumentation selector: #updateDocsPlaceUI; add: 'Notebooks places' target: GrafoscopioDocumentation selector: #updateDocsPlaceUI;
"add: 'Database engine' target: ExternalApp selector: #installSQLite32BitsUI; "add: 'Database engine' target: ExternalApp selector: #installSQLite32BitsUI;
@ -485,12 +490,14 @@ GrafoscopioDockingBar class >> updateDatavizUI [
| update | | update |
update := (UIManager default update := (UIManager default
question: 'Dataviz es un paquete de visualización de datos' confirm:
title: 'Actualizar paquete Dataviz'). 'Dataviz is data visualization package, with several', String cr,
update ifNotNil: [ 'Domain Specific Examples, like Panama Papers, Twitter Data Selfies.',
update String cr, 'Do you want to update it?'
ifTrue: [self updateDataviz] label: 'Update Dataviz package').
ifFalse: [self inform: 'Actualización del paquete dataviz no realizada']] update
ifTrue: [self updateDataviz]
ifFalse: [self messageUpdateNotDone]
] ]
{ #category : #updating } { #category : #updating }
@ -511,14 +518,13 @@ GrafoscopioDockingBar class >> updateGrafoscopioUI [
| update | | update |
update := (UIManager default update := (UIManager default
question: '¿Desea actualizar grafoscopio?' confirm: 'Do you wish to update Grafoscopio?'
title: 'Actualizar grafoscopio'). label: 'Grafoscopio update').
update ifNotNil: [ update
update
ifTrue: [ ifTrue: [
self updateGrafoscopio. self updateGrafoscopio.
self inform: 'Actualización de grafoscopio terminada'] self inform: 'Grafoscopio update finished']
ifFalse: [self inform: 'Actualización de grafoscopio no realizada']] ifFalse: [self messageUpdateNotDone]
] ]
{ #category : #updating } { #category : #updating }
@ -629,43 +635,3 @@ GrafoscopioDockingBar class >> updateUI [
allButFirstDo: [ :bar | bar delete ]. allButFirstDo: [ :bar | bar delete ].
] ]
{ #category : #'ui-building' }
GrafoscopioDockingBar >> proyectSubMenu [
"This should be integrated with the GrafoscopioNotebook same messages.
Was originally wrote in Spanish, and something is lost in translation, but Grafoscopio
should be available in several languages..."
^ MenuModel new
addGroup: [ :group |
group addItem: [ :item |
item
name: 'Activar repositorio remoto...';
icon: Smalltalk ui icons smallPushpinIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Activar repositorio local...';
icon: Smalltalk ui icons homeIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Agregar archivo...';
icon: Smalltalk ui icons newerPackagesAvailableIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Eliminar archivo...';
icon: Smalltalk ui icons packageDeleteIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Enviar al histórico';
icon: Smalltalk ui icons smallScreenshotIcon;
action: [ self inform: 'Por implementar ...' ] ].
group addItem: [ :item |
item
name: 'Acreditarse';
icon: Smalltalk ui icons userIcon;
action: [ self inform: 'Por implementar ...' ] ] ]
]

View File

@ -129,7 +129,8 @@ GrafoscopioDocumentation class >> openPDFManual [
| pdfManual docs | | pdfManual docs |
docs := self current. docs := self current.
pdfManual := docs documents at: 4. pdfManual := docs documents at: 4.
UnixProcess command: 'xdg-open ', (docs localPlace / pdfManual) fullName. "UnixProcess command: 'xdg-open ', (docs localPlace / pdfManual) fullName."
WebBrowser openOn: (docs localPlace / pdfManual) fullName.
] ]
{ #category : #operation } { #category : #operation }
@ -156,6 +157,18 @@ GrafoscopioDocumentation class >> updateAll [
update: 'dataviz' update: 'dataviz'
] ]
{ #category : #updating }
GrafoscopioDocumentation class >> updateAllUI [
"Updates documentation (manual, tutorials) from the official repository for a given documentation."
| update |
update := (UIManager default
confirm: 'Do you wish to update the documentation?'
label: 'Update documentation').
update
ifTrue: [ self updateAll ]
ifFalse: [ GrafoscopioDockingBar messageUpdateNotDone ]
]
{ #category : #updating } { #category : #updating }
GrafoscopioDocumentation class >> updateDocsPlaceUI [ GrafoscopioDocumentation class >> updateDocsPlaceUI [
self current localPlace: (UIManager default chooseDirectory: 'Path to the documentation folder') self current localPlace: (UIManager default chooseDirectory: 'Path to the documentation folder')

View File

@ -604,7 +604,7 @@ GrafoscopioNode >> localFilesLinks [
"I collect all the links that point to the local file system. Because is supposed that "I collect all the links that point to the local file system. Because is supposed that
links contains only references to remote URL or local files, anything that is not a URL is links contains only references to remote URL or local files, anything that is not a URL is
treated as a loca file link." treated as a loca file link."
^ self links reject: [ :l | l asZnUrl isURL ] ^ self links reject: [ :l | l asZnUrl host isNil ]
] ]
{ #category : #exporting } { #category : #exporting }
@ -652,7 +652,9 @@ GrafoscopioNode >> markdownContent [
{ #category : #operation } { #category : #operation }
GrafoscopioNode >> metadata [ GrafoscopioNode >> metadata [
| mnode | | mnode |
mnode := self root preorderTraversal detect: [:n | n headerStartsWith: '%metadata' ]. mnode := self root preorderTraversal
detect: [:n | n headerStartsWith: '%metadata' ]
ifNone: [^ nil].
^ mnode output. ^ mnode output.
] ]
@ -660,6 +662,7 @@ GrafoscopioNode >> metadata [
{ #category : #exporting } { #category : #exporting }
GrafoscopioNode >> metadataAsYamlIn: markdownStream [ GrafoscopioNode >> metadataAsYamlIn: markdownStream [
"I convert the first '%metadata' node into a YAML preamble to be used by Pandoc exportation." "I convert the first '%metadata' node into a YAML preamble to be used by Pandoc exportation."
self metadata ifNil: [ ^ self ].
markdownStream markdownStream
nextPutAll: '---'; nextPutAll: '---';
lf. lf.

View File

@ -18,7 +18,8 @@ Class {
'links', 'links',
'windowMainMenu', 'windowMainMenu',
'workingFile', 'workingFile',
'notebook' 'notebook',
'debugMessage'
], ],
#category : #'Grafoscopio-UI' #category : #'Grafoscopio-UI'
} }
@ -90,6 +91,37 @@ GrafoscopioNotebook >> cutNodeToClipboard [
self copyNodeToClipboard; removeNode. self copyNodeToClipboard; removeNode.
] ]
{ #category : #accessing }
GrafoscopioNotebook >> debugMessage [
^ debugMessage ifNil: [ self defineDebugMessageUI ]
]
{ #category : #accessing }
GrafoscopioNotebook >> debugMessage: aGrafoscopioNodeSelector [
"I define a message that can be used for debugging purposes in the current notebook."
debugMessage := aGrafoscopioNodeSelector
]
{ #category : #operation }
GrafoscopioNotebook >> debugWithSelector: aSymbol [
"I invoke a message to debug in the current node. In the future the debugging scope can be changed to
include different elements instead of the current node."
| currentNode nodeContent |
currentNode := tree highlightedItem.
currentNode ifNil: [ ^ self ].
nodeContent := currentNode content.
^ (nodeContent perform: aSymbol asSymbol) inspect
]
{ #category : #'as yet unclassified' }
GrafoscopioNotebook >> defineDebugMessageUI [
| answer |
answer := UIManager default
request: 'Define debug message to be send to a selected node in this notebook.'
initialAnswer: 'messageNoDebugSelector'.
self debugMessage: answer
]
{ #category : #'editing nodes' } { #category : #'editing nodes' }
GrafoscopioNotebook >> demoteNode [ GrafoscopioNotebook >> demoteNode [
| editedNode | | editedNode |
@ -361,7 +393,12 @@ GrafoscopioNotebook >> notebookSubMenu [
item item
name: 'See pdf'; name: 'See pdf';
icon: Smalltalk ui icons smallInspectItIcon; icon: Smalltalk ui icons smallInspectItIcon;
action: [ self inform: 'To be implemented...' ]]] action: [ self inform: 'To be implemented...' ]].
group addItem: [ :item |
item
name: 'Define debug message...';
icon: Smalltalk ui icons glamorousBug;
action: [ self defineDebugMessageUI ]]]
] ]
{ #category : #private } { #category : #private }
@ -689,7 +726,14 @@ GrafoscopioNotebook >> topBar [
name: nil; name: nil;
description: 'Edit tags...'; description: 'Edit tags...';
icon: FontAwesomeIcons new tagsIcon; icon: FontAwesomeIcons new tagsIcon;
action: [ self inform: 'To be implemented...' ] ]]. action: [ self inform: 'To be implemented...' ] ]];
addGroup: [ :debug |
debug addItem: [ :item |
item
name: nil;
description: 'Debug';
icon: Smalltalk ui icons glamorousBug;
action: [ self debugWithSelector: self debugMessage ] ]]
] ]
{ #category : #accessing } { #category : #accessing }