(Re)create or update light.
349425
function (oldData) {
    var data = this.data;
    var diffData = diff(data, oldData);
    var light = this.light;
    var rendererSystem = this.rendererSystem;
    var self = this;

    // Existing light.
    if (light && !('type' in diffData)) {
      var shadowsLoaded = false;
      // Light type has not changed. Update light.
      Object.keys(diffData).forEach(function (key) {
        var value = data[key];

        switch (key) {
          case 'color': {
            light.color.set(value);
            rendererSystem.applyColorCorrection(light.color);
            break;
          }

          case 'groundColor': {
            light.groundColor.set(value);
            rendererSystem.applyColorCorrection(light.groundColor);
            break;
          }

          case 'angle': {
            light.angle = degToRad(value);
            break;
          }

          case 'target': {
            // Reset target if selector is null.
            if (value === null) {
              if (data.type === 'spot' || data.type === 'directional') {
                light.target = self.defaultTarget;
              }
            } else {
              // Target specified, set target to entity's `object3D` when it is loaded.
              if (value.hasLoaded) {
                self.onSetTarget(value, light);
              } else {
                value.addEventListener('loaded', bind(self.onSetTarget, self, value, light));
              }
            }
            break;
          }

          case 'castShadow':
          case 'shadowBias':
          case 'shadowCameraFar':
          case 'shadowCameraFov':
          case 'shadowCameraNear':
          case 'shadowCameraTop':
          case 'shadowCameraRight':
          case 'shadowCameraBottom':
          case 'shadowCameraLeft':
          case 'shadowCameraVisible':
          case 'shadowMapHeight':
          case 'shadowMapWidth':
          case 'shadowRadius':
            if (!shadowsLoaded) {
              self.updateShadow();
              shadowsLoaded = true;
            }
            break;

          default: {
            light[key] = value;
          }
        }
      });
      return;
    }

    // No light yet or light type has changed. Create and add light.
    this.setLight(this.data);
    this.updateShadow();
  }
1298164
def update(self, event_or_list):
        """"""

        for e in super().update(event_or_list):
            if e.type == MOUSEBUTTONDOWN:
                if e.pos in self:
                    self.click()
                else:
                    self.release(force_no_call=True)

            elif e.type == MOUSEBUTTONUP:
                self.release(force_no_call=e.pos not in self)

            elif e.type == MOUSEMOTION:
                if e.pos in self:
                    self.hovered = True
                else:
                    self.hovered = False
295653
def update(self):
        '''
        
        '''
        self.image = self.blank.copy()
        
        bf = self.font.render(''.join(self.text[:self.cursor_loc]), 
                True, self.color)
        br = bf.get_rect().move(self.margin)
        
        af = self.font.render(''.join(self.text[self.cursor_loc:]), 
                True, self.color)
        
        cr = self.cursor.get_rect()
        cvec = Vector(br.w - cr.w, 0) + self.margin
        
        scroll = Vector()
        
        if cvec.x > self.rect.w:
            scroll.x = self.rect.w - cvec.x - self.font.size(' ')[0]
        
        vcenter_blit(self.image, bf, scroll + br)
        vcenter_blit(self.image, af, scroll + br.topright)
        
        if self.cursor_shown and self.focus and pygame.key.get_focused():
            vcenter_blit(self.image, self.cursor, scroll + cvec)
        
        if self.blink_frames != None:
            self.blinker += 1
            self.blinker %= self.blink_frames
            if not self.blinker:
                self.cursor_shown = not self.cursor_shown
327327
def _transition_callback(self, is_on, transition):
        
        # Update state properties
        if transition.state_stages:
            state = transition.state_stages[transition.stage_index]
            if self.is_on and is_on is False:
                # If led was turned off, set brightness to initial value
                # so that the brightness is restored when it is turned on again
                state['brightness'] = self.brightness
            self.set(is_on=is_on, cancel_transition=False, **state)

        self._active_transition = None
277809
function(resource, opts) {
      if (this.debugMode) log('update', { resource: resource, opts: opts })
      resource._update(this, resource, opts)
    }
422697
def toggle(self):
        
        # Send command
        self.api_call.operate_on_bulb("toggle")
        # Update property
        if self.is_on():
            self.property[self.PROPERTY_NAME_POWER] = self.POWER_OFF
        elif self.is_off():
            self.property[self.PROPERTY_NAME_POWER] = self.POWER_ON
626281
def setLedN(self, led_number=0):
        
        if ( self.dev == None ): return ''
        buf = [REPORT_ID, ord('l'), led_number, 0,0,0,0,0,0]
        self.write(buf)
611616
def brighten(self):
        """"""
        brighten_command = StandardSend(
            self._address, COMMAND_LIGHT_BRIGHTEN_ONE_STEP_0X15_0X00)
        self._send_method(brighten_command)
1077906
def _create_emitter(self, event):
        """"""
        if not hasattr(self, event):
            setattr(self, event,
                    lambda *args, **kwargs: self.emit(event, *args, **kwargs))
514123
def update_value(self, key, value):
        """"""

        if key == "Status":
            self._inhibited = value != "Enabled"
        elif key == "Color temperature":
            self._temperature = int(value.rstrip("K"), 10)
        elif key == "Period":
            self._period = value
        elif key == "Brightness":
            self._brightness = value
        elif key == "Location":
            location = []
            for x in value.split(", "):
                v, d = x.split(" ")
                location.append(float(v) * (1 if d in "NE" else -1))
            self._location = (location)
145022
def refresh(self):
        """"""
        # new_device = {}
        if self.type in CONST.BINARY_SENSOR_TYPES:
            response = self._lupusec.get_sensors()
            for device in response:
                if device['device_id'] == self._device_id:
                    self.update(device)

            return device

        elif self.type == CONST.ALARM_TYPE:
            response = self._lupusec.get_panel()
            self.update(response)
            return response
        
        elif self.type == CONST.TYPE_POWER_SWITCH:
            response = self._lupusec.get_power_switches()
            for pss in response:
                if pss['device_id'] == self._device_id:
                    self.update(pss)
            return pss
1175130
def set_nightlight(self, state):
    """"""
    packet = bytearray(16)
    packet[0] = 2
    if self.check_power():
      packet[4] = 3 if state else 1
    else:
      packet[4] = 2 if state else 0
    self.send_packet(0x6a, packet)
658036
void update()
    {
        mx = x - oldX;
        my = y - oldY;
        oldX = x;
        oldY = y;
    }
1356939
def reload(self):
        """"""
        if time.time() - self.updated > self.ttl:
            self.force_reload()
122221
function(brightness, callback) {
    if (brightness < 0 || brightness > 15) {
      throw "Invalid brightness number";
    }
    this._shiftOut(MAX7219._Registers.Intensity, brightness, callback);
  }
1156086
function(doNotHighlight) {
    this.parent.clearTimeout(this.commitTimeout);
    // Make sure there are no pending dirty nodes.
    if (!doNotHighlight) this.editor.highlightDirty(true);
    // Build set of chains.
    var chains = this.touchedChains(), self = this;

    if (chains.length) {
      this.addUndoLevel(this.updateTo(chains, "linkChain"));
      this.redoHistory = [];
      this.notifyEnvironment();
    }
  }
981661
def SetHighlight( self, node, point=None, propagate=True ):
        """"""
        if node == self.highlightedNode:
            return
        self.highlightedNode = node
        # TODO: restrict refresh to the squares for previous node and new node...
        self.UpdateDrawing()
        if node and propagate:
            wx.PostEvent( self, SquareHighlightEvent( node=node, point=point, map=self ) )