"Fossies" - the Fresh Open Source Software Archive

Member "relax-5.0.0/gui/components/citations.py" (2 Dec 2019, 3748 Bytes) of package /linux/privat/relax-5.0.0.src.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "citations.py" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 4.1.3_vs_5.0.0.

    1 ###############################################################################
    2 #                                                                             #
    3 # Copyright (C) 2009-2010 Michael Bieri                                       #
    4 # Copyright (C) 2009-2012 Edward d'Auvergne                                   #
    5 #                                                                             #
    6 # This file is part of the program relax (http://www.nmr-relax.com).          #
    7 #                                                                             #
    8 # This program is free software: you can redistribute it and/or modify        #
    9 # it under the terms of the GNU General Public License as published by        #
   10 # the Free Software Foundation, either version 3 of the License, or           #
   11 # (at your option) any later version.                                         #
   12 #                                                                             #
   13 # This program is distributed in the hope that it will be useful,             #
   14 # but WITHOUT ANY WARRANTY; without even the implied warranty of              #
   15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
   16 # GNU General Public License for more details.                                #
   17 #                                                                             #
   18 # You should have received a copy of the GNU General Public License           #
   19 # along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
   20 #                                                                             #
   21 ###############################################################################
   22 
   23 # Module docstring.
   24 """Module containing the citations GUI element for listing the citations relevant for the analysis."""
   25 
   26 # relax module imports.
   27 import dep_check
   28 from graphics import fetch_icon
   29 from gui.components.base_list import Base_list
   30 from gui.string_conv import str_to_gui
   31 from gui.uf_objects import Uf_storage; uf_store = Uf_storage()
   32 
   33 
   34 class Citations(Base_list):
   35     """The GUI element for listing the citations relevant for the analysis."""
   36 
   37     def action_bmrb_citation(self, event):
   38         """Launch the bmrb.citation user function.
   39 
   40         @param event:   The wx event.
   41         @type event:    wx event
   42         """
   43 
   44         # Launch the dialog.
   45         uf_store['bmrb.citation'](wx_parent=self.parent)
   46 
   47 
   48     def setup(self):
   49         """Override the base variables."""
   50 
   51         # GUI variables.
   52         self.title = "Citations"
   53         self.observer_base_name = "citations"
   54         self.button_placement = 'bottom'
   55 
   56         # The column titles.
   57         self.columns = [
   58             "Citation ID"
   59         ]
   60 
   61         # Button set up.
   62         self.button_info = [
   63             {
   64                 'object': 'button_add',
   65                 'label': ' Add',
   66                 'icon': fetch_icon('oxygen.actions.list-add-relax-blue', "22x22"),
   67                 'method': self.action_bmrb_citation,
   68                 'tooltip': "Specify a citation to be added the BMRB data file."
   69             }
   70         ]
   71 
   72 
   73     def update_data(self):
   74         """Method called from self.build_element_safe() to update the list data."""
   75 
   76         # Expand the number of rows to match the number of entries, and add the data.
   77         n = 0
   78         if hasattr(cdp, 'exp_info') and hasattr(cdp.exp_info, 'citations'):
   79             n = len(cdp.exp_info.citations)
   80             for i in range(n):
   81                 # Set the citation ID.
   82                 if dep_check.wx_classic:
   83                     self.element.InsertStringItem(i, str_to_gui(cdp.exp_info.citations[i].cite_id))
   84                 else:
   85                     self.element.InsertItem(i, str_to_gui(cdp.exp_info.citations[i].cite_id))