Exemplo n.º 1
0
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        WindowStateReader.__init__(self)
        WindowStateWriter.__init__(self)
        self._db = BookDbLayer()

        self.userConfigDir = QtCore.QDir.homePath() + QtCore.QDir.separator() + \
                             '.pyhomelib';
        if not QtCore.QFileInfo(self.userConfigDir).isDir():
            QtCore.QDir.home().mkdir('.pyhomelib')
        self.uiSettingsFile = self.userConfigDir + QtCore.QDir.separator() + \
                              'ui.xml'
        self.programSettings = MySettings(self.userConfigDir +
                                          QtCore.QDir.separator() +
                                          'pyhomelib.conf')

        if len(sys.argv) < 2:
            dbname = self.userConfigDir + QtCore.QDir.separator() + \
                     'default.sqlite'
        else:
            dbname = QtCore.QString.fromUtf8(sys.argv[1])

        genreModel = GenreTreeModelReader('genres.xml')

        info = QtCore.QFileInfo(dbname)
        if info.exists() and info.size() > 0:
            self._db.open(dbname)
        else:
            QtGui.QMessageBox.information(self, self.tr("Information"),
                QtCore.QString(self.tr("Database doesn't exists, recreating: %1"))
                .arg(dbname))
            self._db.create(dbname, 'Default', '', genreModel.list(),
                     [self.tr('Favorites')])

        try:
            import sqlite3ext
            handle = db().driver().handle()
            sqlite3ext.load_icu(handle.data().ascobject())
        except ImportError:
            pass

        self.setupUi(self)
        QtGui.qApp.setStyleSheet(QtCore.QResource(":resources/pyhomelib.css").data())
        self.appTitle = self.windowTitle()
        self.prependToTitle(self._db.getDbProperty('name').toString())
        self.actionRuLetterA.setText(u"А")
        self.actionRuLetterB.setText(u"Б")
        self.actionRuLetterV.setText(u"В")
        self.actionRuLetterG.setText(u"Г")
        self.actionRuLetterD.setText(u"Д")
        self.actionRuLetterE.setText(u"Е")
        self.actionRuLetterYo.setText(u"Ё")
        self.actionRuLetterZh.setText(u"Ж")
        self.actionRuLetterZ.setText(u"З")
        self.actionRuLetterI.setText(u"И")
        self.actionRuLetterY.setText(u"Й")
        self.actionRuLetterK.setText(u"К")
        self.actionRuLetterL.setText(u"Л")
        self.actionRuLetterM.setText(u"М")
        self.actionRuLetterN.setText(u"Н")
        self.actionRuLetterO.setText(u"О")
        self.actionRuLetterP.setText(u"П")
        self.actionRuLetterR.setText(u"Р")
        self.actionRuLetterS.setText(u"С")
        self.actionRuLetterT.setText(u"Т")
        self.actionRuLetterU.setText(u"У")
        self.actionRuLetterF.setText(u"Ф")
        self.actionRuLetterH.setText(u"Х")
        self.actionRuLetterTs.setText(u"Ц")
        self.actionRuLetterCh.setText(u"Ч")
        self.actionRuLetterSh.setText(u"Ш")
        self.actionRuLetterSch.setText(u"Щ")
        self.actionRuLetterYy.setText(u"Ы")
        self.actionRuLetterEe.setText(u"Э")
        self.actionRuLetterYu.setText(u"Ю")
        self.actionRuLetterYa.setText(u"Я")

        self.lettersGroup = QtGui.QActionGroup(self)
        for a in self.findChildren(QtGui.QAction):
            if a.objectName().startsWith('actionRuLetter') or \
               a.objectName().startsWith('actionEnLetter'):
                self.lettersGroup.addAction(a)

        self.authorsModel = SqlQueryModel(self, self._db, "authorid, lastname, firstname",
                                                          "libauthorname",
                                                          None,
                                                          "lastname, firstname")
        self.authorsView.setModel(self.authorsModel)
        self.setTableAuthorsModelQuery()
        self.authorsView.hideColumn(0)
        for index, name in enumerate([self.tr("authorid"),
                                      self.tr("Last name"),
                                      self.tr("First name")]):
            self.authorsView.model().setHeaderData(index, QtCore.Qt.Horizontal, name)

        self.sequencesModel = SqlQueryModel(self, self._db, "seqid, seqname",
                                                            "libseqname",
                                                            None,
                                                            "seqname")
        self.sequencesView.setModel(self.sequencesModel)
        self.sequencesModel.select()
        self.sequencesView.hideColumn(0)
        for index, name in enumerate([self.tr("seqid"),
                                      self.tr("Sequence")]):
            self.sequencesView.model().setHeaderData(index, QtCore.Qt.Horizontal, name)

        self.genresTree.setModel(genreModel)
        self.genresTree.hideColumn(1)


        self.bookSearchModel = SqlQueryModel(self, self._db, "b.bookid, firstname, lastname, title, seqname, genredesc, lang, year",
                                                             "libbook b LEFT JOIN libsequence s ON b.bookid = s.bookid LEFT JOIN libseqname sn ON s.seqid = sn.seqid LEFT JOIN libauthor a ON b.bookid = a.bookid LEFT JOIN libauthorname an ON a.authorid = an.authorid LEFT JOIN libgenre g ON b.bookid = g.bookid LEFT JOIN libgenrelist gl ON g.genreid = gl.genreid",
                                                             "b.bookid = 0",
                                                             None,
                                                             "1")
        self.bookSearchView.setModel(self.bookSearchModel)
        self.bookSearchModel.select()
        self.bookSearchView.hideColumn(0)
        for index, name in enumerate([self.tr("bookid"),
                                      self.tr("First name"),
                                      self.tr("Last name"),
                                      self.tr("Book Title"),
                                      self.tr("Sequence"),
                                      self.tr("Genre"),
                                      self.tr("Lang"),
                                      self.tr("Year")]):
            self.bookSearchModel.setHeaderData(index, QtCore.Qt.Horizontal, name)

        self.groupsModel = SqlQueryModel(self, self._db, "groupid, groupname",
                                                         "libgrouplist",
                                                         None,
                                                         "groupname")
        self.groupsView.setModel(self.groupsModel)
        self.groupsModel.select()
        self.groupsView.hideColumn(0)
        for index, name in enumerate([self.tr("groupid"),
                                      self.tr("Group")]):
            self.groupsView.model().setHeaderData(index, QtCore.Qt.Horizontal, name)

        self.booksByAuthorModel = SqlQueryModel(self, self._db, "bookid, title, seqname, genredesc, lang, year",
                                                                "libauthor a INNER JOIN libbook b USING(bookid) LEFT JOIN libseqname s ON b.seqid = s.seqid LEFT JOIN libgenrelist g ON b.genreid = g.genreid",
                                                                "a.authorid = ?")
        self.booksByAuthorView.setModel(self.booksByAuthorModel)
        self.booksByAuthorModel.addBindValue(0)
        self.booksByAuthorModel.select()
        self.booksByAuthorView.hideColumn(0)
        for index, name in enumerate([self.tr("bookid"),
                                      self.tr("Book Title"),
                                      self.tr("Sequence"),
                                      self.tr("Genre"),
                                      self.tr("Lang"),
                                      self.tr("Year")]):
            self.booksByAuthorModel.setHeaderData(index, QtCore.Qt.Horizontal, name)

        self.booksBySeqModel = SqlQueryModel(self, self._db, "bookid, firstname, lastname, title, genredesc, lang, year",
                                                             "libsequence s INNER JOIN libbook b USING(bookid) LEFT JOIN libauthorname a ON b.authorid = a.authorid LEFT JOIN libgenrelist g ON b.genreid = g.genreid",
                                                             "s.seqid = ?")
        self.booksBySeqView.setModel(self.booksBySeqModel)
        self.booksBySeqModel.addBindValue(0)
        self.booksBySeqModel.select()
        self.booksBySeqView.hideColumn(0)
        for index, name in enumerate([self.tr("bookid"),
                                      self.tr("First name"),
                                      self.tr("Last name"),
                                      self.tr("Book Title"),
                                      self.tr("Genre"),
                                      self.tr("Lang"),
                                      self.tr("Year")]):
            self.booksBySeqModel.setHeaderData(index, QtCore.Qt.Horizontal, name)

        self.booksByGenreModel = SqlQueryModel(self, self._db, "bookid, firstname, lastname, title, seqname, lang, year",
                                                               "libgenre g INNER JOIN libbook b USING(bookid) LEFT JOIN libauthorname a ON b.authorid = a.authorid LEFT JOIN libseqname s ON b.seqid = s.seqid",
                                                               "g.genreid = ?")
        self.booksByGenreView.setModel(self.booksByGenreModel)
        self.booksByGenreModel.addBindValue(0)
        self.booksByGenreModel.select()
        self.booksByGenreView.hideColumn(0)
        for index, name in enumerate([self.tr("bookid"),
                                      self.tr("First name"),
                                      self.tr("Last name"),
                                      self.tr("Book Title"),
                                      self.tr("Sequence"),
                                      self.tr("Lang"),
                                      self.tr("Year")]):
            self.booksByGenreModel.setHeaderData(index, QtCore.Qt.Horizontal, name)

        self.booksByGroupModel = SqlQueryModel(self, self._db, "b.bookid, firstname, lastname, title, seqname, genredesc, lang, year",
                                                               "libgroup g INNER JOIN libbook b USING(bookid) LEFT JOIN libseqname s ON b.seqid = s.seqid LEFT JOIN libauthorname a ON b.authorid = a.authorid LEFT JOIN libgenrelist gl ON b.genreid = gl.genreid",
                                                               "g.groupid = ?")
        self.booksByGroupView.setModel(self.booksByGroupModel)
        self.booksByGroupModel.addBindValue(0)
        self.booksByGroupModel.select()
        self.booksByGroupView.hideColumn(0)
        for index, name in enumerate([self.tr("bookid"),
                                      self.tr("First name"),
                                      self.tr("Last name"),
                                      self.tr("Book Title"),
                                      self.tr("Sequence"),
                                      self.tr("Genre"),
                                      self.tr("Lang"),
                                      self.tr("Year")]):
            self.booksByGroupModel.setHeaderData(index, QtCore.Qt.Horizontal, name)

        self.readStateFrom(self.uiSettingsFile)
        self.actionRussianAlphabet.setChecked(self.ruLettersToolbar.isVisibleTo(self))
        self.actionEnglishAlphabet.setChecked(self.enLettersToolbar.isVisibleTo(self))

        if not self.programSettings.getRowHeight():
            self.programSettings.writeRowHeight(self.authorsView.verticalHeader().defaultSectionSize())
        else:
            self.setRowHeight(self.programSettings.getRowHeight())

        for key in ('/', 'Ctrl+F'):
            QtGui.QShortcut(key, self).activated.connect(self.on_quickFindShortcut_activated)

        self.parserThread = FB2BookParserThread()
        self.parserThread.bookParsed.connect(self.bookParsed)
        self.parserThread.start()
Exemplo n.º 2
0
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        WindowStateReader.__init__(self)
        WindowStateWriter.__init__(self)

        if not QtSql.QSqlDatabase.drivers().contains("QSQLITE"):
            raise Exception, "Fatal error: QSQLITE database driver is not found!"

        self.userConfigDir = QtCore.QDir.homePath() + QtCore.QDir.separator() + \
                             '.pyhomelib';
        if not QtCore.QFileInfo(self.userConfigDir).isDir():
            QtCore.QDir.home().mkdir('.pyhomelib')
        self.uiSettingsFile = self.userConfigDir + QtCore.QDir.separator() + \
                              'ui.xml'
        self.programSettings = MySettings(self.userConfigDir +
                                          QtCore.QDir.separator() +
                                          'pyhomelib.conf')

        if len(sys.argv) < 2:
            dbname = self.userConfigDir + QtCore.QDir.separator() + \
                     'default.sqlite'
        else:
            dbname = sys.argv[1]

        QtSql.QSqlDatabase.addDatabase("QSQLITE")

        genreModel = GenreTreeModelReader('genres.xml')

        info = QtCore.QFileInfo(dbname)
        if info.exists() and info.size() > 0:
            openDb(dbname)
        else:
            QtGui.QMessageBox.information(self, self.tr("Information"),
                QtCore.QString(self.tr("Database doesn't exists, recreating: %1"))
                .arg(dbname))
            createDb(dbname, 'Default', '', genreModel.list(),
                     [self.tr('Favorites')])

        self.setupUi(self)
        self.appTitle = self.windowTitle()
        self.appendToTitle(getDbProperty('name').toString())
        self.actionRuLetterA.setText(u"А")
        self.actionRuLetterB.setText(u"Б")
        self.actionRuLetterV.setText(u"В")
        self.actionRuLetterG.setText(u"Г")
        self.actionRuLetterD.setText(u"Д")
        self.actionRuLetterE.setText(u"Е")
        self.actionRuLetterYo.setText(u"Ё")
        self.actionRuLetterZh.setText(u"Ж")
        self.actionRuLetterZ.setText(u"З")
        self.actionRuLetterI.setText(u"И")
        self.actionRuLetterY.setText(u"Й")
        self.actionRuLetterK.setText(u"К")
        self.actionRuLetterL.setText(u"Л")
        self.actionRuLetterM.setText(u"М")
        self.actionRuLetterN.setText(u"Н")
        self.actionRuLetterO.setText(u"О")
        self.actionRuLetterP.setText(u"П")
        self.actionRuLetterR.setText(u"Р")
        self.actionRuLetterS.setText(u"С")
        self.actionRuLetterT.setText(u"Т")
        self.actionRuLetterU.setText(u"У")
        self.actionRuLetterF.setText(u"Ф")
        self.actionRuLetterH.setText(u"Х")
        self.actionRuLetterTs.setText(u"Ц")
        self.actionRuLetterCh.setText(u"Ч")
        self.actionRuLetterSh.setText(u"Ш")
        self.actionRuLetterSch.setText(u"Щ")
        self.actionRuLetterYy.setText(u"Ы")
        self.actionRuLetterEe.setText(u"Э")
        self.actionRuLetterYu.setText(u"Ю")
        self.actionRuLetterYa.setText(u"Я")

        self.lettersGroup = QtGui.QActionGroup(self)
        for a in self.findChildren(QtGui.QAction):
            if a.objectName().startsWith('actionRuLetter') or \
               a.objectName().startsWith('actionEnLetter'):
                self.lettersGroup.addAction(a)

        self.authorsModel = SqlQueryModelEx(self, "authorid, lastname, firstname",
                                                  "libauthorname",
                                                  None,
                                                  "lastname, firstname")
        self.authorsView.setModel(self.authorsModel)
        self.setTableAuthorsModelQuery()
        self.authorsView.hideColumn(0)
        self.authorsView.model().setHeaderData(1, QtCore.Qt.Horizontal, self.tr("Last name"))
        self.authorsView.model().setHeaderData(2, QtCore.Qt.Horizontal, self.tr("First name"))

        self.sequencesModel = SqlQueryModelEx(self, "seqid, seqname",
                                                    "libseqname",
                                                    None,
                                                    "seqname")
        self.sequencesView.setModel(self.sequencesModel)
        self.sequencesModel.select()
        self.sequencesView.hideColumn(0)
        self.sequencesView.model().setHeaderData(1, QtCore.Qt.Horizontal, self.tr("Sequence"))

        self.genresTree.setModel(genreModel)
        self.genresTree.hideColumn(1)


        self.bookSearchModel = SqlQueryModelEx(self, "b.bookid, firstname, lastname, title, seqname, genredesc, lang, year",
                                                     "libbook b LEFT JOIN libsequence s ON b.bookid = s.bookid LEFT JOIN libseqname sn ON s.seqid = sn.seqid LEFT JOIN libauthor a ON b.bookid = a.bookid LEFT JOIN libauthorname an ON a.authorid = an.authorid LEFT JOIN libgenre g ON b.bookid = g.bookid LEFT JOIN libgenrelist gl ON g.genreid = gl.genreid",
                                                     "b.bookid = 0",
                                                     None,
                                                     "1")
        self.bookSearchView.setModel(self.bookSearchModel)
        self.bookSearchModel.select()
        self.bookSearchView.hideColumn(0)
        self.bookSearchModel.setHeaderData(1, QtCore.Qt.Horizontal, self.tr("First name"))
        self.bookSearchModel.setHeaderData(2, QtCore.Qt.Horizontal, self.tr("Last name"))
        self.bookSearchModel.setHeaderData(3, QtCore.Qt.Horizontal, self.tr("Book Title"))
        self.bookSearchModel.setHeaderData(4, QtCore.Qt.Horizontal, self.tr("Sequence"))
        self.bookSearchModel.setHeaderData(5, QtCore.Qt.Horizontal, self.tr("Genre"))
        self.bookSearchModel.setHeaderData(6, QtCore.Qt.Horizontal, self.tr("Lang"))
        self.bookSearchModel.setHeaderData(7, QtCore.Qt.Horizontal, self.tr("Year"))

        self.groupsModel = SqlQueryModelEx(self, "groupid, groupname",
                                                 "libgrouplist",
                                                 None,
                                                 "groupname")
        self.groupsView.setModel(self.groupsModel)
        self.groupsModel.select()
        self.groupsView.hideColumn(0)
        self.groupsView.model().setHeaderData(1, QtCore.Qt.Horizontal, self.tr("Group"))

        self.booksByAuthorModel = SqlQueryModelEx(self, "bookid, title, seqname, genredesc, lang, year",
                                                        "libauthor a INNER JOIN libbook b USING(bookid) LEFT JOIN libseqname s ON b.seqid = s.seqid LEFT JOIN libgenrelist g ON b.genreid = g.genreid",
                                                        "a.authorid = ?")
        self.booksByAuthorView.setModel(self.booksByAuthorModel)
        self.booksByAuthorModel.addBindValue(0)
        self.booksByAuthorModel.select()
        self.booksByAuthorView.hideColumn(0)
        self.booksByAuthorModel.setHeaderData(1, QtCore.Qt.Horizontal, self.tr("Book Title"))
        self.booksByAuthorModel.setHeaderData(2, QtCore.Qt.Horizontal, self.tr("Sequence"))
        self.booksByAuthorModel.setHeaderData(3, QtCore.Qt.Horizontal, self.tr("Genre"))
        self.booksByAuthorModel.setHeaderData(4, QtCore.Qt.Horizontal, self.tr("Lang"))
        self.booksByAuthorModel.setHeaderData(5, QtCore.Qt.Horizontal, self.tr("Year"))

        self.booksBySeqModel = SqlQueryModelEx(self, "bookid, firstname, lastname, title, genredesc, lang, year",
                                                     "libsequence s INNER JOIN libbook b USING(bookid) LEFT JOIN libauthorname a ON b.authorid = a.authorid LEFT JOIN libgenrelist g ON b.genreid = g.genreid",
                                                     "s.seqid = ?")
        self.booksBySeqView.setModel(self.booksBySeqModel)
        self.booksBySeqModel.addBindValue(0)
        self.booksBySeqModel.select()
        self.booksBySeqView.hideColumn(0)
        self.booksBySeqModel.setHeaderData(1, QtCore.Qt.Horizontal, self.tr("First name"))
        self.booksBySeqModel.setHeaderData(2, QtCore.Qt.Horizontal, self.tr("Last name"))
        self.booksBySeqModel.setHeaderData(3, QtCore.Qt.Horizontal, self.tr("Book Title"))
        self.booksBySeqModel.setHeaderData(4, QtCore.Qt.Horizontal, self.tr("Genre"))
        self.booksBySeqModel.setHeaderData(5, QtCore.Qt.Horizontal, self.tr("Lang"))
        self.booksBySeqModel.setHeaderData(6, QtCore.Qt.Horizontal, self.tr("Year"))

        self.booksByGenreModel = SqlQueryModelEx(self, "bookid, firstname, lastname, title, seqname, lang, year",
                                                       "libgenre g INNER JOIN libbook b USING(bookid) LEFT JOIN libauthorname a ON b.authorid = a.authorid LEFT JOIN libseqname s ON b.seqid = s.seqid",
                                                       "g.genreid = ?")
        self.booksByGenreView.setModel(self.booksByGenreModel)
        self.booksByGenreModel.addBindValue(0)
        self.booksByGenreModel.select()
        self.booksByGenreView.hideColumn(0)
        self.booksByGenreModel.setHeaderData(1, QtCore.Qt.Horizontal, self.tr("First name"))
        self.booksByGenreModel.setHeaderData(2, QtCore.Qt.Horizontal, self.tr("Last name"))
        self.booksByGenreModel.setHeaderData(3, QtCore.Qt.Horizontal, self.tr("Book Title"))
        self.booksByGenreModel.setHeaderData(4, QtCore.Qt.Horizontal, self.tr("Sequence"))
        self.booksByGenreModel.setHeaderData(5, QtCore.Qt.Horizontal, self.tr("Lang"))
        self.booksByGenreModel.setHeaderData(6, QtCore.Qt.Horizontal, self.tr("Year"))

        self.booksByGroupModel = SqlQueryModelEx(self, "b.bookid, firstname, lastname, title, seqname, genredesc, lang, year",
                                                       "libgroup g INNER JOIN libbook b USING(bookid) LEFT JOIN libseqname s ON b.seqid = s.seqid LEFT JOIN libauthorname a ON b.authorid = a.authorid LEFT JOIN libgenrelist gl ON b.genreid = gl.genreid",
                                                       "g.groupid = ?")
        self.booksByGroupView.setModel(self.booksByGroupModel)
        self.booksByGroupModel.addBindValue(0)
        self.booksByGroupModel.select()
        self.booksByGroupView.hideColumn(0)
        self.booksByGroupModel.setHeaderData(1, QtCore.Qt.Horizontal, self.tr("First name"))
        self.booksByGroupModel.setHeaderData(2, QtCore.Qt.Horizontal, self.tr("Last name"))
        self.booksByGroupModel.setHeaderData(3, QtCore.Qt.Horizontal, self.tr("Book Title"))
        self.booksByGroupModel.setHeaderData(4, QtCore.Qt.Horizontal, self.tr("Sequence"))
        self.booksByGroupModel.setHeaderData(5, QtCore.Qt.Horizontal, self.tr("Genre"))
        self.booksByGroupModel.setHeaderData(6, QtCore.Qt.Horizontal, self.tr("Lang"))
        self.booksByGroupModel.setHeaderData(7, QtCore.Qt.Horizontal, self.tr("Year"))

        self.readStateFrom(self.uiSettingsFile)
        self.actionRussianAlphabet.setChecked(self.ruLettersToolbar.isVisibleTo(self))
        self.actionEnglishAlphabet.setChecked(self.enLettersToolbar.isVisibleTo(self))

        self.parserThread = FB2BookParserThread()
        self.parserThread.bookParsed.connect(self.bookParsed)
        self.parserThread.start()
Exemplo n.º 3
0
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)
        WindowStateReader.__init__(self)
        WindowStateWriter.__init__(self)
        self._db = BookDbLayer()

        self.userConfigDir = QtCore.QDir.homePath() + QtCore.QDir.separator() + \
                             '.pyhomelib'
        if not QtCore.QFileInfo(self.userConfigDir).isDir():
            QtCore.QDir.home().mkdir('.pyhomelib')
        self.uiSettingsFile = self.userConfigDir + QtCore.QDir.separator() + \
                              'ui.xml'
        self.programSettings = MySettings(self.userConfigDir +
                                          QtCore.QDir.separator() +
                                          'pyhomelib.conf')

        if len(sys.argv) < 2:
            dbname = self.userConfigDir + QtCore.QDir.separator() + \
                     'default.sqlite'
        else:
            dbname = QtCore.QString.fromUtf8(sys.argv[1])

        genreModel = GenreTreeModelReader('genres.xml')

        info = QtCore.QFileInfo(dbname)
        if info.exists() and info.size() > 0:
            self._db.open(dbname)
        else:
            QtGui.QMessageBox.information(
                self, self.tr("Information"),
                QtCore.QString(
                    self.tr("Database doesn't exists, recreating: %1")).arg(
                        dbname))
            self._db.create(dbname, 'Default', '', genreModel.list(),
                            [self.tr('Favorites')])

        try:
            import sqlite3ext
            handle = db().driver().handle()
            sqlite3ext.load_icu(handle.data().ascobject())
        except ImportError:
            pass

        self.setupUi(self)
        QtGui.qApp.setStyleSheet(
            QtCore.QResource(":resources/pyhomelib.css").data())
        self.appTitle = self.windowTitle()
        self.prependToTitle(self._db.getDbProperty('name').toString())
        self.actionRuLetterA.setText(u"А")
        self.actionRuLetterB.setText(u"Б")
        self.actionRuLetterV.setText(u"В")
        self.actionRuLetterG.setText(u"Г")
        self.actionRuLetterD.setText(u"Д")
        self.actionRuLetterE.setText(u"Е")
        self.actionRuLetterYo.setText(u"Ё")
        self.actionRuLetterZh.setText(u"Ж")
        self.actionRuLetterZ.setText(u"З")
        self.actionRuLetterI.setText(u"И")
        self.actionRuLetterY.setText(u"Й")
        self.actionRuLetterK.setText(u"К")
        self.actionRuLetterL.setText(u"Л")
        self.actionRuLetterM.setText(u"М")
        self.actionRuLetterN.setText(u"Н")
        self.actionRuLetterO.setText(u"О")
        self.actionRuLetterP.setText(u"П")
        self.actionRuLetterR.setText(u"Р")
        self.actionRuLetterS.setText(u"С")
        self.actionRuLetterT.setText(u"Т")
        self.actionRuLetterU.setText(u"У")
        self.actionRuLetterF.setText(u"Ф")
        self.actionRuLetterH.setText(u"Х")
        self.actionRuLetterTs.setText(u"Ц")
        self.actionRuLetterCh.setText(u"Ч")
        self.actionRuLetterSh.setText(u"Ш")
        self.actionRuLetterSch.setText(u"Щ")
        self.actionRuLetterYy.setText(u"Ы")
        self.actionRuLetterEe.setText(u"Э")
        self.actionRuLetterYu.setText(u"Ю")
        self.actionRuLetterYa.setText(u"Я")

        self.lettersGroup = QtGui.QActionGroup(self)
        for a in self.findChildren(QtGui.QAction):
            if a.objectName().startsWith('actionRuLetter') or \
               a.objectName().startsWith('actionEnLetter'):
                self.lettersGroup.addAction(a)

        self.authorsModel = SqlQueryModel(self, self._db,
                                          "authorid, lastname, firstname",
                                          "libauthorname", None,
                                          "lastname, firstname")
        self.authorsView.setModel(self.authorsModel)
        self.setTableAuthorsModelQuery()
        self.authorsView.hideColumn(0)
        for index, name in enumerate(
            [self.tr("authorid"),
             self.tr("Last name"),
             self.tr("First name")]):
            self.authorsView.model().setHeaderData(index, QtCore.Qt.Horizontal,
                                                   name)

        self.sequencesModel = SqlQueryModel(self, self._db, "seqid, seqname",
                                            "libseqname", None, "seqname")
        self.sequencesView.setModel(self.sequencesModel)
        self.sequencesModel.select()
        self.sequencesView.hideColumn(0)
        for index, name in enumerate([self.tr("seqid"), self.tr("Sequence")]):
            self.sequencesView.model().setHeaderData(index,
                                                     QtCore.Qt.Horizontal,
                                                     name)

        self.genresTree.setModel(genreModel)
        self.genresTree.hideColumn(1)

        self.bookSearchModel = SqlQueryModel(
            self, self._db,
            "b.bookid, firstname, lastname, title, seqname, genredesc, lang, year",
            "libbook b LEFT JOIN libsequence s ON b.bookid = s.bookid LEFT JOIN libseqname sn ON s.seqid = sn.seqid LEFT JOIN libauthor a ON b.bookid = a.bookid LEFT JOIN libauthorname an ON a.authorid = an.authorid LEFT JOIN libgenre g ON b.bookid = g.bookid LEFT JOIN libgenrelist gl ON g.genreid = gl.genreid",
            "b.bookid = 0", None, "1")
        self.bookSearchView.setModel(self.bookSearchModel)
        self.bookSearchModel.select()
        self.bookSearchView.hideColumn(0)
        for index, name in enumerate([
                self.tr("bookid"),
                self.tr("First name"),
                self.tr("Last name"),
                self.tr("Book Title"),
                self.tr("Sequence"),
                self.tr("Genre"),
                self.tr("Lang"),
                self.tr("Year")
        ]):
            self.bookSearchModel.setHeaderData(index, QtCore.Qt.Horizontal,
                                               name)

        self.groupsModel = SqlQueryModel(self, self._db, "groupid, groupname",
                                         "libgrouplist", None, "groupname")
        self.groupsView.setModel(self.groupsModel)
        self.groupsModel.select()
        self.groupsView.hideColumn(0)
        for index, name in enumerate([self.tr("groupid"), self.tr("Group")]):
            self.groupsView.model().setHeaderData(index, QtCore.Qt.Horizontal,
                                                  name)

        self.booksByAuthorModel = SqlQueryModel(
            self, self._db, "bookid, title, seqname, genredesc, lang, year",
            "libauthor a INNER JOIN libbook b USING(bookid) LEFT JOIN libseqname s ON b.seqid = s.seqid LEFT JOIN libgenrelist g ON b.genreid = g.genreid",
            "a.authorid = ?")
        self.booksByAuthorView.setModel(self.booksByAuthorModel)
        self.booksByAuthorModel.addBindValue(0)
        self.booksByAuthorModel.select()
        self.booksByAuthorView.hideColumn(0)
        for index, name in enumerate([
                self.tr("bookid"),
                self.tr("Book Title"),
                self.tr("Sequence"),
                self.tr("Genre"),
                self.tr("Lang"),
                self.tr("Year")
        ]):
            self.booksByAuthorModel.setHeaderData(index, QtCore.Qt.Horizontal,
                                                  name)

        self.booksBySeqModel = SqlQueryModel(
            self, self._db,
            "bookid, firstname, lastname, title, genredesc, lang, year",
            "libsequence s INNER JOIN libbook b USING(bookid) LEFT JOIN libauthorname a ON b.authorid = a.authorid LEFT JOIN libgenrelist g ON b.genreid = g.genreid",
            "s.seqid = ?")
        self.booksBySeqView.setModel(self.booksBySeqModel)
        self.booksBySeqModel.addBindValue(0)
        self.booksBySeqModel.select()
        self.booksBySeqView.hideColumn(0)
        for index, name in enumerate([
                self.tr("bookid"),
                self.tr("First name"),
                self.tr("Last name"),
                self.tr("Book Title"),
                self.tr("Genre"),
                self.tr("Lang"),
                self.tr("Year")
        ]):
            self.booksBySeqModel.setHeaderData(index, QtCore.Qt.Horizontal,
                                               name)

        self.booksByGenreModel = SqlQueryModel(
            self, self._db,
            "bookid, firstname, lastname, title, seqname, lang, year",
            "libgenre g INNER JOIN libbook b USING(bookid) LEFT JOIN libauthorname a ON b.authorid = a.authorid LEFT JOIN libseqname s ON b.seqid = s.seqid",
            "g.genreid = ?")
        self.booksByGenreView.setModel(self.booksByGenreModel)
        self.booksByGenreModel.addBindValue(0)
        self.booksByGenreModel.select()
        self.booksByGenreView.hideColumn(0)
        for index, name in enumerate([
                self.tr("bookid"),
                self.tr("First name"),
                self.tr("Last name"),
                self.tr("Book Title"),
                self.tr("Sequence"),
                self.tr("Lang"),
                self.tr("Year")
        ]):
            self.booksByGenreModel.setHeaderData(index, QtCore.Qt.Horizontal,
                                                 name)

        self.booksByGroupModel = SqlQueryModel(
            self, self._db,
            "b.bookid, firstname, lastname, title, seqname, genredesc, lang, year",
            "libgroup g INNER JOIN libbook b USING(bookid) LEFT JOIN libseqname s ON b.seqid = s.seqid LEFT JOIN libauthorname a ON b.authorid = a.authorid LEFT JOIN libgenrelist gl ON b.genreid = gl.genreid",
            "g.groupid = ?")
        self.booksByGroupView.setModel(self.booksByGroupModel)
        self.booksByGroupModel.addBindValue(0)
        self.booksByGroupModel.select()
        self.booksByGroupView.hideColumn(0)
        for index, name in enumerate([
                self.tr("bookid"),
                self.tr("First name"),
                self.tr("Last name"),
                self.tr("Book Title"),
                self.tr("Sequence"),
                self.tr("Genre"),
                self.tr("Lang"),
                self.tr("Year")
        ]):
            self.booksByGroupModel.setHeaderData(index, QtCore.Qt.Horizontal,
                                                 name)

        self.readStateFrom(self.uiSettingsFile)
        self.actionRussianAlphabet.setChecked(
            self.ruLettersToolbar.isVisibleTo(self))
        self.actionEnglishAlphabet.setChecked(
            self.enLettersToolbar.isVisibleTo(self))

        if not self.programSettings.getRowHeight():
            self.programSettings.writeRowHeight(
                self.authorsView.verticalHeader().defaultSectionSize())
        else:
            self.setRowHeight(self.programSettings.getRowHeight())

        for key in ('/', 'Ctrl+F'):
            QtGui.QShortcut(key, self).activated.connect(
                self.on_quickFindShortcut_activated)

        self.parserThread = FB2BookParserThread()
        self.parserThread.bookParsed.connect(self.bookParsed)
        self.parserThread.start()
Exemplo n.º 4
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent, QtCore.Qt.Window)

        self.setupUi(self)

        model = GenreTreeModelReader('genres.xml')

        reader = FB2StreamReader()
        filename = QtCore.QString.fromUtf8(sys.argv[1])
        reader.read(filename)
        info = reader.info
        self.setWindowTitle(info.bookTitle + " - " + self.windowTitle())
        for i in range(min(3, len(info.Authors))):
            self.authorsLayout.addWidget(self.makeLabel(info.Authors[i].makeName()))
        if len(info.Authors) > 3:
            self.authorsLayout.addWidget(self.makeLabel(self.tr("etc.")))
        self.titleLabel.setText(info.bookTitle)
        genres = QtCore.QStringList()
        for genre in info.Genres:
            genres.append(model.genreDescByCode(genre))
        self.genresLabel.setText(genres.join(", "))
        if info.Coverpage.isEmpty() or info.Coverpage.size() <= 120:
            self.coverpageLabel.setText(self.tr("No coverpage"))
        else:
            pixmap = QtGui.QPixmap()
            pixmap.loadFromData(info.Coverpage)
            if pixmap.width() > 200:
                pixmap = pixmap.scaledToWidth(200, QtCore.Qt.SmoothTransformation)
            self.coverpageLabel.setPixmap(pixmap)
            self.annotationEdit.setMaximumHeight(max(pixmap.height(), 200))
        self.annotationEdit.setText(info.Annotation)

        self.filenameLabel.setText(filename)
        self.sizeLabel.setText(QtCore.QString.number(QtCore.QFileInfo(filename).size()))
        self.md5Label.setText(QtCore.QString(self.MD5(filename)))

        layout = self.layout1
        row = 0
        layout.addWidget(self.makeTitleLabel("title-info"), row, 1, 1, 2)
        row += 1
        for genre in info.Genres:
            layout.addWidget(self.makeLabel("genre:"), row, 1)
            layout.addWidget(self.makeEdit(genre), row, 2)
            row += 1
        if info.Keywords:
            layout.addWidget(self.makeLabel("keywords:"), row, 1)
            layout.addWidget(self.makeEdit(info.Keywords), row, 2)
            row += 1
        if info.Date:
            layout.addWidget(self.makeLabel("date:"), row, 1)
            layout.addWidget(self.makeEdit(info.Date), row, 2)
            row += 1
        if info.Lang:
            layout.addWidget(self.makeLabel("lang:"), row, 1)
            layout.addWidget(self.makeEdit(info.Lang, 30), row, 2)
            row += 1
        if info.srcLang:
            layout.addWidget(self.makeLabel("src-lang:"), row, 1)
            layout.addWidget(self.makeEdit(info.srcLang, 30), row, 2)
            row += 1
        for tr in info.Translators:
            layout.addWidget(self.makeLabel("translator:"), row, 1)
            layout.addWidget(self.makeEdit(tr.makeName()), row, 2)
            row +=1
        for seq in info.Sequences:
            layout.addWidget(self.makeLabel("sequence:"), row, 1)
            layout.addWidget(self.makeEdit(seq.sequenceName + " #" +
                                           QtCore.QString.number(seq.sequenceNumber)), row, 2)

        row += 1

        layout.addWidget(self.makeTitleLabel("document-info"), row, 1, 1, 2)
        row += 1
        for author in info.documentAuthors:
            layout.addWidget(self.makeLabel("author:"), row, 1)
            layout.addWidget(self.makeEdit(author.makeName()), row, 2)
            row += 1
        if info.programUsed:
            layout.addWidget(self.makeLabel("program-used:"), row, 1)
            layout.addWidget(self.makeEdit(info.programUsed), row, 2)
            row += 1
        if info.documentDate:
            layout.addWidget(self.makeLabel("date:"), row, 1)
            layout.addWidget(self.makeEdit(info.documentDate), row, 2)
            row += 1
        if info.srcUrl:
            layout.addWidget(self.makeLabel("src-url:"), row, 1)
            layout.addWidget(self.makeEdit(info.srcUrl), row, 2)
            row += 1
        if info.srcOcr:
            layout.addWidget(self.makeLabel("src-ocr:"), row, 1)
            layout.addWidget(self.makeEdit(info.srcOcr), row, 2)
            row += 1
        if info.Id:
            layout.addWidget(self.makeLabel("id:"), row, 1)
            layout.addWidget(self.makeEdit(info.Id), row, 2)
            row += 1
        if info.Version:
            layout.addWidget(self.makeLabel("version:"), row, 1)
            layout.addWidget(self.makeEdit(info.Version, 40), row, 2)
            row += 1
        if info.History:
            layout.addWidget(self.makeLabel("history:"), row, 1)
            edit = QtGui.QTextEdit(info.History, self)
            edit.setReadOnly(True)
            edit.setFrameStyle(QtGui.QFrame.NoFrame)
            layout.addWidget(edit, row, 2)
            row += 1

        layout.addWidget(self.makeTitleLabel("publish-info"), row, 1, 1, 2)
        row += 1
        if info.bookName:
            layout.addWidget(self.makeLabel("book-name:"), row, 1)
            layout.addWidget(self.makeEdit(info.bookName), row, 2)
            row += 1
        if info.Publisher:
            layout.addWidget(self.makeLabel("publisher:"), row, 1)
            layout.addWidget(self.makeEdit(info.Publisher), row, 2)
            row += 1
        if info.City:
            layout.addWidget(self.makeLabel("city:"), row, 1)
            layout.addWidget(self.makeEdit(info.City), row, 2)
            row += 1
        if info.Year:
            layout.addWidget(self.makeLabel("year:"), row, 1)
            layout.addWidget(self.makeEdit(QtCore.QString.number(info.Year), 50), row, 2)
            row += 1
        if info.ISBN:
            layout.addWidget(self.makeLabel("isbn:"), row, 1)
            layout.addWidget(self.makeEdit(info.ISBN), row, 2)
            row += 1
        for seq in info.publisherSequences:
            layout.addWidget(self.makeLabel("sequence:"), row, 1)
            layout.addWidget(self.makeEdit(seq.sequenceName + " #" +
                                           QtCore.QString.number(seq.sequenceNumber)), row, 2)
            row += 1

        spacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Fixed,
                                         QtGui.QSizePolicy.Expanding)
        layout.addItem(spacer, row, 0)

        self.centered = False
Exemplo n.º 5
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent, QtCore.Qt.Window)

        self.setupUi(self)

        model = GenreTreeModelReader('genres.xml')

        reader = FB2StreamReader()
        filename = QtCore.QString.fromUtf8(sys.argv[1])
        reader.read(filename)
        info = reader.info
        self.setWindowTitle(info.bookTitle + " - " + self.windowTitle())
        for i in range(min(3, len(info.Authors))):
            self.authorsLayout.addWidget(
                self.makeLabel(info.Authors[i].makeName()))
        if len(info.Authors) > 3:
            self.authorsLayout.addWidget(self.makeLabel(self.tr("etc.")))
        self.titleLabel.setText(info.bookTitle)
        genres = QtCore.QStringList()
        for genre in info.Genres:
            genres.append(model.genreDescByCode(genre))
        self.genresLabel.setText(genres.join(", "))
        if info.Coverpage.isEmpty() or info.Coverpage.size() <= 120:
            self.coverpageLabel.setText(self.tr("No coverpage"))
        else:
            pixmap = QtGui.QPixmap()
            pixmap.loadFromData(info.Coverpage)
            if pixmap.width() > 200:
                pixmap = pixmap.scaledToWidth(200,
                                              QtCore.Qt.SmoothTransformation)
            self.coverpageLabel.setPixmap(pixmap)
            self.annotationEdit.setMaximumHeight(max(pixmap.height(), 200))
        self.annotationEdit.setText(info.Annotation)

        self.filenameLabel.setText(filename)
        self.sizeLabel.setText(
            QtCore.QString.number(QtCore.QFileInfo(filename).size()))
        self.md5Label.setText(QtCore.QString(self.MD5(filename)))

        layout = self.layout1
        row = 0
        layout.addWidget(self.makeTitleLabel("title-info"), row, 1, 1, 2)
        row += 1
        for genre in info.Genres:
            layout.addWidget(self.makeLabel("genre:"), row, 1)
            layout.addWidget(self.makeEdit(genre), row, 2)
            row += 1
        if info.Keywords:
            layout.addWidget(self.makeLabel("keywords:"), row, 1)
            layout.addWidget(self.makeEdit(info.Keywords), row, 2)
            row += 1
        if info.Date:
            layout.addWidget(self.makeLabel("date:"), row, 1)
            layout.addWidget(self.makeEdit(info.Date), row, 2)
            row += 1
        if info.Lang:
            layout.addWidget(self.makeLabel("lang:"), row, 1)
            layout.addWidget(self.makeEdit(info.Lang, 30), row, 2)
            row += 1
        if info.srcLang:
            layout.addWidget(self.makeLabel("src-lang:"), row, 1)
            layout.addWidget(self.makeEdit(info.srcLang, 30), row, 2)
            row += 1
        for tr in info.Translators:
            layout.addWidget(self.makeLabel("translator:"), row, 1)
            layout.addWidget(self.makeEdit(tr.makeName()), row, 2)
            row += 1
        for seq in info.Sequences:
            layout.addWidget(self.makeLabel("sequence:"), row, 1)
            layout.addWidget(
                self.makeEdit(seq.sequenceName + " #" +
                              QtCore.QString.number(seq.sequenceNumber)), row,
                2)

        row += 1

        layout.addWidget(self.makeTitleLabel("document-info"), row, 1, 1, 2)
        row += 1
        for author in info.documentAuthors:
            layout.addWidget(self.makeLabel("author:"), row, 1)
            layout.addWidget(self.makeEdit(author.makeName()), row, 2)
            row += 1
        if info.programUsed:
            layout.addWidget(self.makeLabel("program-used:"), row, 1)
            layout.addWidget(self.makeEdit(info.programUsed), row, 2)
            row += 1
        if info.documentDate:
            layout.addWidget(self.makeLabel("date:"), row, 1)
            layout.addWidget(self.makeEdit(info.documentDate), row, 2)
            row += 1
        if info.srcUrl:
            layout.addWidget(self.makeLabel("src-url:"), row, 1)
            layout.addWidget(self.makeEdit(info.srcUrl), row, 2)
            row += 1
        if info.srcOcr:
            layout.addWidget(self.makeLabel("src-ocr:"), row, 1)
            layout.addWidget(self.makeEdit(info.srcOcr), row, 2)
            row += 1
        if info.Id:
            layout.addWidget(self.makeLabel("id:"), row, 1)
            layout.addWidget(self.makeEdit(info.Id), row, 2)
            row += 1
        if info.Version:
            layout.addWidget(self.makeLabel("version:"), row, 1)
            layout.addWidget(self.makeEdit(info.Version, 40), row, 2)
            row += 1
        if info.History:
            layout.addWidget(self.makeLabel("history:"), row, 1)
            edit = QtGui.QTextEdit(info.History, self)
            edit.setReadOnly(True)
            edit.setFrameStyle(QtGui.QFrame.NoFrame)
            layout.addWidget(edit, row, 2)
            row += 1

        layout.addWidget(self.makeTitleLabel("publish-info"), row, 1, 1, 2)
        row += 1
        if info.bookName:
            layout.addWidget(self.makeLabel("book-name:"), row, 1)
            layout.addWidget(self.makeEdit(info.bookName), row, 2)
            row += 1
        if info.Publisher:
            layout.addWidget(self.makeLabel("publisher:"), row, 1)
            layout.addWidget(self.makeEdit(info.Publisher), row, 2)
            row += 1
        if info.City:
            layout.addWidget(self.makeLabel("city:"), row, 1)
            layout.addWidget(self.makeEdit(info.City), row, 2)
            row += 1
        if info.Year:
            layout.addWidget(self.makeLabel("year:"), row, 1)
            layout.addWidget(
                self.makeEdit(QtCore.QString.number(info.Year), 50), row, 2)
            row += 1
        if info.ISBN:
            layout.addWidget(self.makeLabel("isbn:"), row, 1)
            layout.addWidget(self.makeEdit(info.ISBN), row, 2)
            row += 1
        for seq in info.publisherSequences:
            layout.addWidget(self.makeLabel("sequence:"), row, 1)
            layout.addWidget(
                self.makeEdit(seq.sequenceName + " #" +
                              QtCore.QString.number(seq.sequenceNumber)), row,
                2)
            row += 1

        spacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Fixed,
                                   QtGui.QSizePolicy.Expanding)
        layout.addItem(spacer, row, 0)

        self.centered = False
Exemplo n.º 6
0
    def __init__(self, parent=None):
        QtGui.QDialog.__init__(self, parent)

        self.setupUi(self)

        model = GenreTreeModelReader('genres.xml')

        reader = FB2StreamReader()
        filename = QtCore.QString.fromUtf8(sys.argv[1])
        reader.read(filename)
        info = reader.info
        for i in xrange(min(3, len(info.Authors))):
            self.authorsLayout.addWidget(self.makeLabel(info.Authors[i].makeName()))
        if len(info.Authors) > 3:
            self.authorsLayout.addWidget(self.makeLabel(self.tr("etc.")))
        self.titleLabel.setText(info.bookTitle)
        genres = QtCore.QStringList()
        for genre in info.Genres:
            genres.append(model.genreDescByCode(genre))
        self.genresLabel.setText(genres.join(", "))
        if info.Coverpage.isEmpty():
            self.coverpageLabel.setText(self.tr("No coverpage"))
        else:
            pixmap = QtGui.QPixmap()
            pixmap.loadFromData(info.Coverpage)
            if pixmap.width() > 200:
                pixmap = pixmap.scaledToWidth(200)
            self.coverpageLabel.setPixmap(pixmap)
            self.annotationEdit.setMaximumHeight(max(pixmap.height(), 200))
        self.annotationEdit.setText(info.Annotation)

        self.fileinfoLayout.addWidget(self.makeLabel(self.tr("<b>Filename:</b>") +
            " " + filename))
        self.fileinfoLayout.addWidget(self.makeLabel(self.tr("<b>Size:</b>") +
            " " + QtCore.QString.number(QtCore.QFileInfo(filename).size())))
        self.fileinfoLayout.addWidget(self.makeLabel(self.tr("<b>MD5:</b>") +
            " " + QtCore.QString(self.MD5(filename))))

        row = 0
        self.layout1.addWidget(self.makeLabel("<b style='color:red'>&lt;title-info&gt;</b>"), row, 0)
        row += 1
        for genre in info.Genres:
            self.layout1.addWidget(self.makeLabel("<b>genre:</b>"), row, 0)
            self.layout1.addWidget(self.makeLabel(genre), row, 1)
            row += 1
        self.layout1.addWidget(self.makeLabel("<b>keywords:</b>"), row, 0)
        self.layout1.addWidget(self.makeLabel(info.Keywords), row, 1)
        row += 1
        self.layout1.addWidget(self.makeLabel("<b>date:</b>"), row, 0)
        self.layout1.addWidget(self.makeLabel(info.Date), row, 1)
        row += 1
        self.layout1.addWidget(self.makeLabel("<b>lang:</b>"), row, 0)
        self.layout1.addWidget(self.makeLabel(info.Lang), row, 1)
        row += 1
        self.layout1.addWidget(self.makeLabel("<b>src-lang:</b>"), row, 0)
        self.layout1.addWidget(self.makeLabel(info.srcLang), row, 1)
        row += 1
        for tr in info.Translators:
            self.layout1.addWidget(self.makeLabel("<b>translator:</b>"), row, 0)
            self.layout1.addWidget(self.makeLabel(tr.makeName()), row, 1)
            row +=1
        for seq in info.Sequences:
            self.layout1.addWidget(self.makeLabel("<b>sequence:</b>"), row, 0)
            self.layout1.addWidget(self.makeLabel(seq.sequenceName + ", <b>number:</b> " +
                                           QtCore.QString.number(seq.sequenceNumber)), row, 1)
            row += 1
        spacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Fixed,
                                         QtGui.QSizePolicy.Expanding)
        self.layout1.addItem(spacer, row, 0)


        row = 0
        self.layout2.addWidget(self.makeLabel("<b style='color:red'>&lt;document-info&gt;</b>"), row, 0)
        row += 1
        for author in info.documentAuthors:
            self.layout2.addWidget(self.makeLabel("<b>author:</b>"), row, 0)
            self.layout2.addWidget(self.makeLabel(author.makeName()), row, 1)
            row += 1
        self.layout2.addWidget(self.makeLabel("<b>program-used:</b>"), row, 0)
        self.layout2.addWidget(self.makeLabel(info.programUsed), row, 1)
        row += 1
        self.layout2.addWidget(self.makeLabel("<b>date:</b>"), row, 0)
        self.layout2.addWidget(self.makeLabel(info.documentDate), row, 1)
        row += 1
        self.layout2.addWidget(self.makeLabel("<b>src-url:</b>"), row, 0)
        self.layout2.addWidget(self.makeLabel(info.srcUrl), row, 1)
        row += 1
        self.layout2.addWidget(self.makeLabel("<b>src-ocr:</b>"), row, 0)
        self.layout2.addWidget(self.makeLabel(info.srcOcr), row, 1)
        row += 1
        self.layout2.addWidget(self.makeLabel("<b>id:</b>"), row, 0)
        self.layout2.addWidget(self.makeLabel(info.Id), row, 1)
        row += 1
        self.layout2.addWidget(self.makeLabel("<b>version:</b>"), row, 0)
        self.layout2.addWidget(self.makeLabel(info.Version), row, 1)
        row += 1
        self.layout2.addWidget(self.makeLabel("<b style='color:red'>&lt;publish-info&gt;</b>"), row, 0)
        row += 1
        self.layout2.addWidget(self.makeLabel("<b>book-name:</b>"), row, 0)
        self.layout2.addWidget(self.makeLabel(info.bookName), row, 1)
        row += 1
        self.layout2.addWidget(self.makeLabel("<b>publisher:</b>"), row, 0)
        self.layout2.addWidget(self.makeLabel(info.Publisher), row, 1)
        row += 1
        self.layout2.addWidget(self.makeLabel("<b>city:</b>"), row, 0)
        self.layout2.addWidget(self.makeLabel(info.City), row, 1)
        row += 1
        self.layout2.addWidget(self.makeLabel("<b>year:</b>"), row, 0)
        if info.Year:
            self.layout2.addWidget(self.makeLabel(QtCore.QString.number(info.Year)), row, 1)
        row += 1
        self.layout2.addWidget(self.makeLabel("<b>isbn:</b>"), row, 0)
        self.layout2.addWidget(self.makeLabel(info.ISBN), row, 1)
        row += 1
        for seq in info.publisherSequences:
            self.layout2.addWidget(self.makeLabel("<b>sequence:</b>"), row, 0)
            self.layout2.addWidget(self.makeLabel(seq.sequenceName + ", <b>number:</b> " +
                                           QtCore.QString.number(seq.sequenceNumber)), row, 1)
            row += 1
        spacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Fixed,
                                         QtGui.QSizePolicy.Expanding)
        self.layout2.addItem(spacer, row, 0)

        self.centered = False