Exemplo n.º 1
0
  def __init__(self, session):

    self.session = session
    self.peak = None
    
    tkutil.Dialog.__init__(self, session.tk, 'Peak Resonance Mover')

    self.spectrum_menu = sputil.spectrum_menu(session, self.top, 'Spectrum: ')
    self.spectrum_menu.frame.pack(side = 'top', anchor = 'w')

    cb = tkutil.checkbutton(self.top, 'On / Off', 0)
    cb.button.pack(side = 'top', anchor = 'w')
    cb.add_callback(self.onoff_cb)
    self.onoff = cb
    self.will_drag_notice = None
    self.dragged_notice = None

    self.message = Tkinter.Label(self.top)
    self.message.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'ShiftRes')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Exemplo n.º 2
0
  def __init__(self, session):

    self.session = session
    
    tkutil.Dialog.__init__(self, session.tk, 'Pick Atoms')

    cb = tkutil.checkbutton(self.top, 'Show atom labels?', 0)
    self.show_label = cb.variable
    cb.button.pack(side = 'top', anchor = 'w')

    cb = tkutil.checkbutton(self.top, 'Show distances?', 0)
    self.show_distance = cb.variable
    cb.button.pack(side = 'top', anchor = 'w')

    cb = tkutil.checkbutton(self.top, 'Show peaks?', 0)
    self.show_peak = cb.variable
    cb.button.pack(side = 'top', anchor = 'w')

    cb = tkutil.checkbutton(self.top, 'Show assigned atoms?', 0)
    self.show_assigned = cb.variable
    cb.button.pack(side = 'top', anchor = 'w')
    cb.add_callback(pyutil.precompose(color_assigned_atoms, session))

    self.status_line = Tkinter.Label(self.top, anchor = 'nw')
    self.status_line.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'MidasPick')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    self.pick_cb = self.atom_pick_cb
    midas.process(self.session).add_atom_pick_callback(self.pick_cb)
Exemplo n.º 3
0
  def __init__(self, session):

    self.session = session

    tkutil.Settings_Dialog.__init__(self, session.tk, 'Assignment Graph Setup')

    sc = self.spectrum_choice_table(self.top)
    sc.pack(side = 'top', anchor = 'w')

    te = self.tolerance_entry(self.top)
    te.pack(side = 'top', anchor = 'w')
    
    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')
    
    br = tkutil.button_row(self.top,
                           ('Ok', self.ok_cb),
			   ('Apply', self.apply_cb),
                           ('Stop', self.stop_cb),
                           ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'AssignGraph')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
Exemplo n.º 4
0
  def __init__(self, session):

    tkutil.Dialog.__init__(self, session.tk, 'Read Peak List')

    plp = tkutil.file_field(self.top, 'Peak file: ', 'peaklist')
    plp.frame.pack(side = 'top', anchor = 'w')
    self.peak_list_path = plp
    
    sc = sputil.spectrum_menu(session, self.top, 'Spectrum: ')
    sc.frame.pack(side = 'top', anchor = 'w')
    self.spectrum_choice = sc

    sl = tkutil.scrolling_list(self.top, 'Unreadable lines', 5)
    sl.frame.pack(side = 'top', anchor = 'w', fill = 'both', expand = 1)
    self.unreadable = sl
    
    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Create peaks', self.read_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'ReadPeaks')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[1])
    def __init__(self, session):
        """ Initialization
        """
        self.session = session
        tkutil.Dialog.__init__(self, session.tk,
                               'Open & Autoreload Multiple Spectra')
        
        proj = session.project
        mfs = tkutil.multiple_file_selection(self.top, proj.sparky_directory)
        mfs.frame.pack(side = 'top', anchor = 'nw', fill = 'both', expand = 1)
        self.files = mfs

        r = Tkinter.Label(self.top, justify = 'left')
        r.pack(side = 'top', anchor = 'nw')

        self.result = r
        br = tkutil.button_row(self.top,
                               ('Open', self.open_cb),
                               ('Set Timer', self.set_timer),
                               ('Toggle Autoreload', self.toggle_autoreload),
                               ('Cancel', self.close_cb),
                               ('Help',
                                sputil.help_cb(session,
                                               'OpenAutoreloadSpectra')),
                               )
        br.frame.pack(side = 'top', anchor = 'nw')

        self.autoreload = True  # if the spectrum files should be autoreloaded
        self.paths      = None  # list of spectrum files to open
        self.tslist     = None  # list of timestamps for the spectrum files
        self.tth        = None  # threading.Timer instance
        self.q = Queue.Queue(1)
Exemplo n.º 6
0
  def __init__(self, session):

    self.session = session
    self.title = 'Peak List'
    self.spectrum = None
    self.peaks = ()
    self.settings = peak_list_settings()

    tkutil.Dialog.__init__(self, session.tk, self.title)

    pl = sputil.peak_listbox(self.top)
    pl.frame.pack(side = 'top', fill = 'both', expand = 1)
    pl.listbox.bind('<ButtonRelease-1>', pl.select_peak_cb)
    pl.listbox.bind('<ButtonRelease-2>', pl.goto_peak_cb)
    pl.listbox.bind('<Double-ButtonRelease-1>', pl.goto_peak_cb)
    self.peak_list = pl

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Update', self.update_cb),
			   ('Setup...', self.setup_cb),
			   ('Save...', self.peak_list.save_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'PeakListPython')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[3])
Exemplo n.º 7
0
  def __init__(self, session):

    tkutil.Dialog.__init__(self, session.tk, 'Place HC Peaks from Resonances')

    explain = ('Create and label peaks on a 2D C13 HSQC spectrum\n' +
               'for all protons attached to carbons, if both proton\n' +
               'and carbon resonances are assigned and labeled\n'
               'correctly.\n')
    w = Tkinter.Label(self.top, text = explain, justify = 'left')
    w.pack(side = 'top', anchor = 'w')

    m = sputil.spectrum_menu(session, self.top, 'Spectrum: ')
    m.frame.pack(side = 'top', anchor = 'w')
    self.spectrum_menu = m

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Place peaks', self.place_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'HCPeaks')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[1])
Exemplo n.º 8
0
  def __init__(self, session):
    
    tkutil.Settings_Dialog.__init__(self, session.tk,
                                    'Strip Matching Parameters')

    t = tkutil.entry_row(self.top, 'Tolerances ',
                         (' 1H', '.02', 5),
                         (' 13C', '.2', 5),
                         (' 15N', '.2', 5))
    t.frame.pack(side = 'top', anchor = 'w')
    self.tolerances = {'1H': t.variables[0],
                       '13C': t.variables[1],
                       '15N': t.variables[2]}

    e = tkutil.entry_field(self.top, 'Allow ', '0', 3, ' unmatched peaks')
    e.frame.pack(side = 'top', anchor = 'w')
    self.max_unmatched = e.variable
    
    br = tkutil.button_row(self.top,
                           ('Ok', self.ok_cb),
			   ('Apply', self.apply_cb),                           
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'StripPlot')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Exemplo n.º 9
0
  def __init__(self, session):

    self.session = session
    
    tkutil.Dialog.__init__(self, session.tk, 'View Constraints')

    self.pdb_file = tkutil.file_field(self.top, 'PDB File: ', 'pdb')
    self.pdb_file.frame.pack(side = 'top', anchor = 'w')

    self.mardi_file = tkutil.file_field(self.top,
					'Mardigras Constraint File: ',
					'mardigras')
    self.mardi_file.frame.pack(side = 'top', anchor = 'w')

    cb = tkutil.checkbutton(self.top, 'Show satisfied constraints?', 0)
    self.satisfied = cb.variable
    cb.button.pack(side = 'top', anchor = 'w')

    cb = tkutil.checkbutton(self.top, 'Show violated constraints?', 1)
    self.violated = cb.variable
    cb.button.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Show', self.show_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session,
                                                   'MidasConstraints')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Exemplo n.º 10
0
  def create_menus(self, parent, session):

    mbar = Tkinter.Frame(parent)

    m = tkutil.menu(mbar, 'Show')
    m.button.pack(side = 'left')
    add_button = pyutil.precompose(self.add_menu_button, m)
    
    add_button('Select strip spectra...', 'ss', select_strip_spectra)
    add_button('Set strip width...', 'sw', choose_strip_width)
    m.add_separator()
    add_button('Add selected peak strips', 'sk', add_peak_strips)
    add_button('All assigned strips', 'sn', add_assigned_strips)
    m.add_separator()
    add_button('Zoom strips in', 'si', zoom_in_strips)
    add_button('Zoom strips out', 'so', zoom_out_strips)
    add_button('Copy view strip options', 'sv', copy_view_options)
    m.add_separator()
    add_button('Delete selected strip', 'sd', delete_view_strip)
    add_button('Delete all strips', 'sD', delete_all_strips)
    m.add_separator()
    m.add_button('Help', sputil.help_cb(self.session, 'StripPlot'))
    m.add_button('Close', self.close_cb)
      
    m = tkutil.menu(mbar, 'Find')
    m.button.pack(side = 'left')
    add_button = pyutil.precompose(self.add_menu_button, m)
    
    add_button('Go to assigned peak strip', 'sj', goto_assigned_strip)
    m.add_separator()
    add_button('Strip matching tolerances...', 'sT', matching_strips_setup)
    add_button('Add strips matching peaks', 'sm', add_matching_strips)
    add_button('Delete matched strips', 'sM', delete_matched_strips)

    return mbar
Exemplo n.º 11
0
  def __init__(self, session):

    self.session = session
    self.assignments = None
    self.spin_graph_dialog = None
    self.current_resonance = None
    self.extender = None
    self.shown_group_atoms = None
    
    tkutil.Dialog.__init__(self, session.tk, 'Assignment Graph')

    lb = self.peak_list_box(self.top)
    lb.pack(side = 'top', fill = 'both', expand = 1)
    
    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Assign', self.assign_cb),
                           ('Unassign', self.unassign_cb),
                           ('Strips...', self.strip_cb),
                           ('Update', self.update_cb),
			   ('Setup...', self.setup_cb),
                           ('Stop', self.stop_cb),
                           ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'AssignGraph')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[5])
Exemplo n.º 12
0
    def __init__(self, session):
        """ Initialization
        """
        self.session = session
        tkutil.Dialog.__init__(self, session.tk, "Open & Reload Multiple Spectra")

        proj = session.project
        mfs = tkutil.multiple_file_selection(self.top, proj.sparky_directory)
        mfs.frame.pack(side="top", anchor="nw", fill="both", expand=1)
        self.files = mfs

        r = Tkinter.Label(self.top, justify="left")
        r.pack(side="top", anchor="nw")

        self.result = r
        br = tkutil.button_row(
            self.top,
            ("Open", self.open_cb),
            ("Reload", self.reload_spectra),
            ("Cancel", self.close_cb),
            ("Help", sputil.help_cb(session, "OpenAutoreloadSpectra")),
        )
        br.frame.pack(side="top", anchor="nw")

        self.paths = []  # list of spectrum files to open
        self.spectra = []  # spectra already opened

        # if there are opened windows, get the paths
        for v in proj.view_list():
            self.paths.append(v.spectrum.save_path)
            self.spectra.append(v.spectrum)
Exemplo n.º 13
0
  def __init__(self, session):

    self.session = session

    tkutil.Dialog.__init__(self, session.tk, 'ncIDP Repositioning Tool 1.2b/2nd DEC 2010')
    
    cm = sputil.condition_menu(session, self.top, 'Condition: ')
    cm.frame.pack(side = 'top', anchor = 'w')
    self.condition_menu = cm

    rr = tkutil.entry_row(self.top, 'Residues ',
                          ('from', '', 3), ('to', '', 3))
    self.range_variables = rr.variables
    rr.frame.pack(side = 'top', anchor = 'w')

    ol = tkutil.scrolling_list(self.top, '', 5)
    ol.frame.pack(side = 'top', fill = 'both', expand = 1)
    ol.listbox.bind('<ButtonRelease-1>', self.select_cb)
    self.offset_list = ol

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Positions', self.positions_cb),
			   ('Move', self.move_cb),
                           ('Shifts', self.shifts_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'Reposition'))
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[3]) 
Exemplo n.º 14
0
  def __init__(self, session):

    self.session = session
    
    tkutil.Dialog.__init__(self, session.tk, 'Atom Name Translations')

    self.trans_name = tkutil.option_menu(self.top, 'Atom set: ', ())
    self.trans_name.frame.pack(side = 'top', anchor = 'w')
    self.trans_name.add_callback(self.show_translation_cb)
      
    st = tkutil.scrolling_list(self.top, 'Select applicable translations', 5)
    st.frame.pack(side = 'top', anchor = 'w')
    st.listbox['selectmode'] = 'multiple'
    self.standard_trans = st
    
    for t in standard_translations():
      self.standard_trans.listbox.insert('end', t.name)

    self.bad_names = tkutil.scrolling_list(self.top, 'Non standard names', 5)
    self.bad_names.frame.pack(side = 'top', anchor = 'w',
                              fill = 'y', expand = 1)

    br = tkutil.button_row(self.top,
			   ('Update', self.update_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'AtomNameTrans')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Exemplo n.º 15
0
  def __init__(self, session):

    self.session = session
    self.view_to_center = None
    self.selection_notice = None
    
    tkutil.Dialog.__init__(self, session.tk, 'View Center')

    explain = ('Specify a view window to be centered\n' +
               'by the cm or cp commands.  The cm command\n' +
               'centers the view at the point under the mouse\n'
               'when the command is invoked in any window.\n' +
               'The cp command centers the view on the selected\n' +
               'peak.')
    w = Tkinter.Label(self.top, text = explain, justify = 'left')
    w.pack(side = 'top', anchor = 'w')

    add_command = pythonshell.add_command
    add_command('cm', '', 'centerview', 'center_view_on_mouse', session)
    add_command('cp', '', 'centerview', 'center_view_on_peak', session)

    self.center_view = sputil.view_menu(session, self.top, 'View to center: ')
    self.center_view.frame.pack(side = 'top', anchor = 'w')

    ps = tkutil.checkbutton(self.top, 'Center when peak selected?', 0)
    ps.button.pack(side = 'top', anchor = 'w')
    self.peak_select = ps

    br = tkutil.button_row(self.top,
			   ('Ok', self.ok_cb),
                           ('Apply', self.apply_cb),
                           ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'CenterViews')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Exemplo n.º 16
0
  def make_dialog(self):

    tkutil.Dialog.__init__(self, self.session.tk, 'Mirror Assignment Checker')

    self.top.bind('<Destroy>', self.window_destroyed_cb, 1)

    w = self.make_noesy_table(self.top)
    w.pack(side = 'top', anchor = 'w')

    choices = ('Selected peaks',
	       'Peaks with assigned mirror peak',
	       'Peaks without assigned mirror peak',
	       'Unassigned with assigned mirror',
	       )
    self.show_type = tkutil.option_menu(self.top, 'Show ',
                                        choices, choices[0])
    self.show_type.frame.pack(side = 'top', anchor = 'w')

    cb = tkutil.checkbutton(self.top,
                            'Exclude mirrors with low signal/noise?', 0)
    cb.button.pack(side = 'top', anchor = 'w')
    self.exclude_mirrors = cb

    f = Tkinter.Frame(self.top)
    cb.map_widget(f)
    
    e = tkutil.entry_field(f, 'C13 / N15 intensity ratio: ', '1', 3)
    self.c13_n15_factor = e.variable
    e.frame.pack(side = 'top', anchor = 'w')

    e = tkutil.entry_field(f, 'Minimum mirror intensity factor: ', '.5', 3)
    self.min_mirror_factor = e.variable
    e.frame.pack(side = 'top', anchor = 'w')

    pl = tkutil.scrolling_list(self.top, '', 5)
    pl.frame.pack(side = 'top', fill = 'both', expand = 1)
    pl.listbox.bind('<ButtonRelease-2>', self.select_peak_or_assignment_cb)
    pl.listbox.bind('<ButtonRelease-1>', self.goto_peak_or_assignment_cb)
    self.peak_list = pl

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Update', self.update_cb),
			   ('Strips', self.strips_cb),
			   ('Save', self.peak_list.save_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(self.session,
                                                   'MirrorPeak')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[3])

    self.settings = self.get_settings()
Exemplo n.º 17
0
  def __init__(self, session):

    self.session = session
    
    tkutil.Dialog.__init__(self, session.tk, 'Peak Linewidth Plot')

    self.top.columnconfigure(0, weight = 1)
    r = 0
    
    sw = sputil.spectrum_menu(session, self.top, 'Spectrum: ')
    sw.frame.grid(row = r, sticky = 'w')
    r = r + 1
    self.spectrum_widget = sw
    
    af = tkutil.entry_field(self.top, 'Spectrum axis: ', '1', 3)
    af.frame.grid(row = r, sticky = 'w')
    r = r + 1
    self.axis_variable = af.variable
    
    self.lw_ranges = [None, None]
    er = tkutil.entry_row(self.top, 'Linewidth range (hz): ',
                          ('min', '0', 3), ('max', '50', 3), ('step', '5', 3))
    (self.lw_ranges[0], self.lw_ranges[1], self.lw_step) = er.variables
    er.frame.grid(row = r, sticky = 'w')
    r = r + 1
    
    e = tkutil.entry_field(self.top, 'Atoms: ', '', 30)
    self.atoms = e.variable
    e.frame.grid(row = r, sticky = 'w')
    r = r + 1
    
    c = tkutil.scrollable_canvas(self.top)
    c.frame.grid(row = r, sticky = 'news')
    self.top.rowconfigure(r, weight = 1)
    r = r + 1
    self.canvas = c.canvas

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.grid(row = r, sticky = 'w')
    r = r + 1
    
    postscript_cb = pyutil.precompose(tkutil.postscript_cb, self.canvas)
    br = tkutil.button_row(self.top,
			   ('Update', self.update_cb),
			   ('Postscript', postscript_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'LinewidthPlot')),
			   )
    br.frame.grid(row = r, sticky = 'w')
    r = r + 1

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
Exemplo n.º 18
0
  def __init__(self, session):

    self.session = session
    tkutil.Dialog.__init__(self, session.tk, 'Chemical Shift Plot')

    self.top.columnconfigure(0, weight = 1)
    r = 0
    
    self.condition_widget = sputil.condition_menu(session, self.top, 'Condition: ')
    self.condition_widget.frame.grid(row = r, sticky = 'w')
    r = r + 1

    self.ppm_range_widget = [None, None]
    er = tkutil.entry_row(self.top, 'PPM range: ',
                          ('min', '0', 3), ('max', '12', 3), ('step', '1', 3))
    (self.ppm_range_widget[0],
     self.ppm_range_widget[1],
     self.ppm_step_widget) = er.variables
    er.frame.grid(row = r, sticky = 'w')
    r = r + 1
    
    e = tkutil.entry_field(self.top, 'Atoms: ', '', 30)
    self.atoms = e.variable
    e.frame.grid(row = r, sticky = 'w')
    r = r + 1
    
    t = tkutil.checkbutton(self.top, 'Show typical amino acid shifts?', 0)
    self.typical_range = t.variable
    t.button.grid(row = r, sticky = 'w')
    r = r + 1
    
    c = tkutil.scrollable_canvas(self.top)
    c.frame.grid(row = r, sticky = 'news')
    self.top.rowconfigure(r, weight = 1)
    r = r + 1
    self.canvas = c.canvas

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.grid(row = r, sticky = 'w')
    r = r + 1
    
    postscript_cb = pyutil.precompose(tkutil.postscript_cb, self.canvas)
    br = tkutil.button_row(self.top,
			   ('Update', self.update_cb),
			   ('Postscript', postscript_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'ChemShiftPlot')),
			   )
    br.frame.grid(row = r, sticky = 'w')
    r = r + 1

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
Exemplo n.º 19
0
  def __init__(self, session):

    self.session = session
    
    tkutil.Dialog.__init__(self, session.tk, 'Peak Table')

    setup = Tkinter.Frame(self.top)
    setup.pack(side = 'top', anchor = 'w')

    # Choose Spectra

    sbutton = tkutil.checkbutton(self.top, 'Choose Spectra', 1)
    sbutton.button.pack(side = 'top', anchor = 'w')

    schoice = Tkinter.Frame(self.top)
    schoice.pack(side = 'top', anchor = 'w')

    sc = sputil.spectrum_checkbuttons(session, schoice, '')
    sc.frame.pack(side = 'top', anchor = 'w')
    self.spectrum_list = sc.chosen_spectra

    cb = tkutil.checkbutton(schoice, 'Noesy format?', 0)
    self.noesy_format = cb.variable
    cb.button.pack(side = 'top', anchor = 'w')

    sbutton.map_widget(schoice)

    # Peak list

    pl = sputil.assignment_listbox(session, self.top)
    pl.frame.pack(side = 'top', fill = 'both', expand = 1)
    pl.listbox.bind('<ButtonRelease-1>', self.select_assignment_cb)
    pl.listbox.bind('<ButtonRelease-2>', self.goto_assignment_cb)
    pl.listbox.bind('<Double-ButtonRelease-1>', self.goto_assignment_cb)
    self.peak_list = pl

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Update', self.update_cb),
			   ('Save', self.peak_list.save_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'PeakTable')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
Exemplo n.º 20
0
  def __init__(self, session):

    self.molecule = None
    
    tkutil.Dialog.__init__(self, session.tk, 'Sequence Entry')

    se = self.sequence_entry(self.top)
    se.pack(side = 'top', anchor = 'w', fill = 'x', expand = 1)

    br = tkutil.button_row(self.top,
			   ('Ok', self.ok_cb),
                           ('Cancel', self.close_cb),
                           ('Help', sputil.help_cb(session, 'Sequence')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Exemplo n.º 21
0
  def __init__(self, session):

    tkutil.Settings_Dialog.__init__(self, session.tk,
                                    'Python Shell Preferences')

    cb = tkutil.checkbutton(self.top, 'Show Python shell if error occurs?', 1)
    cb.button.pack(side = 'top', anchor = 'nw')
    self.raise_variable = cb.variable

    br = tkutil.button_row(self.top,
                           ('Ok', self.ok_cb),
                           ('Apply', self.apply_cb),
                           ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'PythonShell')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Exemplo n.º 22
0
  def __init__(self, session):

    self.spectrum = None
    self.heavy_axis = None
    
    tkutil.Dialog.__init__(self, session.tk, 'Attached Proton')

    am = tkutil.option_menu(self.top, 'Attached proton axis: ', ())
    am.frame.pack(side = 'top')
    self.axis_menu = am

    br = tkutil.button_row(self.top,
			   ('Ok', self.ok_cb),
                           ('Cancel', self.close_cb),
                           ('Help', sputil.help_cb(session, 'LabelledAxis')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Exemplo n.º 23
0
  def __init__(self, session):

    tkutil.Dialog.__init__(self, session.tk, 'MARDIGRAS Format')

    sc = sputil.spectrum_menu(session, self.top, 'Spectrum: ')
    sc.frame.pack(side = 'top', anchor = 'w')
    self.spectrum_choice = sc

    pl = sputil.peak_listbox(self.top)
    pl.frame.pack(fill = 'both', expand = 1)
    pl.heading['text'] = 'Peak list'
    pl.listbox.bind('<ButtonRelease-1>', pl.select_peak_cb)
    pl.listbox.bind('<ButtonRelease-2>', pl.goto_peak_cb)
    pl.listbox.bind('<Double-ButtonRelease-1>', pl.goto_peak_cb)
    self.peak_list = pl

    ib = tkutil.checkbutton(self.top, 'Include unintegrated peaks?', 0)
    ib.button.pack(side = 'top', anchor = 'w')
    self.unintegrated = ib

    nb = tkutil.checkbutton(self.top, 'Show peak notes?', 0)
    nb.button.pack(side = 'top', anchor = 'w')
    self.note = nb

    eh = Tkinter.Label(self.top, text = 'Omit peak if note has a word from:')
    eh.pack(side = 'top', anchor = 'w')
    ef = tkutil.entry_field(self.top, '  ', width = 30)
    ef.frame.pack(side = 'top', anchor = 'w')
    self.note_words = ef
    et = Tkinter.Label(self.top, text = '(space separated list of words)')
    et.pack(side = 'top', anchor = 'w')
    
    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
                           ('Update', self.update_cb),
                           ('Write Peaks', self.save_peaks_cb),
                           ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session,
                                                   'MardigrasFormat')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
Exemplo n.º 24
0
  def __init__(self, session):

    self.session = session
    
    tkutil.Dialog.__init__(self, session.tk, 'Restricted Peak Pick')
    
    m = sputil.view_menu(session, self.top, 'Find peaks in ')
    m.frame.pack(side = 'top', anchor = 'w')
    m.add_callback(self.chose_spectrum_cb)
    self.pick_menu = m

    m = sputil.spectrum_menu(session, self.top, 'Using peaks in ')
    m.frame.pack(side = 'top', anchor = 'w')
    m.add_callback(self.chose_spectrum_cb)
    self.ref_menu = m

    b = tkutil.checkbutton(self.top, 'Use selected peaks only?', 0)
    b.button.pack(side = 'top', anchor = 'w')
    self.selected_only = b

    lbl= Tkinter.Label(self.top, text = 'Axis match tolerances (ppm)')
    lbl.pack(side = 'top', anchor = 'w')
    self.axis_table_heading = lbl
    
    f = Tkinter.Frame(self.top)
    f.pack(side = 'top', anchor = 'w')
    self.axis_table = f
    self.range_entries = []
    
    self.setup_axis_table()

    progress_label = Tkinter.Label(self.top, anchor = 'nw')
    progress_label.pack(side = 'top', anchor = 'w')

    br = tkutil.button_row(self.top,
			   ('Pick peaks', self.pick_cb),
                           ('Select peaks', self.select_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'RestrictedPick')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[2])
Exemplo n.º 25
0
  def __init__(self, session):

    self.session = session
    
    tkutil.Dialog.__init__(self, session.tk, 'Create Corma Spectrum')

    sm = sputil.spectrum_menu(session, self.top, 'Spectrum: ')
    sm.frame.pack(side = 'top', anchor = 'w')
    sm.add_callback(self.spectrum_cb)
    self.spectrum_menu = sm

    ms = tkutil.entry_row(self.top, 'Matrix size: ',
                          ('w1', '0', 5), ('w2', '0', 5))
    ms.frame.pack(side = 'top', anchor = 'w')
    self.matrix_size = ms

    lw = tkutil.entry_row(self.top, 'Default linewidth (hz): ',
                          ('w1', '0', 5), ('w2', '0', 5))
    lw.frame.pack(side = 'top', anchor = 'w')
    self.default_linewidth = lw

    cp = tkutil.file_field(self.top, 'Corma file: ', 'corma')
    cp.frame.pack(side = 'top', anchor = 'w')
    self.corma_path = cp

    sp = tkutil.file_field(self.top, 'Save in file: ', 'spectrum', save = 1)
    sp.frame.pack(side = 'top', anchor = 'w')
    self.save_path = sp
    
    progress_label = Tkinter.Label(self.top, anchor = 'nw', justify = 'left')
    progress_label.pack(side = 'top', anchor = 'w')
    
    self.spectrum_cb(self.spectrum_menu.get())

    br = tkutil.button_row(self.top,
			   ('Create Spectrum', self.create_spectrum_cb),
			   ('Stop', self.stop_cb),
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'CormaSpectrum')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    tkutil.Stoppable.__init__(self, progress_label, br.buttons[1])
Exemplo n.º 26
0
  def __init__(self, session):

    tkutil.Settings_Dialog.__init__(self, session.tk, 'Show Peak Strips')

    sw = tkutil.entry_field(self.top, 'Strip width (screen pixels): ', '', 4)
    sw.frame.pack(side = 'top', anchor = 'w')
    self.strip_width = sw.variable

    gp = tkutil.entry_field(self.top, 'Gap between strips (screen pixels): ',
                            '', 4)
    gp.frame.pack(side = 'top', anchor = 'w')
    self.strip_gap = gp.variable

    br = tkutil.button_row(self.top,
			   ('Ok', self.ok_cb),
			   ('Apply', self.apply_cb),
			   ('Close', self.close_cb),                           
                           ('Help', sputil.help_cb(session, 'StripPlot')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Exemplo n.º 27
0
  def __init__(self, session):

    self.session = session
    
    tkutil.Settings_Dialog.__init__(self, session.tk, 'Show Peak Strips')

    f = self.spectrum_choice_table(self.top)
    f.pack(side = 'top', anchor = 'w')
    
    sx = tkutil.checkbutton(self.top, 'Show spectrum name under each strip', 0)
    sx.button.pack(side = 'top', anchor = 'w', padx = 10, pady = 10)
    self.label_spectrum = sx

    br = tkutil.button_row(self.top,
			   ('Ok', self.ok_cb),
			   ('Apply', self.apply_cb),
			   ('Close', self.close_cb),                           
                           ('Help', sputil.help_cb(session, 'StripPlot')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')
Exemplo n.º 28
0
  def __init__(self, session):

    self.session = session
    self.raise_on_error = 1
    
    tkutil.Dialog.__init__(self, session.tk, 'Python Shell')
    self.top.bind('<Destroy>', self.window_destroyed_cb, 1)

    w = tkutil.scrolling_text(self.top, 10, 80)
    w.frame.pack(side = 'top', fill = 'both', expand = 1)
    w.text.bind('<KeyRelease-Return>', self.enter_cb)
    w.text.focus_set()  # Initial focus child is text window
    self.text = w.text
    br = tkutil.button_row(self.top,
                           ('Preferences...', self.preferences_cb),
                           ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'PythonShell')),
			   )
    br.frame.pack(side = 'top', anchor = 'w')

    #
    # Python output goes to this dialog
    #
    class output_object:
      def __init__(self, write_cb):
        self.write = write_cb

    #
    # Make stdout and stderr output go to this shell window
    #
    self.stdout = output_object(self.output_text)
    self.stderr = output_object(self.output_error)

    session.stdout = self.stdout
    session.stderr = self.stderr
    
    if hasattr(session, 'redirect_stdio') and session.redirect_stdio:
      sys.stdout = self.stdout
      sys.stderr = self.stderr

    self.stdout.write(sys.ps1)
Exemplo n.º 29
0
  def __init__(self, session):

    self.session = session
    
    tkutil.Dialog.__init__(self, session.tk, 'Open Multiple Spectra')

    proj = session.project
    mfs = tkutil.multiple_file_selection(self.top, proj.sparky_directory)
    mfs.frame.pack(side = 'top', anchor = 'nw', fill = 'both', expand = 1)
    self.files = mfs

    r = Tkinter.Label(self.top, justify = 'left')
    r.pack(side = 'top', anchor = 'nw')
    self.result = r
    
    br = tkutil.button_row(self.top,
                           ('Open', self.open_cb),
                           ('Cancel', self.close_cb),
                           ('Help', sputil.help_cb(session, 'OpenSpectra')),
			   )
    br.frame.pack(side = 'top', anchor = 'nw')
Exemplo n.º 30
0
  def __init__(self, session):
    
    tkutil.Dialog.__init__(self, session.tk, 'Fit Plot')

    self.top.rowconfigure(1, weight = 1)
    self.top.columnconfigure(0, weight = 1)

    h = Tkinter.Label(self.top)
    h.grid(row = 0, column = 0, sticky = 'w')
    self.heading = h

    c = Tkinter.Canvas(self.top)
    c.grid(row = 1, column = 0, sticky = 'news')
    self.canvas = c
    
    br = tkutil.button_row(self.top,
			   ('Close', self.close_cb),
                           ('Help', sputil.help_cb(session, 'RelaxFit')),
			   )
    br.frame.grid(row = 2, sticky = 'w')

    self.show_window(1)