예제 #1
0
  def window_destroyed_cb(self, event):

    if str(event.widget) == str(self.frame):
      if sparky.object_exists(self.session):
        for notice in self.notices:
          self.session.dont_notify_me(notice)
      self.notices = ()
예제 #2
0
    def window_destroyed_cb(self, event):

        if str(event.widget) == str(self.frame):
            if sparky.object_exists(self.session):
                for notice in self.notices:
                    self.session.dont_notify_me(notice)
            self.notices = ()
예제 #3
0
  def view_exists(self):

    v = self.view
    if v == None:
      return 0

    if not sparky.object_exists(v):
      self.view = None      # view object no longer exists
      return 0

    return 1
예제 #4
0
  def position_view(self, parent, column, strip_width, strip_gap):

    if column == None:
      self.delete_view()
    else:
      if not self.view_exists():
        if sparky.object_exists(self.spectrum):
          self.view = self.create_view(parent, column, strip_width)
        else:
          self.view = None
          return
      tkutil.tk_call(parent, self.view.frame, 'configure',
                     '-width', strip_width)
      tkutil.tk_call(parent, 'grid', 'configure', self.view.frame,
                     '-row', 0, '-column', column,
                     '-sticky', 'news', '-padx', strip_gap/2)
예제 #5
0
    def show_selected_peak_assignments(self):

        spectrum = self.settings.spectrum
        if spectrum == None:
            return

        #
        # If the spectrum is deleted this will remove the peak selection
        # callback.  This suppresses errors that would be displayed on every
        # peak selection.  Should be notified about spectrum delete and
        # update appropriately instead.
        #
        if not sparky.object_exists(spectrum):
            self.remove_selection_callback()

        self.stoppable_call(self.show_peaks, self.show_alternative_assignments,
                            'selected peaks', spectrum.selected_peaks())
예제 #6
0
  def show_selected_peak_assignments(self):

    spectrum = self.settings.spectrum
    if spectrum == None:
      return

    #
    # If the spectrum is deleted this will remove the peak selection
    # callback.  This suppresses errors that would be displayed on every
    # peak selection.  Should be notified about spectrum delete and
    # update appropriately instead.
    #
    if not sparky.object_exists(spectrum):
      self.remove_selection_callback()
      
    self.stoppable_call(self.show_peaks,
			self.show_alternative_assignments, 'selected peaks',
			spectrum.selected_peaks())
예제 #7
0
	def clear_peaks_cb(self):
		paraSpec = self.para_menu.spectrum()

		if not paraSpec:
			raise IOError("You need to select a paramagnetic spectrum")

		selected_ornaments = self.session.selected_ornaments()
		self.session.unselect_all_ornaments()

		for peak in paraSpec.peak_list():
			if peak.note == "PCS_backcalc":
				peak.selected = 1
		self.session.command_characters("")

		for ornament in selected_ornaments:
			if sparky.object_exists(ornament):
				ornament.selected = 1

		self.message['text'] = "PCS peaks deleted from spectrum:\n{}".format(paraSpec.name)
예제 #8
0
  def show_settings(self, settings):

    tsp_list = settings['type-spectrum-phase-list']
    if tsp_list:
      types = {}
      for type, spectrum, phase in tsp_list:
        if sparky.object_exists(spectrum):
          self.type_to_spectrum_menu[type].set(spectrum.name)
        self.type_to_phase[type].set(phase)
        types[type] = 1
      for type in self.type_to_spectrum_menu.keys():
        if not types.has_key(type):
          self.type_to_spectrum_menu[type].set('')
      
    ttable = settings['tolerance-table']
    for e in self.tolerances:
      atom_name = e.label['text']
      if ttable.has_key(atom_name):
        new_tol = ttable[atom_name]
        current_tol = pyutil.string_to_float(e.variable.get(), 0)
        if new_tol != current_tol:
          e.variable.set('%.3g' % new_tol)

    self.temp_directory.set(settings['temp-directory'])
예제 #9
0
  def remove_selection_callback(self):

    if self.selection_notice:
      if sparky.object_exists(self.session):
        self.session.dont_notify_me(self.selection_notice)
      self.selection_notice = None