2013-04-28 11:38:41 -04:00
|
|
|
#!/usr/bin/python3
|
2016-05-31 21:59:31 -04:00
|
|
|
# Copyright 2016 Hardcoded Software (http://www.hardcoded.net)
|
2016-05-31 20:21:07 -04:00
|
|
|
#
|
|
|
|
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
|
|
|
# which should be included with this package. The terms are also available at
|
2015-01-03 16:33:16 -05:00
|
|
|
# http://www.gnu.org/licenses/gpl-3.0.html
|
2010-10-04 15:42:38 +02:00
|
|
|
|
|
|
|
import sys
|
2011-11-30 11:06:08 -05:00
|
|
|
import os.path as op
|
2014-04-18 10:55:01 -04:00
|
|
|
import gc
|
2010-10-05 10:22:02 +02:00
|
|
|
|
2013-10-20 15:15:09 -04:00
|
|
|
from PyQt5.QtCore import QCoreApplication, QSettings
|
|
|
|
from PyQt5.QtGui import QIcon, QPixmap
|
|
|
|
from PyQt5.QtWidgets import QApplication
|
2010-10-05 10:22:02 +02:00
|
|
|
|
2011-11-03 10:25:15 -04:00
|
|
|
from hscommon.trans import install_gettext_trans_under_qt
|
2010-11-20 12:42:15 +01:00
|
|
|
from qtlib.error_report_dialog import install_excepthook
|
2012-08-07 12:37:17 -04:00
|
|
|
from qtlib.util import setupQtLogging
|
2016-05-31 21:59:31 -04:00
|
|
|
from qt import dg_rc
|
|
|
|
from qt.platform import BASE_PATH
|
|
|
|
from core import __version__, __appname__
|
2010-10-05 10:22:02 +02:00
|
|
|
|
2013-10-20 15:38:24 -04:00
|
|
|
def main():
|
2010-10-05 10:22:02 +02:00
|
|
|
app = QApplication(sys.argv)
|
2011-01-21 13:57:54 +01:00
|
|
|
QCoreApplication.setOrganizationName('Hardcoded Software')
|
|
|
|
QCoreApplication.setApplicationName(__appname__)
|
|
|
|
QCoreApplication.setApplicationVersion(__version__)
|
2012-08-07 12:37:17 -04:00
|
|
|
setupQtLogging()
|
2011-01-19 09:47:00 +01:00
|
|
|
settings = QSettings()
|
2012-03-16 14:07:29 -04:00
|
|
|
lang = settings.value('Language')
|
2011-11-30 12:13:02 -05:00
|
|
|
locale_folder = op.join(BASE_PATH, 'locale')
|
2011-11-30 11:06:08 -05:00
|
|
|
install_gettext_trans_under_qt(locale_folder, lang)
|
2011-01-19 09:47:00 +01:00
|
|
|
# Many strings are translated at import time, so this is why we only import after the translator
|
|
|
|
# has been installed
|
2016-05-31 21:59:31 -04:00
|
|
|
from qt.app import DupeGuru
|
2010-10-05 10:22:02 +02:00
|
|
|
app.setWindowIcon(QIcon(QPixmap(":/{0}".format(DupeGuru.LOGO_NAME))))
|
|
|
|
dgapp = DupeGuru()
|
2014-03-29 17:42:23 -04:00
|
|
|
install_excepthook('https://github.com/hsoft/dupeguru/issues')
|
2014-04-18 10:55:01 -04:00
|
|
|
result = app.exec()
|
|
|
|
# I was getting weird crashes when quitting under Windows, and manually deleting main app
|
|
|
|
# references with gc.collect() in between seems to fix the problem.
|
|
|
|
del dgapp
|
|
|
|
gc.collect()
|
|
|
|
del app
|
|
|
|
gc.collect()
|
|
|
|
return result
|
2013-10-20 15:38:24 -04:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
sys.exit(main())
|