Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

41
LINES

< > BotCompany Repo | #1019073 // Sensory Status [Dyn Module - Internet, Visual, Audio]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (14693L/102K).

!7

module SensoryStatus > DynModule {
  transient L<SingleComponentPanel> panels;
  transient volatile bool online, cam, mic;
  transient ReliableSingleThread rst = dm_rst(this, r actualUpdate);
  
  visualize {
    ret hgrid(panels = repF singleComponentPanel(3));
  }
  
  start {
    doEvery(10000, rst);
    dm_afterVisualize(rst);
  }
  
  void actualUpdate {
    temp enter();
    online = main.areWeOnline();
    cam = dm_isWebCamLive();
    mic = dm_anyIncomingAudio();
    if (nempty(panels)) {
      setComponent(0, jimage(online ? #1101406 : #1101405), online ?  "I have Internet" : "I am offline");
      setComponent(1, jimage(cam ? #1101410 : null), cam ? "I can see!" : "I am blind");
      setComponent(2, jimage(mic ? #1019081 : null), mic ? "I can hear something!" : "I can't hear anything");
    }
    setModuleName("Sensory Status +" + count());
  }
  
  void setComponent(int i, JComponent c, S tooltip) {
    SingleComponentPanel panel = get(panels, i);
    if (panel != null) {
      setToolTip(c, tooltip);
      panel.setComponent(c);
    }
  }
  
  int count() {
    ret addBools(online, cam, mic);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019073
Snippet name: Sensory Status [Dyn Module - Internet, Visual, Audio]
Eternal ID of this version: #1019073/14
Text MD5: 6188a3b84fd275140457cd6d4b305175
Transpilation MD5: 824be8a62415086d42830b3736b144fa
Author: stefan
Category: javax / stefan's os / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-07 02:39:55
Source code size: 1171 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 312 / 996
Version history: 13 change(s)
Referenced in: [show references]