예제 #1
0
파일: gui.py 프로젝트: supermihi/bibtexvcs
def run(database=None):
    import bibtexvcs
    from distutils.version import StrictVersion
    app = QtWidgets.QApplication(sys.argv)
    window = None

    newVersion = bibtexvcs.pypiVersion()
    if newVersion:
        newVersion = StrictVersion(newVersion)
        myVersion = StrictVersion(bibtexvcs.__version__)
        if newVersion > myVersion:
            window = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical,
                                           'New version available',
                                           'A new version of BibTeX VCS ({}) is available. '
                                           'Please update and start again.'
                                           .format(newVersion), QtWidgets.QMessageBox.Ok)
            window.show()
            window.accepted.connect(app.exit)
    if window is None:
        window = BtVCSGui(database)  # bind Qt object to variable to avoid garbage collection
    if QT5:
        app.setStyle('fusion')
    app.exec_()
예제 #2
0
def run():
    if len (sys.argv) > 1 and sys.argv[1] == '-j':
        config.getDefaultDatabase().runJabref()
        sys.exit(0)
    import bibtexvcs, pkg_resources
    from distutils.version import StrictVersion
    app = QtWidgets.QApplication(sys.argv)
    window = None
    newVersion = bibtexvcs.pypiVersion()
    if newVersion:
        newVersion = StrictVersion(newVersion)
        myVersion = StrictVersion(pkg_resources.get_distribution('bibtexvcs').version)
        if newVersion > myVersion:
            window = QtWidgets.QMessageBox(QtWidgets.QMessageBox.Critical,
                                           "New version available",
                                           "A new version of BibTeX VCS ({}) is available. "
                                           "Please update (pip install -U --user bibtexvcs), "
                                           "then start again.".format(newVersion),
                                           QtWidgets.QMessageBox.Ok)
            window.show()
            window.accepted.connect(app.exit)
    if window is None:
        window = BtVCSGui()
    app.exec_()