Beispiel #1
0
    def test03 (self):

	ag = Fields.AuthorGroup ()

	ag.append (Fields.Author ("Jäger, Herbert"))
        item = {'author': ag, 'title': 'Bonjour tristesse'}
        r = userformat.author_title_format (item)
	self.assertEqual (r, 'Jäger, H.: Bonjour tristesse')
Beispiel #2
0
    def test02 (self):
        
        ag = Fields.AuthorGroup()

        ag.append (Fields.Author ("Françoise Sagan"))
        item = {'author': ag, 'title': 'Bonjour tristesse'}
        r = userformat.author_title_format (item)
        self.assertEqual (r, 'Sagan, F.: Bonjour tristesse')
Beispiel #3
0
    def test03(self):

        ag = Fields.AuthorGroup()

        ag.append(Fields.Author("Jäger, Herbert"))
        item = {'author': ag, 'title': 'Bonjour tristesse'}
        r = userformat.author_title_format(item)
        self.assertEqual(r, 'Jäger, H.: Bonjour tristesse')
Beispiel #4
0
    def test02(self):

        ag = Fields.AuthorGroup()

        ag.append(Fields.Author("Françoise Sagan"))
        item = {'author': ag, 'title': 'Bonjour tristesse'}
        r = userformat.author_title_format(item)
        self.assertEqual(r, 'Sagan, F.: Bonjour tristesse')
Beispiel #5
0
    def display(self, iterator):

        # clear the access table
        self.access = []

        Utils.set_cursor(self.w, 'clock')

        self.model.clear()

        for entry in iterator:
            row = []

            i = 0

            for f in self.fields:
                row.append(i)
                i = i + 1

                if f == '-key-':
                    row.append((str(entry.key.key)).decode('latin-1'))

                elif f == '-type-':
                    row.append(str(entry.type.name))  ## ascii

                elif f == '-author/editor-':
                    row.append(
                        userformat.author_editor_format(entry).decode(
                            'latin-1'))

                elif f == '-author/title-':
                    row.append(
                        userformat.author_title_format(entry).decode(
                            'latin-1'))

                elif entry.has_key(f):

                    if Types.get_field(f).type == Fields.AuthorGroup:
                        text = join(map(lambda a: str(a.last), entry[f]), ', ')
                    elif Types.get_field(f).type == Fields.Date:
                        text = str(entry[f].year)
                    else:
                        text = str(entry[f])

                    row.append(text.decode('latin-1'))
                else:
                    row.append('')

            if True:
                row.append(i)
                if Resource.is_viewable(entry):
                    row.append(self.gvpixbuf)
                else:
                    row.append(None)

            iter = self.model.append()

            apply(self.model.set, [iter] + row)

            self.access.append(entry)

            entry = iterator.next()

        Utils.set_cursor(self.w, 'normal')
        return
Beispiel #6
0
    def display (self, iterator):

        # clear the access table
        self.access = []

        Utils.set_cursor (self.w, 'clock')

        self.model.clear ()

        for entry in iterator:
            row = []

            i = 0

            for f in self.fields:
                row.append (i)
                i = i + 1

                if f == '-key-':
                    row.append ((str (entry.key.key)).decode ('latin-1'))

                elif f == '-type-':
                    row.append (str (entry.type.name)) ## ascii

                elif f == '-author/editor-':
                    row.append (userformat.author_editor_format
                                (entry).decode ('latin-1'))

                elif f == '-author/title-':
                    row.append (userformat.author_title_format
                                (entry).decode ('latin-1'))

                elif entry.has_key (f):

                    if Types.get_field (f).type == Fields.AuthorGroup:
                        text = join (map (lambda a: str (a.last), entry [f]), ', ')
                    elif Types.get_field (f).type == Fields.Date:
                        text = str (entry [f].year)
                    else:
                        text = str (entry [f])

                    row.append (text.decode ('latin-1'))
                else:
                    row.append ('')

            if True:
                row.append (i)
                if Resource.is_viewable (entry):
                    row.append (self.gvpixbuf)
                else:
                    row.append (None)

            iter = self.model.append  ()

            apply (self.model.set, [iter] + row)

            self.access.append (entry)

            entry = iterator.next ()

        Utils.set_cursor (self.w, 'normal')
        return