1 | sbool conceptLanguageToolTips_enabled; |
2 | |
3 | svoid conceptLanguageToolTips() swing { |
4 | if (conceptLanguageToolTips_enabled) ret; |
5 | conceptLanguageToolTips_enabled = true; |
6 | |
7 | thread "conceptLanguageToolTips" { |
8 | bool firstTime = true; // hack fix for tool tip not appearing the first time |
9 | S initialMsg = "Move mouse over a concept word to reveal its meaning!"; |
10 | |
11 | //repeat with ms sleep 500 { |
12 | // Don't respond to "pause" button |
13 | while (licensed_noPing()) { |
14 | pcall { |
15 | Component c = (Component) componentAtMouse_gen(); |
16 | if (c instanceof JComponent) { |
17 | S word = wordAtMouse(), msg = firstTime ? initialMsg : ""; |
18 | |
19 | if (possibleGlobalID(word)) { |
20 | Lisp l = getLispTruth(word); |
21 | S name = null; |
22 | if (l != null) |
23 | name = lispToEnglish_prettier(l); |
24 | if (name == null) |
25 | name = conceptToNameOpt(word); // This reloads AI concepts |
26 | if (name != null) { |
27 | msg = word + ": " + name; |
28 | firstTime = false; |
29 | } |
30 | } |
31 | setToolTipText((JComponent) c, msg); |
32 | } |
33 | } |
34 | Thread.sleep(500); |
35 | } |
36 | } |
37 | } |
Began life as a copy of #1007437
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007440 |
Snippet name: | conceptLanguageToolTips |
Eternal ID of this version: | #1007440/12 |
Text MD5: | 7d61117d2444ce6027ec8452aba950a4 |
Author: | stefan |
Category: | javax / gui / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-04-30 00:39:54 |
Source code size: | 1217 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 518 / 554 |
Version history: | 11 change(s) |
Referenced in: | [show references] |