Toggles Modis on or off
348841
def toggle(self, discord_token, discord_client_id):
        """"""
        if self.state == 'off':
            self.start(discord_token, discord_client_id)
        elif self.state == 'on':
            self.stop()
1322872
def change_setting(self, key, val):
        
        if isinstance(val, bool):
            payload = 'on' if val else 'off'
        else:
            payload = val
        return self._request('/settings/{}?set={}'.format(key, payload))
826767
function toggleState(element, state) {
    setAttribute(element, `aria-${state}`, !stringToBoolean(getAttribute(element, `aria-${state}`)));
}
623669
def toggle(self, key):
        
        val = self[key]
        assert isinstance(val, bool), 'key[%r] = %r is not a bool' % (key, val)
        self.pref_update(key, not val)
536663
def toggle_power(self, selector='all', duration=1.0):
        """"""

        argument_tuples = [
            ("duration", duration)
        ]

        return self.client.perform_request(
            method='post', endpoint='lights/{}/toggle',
            endpoint_args=[selector], argument_tuples=argument_tuples)
899717
def _on_leave(self, *args):
        """"""
        if self.__clicked:
            self.config(foreground=self._clicked_color)
        else:
            self.config(foreground=self._normal_color)
        self.config(cursor="")
86412
def toggle_buttons(self):
        """"""
        all_time_on = self.all_time.get_value()
        all_chan_on = self.all_chan.get_value()

        self.times['beg'].setEnabled(not all_time_on)
        self.times['end'].setEnabled(not all_time_on)
        self.idx_chan.setEnabled(not all_chan_on)
192960
function enableLuxometerNotifications(device, configCharacteristic, dataCharacteristic)
{
	// Turn Luxometer ON.
	evothings.ble.writeCharacteristic(
		device,
		configCharacteristic,
		new Uint8Array([1]),
		onLuxometerActivated,
		onLuxometerActivatedError)

	function onLuxometerActivated()
	{
		showMessage('Luxometer is ON')

		// Enable notifications from the Luxometer.
		evothings.ble.enableNotification(
			device,
			dataCharacteristic,
			onLuxometerNotification,
			onLuxometerNotificationError)
	}

	function onLuxometerActivatedError(error)
	{
		showMessage('Luxometer activate error: ' + error)
	}

	// Called repeatedly until disableNotification is called.
	function onLuxometerNotification(data)
	{
		var lux = calculateLux(data)
		showMessage('Luxometer value: ' + lux)
	}

	function onLuxometerNotificationError(error)
	{
		showMessage('Luxometer notification error: ' + error)
	}
}
555481
def turn_on(host, did, token=None):
    """"""
    urllib3.disable_warnings()
    if token:
        scheme = "https"
    if not token:
        scheme = "http"
        token = "1234567890"
    url = (
            scheme + '://' + host + '/gwr/gop.php?cmd=DeviceSendCommand&data=<gip><version>1</version><token>' + token + '</token><did>' + did + '</did><value>1</value></gip>&fmt=xml')
    response = requests.get(url, verify=False)
    if response.status_code == '200':
        return True
    else:
        return False
894029
def _toggle_filming(self):
        """"""

        if self._filming:
            self.log("Stopping operation")
            self._filming = False
            self.timer.stop()
        else:
            self.log("Starting operation")
            self._filming = True
            self.timer.start()
1067418
async def set_config(self, on=None, long=None, lat=None,
                         sunriseoffset=None, sunsetoffset=None):
        """"""
        data = {
            key: value for key, value in {
                'on': on,
                'long': long,
                'lat': lat,
                'sunriseoffset': sunriseoffset,
                'sunsetoffset': sunsetoffset,
            }.items() if value is not None
        }

        await self._request('put', 'sensors/{}/config'.format(self.id),
                            json=data)
1041702
function toggleSlideShowMode() {
  const streams = room.remoteStreams;
  const cb = (evt) => {
    console.log('SlideShowMode changed', evt);
  };
  slideShowMode = !slideShowMode;
  streams.forEach((stream) => {
    if (localStream.getID() !== stream.getID()) {
      console.log('Updating config');
      stream.updateConfiguration({ slideShowMode }, cb);
    }
  });
}
1231842
def toggle_shells(command, enable):
    """"""
    selection = list(selected_shells(command))
    if command and command != '*' and selection:
        for i in selection:
            if i.state != remote_dispatcher.STATE_DEAD and i.enabled != enable:
                break
        else:
            toggle_shells('*', not enable)

    for i in selection:
        if i.state != remote_dispatcher.STATE_DEAD:
            i.set_enabled(enable)
872451
function(content, opts, onOk, onCancel) {
        Dialog.setup('confirm', content, opts, onOk, onCancel);
      }
669384
def gui(discord_token, discord_client_id):
    

    logger.info("Starting Modis in GUI")

    import tkinter as tk

    logger.debug("Loading packages")
    from modis.discord_modis import gui as discord_modis_gui
    from modis.reddit_modis import gui as reddit_modis_gui
    from modis.facebook_modis import gui as facebook_modis_gui

    logger.debug("Initialising window")

    # Setup the root window
    root = tk.Tk()
    root.minsize(width=800, height=400)
    root.geometry("800x600")
    root.title("Modis Control Panel")
    # Icon
    root.iconbitmap(r"{}/assets/modis.ico".format(file_dir))

    # Setup the notebook
    """notebook = ttk.Notebook(root)
    notebook.grid(column=0, row=0, padx=0, pady=0, sticky="W E N S")

    # Configure stretch ratios
    root.columnconfigure(0, weight=1)
    root.rowconfigure(0, weight=1)
    notebook.columnconfigure(0, weight=1)
    notebook.rowconfigure(0, weight=1)

    # Add tabs
    logger.debug("Adding packages to window")
    notebook.add(
        discord_modis_gui.Frame(notebook, discord_token, discord_client_id),
        text="Discord")
    notebook.add(reddit_modis_gui.Frame(notebook), text="Reddit")
    notebook.add(facebook_modis_gui.Frame(notebook), text="Facebook")"""
    discord = discord_modis_gui.Frame(root, discord_token, discord_client_id)
    discord.grid(column=0, row=0, padx=0, pady=0, sticky="W E N S")
    # Configure stretch ratios
    root.columnconfigure(0, weight=1)
    root.rowconfigure(0, weight=1)
    discord.columnconfigure(0, weight=1)
    discord.rowconfigure(0, weight=1)

    logger.debug("GUI initialised")

    # Run the window UI
    root.mainloop()
820863
def disable(self):
        
        w.ActButton.disable(self)
        g = get_root(self).globals
        if self._expert:
            self.config(bg=g.COL['start'])
        else:
            self.config(bg=g.COL['startD'])
926072
def set_toggle_interval(self, interval, rfm=1):
        """"""
        cmds = {1: 't', 2: 'T'}
        self._write_cmd('{}{}'.format(interval, cmds[rfm]))