upon enter on the specimen box it makes that specimen the current
        specimen
323036
def on_enter_specimen(self, event):
        
        new_specimen = self.specimens_box.GetValue()
        if new_specimen not in self.specimens:
            self.user_warning(
                "%s is not a valid specimen with measurement data, aborting" % (new_specimen))
            self.specimens_box.SetValue(self.s)
            return
        self.select_specimen(new_specimen)
        if self.ie_open:
            self.ie.change_selected(self.current_fit)
        self.update_selection()
420691
def postinit(self, test=None, fail=None):
        
        self.fail = fail
        self.test = test
488057
def _onWhat(self, name, line, pos, absPosition):
        """"""
        self.__lastImport.what.append(ImportWhat(name, line, pos, absPosition))
943688
def item_selected(self, item=None):
        """"""
        if item is None:
            item = self.currentItem()

        # stack history is in inverse order
        try:
            index = self.stack_history[-(self.currentRow()+1)]
        except IndexError:
            pass
        else:
            self.editor.set_stack_index(index)
            self.editor.current_changed(index)
        self.hide()
351009
def on_save_interpretation_button(self, event):
        
        if "specimen_int_uT" not in self.Data[self.s]['pars']:
            return
        if 'deleted' in self.Data[self.s]['pars']:
            self.Data[self.s]['pars'].pop('deleted')
        self.Data[self.s]['pars']['saved'] = True

        # collect all interpretation by sample
        sample = self.Data_hierarchy['specimens'][self.s]
        if sample not in list(self.Data_samples.keys()):
            self.Data_samples[sample] = {}
        if self.s not in list(self.Data_samples[sample].keys()):
            self.Data_samples[sample][self.s] = {}
        self.Data_samples[sample][self.s]['B'] = self.Data[self.s]['pars']["specimen_int_uT"]

        # collect all interpretation by site
        # site=thellier_gui_lib.get_site_from_hierarchy(sample,self.Data_hierarchy)
        site = thellier_gui_lib.get_site_from_hierarchy(
            sample, self.Data_hierarchy)
        if site not in list(self.Data_sites.keys()):
            self.Data_sites[site] = {}
        if self.s not in list(self.Data_sites[site].keys()):
            self.Data_sites[site][self.s] = {}
        self.Data_sites[site][self.s]['B'] = self.Data[self.s]['pars']["specimen_int_uT"]

        self.draw_sample_mean()
        self.write_sample_box()
        self.close_warning = True
268817
def change_selected(self,new_fit):
        
        if len(self.fit_list)==0: return
        if self.search_query and self.parent.current_fit not in [x[0] for x in self.fit_list]: return
        if self.current_fit_index == None:
            if not self.parent.current_fit: return
            for i,(fit,specimen) in enumerate(self.fit_list):
                if fit == self.parent.current_fit:
                    self.current_fit_index = i
                    break
        i = 0
        if isinstance(new_fit, Fit):
            for i, (fit,speci) in enumerate(self.fit_list):
                if fit == new_fit:
                    break
        elif type(new_fit) is int:
            i = new_fit
        elif new_fit != None:
            print(('cannot select fit of type: ' + str(type(new_fit))))
        if self.current_fit_index != None and \
        len(self.fit_list) > 0 and \
        self.fit_list[self.current_fit_index][0] in self.parent.bad_fits:
            self.logger.SetItemBackgroundColour(self.current_fit_index,"")
        else:
            self.logger.SetItemBackgroundColour(self.current_fit_index,"WHITE")
        self.current_fit_index = i
        if self.fit_list[self.current_fit_index][0] in self.parent.bad_fits:
            self.logger.SetItemBackgroundColour(self.current_fit_index,"red")
        else:
            self.logger.SetItemBackgroundColour(self.current_fit_index,"LIGHT BLUE")
1007354
public void init(Record record, Record recordSub, boolean bRestoreCurrentRecord)
    {
        m_recordSub = recordSub;
        m_bRestoreCurrentRecord = bRestoreCurrentRecord;
        super.init(record);
    }
184366
def replay(journal_entry, function, *args, **kwargs):
    '''
    
    '''
    # Starts the fiber section
    section = fiber.WovenSection()
    section.enter()

    # Check if this is the first recording in the fiber section
    journal_mode = section.state.get(RECMODE_TAG, None)
    is_first = journal_mode is None

    if is_first:
        section.state[RECMODE_TAG] = JournalMode.replay
        section.state[JOURNAL_ENTRY_TAG] = IJournalReplayEntry(journal_entry)

    result = function(*args, **kwargs)

    # We don't want anything asynchronous to be called,
    # so we abort the fiber section
    section.abort(result)
    # side effects are returned in sake of making sure that
    # all the side effects expected have been consumed (called)
    return result
1107342
public final void sample()
  {
    synchronized (_lock) {
      long count = _totalCount.get();
      long lastCount = _lastAvgTotalCount;
      _lastAvgTotalCount = count;

      long sum = _sum.get();
      double lastSum = _lastAvgSum;
      _lastAvgSum = sum;

      if (count == lastCount) {
        _avg =  0;
      }
      else {
        _avg = _scale * (sum - lastSum) / (double) (count - lastCount);
      }
    }
  }
992417
function() {
      var t = this;

      // Set the current tour pages
      t.pages = t.tour.get('pages');

      // Tour fields
      t.$('.nm-tsv-id').val(t.tour.get('id'));
      t.$('.nm-tsv-title').val(t.tour.get('title'));
      t.$('.nm-tsv-description').val(t.tour.get('description'));
      t.$('.nm-tsv-auto-next-sec').val(t.tour.get('autoNextSec'));
      var pageList = t.$('.nm-tsv-page-list').html('');

      // Tour pages
      var table = $('<table></table>').appendTo(pageList);

      for (var i = 0; i < t.pages.length; i++) {
        var page = t.pages[i];
        $('<tr><td>' + page['title'] + '</td><td class="nm-tsv-up" title="move up"><i class="icon-caret-up"></i></td><td class="nm-tsv-down" title="move down"><i class="icon-caret-down"></i></td><td class="nm-tsv-remove" title="remove page"><i class="icon-minus"></i></td></tr>').appendTo(table);
      }

      // Connect all tooltips
      UI.tooltip(t.$('*[title]'),{placement:'bottom'});

    }
1091733
def OnClick_listctrl(self, event):
        
        i = event.GetIndex()
        if self.parent.current_fit == self.fit_list[i][0]: return
        self.parent.initialize_CART_rot(self.fit_list[i][1])
        si = self.parent.specimens.index(self.fit_list[i][1])
        self.parent.specimens_box.SetSelection(si)
        self.parent.select_specimen(self.fit_list[i][1])
        self.change_selected(i)
        fi = 0
        while (self.parent.s == self.fit_list[i][1] and i >= 0): i,fi = (i-1,fi+1)
        self.parent.update_fit_box()
        self.parent.fit_box.SetSelection(fi-1)
        self.parent.update_selection()
1221908
def activated(self, item):
        """"""
        itemdata = self.data.get(id(self.currentItem()))
        if itemdata is not None:
            filename, lineno, colno = itemdata
            self.sig_edit_goto.emit(filename, lineno, self.search_text)
1039840
def InitUI(self):
        
        if self.data_type in ['orient', 'ages']:
            belongs_to = []
        else:
            parent_table_name = self.parent_type + "s"
            if parent_table_name in self.contribution.tables:
                belongs_to = sorted(self.contribution.tables[parent_table_name].df.index.unique())
            else:
                belongs_to = []

        self.choices = {}
        if self.data_type in ['specimens', 'samples', 'sites']:
            self.choices = {1: (belongs_to, False)}
        if self.data_type == 'orient':
            self.choices = {1: (['g', 'b'], False)}
        if self.data_type == 'ages':
            for level in ['specimen', 'sample', 'site', 'location']:
                if level in self.grid.col_labels:
                    level_names = []
                    if level + "s" in self.contribution.tables:
                        level_names = list(self.contribution.tables[level+"s"].df.index.unique())
                    num = self.grid.col_labels.index(level)
                    self.choices[num] = (level_names, False)
        # Bind left click to drop-down menu popping out
        self.grid.Bind(wx.grid.EVT_GRID_CELL_LEFT_CLICK,
                       lambda event: self.on_left_click(event, self.grid, self.choices))

        cols = self.grid.GetNumberCols()
        col_labels = [self.grid.GetColLabelValue(col) for col in range(cols)]

        # check if any additional columns have controlled vocabularies
        # if so, get the vocabulary list
        for col_number, label in enumerate(col_labels):
            self.add_drop_down(col_number, label)
354345
def create_current_pb(self, ):
        
        pb = QtGui.QPushButton("Select current")
        self.selection_tabw.setCornerWidget(pb)
        return pb
589843
function(){
		this.puzzle.opemgr.newOperation();
		
		this.cell.subclear();
		this.cross.subclear();
		this.border.subclear();
		this.excell.subclear();
	}
386428
def probe(self):
        

        # make sure the filehandler is still valid
        # (e.g. file stat hasnt changed, file exists etc.)
        if not self.validate_file_handler():
            return []

        messages = []

        # read any new lines and push them onto the stack
        for line in self.fh.readlines(self.max_lines):
            data = {"path":self.path}
            msg = self.new_message()

            # process the line - this is where parsing happens
            parsed = self.process_line(line, data)
            if not parsed:
                continue
            data.update(parsed)

            # process the probe - this is where data assignment
            # happens
            data = self.process_probe(data)
            msg["data"] = [data]
            messages.append(msg)


        # process all new messages before returning them
        # for emission
        messages = self.process_messages(messages)

        return messages
1258087
def onSelect_specimen(self, event):
        
        self.selected_meas = []
        self.select_specimen(str(self.specimens_box.GetValue()))
        if self.ie_open:
            self.ie.change_selected(self.current_fit)
        self.update_selection()