Reflect currently running pair in GUI
179066
def on_about_to_process(self, plugin, instance):
        """"""

        if instance is not None:
            instance_model = self.data["models"]["instances"]
            index = instance_model.items.index(instance)
            index = instance_model.createIndex(index, 0)
            instance_model.setData(index, True, model.IsProcessing)

        plugin_model = self.data["models"]["plugins"]
        index = plugin_model.items.index(plugin)
        index = plugin_model.createIndex(index, 0)
        plugin_model.setData(index, True, model.IsProcessing)
        self.info("%s %s" % (self.tr("Processing"), index.data(model.Label)))
732773
def set(self, key, val):
        
        data = self.get_data(True)
        if data is not None:
            data[key] = val
        else:
            raise RuntimeError("No task is currently running")
1307739
def set_current_value(self, value):
        """"""
        self._oldvalue = self.get_current_value()
        self._currentvalue = value
        if self._oldvalue != value:
            # self.notify_observers("new_ip_detected", {"ip": value})
            LOG.debug("%s.set_current_value(%s)", self.__class__.__name__, value)
        return value
1335001
def repaint
      @color_pair ||= get_color($datacolor, @color, @bgcolor) 
      # earlier attrib defaulted to REVERSE which was surprising.
      _attr = @attr || Ncurses::A_NORMAL
      len = @form.window.getmaxx # width does not change upon resizing so useless, fix or do something
      len = Ncurses.COLS if len == 0 || len > Ncurses.COLS
      # this should only happen if there's a change in window
      if @row_relative
        @row = Ncurses.LINES+@row_relative
      end

      # first print dashes through
      @form.window.printstring @row, @col, "%s" % "-" * len, @color_pair, _attr

      # now call the block to get current values
      if @command
        ftext = @command.call(self, @args) 
      else
        status = $status_message ? $status_message.value : ""
        #ftext = " %-20s | %s" % [Time.now, status] # should we print a default value just in case user doesn't
        ftext = status # should we print a default value just in case user doesn't
      end
      # 2013-03-25 - 11:52 replaced $datacolor with @color_pair - how could this have been ?
      # what if user wants to change attrib ?
      if ftext =~ /#\[/
        # hopefully color_pair does not clash with formatting
        @form.window.printstring_formatted @row, @col, ftext, @color_pair, _attr
      else
        @form.window.printstring @row, @col, ftext, @color_pair, _attr
      end

      if @right_text
        ftext = @right_text.call(self, @right_args) 
        if ftext =~ /#\[/
          # hopefully color_pair does not clash with formatting
          @form.window.printstring_formatted_right @row, nil, ftext, @color_pair, _attr
        else
          c = len - ftext.length
          @form.window.printstring @row, c, ftext, @color_pair, _attr
        end
      else
        t = Time.now
        tt = t.strftime "%F %H:%M:%S"
        #r = Ncurses.LINES
        # somehow the bg defined here affects the bg in left text, if left does not define
        # a bg. The bgcolor defined of statusline is ignored in left or overriden by this
        #ftext = "#[fg=white,bg=blue] %-20s#[/end]" % [tt] # print a default
        @form.window.printstring_formatted_right @row, nil, tt, @color_pair, _attr
      end

      @repaint_required = false
    end
1136189
function(){
        while(this.numPairs>0){
            var pair=this.pairs[--this.numPairs];
            pair.shape1=null;
            pair.shape2=null;
        }
        this.numPairChecks=0;
        this.collectPairs();
    }
201996
def pair(self):
        """"""
        if self.ip is NotSpecified:
            if self.ip is NotSpecified:
                second = self.host_port
            else:
                second = (self.ip, )
        else:
            second = (self.ip, self.host_port)
        return self.container_port.port_str, second
509400
@SideOnly(Side.CLIENT)
	public static void updateGui(TileEntity te)
	{
		if (te != currentTileEntity)
			return;
		currenGui.updateGui();
	}
409004
def is_paired?
      @o_dev[I_DEVICE]['Paired']
    rescue DBus::Error => e
      case e.name
      when E_UNKNOWN_OBJECT
        raise StalledObject
      else raise ScriptError
      end
    end
752035
def refreshUi( self ):
        
        dataSet = self.dataSet()
        if not dataSet:
            return False
            
        # lookup widgets based on the data set information
        for widget in self.findChildren(QWidget):
            prop = unwrapVariant(widget.property('dataName'))
            if prop is None:
                continue
            
            # update the data for the widget
            prop_name = nativestring(prop)
            if prop_name in dataSet:
                value = dataSet.value(prop_name)
                projexui.setWidgetValue(widget, value)
        
        return True
56212
def interact(self):
        """"""
        lines = ""
        for line in self.read():
            lines += line
            try:
                self.eval(lines)
            except ValueError:
                pass
            except KeyboardInterrupt as e:
                raise e
            except:
                self.terminal.error(traceback.format_exc())
                break
            else:
                break
642878
private void updateDiff() throws EDBException {
        List<String> keyList = loadKeyList();

        for (String key : keyList) {
            if (key.equals("id") || key.equals("prevTimestamp") || key.equals("timestamp")) {
                continue;
            }
            Object first = startState.get(key);
            Object last = endState.get(key);

            // if the key value pair is exactly the same, skip it
            if (last != null && first != null && first.equals(last)) {
                continue;
            }
            diff.put(key, new Entry(first, last));
            differences++;
        }
    }
1268117
def _set_data(self):
        """"""
        self.setting_data = True
        step, steps, frames = self.step_current, self.steps, self.frames
        current = '{0}/{1}'.format(step + 1, steps)
        frame = frames[step]

        combobox_frames = [u"{0}. {1}".format(i+1, f['title'])
                           for i, f in enumerate(frames)]

        title, content, image = '', '', None
        widgets, dockwidgets, decoration = None, None, None
        run = None

        # Check if entry exists in dic and act accordingly
        if 'title' in frame:
            title = frame['title']

        if 'content' in frame:
            content = frame['content']

        if 'widgets' in frame:
            widget_names = frames[step]['widgets']
            # Get the widgets based on their name
            widgets, dockwidgets = self._process_widgets(widget_names,
                                                         self.spy_window)
        self.widgets = widgets
        self.dockwidgets = dockwidgets

        if 'decoration' in frame:
            widget_names = frames[step]['decoration']
            deco, decoration = self._process_widgets(widget_names,
                                                     self.spy_window)
            self.decoration = decoration

        if 'image' in frame:
            image = frames[step]['image']

        if 'interact' in frame:
            self.canvas.set_interaction(frame['interact'])
            if frame['interact']:
                self._set_modal(False, [self.tips])
            else:
                self._set_modal(True, [self.tips])
        else:
            self.canvas.set_interaction(False)
            self._set_modal(True, [self.tips])

        if 'run' in frame:
            # Asume that the frist widget is the console
            run = frame['run']
            self.run = run

        self.tips.set_data(title, content, current, image, run,
                           frames=combobox_frames, step=step)
        self._check_buttons()

        # Make canvas black when starting a new place of decoration
        self.canvas.update_widgets(dockwidgets)
        self.canvas.update_decoration(decoration)
        self.setting_data = False
250143
async def pair(self):
        """"""
        # Connect using the specified protocol
        # TODO: config should be stored elsewhere so that API is same for both
        protocol = self.atv.service.protocol
        if protocol == const.PROTOCOL_DMAP:
            await self.atv.pairing.start(zeroconf=Zeroconf(),
                                         name=self.args.remote_name,
                                         pairing_guid=self.args.pairing_guid)
        elif protocol == const.PROTOCOL_MRP:
            await self.atv.pairing.start()

        # Ask for PIN if present or just wait for pairing to end
        if self.atv.pairing.device_provides_pin:
            pin = await _read_input(self.loop, 'Enter PIN on screen: ')
            self.atv.pairing.pin(pin)
        else:
            self.atv.pairing.pin(self.args.pin_code)

            print('Use {0} to pair with "{1}" (press ENTER to stop)'.format(
                self.args.pin_code, self.args.remote_name))

        if self.args.pin_code is None:
            print('Use any pin to pair with "{}" (press ENTER to stop)'.format(
                self.args.remote_name))
        else:
            print('Use pin {} to pair with "{}" (press ENTER to stop)'.format(
                self.args.pin_code, self.args.remote_name))

        await self.loop.run_in_executor(None, sys.stdin.readline)

        await self.atv.pairing.stop()

        # Give some feedback to the user
        if self.atv.pairing.has_paired:
            print('Pairing seems to have succeeded, yey!')
            print('You may now use these credentials: {0}'.format(
                self.atv.pairing.credentials))
        else:
            print('Pairing failed!')
            return 1

        return 0
795803
async def refresh(self):
        """"""
        cls = type(self)
        if hasattr(cls, 'read'):
            descriptors, alt_descriptors = get_pk_descriptors(cls)
            if len(descriptors) == 1:
                try:
                    obj = await cls.read(getattr(self, descriptors[0][0]))
                except AttributeError:
                    found = False
                    for alt_name, _ in alt_descriptors[0]:
                        if hasattr(self, alt_name):
                            obj = await cls.read(getattr(self, alt_name))
                            found = True
                            break
                    if not found:
                        raise
            elif len(descriptors) > 1:
                args = []
                for idx, (name, _) in enumerate(descriptors):
                    try:
                        args.append(getattr(self, name))
                    except AttributeError:
                        found = False
                        for alt_name, _ in alt_descriptors[idx]:
                            if hasattr(self, alt_name):
                                args.append(getattr(self, alt_name))
                                found = True
                                break
                        if not found:
                            raise
                obj = await cls.read(*args)
            else:
                raise AttributeError(
                    "unable to perform 'refresh' no primary key "
                    "fields defined.")
            if type(obj) is cls:
                self._data = obj._data
                self._loaded = True
            else:
                raise TypeError(
                    "result of '%s.read' must be '%s', not '%s'" % (
                        cls.__name__, cls.__name__, type(obj).__name__))
        else:
            raise AttributeError(
                "'%s' object doesn't support refresh." % cls.__name__)
622633
def when_change(
        self,
        *keys: Hashable,
        exclude: bool = False,
        live: bool = False,
        timeout: float = None,
        identical_okay: bool = False,
        start_time: bool = None,
        count: int = None,
    ) -> StateWatcher:
        
        if not keys:

            def callback(update: StateUpdate) -> dict:
                return update.after

        else:
            if identical_okay:
                raise ValueError(
                    "Passing both `identical_okay` and `keys` is not possible. "
                    "(Hint: Omit `keys`)"
                )

            key_set = set(keys)

            def select(before, after):
                selected = {*before.keys(), *after.keys()}
                if exclude:
                    return selected - key_set
                else:
                    return selected & key_set

            def callback(update: StateUpdate) -> dict:
                before, after = update.before, update.after
                try:
                    if not any(before[k] != after[k] for k in select(before, after)):
                        raise _SkipStateUpdate
                except KeyError:  # this indirectly implies that something has changed
                    pass
                return update.after

        return StateWatcher(
            state=self,
            live=live,
            timeout=timeout,
            identical_okay=identical_okay,
            start_time=start_time,
            count=count,
            callback=callback,
        )
414496
def show(self, ):
        
        wins = set(JB_MainWindow.instances())
        widgets = set(self.get_widgets())
        for w in wins - widgets:
            self.add_widget(w)
        super(JB_WindowToolTip, self).show()
103274
def gui_call(self, method, *args, **kwdargs):
        
        my_id = thread.get_ident()
        if my_id == self.gui_thread_id:
            return method(*args, **kwdargs)
        else:
            future = self.gui_do(method, *args, **kwdargs)
            return future.wait()