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' }
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
entryText:
'_.:| Grafoscopio |:._',
(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),
'Covered under MIT license.',
(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"
UIManager default abort:
'Esta funcionalidad aún no está implementada!',
'This functionality is not implemented yet!',
(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),
'http://mutabit.com/grafoscopio',
(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' }
@ -441,7 +446,7 @@ GrafoscopioDockingBar class >> start [
updateMenu := MenuMorph new.
updateMenu
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: 'Notebooks places' target: GrafoscopioDocumentation selector: #updateDocsPlaceUI;
"add: 'Database engine' target: ExternalApp selector: #installSQLite32BitsUI;
@ -485,12 +490,14 @@ GrafoscopioDockingBar class >> updateDatavizUI [
| update |
update := (UIManager default
question: 'Dataviz es un paquete de visualización de datos'
title: 'Actualizar paquete Dataviz').
update ifNotNil: [
update
ifTrue: [self updateDataviz]
ifFalse: [self inform: 'Actualización del paquete dataviz no realizada']]
confirm:
'Dataviz is data visualization package, with several', String cr,
'Domain Specific Examples, like Panama Papers, Twitter Data Selfies.',
String cr, 'Do you want to update it?'
label: 'Update Dataviz package').
update
ifTrue: [self updateDataviz]
ifFalse: [self messageUpdateNotDone]
]
{ #category : #updating }
@ -511,14 +518,13 @@ GrafoscopioDockingBar class >> updateGrafoscopioUI [
| update |
update := (UIManager default
question: '¿Desea actualizar grafoscopio?'
title: 'Actualizar grafoscopio').
update ifNotNil: [
update
confirm: 'Do you wish to update Grafoscopio?'
label: 'Grafoscopio update').
update
ifTrue: [
self updateGrafoscopio.
self inform: 'Actualización de grafoscopio terminada']
ifFalse: [self inform: 'Actualización de grafoscopio no realizada']]
self inform: 'Grafoscopio update finished']
ifFalse: [self messageUpdateNotDone]
]
{ #category : #updating }
@ -629,43 +635,3 @@ GrafoscopioDockingBar class >> updateUI [
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 |
docs := self current.
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 }
@ -156,6 +157,18 @@ GrafoscopioDocumentation class >> updateAll [
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 }
GrafoscopioDocumentation class >> updateDocsPlaceUI [
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
links contains only references to remote URL or local files, anything that is not a URL is
treated as a loca file link."
^ self links reject: [ :l | l asZnUrl isURL ]
^ self links reject: [ :l | l asZnUrl host isNil ]
]
{ #category : #exporting }
@ -652,7 +652,9 @@ GrafoscopioNode >> markdownContent [
{ #category : #operation }
GrafoscopioNode >> metadata [
| mnode |
mnode := self root preorderTraversal detect: [:n | n headerStartsWith: '%metadata' ].
mnode := self root preorderTraversal
detect: [:n | n headerStartsWith: '%metadata' ]
ifNone: [^ nil].
^ mnode output.
]
@ -660,6 +662,7 @@ GrafoscopioNode >> metadata [
{ #category : #exporting }
GrafoscopioNode >> metadataAsYamlIn: markdownStream [
"I convert the first '%metadata' node into a YAML preamble to be used by Pandoc exportation."
self metadata ifNil: [ ^ self ].
markdownStream
nextPutAll: '---';
lf.

View File

@ -18,7 +18,8 @@ Class {
'links',
'windowMainMenu',
'workingFile',
'notebook'
'notebook',
'debugMessage'
],
#category : #'Grafoscopio-UI'
}
@ -90,6 +91,37 @@ GrafoscopioNotebook >> cutNodeToClipboard [
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' }
GrafoscopioNotebook >> demoteNode [
| editedNode |
@ -361,7 +393,12 @@ GrafoscopioNotebook >> notebookSubMenu [
item
name: 'See pdf';
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 }
@ -689,7 +726,14 @@ GrafoscopioNotebook >> topBar [
name: nil;
description: 'Edit tags...';
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 }