Create actions associated with this widget.
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
631343
def create_action(plugin, action_id, properties = {})
      the_plugin = hawk_escape plugin
      # Check if plugin exists
      http_get("/plugins/#{the_plugin}")

      payload = { actionId: action_id, actionPlugin: plugin, properties: properties }
      ret = http_post('/actions', payload)
      Trigger::Action.new(ret)
    end
418801
def create_context_menu_actions(self):
        """"""
        actions = []
        fnames = self.get_selected_filenames()
        new_actions = self.create_file_new_actions(fnames)
        if len(new_actions) > 1:
            # Creating a submenu only if there is more than one entry
            new_act_menu = QMenu(_('New'), self)
            add_actions(new_act_menu, new_actions)
            actions.append(new_act_menu)
        else:
            actions += new_actions
        import_actions = self.create_file_import_actions(fnames)
        if len(import_actions) > 1:
            # Creating a submenu only if there is more than one entry
            import_act_menu = QMenu(_('Import'), self)
            add_actions(import_act_menu, import_actions)
            actions.append(import_act_menu)
        else:
            actions += import_actions
        if actions:
            actions.append(None)
        if fnames:
            actions += self.create_file_manage_actions(fnames)
        if actions:
            actions.append(None)
        if fnames and all([osp.isdir(_fn) for _fn in fnames]):
            actions += self.create_folder_manage_actions(fnames)
        return actions
1327154
protected function postActions()
    {
        if ($this->option('createaction') != null) {
            $this->createAction();
        }
        if ($this->option('menu') != null) {
            $this->createMenu();
        }
        if ($this->option('model') != null) {
            $this->createModel($this->argument('link'));
        }
    }
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
365576
def add(self, action):
        """"""
        self._state_machine.transition_to_add()
        self._actions.append(action)
669309
def create_toggle_view_action(self):
        """"""
        title = self.get_plugin_title()
        if self.CONF_SECTION == 'editor':
            title = _('Editor')
        if self.shortcut is not None:
            action = create_action(self, title,
                             toggled=lambda checked: self.toggle_view(checked),
                             shortcut=QKeySequence(self.shortcut),
                             context=Qt.WidgetShortcut)
        else:
            action = create_action(self, title, toggled=lambda checked:
                                                self.toggle_view(checked))
        self.toggle_view_action = action
834164
def setup_menu_actions(self):
        """"""
        self.recent_notebook_menu.clear()
        self.recent_notebooks_actions = []
        if self.recent_notebooks:
            for notebook in self.recent_notebooks:
                name = notebook
                action = \
                    create_action(self,
                                  name,
                                  icon=ima.icon('filenew'),
                                  triggered=lambda v,
                                  path=notebook:
                                      self.create_new_client(filename=path))
                self.recent_notebooks_actions.append(action)
            self.recent_notebooks_actions += \
                [None, self.clear_recent_notebooks_action]
        else:
            self.recent_notebooks_actions = \
                [self.clear_recent_notebooks_action]
        add_actions(self.recent_notebook_menu, self.recent_notebooks_actions)
        self.update_notebook_actions()
370092
def create_widgets(self):
        """"""
        self.bbox = QDialogButtonBox(
                QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self.idx_ok = self.bbox.button(QDialogButtonBox.Ok)
        self.idx_cancel = self.bbox.button(QDialogButtonBox.Cancel)

        self.idx_group = FormMenu([gr['name'] for gr in self.groups])

        chan_box = QListWidget()
        self.idx_chan = chan_box

        stage_box = QListWidget()
        stage_box.addItems(STAGE_NAME)
        stage_box.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.idx_stage = stage_box

        cycle_box = QListWidget()
        cycle_box.setSelectionMode(QAbstractItemView.ExtendedSelection)
        self.idx_cycle = cycle_box
74198
def create_widget(self):
        
        d = self.declaration
        self.widget = Switch(self.get_context(), None,
                             d.style or '@attr/switchStyle')
445363
protected function addActions ()
    {
        add_action(Hooks::ADMIN_MENU, array($this, 'addPage'));
        if ($this->currentlyOnPage()) {
            add_action(Hooks::ADMIN_INIT, [$this, 'adminInit']);
        }
    }
1020450
def create_widget(self):
        
        d = self.declaration
        self.widget = LinearLayout(self.get_context(), None, d.style)
423012
def create_ui(self):
        
        self.entry = gtk.Entry()
        self.widget.add(self.entry)
740953
def create_widget(self):
        
        d = self.declaration
        self.widget = CheckBox(self.get_context(), None,
                               d.style or "@attr/checkboxStyle")
769561
def create_widget(self):
        
        d = self.declaration
        self.widget = FloatingActionButton(self.get_context(), None, d.style)
1057237
def create_widget(self):
        
        d = self.declaration
        self.widget = FrameLayout(self.get_context(), None, d.style)
931190
def setup_menu_actions(self):
        """"""
        self.recent_project_menu.clear()
        self.recent_projects_actions = []
        if self.recent_projects:
            for project in self.recent_projects:
                if self.is_valid_project(project):
                    name = project.replace(get_home_dir(), '~')
                    action = create_action(
                        self,
                        name,
                        icon=ima.icon('project'),
                        triggered=(
                            lambda _, p=project: self.open_project(path=p))
                        )
                    self.recent_projects_actions.append(action)
                else:
                    self.recent_projects.remove(project)
            self.recent_projects_actions += [None,
                                             self.clear_recent_projects_action]
        else:
            self.recent_projects_actions = [self.clear_recent_projects_action]
        add_actions(self.recent_project_menu, self.recent_projects_actions)
        self.update_project_actions()