Documentation: Improving UI experience for dowloading main tutorial.

This commit is contained in:
Offray Vladimir Luna Cárdenas 2016-03-11 15:08:33 +00:00
parent 65a0e3488d
commit 25598642b3

View File

@ -84,6 +84,43 @@ GrafoscopioBrowser class >> configureSettings [
]
]
{ #category : #updating }
GrafoscopioBrowser class >> downloadTutorial [
"I download the interactive tutorial in STON format.
I define some metadata associated to the tutorial document.
Language is provided according to the ISO 639-1 code convention."
| doc client |
doc := Dictionary
with: 'type' -> 'tutorial'
with: 'language' -> 'ES_CO'
with: 'remote' -> 'http://mutabit.com/repos.fossil/grafoscopio/doc/tip/Docs/Es/Tutoriales/tutorial.ston'
with: 'local' -> './Docs/Es/Tutoriales/'.
((doc at: 'local'), 'tutorial.ston') asFileReference exists
ifTrue: [
((doc at: 'local'), 'tutorial.temp.ston') asFileReference exists
ifTrue: [ ((doc at: 'local'), 'tutorial.temp.ston') asFileReference delete].
((doc at: 'local'), 'tutorial.ston') asFileReference renameTo: 'tutorial.temp.ston'
].
[:bar |
bar title: 'Actualizando el tutorial...'.
[client := ZnClient new.
client
get: (doc at: 'remote');
signalProgress: true;
downloadTo: (doc at: 'local').
]
on: HTTPProgress
do: [ :progress |
progress isEmpty ifFalse: [ bar current: progress percentage ].
progress resume ].
] asJob run.
client isSuccess
ifFalse: [ self inform: 'Algo salió mal. Verifique su conexión a Internet.' ]
]
{ #category : #'graphical interface' }
GrafoscopioBrowser class >> messageAbout [
"Shows the author, license, sponsors and main contributors to the project and point to further documentation on the web"
@ -310,6 +347,10 @@ GrafoscopioBrowser class >> updateDocumentation [
with: 'remote' -> 'http://mutabit.com/repos.fossil/grafoscopio/doc/tip/Docs/Es/Tutoriales/tutorial.ston'
with: 'local' -> './Docs/Es/Tutoriales/'
).
UIManager default
displayProgress: 'Actualizando la documentación'
from: 0.0 to: 0.1
during: [
docs do: [:each |
client := ZnClient new.
client get: (each at: 'remote').
@ -322,7 +363,7 @@ GrafoscopioBrowser class >> updateDocumentation [
fileLocation asFileReference
writeStreamDo: [:stream |
stream write: client contents utf8Decoded asString].
].
]].
self inform: 'Actualización de la documentación terminada'.
]
].
@ -508,33 +549,12 @@ GrafoscopioBrowser class >> updateSystem [
GrafoscopioBrowser class >> updateTutorial [
"I Update main tutorial from official repository"
| update filePath fileLocation client docs |
| update |
update := (UIManager default
confirm: '¿Desea actualizar la documentación?'
confirm: '¿Desea actualizar el tutorial?'
label: 'Actualizar el tutorial').
update
ifTrue: [
docs := Dictionary
with: 'tutorial' -> (Dictionary
with: 'remote' -> 'http://mutabit.com/repos.fossil/grafoscopio/doc/tip/Docs/Es/Tutoriales/tutorial.ston'
with: 'local' -> './Docs/Es/Tutoriales/'
).
docs do: [:each |
client := ZnClient new.
client get: (each at: 'remote').
client isSuccess
ifFalse: [ self inform: 'Algo salió mal. Verifique su conexión a Internet.' ]
ifTrue: [
filePath := each at: 'local'.
filePath asFileReference ensureCreateDirectory.
fileLocation := filePath, ((each at: 'remote') splitOn: '/') last.
fileLocation asFileReference
writeStreamDo: [:stream |
stream write: client contents utf8Decoded asString].
].
self inform: 'Actualización del tutorial terminada'.
]
].
ifTrue: [self downloadTutorial]
]
{ #category : #updating }