interactive mode of select tasks
433291
def _check_select(self):
        
        if not self.interactive:
            return super(OneScheduler, self)._check_select()

        # waiting for running tasks
        if self.running_task > 0:
            return

        is_crawled = []

        def run(project=None):
            return crawl('on_start', project=project)

        def crawl(url, project=None, **kwargs):
            """
            Crawl given url, same parameters as BaseHandler.crawl

            url - url or taskid, parameters will be used if in taskdb
            project - can be ignored if only one project exists.
            """

            # looking up the project instance
            if project is None:
                if len(self.projects) == 1:
                    project = list(self.projects.keys())[0]
                else:
                    raise LookupError('You need specify the project: %r'
                                      % list(self.projects.keys()))
            project_data = self.processor.project_manager.get(project)
            if not project_data:
                raise LookupError('no such project: %s' % project)

            # get task package
            instance = project_data['instance']
            instance._reset()
            task = instance.crawl(url, **kwargs)
            if isinstance(task, list):
                raise Exception('url list is not allowed in interactive mode')

            # check task in taskdb
            if not kwargs:
                dbtask = self.taskdb.get_task(task['project'], task['taskid'],
                                              fields=self.request_task_fields)
                if not dbtask:
                    dbtask = self.taskdb.get_task(task['project'], task['url'],
                                                  fields=self.request_task_fields)
                if dbtask:
                    task = dbtask

            # select the task
            self.on_select_task(task)
            is_crawled.append(True)

            shell.ask_exit()

        def quit_interactive():
            '''Quit interactive mode'''
            is_crawled.append(True)
            self.interactive = False
            shell.ask_exit()

        def quit_pyspider():
            '''Close pyspider'''
            is_crawled[:] = []
            shell.ask_exit()

        shell = utils.get_python_console()
        banner = (
            'pyspider shell - Select task\n'
            'crawl(url, project=None, **kwargs) - same parameters as BaseHandler.crawl\n'
            'quit_interactive() - Quit interactive mode\n'
            'quit_pyspider() - Close pyspider'
        )
        if hasattr(shell, 'show_banner'):
            shell.show_banner(banner)
            shell.interact()
        else:
            shell.interact(banner)
        if not is_crawled:
            self.ioloop.add_callback(self.ioloop.stop)
576344
private TaskField selectField(TaskField[] fields, int index)
   {
      if (index < 1 || index > fields.length)
      {
         throw new IllegalArgumentException(index + " is not a valid field index");
      }
      return (fields[index - 1]);
   }
1258366
def mode(dev, target):
    
    click.echo("Current mode: %s" % dev.mode_readable)
    if target:
        click.echo("Setting mode: %s" % target)
        dev.mode = target
184556
function select(invoked, local) {
  var embark;
  if (local) {
    embark = local;
  } else {
    embark = invoked;
  }
  return embark;
}
1234655
def OnSelectAll(self, event):
        """"""

        entry_line = \
            self.main_window.entry_line_panel.entry_line_panel.entry_line

        if wx.Window.FindFocus() != entry_line:
            self.main_window.grid.SelectAll()

        else:
            entry_line.SelectAll()
215734
def item_selection_changed(self):
        """"""
        row = self.current_row()
        if self.count() and row >= 0:
            if '</b></big><br>' in self.list.currentItem().text() and row == 0:
                self.next_row()
            if self.mode == self.FILE_MODE:
                try:
                    stack_index = self.paths.index(self.filtered_path[row])
                    self.plugin = self.widgets[stack_index][1]
                    self.goto_line(self.line_number)
                    try:
                        self.plugin.switch_to_plugin()
                        self.raise_()
                    except AttributeError:
                        # The widget using the fileswitcher is not a plugin
                        pass
                    self.edit.setFocus()
                except ValueError:
                    pass
            else:
                line_number = self.filtered_symbol_lines[row]
                self.goto_line(line_number)
379605
def interactive():
    
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument('--device', default='/dev/ttyUSB0',
                        help='Path to PLM device')
    parser.add_argument('-v', '--verbose', action='count',
                        help='Set logging level to verbose')
    parser.add_argument('-l', '--logfile', default='',
                        help='Log file name')
    parser.add_argument('--workdir', default='',
                        help='Working directory for reading and saving '
                        'device information.')
    args = parser.parse_args()

    loop = asyncio.get_event_loop()
    cmd = Commander(loop, args)
    cmd.start()
    try:
        loop.run_forever()
    except KeyboardInterrupt:
        if cmd.tools.plm:
            if cmd.tools.plm.transport:
                # _LOGGING.info('Closing the session')
                cmd.tools.plm.transport.close()
        loop.stop()
        pending = asyncio.Task.all_tasks(loop=loop)
        for task in pending:
            task.cancel()
            try:
                loop.run_until_complete(task)
            except asyncio.CancelledError:
                pass
            except KeyboardInterrupt:
                pass
        loop.close()
401486
public function selectCommand(): void
    {
        $opts = ['john', 'simon', 'rose'];
        // can also: $this->select();
        $a = Interact::select('you name is', $opts);

        $this->write('Your answer is: ' . $opts[$a]);
    }
1223041
def set_mode_cb(self, mode, tf):
        """"""
        if tf:
            if mode == 'select':
                mode = 'pick'
            self.canvas.set_draw_mode(mode)
            if mode == 'edit':
                self.edit_select_region()
        return True
1259477
public function multiSelectCommand(): void
    {
        $opts = ['john', 'simon', 'rose', 'tom'];

        // can also: $a = Interact::multiSelect('Your friends are', $opts);
        $a = $this->multiSelect('Your friends are', $opts);

        $this->write('Your answer is: ' . json_encode($a));
    }
1110845
function(ev) {
            // ignore right clicks
            if (ev.which !== Garnish.PRIMARY_CLICK) {
                return;
            }

            // Enforce the filter
            if (this.settings.filter && !$(ev.target).is(this.settings.filter)) {
                return;
            }

            this.mousedownTarget = ev.currentTarget;

            var $item = $($.data(ev.currentTarget, 'select-item'));

            if (this.first !== null && ev.shiftKey) {
                // Shift key is consistent for both selection modes
                this.selectRange($item, true);
            }
            else if (this._actAsCheckbox(ev)) {
                this.toggleItem($item, true);
            }
        }
224549
function () {
      if (!selection.isSelected()) {
        return;
      }
      if (autofill.handle) {
        autofill.showHandle();
      }
      priv.currentBorder.appear([priv.selStart]);
      highlight.on();
    }
775450
protected void startSelecting()
	{
		if (GuiScreen.isShiftKeyDown())
		{
			if (!selectingText)
				selectionCursor.from(cursor);
			selectingText = true;
		}
		else
			selectingText = false;
	}
648265
def selectNone( self ):
        
        currLayer = self._currentLayer
        for item in self.items():
            layer = item.layer()
            if ( layer == currLayer or not layer ):
                item.setSelected(False)
647516
def select(self, index, command=QtGui.QItemSelectionModel.Toggle):
        """"""
        component = self.model().data(index, QtCore.Qt.UserRole)
        self.selectComponent(component, index)
255646
function selectHourOnInputElement() {
				inputElement.focus();
				setTimeout(function() {
					inputElement.get(0).setSelectionRange(0, inputElement.val().indexOf(settings.separator));
				}, 1);
			}
1136309
def run_selected_clicked(self):
        """"""
        # get all selected rows
        rows = sorted(set(index.row() for index in
                          self.table.selectedIndexes()))
        self.enable_busy_cursor()
        # iterate over selected rows
        for row in rows:
            current_row = row
            item = self.table.item(current_row, 0)
            status_item = self.table.item(current_row, 1)
            self.run_task(item, status_item)
        self.disable_busy_cursor()