Minor usability improvements

pull/41/head
Laurent Cozic 2017-10-24 21:22:57 +01:00
parent 47da5f24e9
commit fed256753c
9 changed files with 150 additions and 54 deletions

View File

@ -90,6 +90,10 @@ class AppGui {
return this.widget('statusBar').prompt(initialText, promptString); return this.widget('statusBar').prompt(initialText, promptString);
} }
stdoutMaxWidth() {
return this.widget('console').innerWidth - 1;
}
buildUi() { buildUi() {
this.rootWidget_ = new ReduxRootWidget(this.store_); this.rootWidget_ = new ReduxRootWidget(this.store_);
this.rootWidget_.name = 'root'; this.rootWidget_.name = 'root';
@ -261,6 +265,18 @@ class AppGui {
setupShortcuts() { setupShortcuts() {
const shortcuts = {}; const shortcuts = {};
shortcuts['TAB'] = {
friendlyName: 'Tab',
description: _('Give focus to next widget'),
isDocOnly: true,
}
shortcuts['SHIFT_TAB'] = {
friendlyName: 'Shift+Tab',
description: _('Give focus to previous widget'),
isDocOnly: true,
}
shortcuts['DELETE'] = { shortcuts['DELETE'] = {
description: _('Delete the currently selected note or notebook.'), description: _('Delete the currently selected note or notebook.'),
action: async () => { action: async () => {

View File

@ -60,7 +60,7 @@ class Application {
} }
commandStdoutMaxWidth() { commandStdoutMaxWidth() {
return 78; return this.gui().stdoutMaxWidth();
} }
async refreshCurrentFolder() { async refreshCurrentFolder() {
@ -421,6 +421,7 @@ class Application {
exit: () => {}, exit: () => {},
showModalOverlay: (text) => {}, showModalOverlay: (text) => {},
hideModalOverlay: () => {}, hideModalOverlay: () => {},
stdoutMaxWidth: () => { return 78; }
}; };
} }

View File

@ -55,10 +55,11 @@ class Command extends BaseCommand {
this.stdout(''); this.stdout('');
this.stdout(commandNames.join(', ')); this.stdout(commandNames.join(', '));
this.stdout(''); this.stdout('');
this.stdout(_('To move from one widget to another, press Tab or Shift+Tab.'));
this.stdout(_('To maximise/minimise the console, press "C".')); this.stdout(_('To maximise/minimise the console, press "C".'));
this.stdout(_('To enter command line mode, press ":"')); this.stdout(_('To enter command line mode, press ":"'));
this.stdout(_('To exit command line mode, press ESCAPE')); this.stdout(_('To exit command line mode, press ESCAPE'));
this.stdout(_('To view a list of available shortcuts type `help shortcuts`')); this.stdout(_('For the complete list of available keyboard shortcuts, type `help shortcuts`'));
} }
app().gui().showConsole(); app().gui().showConsole();

View File

@ -35,6 +35,8 @@ class Command extends BaseCommand {
const ok = force ? true : await this.prompt(msg); const ok = force ? true : await this.prompt(msg);
if (!ok) return; if (!ok) return;
let lastProgress = '';
let options = { let options = {
fuzzyMatching: args.options['fuzzy-matching'] === true, fuzzyMatching: args.options['fuzzy-matching'] === true,
onProgress: (progressState) => { onProgress: (progressState) => {
@ -45,7 +47,8 @@ class Command extends BaseCommand {
if (progressState.skipped) line.push(_('Skipped: %d.', progressState.skipped)); if (progressState.skipped) line.push(_('Skipped: %d.', progressState.skipped));
if (progressState.resourcesCreated) line.push(_('Resources: %d.', progressState.resourcesCreated)); if (progressState.resourcesCreated) line.push(_('Resources: %d.', progressState.resourcesCreated));
if (progressState.notesTagged) line.push(_('Tagged: %d.', progressState.notesTagged)); if (progressState.notesTagged) line.push(_('Tagged: %d.', progressState.notesTagged));
cliUtils.redraw(line.join(' ')); lastProgress = line.join(' ');
cliUtils.redraw(lastProgress);
}, },
onError: (error) => { onError: (error) => {
let s = error.trace ? error.trace : error.toString(); let s = error.trace ? error.trace : error.toString();
@ -57,6 +60,7 @@ class Command extends BaseCommand {
this.stdout(_('Importing notes...')); this.stdout(_('Importing notes...'));
await importEnex(folder.id, filePath, options); await importEnex(folder.id, filePath, options);
cliUtils.redrawDone(); cliUtils.redrawDone();
this.stdout(_('The notes have been imported: %s', lastProgress));
} }
} }

View File

@ -49,12 +49,17 @@ function renderCommandHelp(cmd, width = null) {
if (cmd.name() === 'config') { if (cmd.name() === 'config') {
const renderMetadata = (md) => { const renderMetadata = (md) => {
let desc = []; let desc = [];
if (md.label) { if (md.label) {
let label = md.label(); let label = md.label();
if (label.length && label[label.length - 1] !== '.') label += '.'; if (label.length && label[label.length - 1] !== '.') label += '.';
desc.push(label); desc.push(label);
} }
if (md.description) {
desc.push(md.description());
}
desc.push(_('Type: %s.', md.isEnum ? _('Enum') : Setting.typeToString(md.type))); desc.push(_('Type: %s.', md.isEnum ? _('Enum') : Setting.typeToString(md.type)));
if (md.isEnum) desc.push(_('Possible values: %s.', Setting.enumOptionsDoc(md.key, '%s (%s)'))); if (md.isEnum) desc.push(_('Possible values: %s.', Setting.enumOptionsDoc(md.key, '%s (%s)')));
@ -82,6 +87,7 @@ function renderCommandHelp(cmd, width = null) {
let keysValues = []; let keysValues = [];
const keys = Setting.keys(true, 'cli'); const keys = Setting.keys(true, 'cli');
for (let i = 0; i < keys.length; i++) { for (let i = 0; i < keys.length; i++) {
if (keysValues.length) keysValues.push(['','']);
const md = Setting.settingMetadata(keys[i]); const md = Setting.settingMetadata(keys[i]);
if (!md.label) continue; if (!md.label) continue;
keysValues.push(renderMetadata(md)); keysValues.push(renderMetadata(md));

View File

@ -15,6 +15,12 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
msgid "Give focus to next widget"
msgstr ""
msgid "Give focus to previous widget"
msgstr ""
msgid "Delete the currently selected note or notebook." msgid "Delete the currently selected note or notebook."
msgstr "" msgstr ""
@ -244,6 +250,9 @@ msgstr ""
msgid "The possible commands are:" msgid "The possible commands are:"
msgstr "" msgstr ""
msgid "To move from one widget to another, press Tab or Shift+Tab."
msgstr ""
msgid "To maximise/minimise the console, press \"C\"." msgid "To maximise/minimise the console, press \"C\"."
msgstr "" msgstr ""
@ -253,7 +262,8 @@ msgstr ""
msgid "To exit command line mode, press ESCAPE" msgid "To exit command line mode, press ESCAPE"
msgstr "" msgstr ""
msgid "To view a list of available shortcuts type `help shortcuts`" msgid ""
"For the complete list of available keyboard shortcuts, type `help shortcuts`"
msgstr "" msgstr ""
msgid "Imports an Evernote notebook file (.enex file)." msgid "Imports an Evernote notebook file (.enex file)."
@ -299,6 +309,10 @@ msgstr ""
msgid "Importing notes..." msgid "Importing notes..."
msgstr "" msgstr ""
#, javascript-format
msgid "The notes have been imported: %s"
msgstr ""
msgid "" msgid ""
"Displays the notes in the current notebook. Use `ls /` to display the list " "Displays the notes in the current notebook. Use `ls /` to display the list "
"of notebooks." "of notebooks."
@ -564,15 +578,31 @@ msgstr ""
msgid "Invalid option value: \"%s\". Possible values are: %s." msgid "Invalid option value: \"%s\". Possible values are: %s."
msgstr "" msgstr ""
msgid "File system synchronisation target directory"
msgstr ""
msgid ""
"The path to synchronise with when file system synchronisation is enabled. "
"See `sync.target`."
msgstr ""
msgid "Synchronisation target" msgid "Synchronisation target"
msgstr "" msgstr ""
msgid ""
"The target to synchonise to. If synchronising with the file system, set "
"`sync.2.path` to specify the target directory."
msgstr ""
msgid "File system" msgid "File system"
msgstr "" msgstr ""
msgid "OneDrive" msgid "OneDrive"
msgstr "" msgstr ""
msgid "Text editor"
msgstr ""
msgid "" msgid ""
"The editor that will be used to open a note. If none is provided it will try " "The editor that will be used to open a note. If none is provided it will try "
"to auto-detect the default editor." "to auto-detect the default editor."
@ -581,25 +611,13 @@ msgstr ""
msgid "Language" msgid "Language"
msgstr "" msgstr ""
msgid "Todo filter"
msgstr ""
msgid "Show all"
msgstr ""
msgid "Non-completed and recently completed ones"
msgstr ""
msgid "Non-completed ones only"
msgstr ""
msgid "Show uncompleted todos on top of the lists" msgid "Show uncompleted todos on top of the lists"
msgstr "" msgstr ""
msgid "Show advanced options" msgid "Show advanced options"
msgstr "" msgstr ""
msgid "Save location with notes" msgid "Save geo-location with notes"
msgstr "" msgstr ""
msgid "Synchronisation interval" msgid "Synchronisation interval"

View File

@ -15,6 +15,12 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.3\n" "X-Generator: Poedit 2.0.3\n"
msgid "Give focus to next widget"
msgstr ""
msgid "Give focus to previous widget"
msgstr ""
msgid "Delete the currently selected note or notebook." msgid "Delete the currently selected note or notebook."
msgstr "" msgstr ""
@ -271,6 +277,9 @@ msgstr ""
msgid "The possible commands are:" msgid "The possible commands are:"
msgstr "" msgstr ""
msgid "To move from one widget to another, press Tab or Shift+Tab."
msgstr ""
#, fuzzy #, fuzzy
msgid "To maximise/minimise the console, press \"C\"." msgid "To maximise/minimise the console, press \"C\"."
msgstr "Quitter le logiciel." msgstr "Quitter le logiciel."
@ -281,7 +290,8 @@ msgstr ""
msgid "To exit command line mode, press ESCAPE" msgid "To exit command line mode, press ESCAPE"
msgstr "" msgstr ""
msgid "To view a list of available shortcuts type `help shortcuts`" msgid ""
"For the complete list of available keyboard shortcuts, type `help shortcuts`"
msgstr "" msgstr ""
msgid "Imports an Evernote notebook file (.enex file)." msgid "Imports an Evernote notebook file (.enex file)."
@ -330,6 +340,10 @@ msgstr "Etiquettes : %d."
msgid "Importing notes..." msgid "Importing notes..."
msgstr "Importation des notes..." msgstr "Importation des notes..."
#, fuzzy, javascript-format
msgid "The notes have been imported: %s"
msgstr "Aucun carnet n'est spécifié."
#, fuzzy #, fuzzy
msgid "" msgid ""
"Displays the notes in the current notebook. Use `ls /` to display the list " "Displays the notes in the current notebook. Use `ls /` to display the list "
@ -627,15 +641,32 @@ msgstr "Impossible de déplacer la note vers le carnet \"%s\""
msgid "Invalid option value: \"%s\". Possible values are: %s." msgid "Invalid option value: \"%s\". Possible values are: %s."
msgstr "Option invalide: \"%s\". Les valeurs possibles sont : %s." msgstr "Option invalide: \"%s\". Les valeurs possibles sont : %s."
#, fuzzy
msgid "File system synchronisation target directory"
msgstr "Cible de la synchronisation"
msgid ""
"The path to synchronise with when file system synchronisation is enabled. "
"See `sync.target`."
msgstr ""
msgid "Synchronisation target" msgid "Synchronisation target"
msgstr "Cible de la synchronisation" msgstr "Cible de la synchronisation"
msgid ""
"The target to synchonise to. If synchronising with the file system, set "
"`sync.2.path` to specify the target directory."
msgstr ""
msgid "File system" msgid "File system"
msgstr "Système de fichier" msgstr "Système de fichier"
msgid "OneDrive" msgid "OneDrive"
msgstr "OneDrive" msgstr "OneDrive"
msgid "Text editor"
msgstr ""
msgid "" msgid ""
"The editor that will be used to open a note. If none is provided it will try " "The editor that will be used to open a note. If none is provided it will try "
"to auto-detect the default editor." "to auto-detect the default editor."
@ -644,25 +675,14 @@ msgstr ""
msgid "Language" msgid "Language"
msgstr "Langue" msgstr "Langue"
msgid "Todo filter"
msgstr "Filtre des tâches"
msgid "Show all"
msgstr "Afficher tous"
msgid "Non-completed and recently completed ones"
msgstr "Tâches non-complétées et récentes"
msgid "Non-completed ones only"
msgstr "Tâches complétées seulement"
msgid "Show uncompleted todos on top of the lists" msgid "Show uncompleted todos on top of the lists"
msgstr "Tâches non-terminées en haut des listes" msgstr "Tâches non-terminées en haut des listes"
msgid "Show advanced options" msgid "Show advanced options"
msgstr "" msgstr ""
msgid "Save location with notes" #, fuzzy
msgid "Save geo-location with notes"
msgstr "Enregistrer l'emplacement avec les notes" msgstr "Enregistrer l'emplacement avec les notes"
msgid "Synchronisation interval" msgid "Synchronisation interval"
@ -822,6 +842,18 @@ msgstr ""
msgid "Welcome" msgid "Welcome"
msgstr "Bienvenue" msgstr "Bienvenue"
#~ msgid "Todo filter"
#~ msgstr "Filtre des tâches"
#~ msgid "Show all"
#~ msgstr "Afficher tous"
#~ msgid "Non-completed and recently completed ones"
#~ msgstr "Tâches non-complétées et récentes"
#~ msgid "Non-completed ones only"
#~ msgstr "Tâches complétées seulement"
#, fuzzy #, fuzzy
#~ msgid "Delete a note" #~ msgid "Delete a note"
#~ msgstr "Supprimer la note" #~ msgstr "Supprimer la note"

View File

@ -15,6 +15,12 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n" "Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
msgid "Give focus to next widget"
msgstr ""
msgid "Give focus to previous widget"
msgstr ""
msgid "Delete the currently selected note or notebook." msgid "Delete the currently selected note or notebook."
msgstr "" msgstr ""
@ -244,6 +250,9 @@ msgstr ""
msgid "The possible commands are:" msgid "The possible commands are:"
msgstr "" msgstr ""
msgid "To move from one widget to another, press Tab or Shift+Tab."
msgstr ""
msgid "To maximise/minimise the console, press \"C\"." msgid "To maximise/minimise the console, press \"C\"."
msgstr "" msgstr ""
@ -253,7 +262,8 @@ msgstr ""
msgid "To exit command line mode, press ESCAPE" msgid "To exit command line mode, press ESCAPE"
msgstr "" msgstr ""
msgid "To view a list of available shortcuts type `help shortcuts`" msgid ""
"For the complete list of available keyboard shortcuts, type `help shortcuts`"
msgstr "" msgstr ""
msgid "Imports an Evernote notebook file (.enex file)." msgid "Imports an Evernote notebook file (.enex file)."
@ -299,6 +309,10 @@ msgstr ""
msgid "Importing notes..." msgid "Importing notes..."
msgstr "" msgstr ""
#, javascript-format
msgid "The notes have been imported: %s"
msgstr ""
msgid "" msgid ""
"Displays the notes in the current notebook. Use `ls /` to display the list " "Displays the notes in the current notebook. Use `ls /` to display the list "
"of notebooks." "of notebooks."
@ -564,15 +578,31 @@ msgstr ""
msgid "Invalid option value: \"%s\". Possible values are: %s." msgid "Invalid option value: \"%s\". Possible values are: %s."
msgstr "" msgstr ""
msgid "File system synchronisation target directory"
msgstr ""
msgid ""
"The path to synchronise with when file system synchronisation is enabled. "
"See `sync.target`."
msgstr ""
msgid "Synchronisation target" msgid "Synchronisation target"
msgstr "" msgstr ""
msgid ""
"The target to synchonise to. If synchronising with the file system, set "
"`sync.2.path` to specify the target directory."
msgstr ""
msgid "File system" msgid "File system"
msgstr "" msgstr ""
msgid "OneDrive" msgid "OneDrive"
msgstr "" msgstr ""
msgid "Text editor"
msgstr ""
msgid "" msgid ""
"The editor that will be used to open a note. If none is provided it will try " "The editor that will be used to open a note. If none is provided it will try "
"to auto-detect the default editor." "to auto-detect the default editor."
@ -581,25 +611,13 @@ msgstr ""
msgid "Language" msgid "Language"
msgstr "" msgstr ""
msgid "Todo filter"
msgstr ""
msgid "Show all"
msgstr ""
msgid "Non-completed and recently completed ones"
msgstr ""
msgid "Non-completed ones only"
msgstr ""
msgid "Show uncompleted todos on top of the lists" msgid "Show uncompleted todos on top of the lists"
msgstr "" msgstr ""
msgid "Show advanced options" msgid "Show advanced options"
msgstr "" msgstr ""
msgid "Save location with notes" msgid "Save geo-location with notes"
msgstr "" msgstr ""
msgid "Synchronisation interval" msgid "Synchronisation interval"

View File

@ -318,9 +318,9 @@ Setting.THEME_DARK = 2;
Setting.metadata_ = { Setting.metadata_ = {
'activeFolderId': { value: '', type: Setting.TYPE_STRING, public: false }, 'activeFolderId': { value: '', type: Setting.TYPE_STRING, public: false },
'firstStart': { value: true, type: Setting.TYPE_BOOL, public: false }, 'firstStart': { value: true, type: Setting.TYPE_BOOL, public: false },
'sync.2.path': { value: '', type: Setting.TYPE_STRING, public: true, appTypes: ['cli'] }, 'sync.2.path': { value: '', type: Setting.TYPE_STRING, public: true, appTypes: ['cli'], label: () => _('File system synchronisation target directory'), description: () => _('The path to synchronise with when file system synchronisation is enabled. See `sync.target`.') },
'sync.3.auth': { value: '', type: Setting.TYPE_STRING, public: false }, 'sync.3.auth': { value: '', type: Setting.TYPE_STRING, public: false },
'sync.target': { value: Setting.SYNC_TARGET_ONEDRIVE, type: Setting.TYPE_INT, isEnum: true, public: true, label: () => _('Synchronisation target'), options: () => { 'sync.target': { value: Setting.SYNC_TARGET_ONEDRIVE, type: Setting.TYPE_INT, isEnum: true, public: true, label: () => _('Synchronisation target'), description: () => _('The target to synchonise to. If synchronising with the file system, set `sync.2.path` to specify the target directory.'), options: () => {
let output = {}; let output = {};
output[Setting.SYNC_TARGET_MEMORY] = 'Memory'; output[Setting.SYNC_TARGET_MEMORY] = 'Memory';
output[Setting.SYNC_TARGET_FILESYSTEM] = _('File system'); output[Setting.SYNC_TARGET_FILESYSTEM] = _('File system');
@ -333,7 +333,7 @@ Setting.metadata_ = {
'sync.4.context': { value: '', type: Setting.TYPE_STRING, public: false }, 'sync.4.context': { value: '', type: Setting.TYPE_STRING, public: false },
'sync.5.context': { value: '', type: Setting.TYPE_STRING, public: false }, 'sync.5.context': { value: '', type: Setting.TYPE_STRING, public: false },
'sync.6.context': { value: '', type: Setting.TYPE_STRING, public: false }, 'sync.6.context': { value: '', type: Setting.TYPE_STRING, public: false },
'editor': { value: '', type: Setting.TYPE_STRING, public: true, appTypes: ['cli'], label: () => _('The editor that will be used to open a note. If none is provided it will try to auto-detect the default editor.') }, 'editor': { value: '', type: Setting.TYPE_STRING, public: true, appTypes: ['cli'], label: () => _('Text editor'), description: () => _('The editor that will be used to open a note. If none is provided it will try to auto-detect the default editor.') },
'locale': { value: defaultLocale(), type: Setting.TYPE_STRING, isEnum: true, public: true, label: () => _('Language'), options: () => { 'locale': { value: defaultLocale(), type: Setting.TYPE_STRING, isEnum: true, public: true, label: () => _('Language'), options: () => {
return supportedLocalesToLanguages(); return supportedLocalesToLanguages();
}}, }},
@ -341,14 +341,14 @@ Setting.metadata_ = {
// return Logger.levelEnum(); // return Logger.levelEnum();
// }}, // }},
// Not used for now: // Not used for now:
'todoFilter': { value: 'all', type: Setting.TYPE_STRING, isEnum: true, public: false, appTypes: ['mobile'], label: () => _('Todo filter'), options: () => ({ // 'todoFilter': { value: 'all', type: Setting.TYPE_STRING, isEnum: true, public: false, appTypes: ['mobile'], label: () => _('Todo filter'), options: () => ({
all: _('Show all'), // all: _('Show all'),
recent: _('Non-completed and recently completed ones'), // recent: _('Non-completed and recently completed ones'),
nonCompleted: _('Non-completed ones only'), // nonCompleted: _('Non-completed ones only'),
})}, // })},
'uncompletedTodosOnTop': { value: true, type: Setting.TYPE_BOOL, public: true, label: () => _('Show uncompleted todos on top of the lists') }, 'uncompletedTodosOnTop': { value: true, type: Setting.TYPE_BOOL, public: true, label: () => _('Show uncompleted todos on top of the lists') },
'showAdvancedOptions': { value: false, type: Setting.TYPE_BOOL, public: true, appTypes: ['mobile'], label: () => _('Show advanced options') }, 'showAdvancedOptions': { value: false, type: Setting.TYPE_BOOL, public: true, appTypes: ['mobile'], label: () => _('Show advanced options') },
'trackLocation': { value: true, type: Setting.TYPE_BOOL, public: true, label: () => _('Save location with notes') }, 'trackLocation': { value: true, type: Setting.TYPE_BOOL, public: true, label: () => _('Save geo-location with notes') },
'sync.interval': { value: 300, type: Setting.TYPE_INT, isEnum: true, public: true, label: () => _('Synchronisation interval'), options: () => { 'sync.interval': { value: 300, type: Setting.TYPE_INT, isEnum: true, public: true, label: () => _('Synchronisation interval'), options: () => {
return { return {
0: _('Disabled'), 0: _('Disabled'),