Create action for multi buffer dialog.
554679
def _create_multi_buffer_action(self):
        """"""
        icon = resources_path('img', 'icons', 'show-multi-buffer.svg')
        self.action_multi_buffer = QAction(
            QIcon(icon),
            self.tr('Multi Buffer'), self.iface.mainWindow())
        self.action_multi_buffer.setStatusTip(self.tr(
            'Open InaSAFE multi buffer'))
        self.action_multi_buffer.setWhatsThis(self.tr(
            'Open InaSAFE multi buffer'))
        self.action_multi_buffer.triggered.connect(self.show_multi_buffer)
        self.add_action(
            self.action_multi_buffer,
            add_to_toolbar=self.full_toolbar)
1060817
def create_action(self):
        """"""
        actions = {}

        act = QAction('Load Montage...', self)
        act.triggered.connect(self.load_channels)
        act.setEnabled(False)
        actions['load_channels'] = act

        act = QAction('Save Montage...', self)
        act.triggered.connect(self.save_channels)
        act.setEnabled(False)
        actions['save_channels'] = act

        self.action = actions
13900
def call_action(self, service_name, action_name, **kwargs):
        """"""
        action = self.services[service_name].actions[action_name]
        return action.execute(**kwargs)
1006584
private OnMultiChoiceClickListener createMultiChoiceListener() {
        return new OnMultiChoiceClickListener() {

            @Override
            public void onClick(final DialogInterface dialog, final int position,
                                final boolean isChecked) {
                String text = getString(R.string.multi_choice_listener_selected_text);

                if (!isChecked) {
                    text = getString(R.string.multi_choice_listener_unselected_text);
                }

                if (toast != null) {
                    toast.cancel();
                }

                showToast(String.format(text, position));
            }

        };
    }
299018
protected void actionNext() {

        if (m_dialogIndex >= (m_resources.size() - 1)) {
            return;
        }

        m_dialogIndex++;
        m_uploadPropertyPanel.getPropertyEditor().getForm().validateAndSubmit();
        m_nextAction = new Runnable() {

            public void run() {

                loadDialogBean(m_resources.get(m_dialogIndex));
            }
        };
    }
1333712
def _createAction(self, widget, iconFileName, text, shortcut, slot):
        
        icon = qutepart.getIcon(iconFileName)
        action = QAction(icon, text, widget)
        action.setShortcut(QKeySequence(shortcut))
        action.setShortcutContext(Qt.WidgetShortcut)
        action.triggered.connect(slot)

        widget.addAction(action)

        return action
1160826
def cmd_screen(action, action_space, ability_id, queued, screen):
  """"""
  action_cmd = spatial(action, action_space).unit_command
  action_cmd.ability_id = ability_id
  action_cmd.queue_command = queued
  screen.assign_to(action_cmd.target_screen_coord)
652959
@Override
    public void actionDialog() throws JspException, ServletException, IOException {

        if (getAction() == ACTION_CONTINUE) {
            sendForward(nextUrl(), paramsAsParameterMap());
            return;
        }
        super.actionDialog();
    }
676124
def add_action_callback(self, *event):
        """"""
        if react_to_event(self.view, self.tree_view, event) and self.active_entry_widget is None:
            self.on_add(None)
            return True
587908
def SetAction(self, action, **kws):
        ""
        if hasattr(action,'__call__'):
            self.__action = Closure(action, **kws)
345647
def create_action(self):
        """"""
        actions = {}

        act = QAction('New Annotations', self)
        act.triggered.connect(self.new_annot)
        actions['new_annot'] = act

        act = QAction('Load Annotations', self)
        act.triggered.connect(self.load_annot)
        actions['load_annot'] = act

        act = QAction('Clear Annotations...', self)
        act.triggered.connect(self.clear_annot)
        actions['clear_annot'] = act

        act = QAction('New...', self)
        act.triggered.connect(self.new_rater)
        actions['new_rater'] = act
        
        act = QAction('Rename...', self)
        act.triggered.connect(self.rename_rater)
        actions['rename_rater'] = act

        act = QAction('Delete...', self)
        act.triggered.connect(self.delete_rater)
        actions['del_rater'] = act

        act = QAction(QIcon(ICON['bookmark']), 'New Bookmark', self)
        act.setCheckable(True)
        actions['new_bookmark'] = act

        act = QAction(QIcon(ICON['new_eventtype']), 'New Event Type', self)
        act.triggered.connect(self.new_eventtype)
        actions['new_eventtype'] = act

        act = QAction(QIcon(ICON['del_eventtype']), 'Delete Event Type', self)
        act.triggered.connect(self.delete_eventtype)
        actions['del_eventtype'] = act
        
        act = QAction('Rename Event Type', self)
        act.triggered.connect(self.rename_eventtype)
        actions['rename_eventtype'] = act

        act = QAction('New Name', self)
        act.triggered.connect(self.markers_to_events)
        actions['m2e_newname'] = act
        
        act = QAction('Keep Marker Names', self)
        act.triggered.connect(partial(self.markers_to_events, True))
        actions['m2e_keepname'] = act
        
        act = QAction('Merge Events...', self)
        act.triggered.connect(self.parent.show_merge_dialog)
        actions['merge_events'] = act

        act = QAction(QIcon(ICON['event']), 'Event Mode', self)
        act.setCheckable(True)
        actions['new_event'] = act

        uncheck_new_event = lambda: actions['new_event'].setChecked(False)
        uncheck_new_bookmark = lambda: actions['new_bookmark'].setChecked(False)
        actions['new_event'].triggered.connect(uncheck_new_bookmark)
        actions['new_bookmark'].triggered.connect(uncheck_new_event)

        act = {}
        for one_stage, one_shortcut in zip(STAGE_NAME, STAGE_SHORTCUT):
            act[one_stage] = QAction('Score as ' + one_stage, self.parent)
            act[one_stage].setShortcut(one_shortcut)
            stage_idx = STAGE_NAME.index(one_stage)
            act[one_stage].triggered.connect(partial(self.get_sleepstage,
                                                     stage_idx))
            self.addAction(act[one_stage])

        actions['stages'] = act

        act = {}
        for one_qual, one_shortcut in zip(QUALIFIERS, QUALITY_SHORTCUT):
            act[one_qual] = QAction('Score as ' + one_qual, self.parent)
            act[one_qual].setShortcut(one_shortcut)
            qual_idx = QUALIFIERS.index(one_qual)
            act[one_qual].triggered.connect(partial(self.get_quality,
                                                    qual_idx))
            self.addAction(act[one_qual])

        actions['quality'] = act

        act = QAction('Set Cycle Start', self)
        act.setShortcut('Ctrl+[')
        act.triggered.connect(self.get_cycle_mrkr)
        actions['cyc_start'] = act

        act = QAction('Set Cycle End', self)
        act.setShortcut('Ctrl+]')
        act.triggered.connect(partial(self.get_cycle_mrkr, end=True))
        actions['cyc_end'] = act

        act = QAction('Remove Cycle Marker', self)
        act.triggered.connect(self.remove_cycle_mrkr)
        actions['remove_cyc'] = act

        act = QAction('Clear Cycle Markers', self)
        act.triggered.connect(self.clear_cycle_mrkrs)
        actions['clear_cyc'] = act

        act = QAction('Domino', self)
        act.triggered.connect(partial(self.import_staging, 'domino'))
        actions['import_domino'] = act

        act = QAction('Alice', self)
        act.triggered.connect(partial(self.import_staging, 'alice'))
        actions['import_alice'] = act

        act = QAction('Sandman', self)
        act.triggered.connect(partial(self.import_staging, 'sandman'))
        actions['import_sandman'] = act

        act = QAction('RemLogic', self)
        act.triggered.connect(partial(self.import_staging, 'remlogic'))
        actions['import_remlogic'] = act

        act = QAction('Compumedics', self)
        act.triggered.connect(partial(self.import_staging, 'compumedics'))
        actions['import_compumedics'] = act
        
        act = QAction('PRANA', self)
        act.triggered.connect(partial(self.import_staging, 'prana'))
        actions['import_prana'] = act
        
        act = QAction('DeltaMed', self)
        act.triggered.connect(partial(self.import_staging, 'deltamed'))
        actions['import_deltamed'] = act

        act = QAction('FASST', self)
        act.triggered.connect(self.import_fasst)
        actions['import_fasst'] = act

        act = QAction('Domino', self)
        act.triggered.connect(partial(self.import_staging, 'domino', 
                                      as_qual=True))
        actions['import_domino_qual'] = act

        act = QAction('Alice', self)
        act.triggered.connect(partial(self.import_staging, 'alice', 
                                      as_qual=True))
        actions['import_alice_qual'] = act

        act = QAction('Sandman', self)
        act.triggered.connect(partial(self.import_staging, 'sandman', 
                                      as_qual=True))
        actions['import_sandman_qual'] = act

        act = QAction('RemLogic', self)
        act.triggered.connect(partial(self.import_staging, 'remlogic', 
                                      as_qual=True))
        actions['import_remlogic_qual'] = act

        act = QAction('Compumedics', self)
        act.triggered.connect(partial(self.import_staging, 'compumedics', 
                                      as_qual=True))
        actions['import_compumedics_qual'] = act
        
        act = QAction('PRANA', self)
        act.triggered.connect(partial(self.import_staging, 'prana', 
                                      as_qual=True))
        actions['import_prana_qual'] = act
        
        act = QAction('DeltaMed', self)
        act.triggered.connect(partial(self.import_staging, 'deltamed', 
                                      as_qual=True))
        actions['import_deltamed_qual'] = act
        
        act = QAction('Wonambi', self)
        act.triggered.connect(partial(self.import_events, 'wonambi'))
        actions['import_events_wonambi'] = act
        
        act = QAction('RemLogic', self)
        act.triggered.connect(partial(self.import_events, 'remlogic'))
        actions['import_events_remlogic'] = act

        act = QAction('CSV', self)
        act.triggered.connect(partial(self.export, xformat='csv'))
        actions['export_to_csv'] = act
        
        act = QAction('RemLogic', self)
        act.triggered.connect(partial(self.export, xformat='remlogic'))
        actions['export_to_remlogic'] = act
        
        act = QAction('RemLogic FR', self)
        act.triggered.connect(partial(self.export, xformat='remlogic_fr'))
        actions['export_to_remlogic_fr'] = act

        act = QAction('Export Events...', self)
        act.triggered.connect(self.parent.show_export_events_dialog)
        actions['export_events'] = act

        act = QAction('Spindle...', self)
        act.triggered.connect(self.parent.show_spindle_dialog)
        act.setShortcut('Ctrl+Shift+s')
        act.setEnabled(False)
        actions['spindle'] = act

        act = QAction('Slow Wave...', self)
        act.triggered.connect(self.parent.show_slow_wave_dialog)
        act.setShortcut('Ctrl+Shift+w')
        act.setEnabled(False)
        actions['slow_wave'] = act

        act = QAction('Analysis Console', self)
        act.triggered.connect(self.parent.show_analysis_dialog)
        act.setShortcut('Ctrl+Shift+a')
        act.setEnabled(False)
        actions['analyze'] = act

        act = QAction('Sleep Statistics', self)
        act.triggered.connect(self.export_sleeps_stats)
        actions['export_sleepstats'] = act

        self.action = actions
253688
def copy_action_callback(self, *event):
        """"""
        if react_to_event(self.view, self.tree_view, event) and self.active_entry_widget is None:
            _, dict_paths = self.get_view_selection()
            selected_data_list = []
            for dict_path_as_list in dict_paths:
                value = self.model.state.semantic_data
                for path_element in dict_path_as_list:
                    value = value[path_element]
                selected_data_list.append((path_element, value))
            rafcon.gui.clipboard.global_clipboard.set_semantic_dictionary_list(selected_data_list)
435141
def create_program_action(parent, text, name, icon=None, nt_name=None):
    """"""
    if is_text_string(icon):
        icon = get_icon(icon)
    if os.name == 'nt' and nt_name is not None:
        name = nt_name
    path = programs.find_program(name)
    if path is not None:
        return create_action(parent, text, icon=icon,
                             triggered=lambda: programs.run_program(name))
659496
private void createActionStack() throws ParserException, GrammarException {
	boolean accepted = false;
	do {
	    checkTimeout();
	    stepCounter++;
	    if (logger.isTraceEnabled()) {
		logger.trace(toString());
	    }
	    if (streamPosition > maxPosition) {
		maxPosition = streamPosition;
	    }
	    final ParserActionSet actionSet;
	    final Token token;
	    if (streamPosition < getTokenStream().size()) {
		token = getTokenStream().get(streamPosition);
		actionSet = parserTable.getActionSet(stateStack.peek(), new Terminal(token.getName(), token.getText()));
	    } else {
		token = null;
		actionSet = parserTable.getActionSet(stateStack.peek(), FinishTerminal.getInstance());
	    }
	    if (logger.isTraceEnabled()) {
		logger.trace(actionSet.toString());
	    }
	    final ParserAction action = getAction(actionSet);
	    switch (action.getAction()) {
	    case SHIFT:
		shift(action);
		break;
	    case REDUCE:
		reduce(action);
		break;
	    case ACCEPT:
		accept(action);
		accepted = true;
		break;
	    case ERROR:
		error();
		break;
	    default:
		throw new ParserException("Invalid action '" + action + "'for parser near '"
			+ getTokenStream().getCodeSample(maxPosition) + "'!");
	    }
	} while (!accepted);
    }
548992
def create_action(self):
        """"""
        actions = {}

        act = QAction(QIcon(ICON['step_prev']), 'Previous Step', self)
        act.setShortcut('[')
        act.triggered.connect(self.step_prev)
        actions['step_prev'] = act

        act = QAction(QIcon(ICON['step_next']), 'Next Step', self)
        act.setShortcut(']')
        act.triggered.connect(self.step_next)
        actions['step_next'] = act

        act = QAction(QIcon(ICON['page_prev']), 'Previous Page', self)
        act.setShortcut(QKeySequence.MoveToPreviousChar)
        act.triggered.connect(self.page_prev)
        actions['page_prev'] = act

        act = QAction(QIcon(ICON['page_next']), 'Next Page', self)
        act.setShortcut(QKeySequence.MoveToNextChar)
        act.triggered.connect(self.page_next)
        actions['page_next'] = act

        act = QAction('Go to Epoch', self)
        act.setShortcut(QKeySequence.FindNext)
        act.triggered.connect(self.go_to_epoch)
        actions['go_to_epoch'] = act

        act = QAction('Line Up with Epoch', self)
        act.setShortcut('F4')
        act.triggered.connect(self.line_up_with_epoch)
        actions['line_up_with_epoch'] = act

        act = QAction(QIcon(ICON['zoomprev']), 'Wider Time Window', self)
        act.setShortcut(QKeySequence.ZoomIn)
        act.triggered.connect(self.X_more)
        actions['X_more'] = act

        act = QAction(QIcon(ICON['zoomnext']), 'Narrower Time Window', self)
        act.setShortcut(QKeySequence.ZoomOut)
        act.triggered.connect(self.X_less)
        actions['X_less'] = act

        act = QAction(QIcon(ICON['zoomin']), 'Larger Scaling', self)
        act.setShortcut(QKeySequence.MoveToPreviousLine)
        act.triggered.connect(self.Y_more)
        actions['Y_less'] = act

        act = QAction(QIcon(ICON['zoomout']), 'Smaller Scaling', self)
        act.setShortcut(QKeySequence.MoveToNextLine)
        act.triggered.connect(self.Y_less)
        actions['Y_more'] = act

        act = QAction(QIcon(ICON['ydist_more']), 'Larger Y Distance', self)
        act.triggered.connect(self.Y_wider)
        actions['Y_wider'] = act

        act = QAction(QIcon(ICON['ydist_less']), 'Smaller Y Distance', self)
        act.triggered.connect(self.Y_tighter)
        actions['Y_tighter'] = act

        act = QAction(QIcon(ICON['chronometer']), '6 Hours Earlier', self)
        act.triggered.connect(partial(self.add_time, -6 * 60 * 60))
        actions['addtime_-6h'] = act

        act = QAction(QIcon(ICON['chronometer']), '1 Hour Earlier', self)
        act.triggered.connect(partial(self.add_time, -60 * 60))
        actions['addtime_-1h'] = act

        act = QAction(QIcon(ICON['chronometer']), '10 Minutes Earlier', self)
        act.triggered.connect(partial(self.add_time, -10 * 60))
        actions['addtime_-10min'] = act

        act = QAction(QIcon(ICON['chronometer']), '10 Minutes Later', self)
        act.triggered.connect(partial(self.add_time, 10 * 60))
        actions['addtime_10min'] = act

        act = QAction(QIcon(ICON['chronometer']), '1 Hour Later', self)
        act.triggered.connect(partial(self.add_time, 60 * 60))
        actions['addtime_1h'] = act

        act = QAction(QIcon(ICON['chronometer']), '6 Hours Later', self)
        act.triggered.connect(partial(self.add_time, 6 * 60 * 60))
        actions['addtime_6h'] = act

        act = QAction('Go to Next Event', self)
        act.setShortcut('s')
        act.triggered.connect(self.next_event)
        actions['next_event'] = act
        
        act = QAction('Delete Event and Go to Next', self)
        act.setShortcut('d')
        act.triggered.connect(partial(self.next_event, True))
        actions['del_and_next_event'] = act
        
        act = QAction('Next Event of Same Type', self)
        act.setCheckable(True)
        act.setChecked(True)
        actions['next_of_same_type'] = act
        
        act = QAction('Change Event Type', self)
        act.setShortcut('e')
        act.triggered.connect(self.change_event_type)
        actions['change_event_type'] = act
        
        act = QAction('Centre Window Around Event', self)
        act.setCheckable(True)
        act.setChecked(True)
        actions['centre_event'] = act
        
        act = QAction('Full-length Markers', self)
        act.setCheckable(True)
        act.setChecked(True)
        act.triggered.connect(self.display_annotations)
        actions['cross_chan_mrk'] = act

        # Misc
        act = QAction('Export to svg...', self)
        act.triggered.connect(partial(export_graphics, MAIN=self.parent))
        actions['export_svg'] = act

        self.action = actions
311930
def create_dialog(self):
        
        box0 = QGroupBox('Info')

        self.name = FormStr()

        self.name.setText('sw')
        self.idx_group.activated.connect(self.update_channels)

        form = QFormLayout(box0)
        form.addRow('Event name',
                           self.name)
        form.addRow('Channel group',
                       self.idx_group)
        form.addRow('Channel(s)',
                       self.idx_chan)
        form.addRow('Cycle(s)',
                       self.idx_cycle)
        form.addRow('Stage(s)',
                       self.idx_stage)

        box1 = QGroupBox('Parameters')

        mbox = QComboBox()
        method_list = SLOW_WAVE_METHODS
        for method in method_list:
            mbox.addItem(method)
        self.idx_method = mbox
        self.method = mbox.currentText()
        mbox.currentIndexChanged.connect(self.update_values)

        self.index['f1'] = FormFloat()
        self.index['f2'] = FormFloat()
        self.index['min_trough_dur'] = FormFloat()
        self.index['max_trough_dur'] = FormFloat()
        self.index['max_trough_amp'] = FormFloat()
        self.index['min_ptp'] = FormFloat()
        self.index['min_dur'] = FormFloat()
        self.index['max_dur'] = FormFloat()

        form = QFormLayout(box1)
        form.addRow('Method',
                            mbox)
        form.addRow('Lowcut (Hz)',
                           self.index['f1'])
        form.addRow('Highcut (Hz)',
                           self.index['f2'])
        form.addRow('Min. trough duration (sec)',
                           self.index['min_trough_dur'])
        form.addRow(' Max. trough duration (sec)',
                           self.index['max_trough_dur'])
        form.addRow(' Max. trough amplitude (uV)',
                           self.index['max_trough_amp'])
        form.addRow('Min. peak-to-peak amplitude (uV)',
                           self.index['min_ptp'])
        form.addRow('Min. duration (sec)',
                           self.index['min_dur'])
        form.addRow(' Max. duration (sec)',
                           self.index['max_dur'])
        box3 = QGroupBox('Options')

        self.index['detrend'] = FormBool('Detrend (linear)')
        self.index['invert'] = FormBool('Invert detection (down-then-up)')
        self.index['excl_epoch'] = FormBool('Exclude Poor signal epochs')
        self.index['excl_event'] = FormMenu(['none', 'channel-specific', 
                                      'from any channel'])
        self.index['min_seg_dur'] = FormFloat(5)

        self.index['excl_epoch'].set_value(True)
        self.index['detrend'].set_value(True)

        form = QFormLayout(box3)
        form.addRow(self.index['excl_epoch'])
        form.addRow('Exclude Artefact events', 
                    self.index['excl_event'])
        form.addRow('Minimum subsegment duration',
                       self.index['min_seg_dur'])
        form.addRow(self.index['detrend'])
        form.addRow(self.index['invert'])

        self.bbox.clicked.connect(self.button_clicked)

        btnlayout = QHBoxLayout()
        btnlayout.addStretch(1)
        btnlayout.addWidget(self.bbox)

        vlayout = QVBoxLayout()
        vlayout.addWidget(box1)
        vlayout.addWidget(box3)
        vlayout.addStretch(1)
        vlayout.addLayout(btnlayout)

        hlayout = QHBoxLayout()
        hlayout.addWidget(box0)
        hlayout.addLayout(vlayout)

        self.update_values()
        self.setLayout(hlayout)
377152
def buffer(self, *args, **kwargs):
        """"""
        self.check_session()
        result = self.session.buffer(*args, **kwargs)
        return result