Preliminar support for notebooks with proper

%metadata nodes to be subscribed into the main help menu.
This commit is contained in:
Offray Vladimir Luna Cárdenas 2017-11-21 19:05:17 +00:00
parent c5fc48c272
commit 880006df73
2 changed files with 114 additions and 41 deletions

View File

@ -21,11 +21,58 @@ Class {
],
#classInstVars : [
'dockingBar',
'recentNotebooks'
'recentNotebooks',
'helpMenu'
],
#category : #'Grafoscopio-UI'
}
{ #category : #adding }
GrafoscopioDockingBar class >> addToHelpMenu: aGrafoscopioNotebook [
| metadata nbFile |
metadata := aGrafoscopioNotebook metadata.
nbFile := aGrafoscopioNotebook workingFile.
(metadata at: 'showOnHelp' ifAbsent: [ ^ self ])
ifTrue: [
self helpMenu submorphs
detect: [ :s | s contents = (metadata at: 'shortTitle') ]
ifFound: [
self inform:
'The notebook: ', String cr,
nbFile fullName, String cr,
' needs another shortTitle to be added to the docking bar Help Menu.' ]
ifNone: [
self helpMenu
add: (metadata at: 'shortTitle')
target: [ GrafoscopioNotebook open: nbFile ]
selector: #value ] ].
self updateUI
]
{ #category : #accessing }
GrafoscopioDockingBar class >> defaultHelpMenu [
| defaultHelpMenu |
defaultHelpMenu := MenuMorph new.
defaultHelpMenu
add: 'Tutorial (Spanish)'
target: [ GrafoscopioNotebook open: GrafoscopioDocs tutorial ]
selector: #value;
add: 'Manual'
target: [ GrafoscopioNotebook open: GrafoscopioDocs manual ]
selector: #value;
add: 'Manual (PDF)'
target: GrafoscopioDocs
selector: #openPDFManual;
add: 'Dataviz'
target: [ GrafoscopioNotebook open: DatavizDocs introNotebook ]
selector: #value;
add: 'Dev''s notes'
target: [ GrafoscopioNotebook open: GrafoscopioDocs devNotes ]
selector: #value;
add: 'About Grafoscopio' target: self selector: #messageAbout.
^ defaultHelpMenu
]
{ #category : #specs }
GrafoscopioDockingBar class >> defaultSpec [
<spec: #default>
@ -243,11 +290,49 @@ GrafoscopioDockingBar class >> exampleBootstrapUI [
ui openWithSpecLayout: lay.
]
{ #category : #accessing }
GrafoscopioDockingBar class >> helpMenu [
^ helpMenu ifNil: [ helpMenu := self defaultHelpMenu ]
]
{ #category : #accessing }
GrafoscopioDockingBar class >> helpMenu: anObject [
helpMenu := anObject
]
{ #category : #'class initialization' }
GrafoscopioDockingBar class >> initialize [
self start.
]
{ #category : #accessing }
GrafoscopioDockingBar class >> launchMenu [
| launchMenu |
launchMenu := MenuMorph new.
launchMenu
add: 'New notebook'
target: GrafoscopioNotebook new
selector: #openDefault;
add: 'Notebook from file...'
target: GrafoscopioNotebook new
selector: #openFromFileSelector;
add: 'Notebook from the Internet...'
target: GrafoscopioNotebook new
selector: #openFromUrlUI;
add: 'Recent notebooks...'
target: self
selector: #openFromRecentlyUsed;
add: 'Example notebooks...'
target: self
selector: #messageNotImplementedYet;
add: 'Roassal visualizations gallery'
target: RTExampleBrowser new
selector: #open;
add: 'Playground' target: Smalltalk tools selector: #openWorkspace;
add: 'Transcript' target: Smalltalk tools selector: #openTranscript.
^ launchMenu
]
{ #category : #'graphical interface' }
GrafoscopioDockingBar class >> messageAbout [
"I show the author(s), license, sponsors and main contributors to the project
@ -371,48 +456,14 @@ GrafoscopioDockingBar class >> showSettings [
GrafoscopioDockingBar class >> start [
"Creates a custom docking bar for grafoscopio on top, for shorcuts to the most used actions,
and as a fixed place for asking for help, external tools and grafoscopio updates and about"
| launchMenu helpMenu updateMenu |
launchMenu := MenuMorph new.
launchMenu
add: 'New notebook' target: (GrafoscopioNotebook new) selector: #openDefault;
add: 'Notebook from file...' target: (GrafoscopioNotebook new) selector: #openFromFileSelector;
add: 'Notebook from the Internet...' target: (GrafoscopioNotebook new) selector: #openFromUrlUI;
add: 'Recent notebooks...' target: self selector: #openFromRecentlyUsed;
add: 'Example notebooks...' target: self selector: #messageNotImplementedYet;
add: 'Roassal visualizations gallery' target: (RTExampleBrowser new) selector: #open;
add: 'Playground' target: (Smalltalk tools) selector: #openWorkspace;
add: 'Transcript' target: (Smalltalk tools) selector: #openTranscript.
updateMenu := MenuMorph new.
updateMenu
add: 'Grafoscopio' target: self selector: #updateGrafoscopioUI;
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;
add: 'Pandoc path' target: ExternalApp selector: #configurePandoc;
add: 'Fossil path' target: ExternalApp selector: #configureFossil;"
add: 'All the system' target: self selector: #updateSystem.
helpMenu := MenuMorph new.
helpMenu
add: 'Tutorial (Spanish)' target: [GrafoscopioNotebook open: GrafoscopioDocs tutorial] selector: #value;
add: 'Manual' target: [ GrafoscopioNotebook open: GrafoscopioDocs manual ] selector: #value;
add: 'Manual (PDF)' target: GrafoscopioDocs selector: #openPDFManual;
add: 'Dataviz' target: [ GrafoscopioNotebook open: DatavizDocs introNotebook ] selector: #value ;
add: 'Dev''s notes' target: [GrafoscopioNotebook open: GrafoscopioDocs devNotes ] selector: #value;
add: 'About Grafoscopio' target: self selector: #messageAbout.
dockingBar := DockingBarMorph new.
dockingBar
add: 'Launch' subMenu: launchMenu;
add: 'Update' subMenu: updateMenu;
add: 'Help' subMenu: helpMenu.
dockingBar
dockingBar
add: 'Launch' subMenu: self launchMenu;
add: 'Update' subMenu: self updateMenu;
add: 'Help' subMenu: self helpMenu.
dockingBar
adhereToTop;
openInWorld.
openInWorld
]
{ #category : #updating }
@ -469,6 +520,23 @@ GrafoscopioDockingBar class >> updateGrafoscopioUI [
self inform: 'Grafoscopio update finished'
]
{ #category : #accessing }
GrafoscopioDockingBar class >> updateMenu [
| updateMenu |
updateMenu := MenuMorph new.
updateMenu
add: 'Grafoscopio' target: self selector: #updateGrafoscopioUI;
add: 'Documentation'
target: GrafoscopioDocumentation
selector: #updateAllUI;
add: 'DataViz package' target: self selector: #updateDatavizUI;
add: 'Notebooks places'
target: GrafoscopioDocumentation
selector: #updateDocsPlaceUI;
add: 'All the system' target: self selector: #updateSystem.
^ updateMenu
]
{ #category : #updating }
GrafoscopioDockingBar class >> updatePrerrequisitesScript [
"Updates the system prerequisites with new versions of itself take from the source code repository"

View File

@ -409,6 +409,11 @@ GrafoscopioNotebook >> markdownFileChecksumUpto: anInteger [
^ self markdownFileChecksum copyFrom: 1 to: anInteger asInteger.
]
{ #category : #utilities }
GrafoscopioNotebook >> metadata [
^ self notebook metadata
]
{ #category : #'editing nodes' }
GrafoscopioNotebook >> moveNodeAfter [
| editedNode |