352 lines
10 KiB
Smalltalk
352 lines
10 KiB
Smalltalk
"
|
|
I'm the Graphical User Interface for Grafoscopio environment.
|
|
|
|
My main responsability is to provide grafoscopio with a docking bar
|
|
with menu options for open, browse notebooks, update the system
|
|
and its components and the help menu.
|
|
|
|
"
|
|
Class {
|
|
#name : #GfUIHelpers,
|
|
#superclass : #DynamicComposablePresenter,
|
|
#instVars : [
|
|
'windowMainMenu',
|
|
'tree',
|
|
'nodeHeader',
|
|
'nodeBody'
|
|
],
|
|
#classVars : [
|
|
'dockingBar',
|
|
'recentNotebooks'
|
|
],
|
|
#classInstVars : [
|
|
'dockingBar',
|
|
'recentNotebooks',
|
|
'helpMenu'
|
|
],
|
|
#category : #'Grafoscopio-UI'
|
|
}
|
|
|
|
{ #category : #adding }
|
|
GfUIHelpers 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 : #updating }
|
|
GfUIHelpers class >> installDataviz [
|
|
"I install the Dataviz package.
|
|
DataViz contains Data visualization helpers"
|
|
"self isDatavizInstalled ifTrue: [ ^ self ]."
|
|
Metacello new
|
|
smalltalkhubUser: 'Offray' project: 'Dataviz';
|
|
configuration: 'Dataviz';
|
|
load.
|
|
self inform: 'Dataviz package install finished.'
|
|
]
|
|
|
|
{ #category : #updating }
|
|
GfUIHelpers class >> installDatavizUI [
|
|
"I'm the User Interface for installing the Dataviz package for the first time."
|
|
| install |
|
|
install := (UIManager default
|
|
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 install it?'
|
|
label: 'Install Dataviz package').
|
|
install ifFalse: [ ^ self ].
|
|
self installDataviz
|
|
]
|
|
|
|
{ #category : #updating }
|
|
GfUIHelpers class >> isDatavizInstalled [
|
|
^ (Metacello image
|
|
configuration: #('Dataviz');
|
|
list) isNotEmpty
|
|
]
|
|
|
|
{ #category : #'graphical interface' }
|
|
GfUIHelpers class >> messageAbout [
|
|
"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-2017 by Offray Vladimir Luna Cárdenas',
|
|
(String with: Character cr),
|
|
'Covered under MIT license.',
|
|
(String with: Character cr),
|
|
(String with: Character cr),
|
|
'[ Sponsors ]',
|
|
(String with: Character cr),
|
|
'mutabiT | www.mutabit.com ',
|
|
(String with: Character cr),
|
|
'HiTec Lab, Fundación Universitaria Los Libertadores | www.ulibertadores.edu.co ',
|
|
(String with: Character cr),
|
|
(String with: Character cr),
|
|
'[ Thanks to ]',
|
|
(String with: Character cr),
|
|
'HackBo, Hackerspace Bogota | http://hackbo.co',
|
|
(String with: Character cr),
|
|
'// Regular workshops attendees \\
|
|
Rafael Medida, Iván Pulido, Camilo Hurtado',
|
|
(String with: Character cr),
|
|
'// Coffe talk (mostly about grafoscopio) \\
|
|
Yanneth Gil, Andrés Calderón, Luis Alejandro Bernal',
|
|
(String with: Character cr),
|
|
'// Pharo, Moose and Agile Visualization communities \\
|
|
Tudor Girba, Alexandre Bergel, Nicolai Hess, Peter Uhnák, Milton Mamani ',
|
|
(String with: Character cr),
|
|
'// Family support while writing, coding & travelling (among others!) \\
|
|
Divian Luna, Hilda Cárdenas',
|
|
(String with: Character cr),
|
|
(String with: Character cr),
|
|
'For further details and versions go to:',
|
|
(String with: Character cr),
|
|
(String with: Character cr),
|
|
'http://mutabit.com/grafoscopio';
|
|
title: 'About Grafoscopio';
|
|
open.
|
|
]
|
|
|
|
{ #category : #'graphical interface' }
|
|
GfUIHelpers class >> messageNoRecentDocuments [
|
|
"Shows that a feature is not implemeted and point to further documentation on the web"
|
|
|
|
UIManager default abort:
|
|
'Recent documents list is emtpy.',
|
|
(String with: Character cr),
|
|
'To fill it, open a document using the Grafoscopio menu option at the top bar:',
|
|
(String with: Character cr),
|
|
(String with: Character cr),
|
|
'"Launch > Notebook from file..."',
|
|
(String with: Character cr),
|
|
(String with: Character cr)
|
|
title: 'No recent documents'.
|
|
]
|
|
|
|
{ #category : #'graphical interface' }
|
|
GfUIHelpers class >> messageNotImplementedYet [
|
|
"Shows that a feature is not implemeted and point to further documentation on the web"
|
|
|
|
UIManager default abort:
|
|
'This functionality is not implemented yet!',
|
|
(String with: Character cr),
|
|
'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: 'To be implemented'.
|
|
]
|
|
|
|
{ #category : #'graphical interface' }
|
|
GfUIHelpers class >> openFromRecentlyUsed [
|
|
"Opens a recent notebooks list"
|
|
| selection recentNotebooksReversed |
|
|
|
|
self recentNotebooks
|
|
ifNotEmpty: [
|
|
recentNotebooksReversed := recentNotebooks reversed.
|
|
selection := UIManager default
|
|
chooseFrom: recentNotebooksReversed title: 'Choose a notebook...'.
|
|
selection > 0
|
|
ifTrue: [ GrafoscopioNotebook new openFromFile: (recentNotebooksReversed at: selection)]
|
|
ifFalse: [ self inform: 'No notebook selected!' ]
|
|
]
|
|
ifEmpty: [self messageNoRecentDocuments]
|
|
|
|
|
|
|
|
]
|
|
|
|
{ #category : #accessing }
|
|
GfUIHelpers class >> recentNotebooks [
|
|
^ recentNotebooks ifNil: [recentNotebooks := OrderedCollection new ]
|
|
]
|
|
|
|
{ #category : #updating }
|
|
GfUIHelpers class >> updateDataviz [
|
|
"I update the Dataviz package with new versions of itself take from the source code
|
|
repository.
|
|
DataViz contains Data visualization helpers"
|
|
self isDatavizInstalled
|
|
ifFalse: [ self installDatavizUI ]
|
|
ifTrue: [
|
|
Gofer it
|
|
smalltalkhubUser: 'Offray' project: 'Dataviz';
|
|
configurationOf: 'Dataviz';
|
|
load.
|
|
self inform: 'Dataviz package update finished.'].
|
|
|
|
]
|
|
|
|
{ #category : #updating }
|
|
GfUIHelpers class >> updateDatavizUI [
|
|
"I'm the User Interface for updating the Dataviz package with new versions of itself
|
|
take from the source code repository"
|
|
| update |
|
|
update := (UIManager default
|
|
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 ifFalse: [ ^ self ].
|
|
self updateDataviz
|
|
]
|
|
|
|
{ #category : #updating }
|
|
GfUIHelpers class >> updateGrafoscopio [
|
|
"Updates Grafoscopio with new versions of itself take from the source code repository and
|
|
reloads the User Interface"
|
|
Gofer new
|
|
smalltalkhubUser: 'Offray' project: 'Grafoscopio';
|
|
package: 'Grafoscopio';
|
|
load.
|
|
GrafoscopioUtils update.
|
|
]
|
|
|
|
{ #category : #updating }
|
|
GfUIHelpers class >> updateGrafoscopioUI [
|
|
"Updates Grafoscopio with new versions of itself take from the source code repository and
|
|
the User Interface"
|
|
| update |
|
|
|
|
update := (UIManager default
|
|
confirm: 'Do you wish to update Grafoscopio?'
|
|
label: 'Grafoscopio update').
|
|
update ifFalse: [ ^ self ].
|
|
self updateGrafoscopio.
|
|
GrafoscopioUtils update.
|
|
self updateUI.
|
|
self inform: 'Grafoscopio update finished'
|
|
]
|
|
|
|
{ #category : #updating }
|
|
GfUIHelpers class >> updatePrerrequisitesScript [
|
|
"Updates the system prerequisites with new versions of itself take from the source code repository"
|
|
|
|
"Visualization library (which also makes main menu loadable)"
|
|
Gofer it
|
|
smalltalkhubUser: 'ObjectProfile' project: 'Roassal2';
|
|
configurationOf: 'Roassal2';
|
|
loadStable.
|
|
|
|
"Support for the STON format used in file persistance for grafoscopio notebooks"
|
|
Gofer new
|
|
smalltalkhubUser: 'SvenVanCaekenberghe' project: 'STON';
|
|
configurationOf: 'Ston';
|
|
loadBleedingEdge.
|
|
|
|
"Moose and Roassal integration"
|
|
Gofer new
|
|
smalltalkhubUser: 'Moose' project: 'Glamour';
|
|
package: 'Glamour-Tools';
|
|
package: 'Glamour-Roassal2-Presentations';
|
|
load.
|
|
|
|
Gofer new
|
|
smalltalkhubUser: 'Moose' project: 'GToolkit';
|
|
package: 'GT-InspectorExtensions-CoreRoassal';
|
|
load.
|
|
|
|
"Fast Table support"
|
|
Gofer it
|
|
smalltalkhubUser: 'estebanlm' project: 'FastTable';
|
|
package: 'FastTable';
|
|
load.
|
|
|
|
"Integration with external tools"
|
|
Gofer new
|
|
smalltalkhubUser: 'Offray' project: 'Grafoscopio';
|
|
package: 'Grafoscopio-ExternalTools';
|
|
load.
|
|
|
|
"HTML scrapping"
|
|
Gofer new
|
|
smalltalkhubUser: 'PharoExtras' project: 'Soup';
|
|
configurationOf: 'Soup';
|
|
loadStable.
|
|
|
|
"SQLite support"
|
|
Gofer new
|
|
url: 'http://smalltalkhub.com/mc/PharoExtras/NBSQLite3/main';
|
|
package: 'NBSQLite3';
|
|
load.
|
|
|
|
Gofer new
|
|
url: 'http://smalltalkhub.com/mc/PharoExtras/NBSQLite3/main';
|
|
package: 'NBSQLite3-Examples';
|
|
load.
|
|
|
|
"Support for Operative System integration"
|
|
Gofer new
|
|
squeaksource: 'OSProcess';
|
|
package: 'OSProcess';
|
|
load.
|
|
|
|
Gofer new
|
|
squeaksource: 'CommandShell';
|
|
package: 'CommandShell-Piping';
|
|
load.
|
|
|
|
"Bibliographic support"
|
|
Gofer new
|
|
squeaksource: 'Citezen';
|
|
package: 'ConfigurationOfCitezen';
|
|
load.
|
|
|
|
]
|
|
|
|
{ #category : #updating }
|
|
GfUIHelpers class >> updateRecentNotebooksWith: aFileReference [
|
|
(self recentNotebooks includes: aFileReference)
|
|
ifFalse: [self recentNotebooks add: aFileReference].
|
|
]
|
|
|
|
{ #category : #updating }
|
|
GfUIHelpers class >> updateSystem [
|
|
| tmp1 |
|
|
tmp1 := UIManager default
|
|
question: 'Do you wish to update all Grafoscopio and its co-dependencies ?'
|
|
title: 'Grafoscopio update'.
|
|
tmp1
|
|
ifNotNil: [ tmp1
|
|
ifTrue: [
|
|
self
|
|
updateGrafoscopio;
|
|
updateDataviz.
|
|
GrafoscopioDocumentation updateAll.
|
|
self inform: 'System update finished.' ]]
|
|
]
|
|
|
|
{ #category : #updating }
|
|
GfUIHelpers class >> updateUI [
|
|
"I update the User Interface (UI) with new versions of the docking bar or logos where available.
|
|
I'm helpful while testing new functionality that should be expossed to the user via the UI"
|
|
self start.
|
|
(World submorphs select: [ :each | each class = DockingBarMorph ])
|
|
allButFirstDo: [ :bar | bar delete ].
|
|
|
|
]
|