Пример #1
0
 def __repr__(self):
     return u'' + \
     '       title: %s\n' % td(self.title) + \
     '     authors: %s\n' % self.authors + \
     '    keywords: %s\n' % self.keywords + \
     ' publication: %s\n' % self.publication + \
     '        date: %s\n' % self.date + \
     '      volume: %s\n' % self.volume + \
     '       pages: %s\n' % self.pages + \
     '         doi: %s\n' % self.doi
Пример #2
0
 def __repr__(self):
     return u'' + \
     'ref_id: %s\n' % self.ref_id + \
     'title: %s\n' % td(self.title) + \
     'authors: %s\n' % self.authors + \
     'publication: %s\n' % self.publication + \
     'volume: %s\n' % self.volume + \
     'date: %s\n' % self.date + \
     'pages: %s\n' % self.pages + \
     'pubmed_link: %s\n' % self.pubmed + \
     'crossref_link: %s\n' % self.crossref + \
     'CAS_link: %s\n' % self.cas + \
     'ISI_link: %s\n' % self.isi + \
     'ADS_link: %s\n' % self.ads + \
     'doi: %s\n' % self.doi
Пример #3
0
 def __repr__(self):
     return u'' + \
     '                    ref_id: %s\n' % self.ref_id + \
     '                     title: %s\n' % td(self.title) + \
     '                   authors: %s\n' % self.authors + \
     '               publication: %s\n' % self.publication + \
     '                    volume: %s\n' % self.volume + \
     '                      date: %s\n' % self.date + \
     '                     pages: %s\n' % self.pages + \
     '               pubmed_link: %s\n' % self.pubmed + \
     '                 pubmed_id: %s\n' % self.pubmed_id + \
     '             crossref_link: %s\n' % self.crossref + \
     '                  CAS_link: %s\n' % self.cas + \
     '             abstract_link: %s\n' % self.abstract + \
     '           references_link: %s\n' % self.ref_references + \
     '                  pdf_link: %s\n' % self.pdf_link + \
     '                       doi: %s\n' % self.doi + \
     'web of science times cited: %s\n' % self.citetimes
Пример #4
0
    def ref_to_label(self, ref):
        """
        Creates a ReferenceLabel object from a single paper reference.
        Formats title, author information for display, connects functionality
        to the label object.
        Used by get_refs().

        Parameters
        ----------
        ref: dict
            Contains information from a single paper reference.

        Returns
        -------
        ref_label: ReferenceLabel
            For display in reference box.
        """
        # Extract main display info
        ref_id = ref.get('ref_id')
        ref_title = ref.get('title')
        ref_author_list = ref.get('authors')
        ref_doi = ref.get('doi')
        ref_year = ref.get('year')
        if ref_year is None:
            ref_year = ref.get('date')

        # Format short and long author lists
        if ref_author_list is not None:
            ref_full_authors = '; '.join(ref_author_list)
            if len(ref_author_list) > 2:
                ref_first_authors = ref_author_list[0] + ', ' + ref_author_list[1] + ', et al.'
            else:
                ref_first_authors = ref_full_authors

        # Initialize indicator about whether reference is in library
        in_lib = 2

        # Build up strings with existing info
        # Small text is for abbreviated preview.
        # Expanded text is additional information for the larger
        # reference view when a label is clicked.
        ref_small_text = ''
        ref_expanded_text = ''
        if ref_id is not None:
            ref_small_text = ref_small_text + str(ref_id)
            ref_expanded_text = ref_expanded_text + str(ref_id)
        if ref_author_list is not None:
            ref_small_text = ref_small_text + '. ' + ref_first_authors
            ref_expanded_text = ref_expanded_text + '. ' + ref_full_authors
        if ref.get('publication') is not None:
            ref_expanded_text = ref_expanded_text + '\n' + ref.get('publication')
        if ref_year is not None:
            ref_small_text = ref_small_text + ', ' + ref_year
            ref_expanded_text = ref_expanded_text + ', ' + ref_year
        if ref_title is not None:
            ref_small_text = ref_small_text + ', ' + ref_title
            ref_expanded_text = ref_expanded_text + '\n' + ref_title
        if ref_doi is not None:
            ref_expanded_text = ref_expanded_text + '\n' + ref_doi
            in_library = self.library.check_for_document(ref_doi)
            if in_library:
                in_lib = 1
            else:
                in_lib = 0

        # Cut off length of small text to fit within window
        ref_small_text = td(ref_small_text, 66)

        # Make ReferenceLabel object and set attributes
        ref_label = ReferenceLabel(ref_small_text, self)
        ref_label.small_text = ref_small_text
        ref_label.expanded_text = ref_expanded_text
        ref_label.reference = ref
        ref_label.doi = ref.get('doi')

        # Connect click to expanding the label
        # Connect double click to opening notes/info window
        ref_label.ClickFilter.clicked.connect(self.change_ref_label)
        ref_label.ClickFilter.doubleclicked.connect(self.show_ref_notes_box)

        # Append all labels to reference text lists in in Data()
        self.data.small_ref_labels.append(ref_small_text)
        self.data.expanded_ref_labels.append(ref_expanded_text)

        # Make widget background color green if document is in library.
        # Red if not in library.
        # Neutral if there is no DOI
        if in_lib == 1:
            ref_label.setStyleSheet("background-color: rgba(0,255,0,0.25);")
        elif in_lib == 0:
            ref_label.setStyleSheet("background-color: rgba(255,0,0,0.25);")

        return ref_label