!7 !include #1016871 // main is not run module SnippetsDB { bool withText, quickUpdate; transient ReliableSingleThread rst = new(r updateMe); start { updateInterval = quickUpdate ? 60 : 3600; autoDownloadText = withText; useDBOf(#1016871); addDirToDontBackupList(dbDir()); onConceptsChange(rst); fullUpdateAtStart = false; snippetsDB_init(); indexConceptField(CSnippet, 'type); } visualize { ret centerBoldLabel(jLiveValueLabel(dm_calculatedLiveValue(this, S, func -> S { n2(countConcepts(CSnippet), "snippet") }))); } enhanceFrame { addTitlePopupMenuItem(f, "Full download", r-thread enter { fullDownload(); }); dm_boolFieldMenuItem(f, 'withText, onSet := r { autoDownloadText = withText }); dm_boolFieldMenuItem(f, 'quickUpdate); } // API for other modules L snippetsOfType(S type) { ret sortedByFieldDesc('snippetID, conceptsWhere(CSnippet, +type)); } L allSnippets() { ret list(CSnippet); } S getSnippetText(S snippetID) enter { ret main.getSnippetText(snippetID); } }