def main(argv): app = QApplication(sys.argv) app.setWindowIcon(QIcon(QPixmap(":/logo_small"))) app.setOrganizationName('Hardcoded Software') app.setApplicationName('moneyGuru') settings = QSettings() LOGGING_LEVEL = logging.DEBUG if adjust_after_deserialization(settings.value('DebugMode')) else logging.WARNING setupQtLogging(level=LOGGING_LEVEL) logging.debug('started in debug mode') if ISLINUX: stylesheetFile = QFile(':/stylesheet_lnx') else: stylesheetFile = QFile(':/stylesheet_win') stylesheetFile.open(QFile.ReadOnly) textStream = QTextStream(stylesheetFile) style = textStream.readAll() stylesheetFile.close() app.setStyleSheet(style) lang = settings.value('Language') locale_folder = op.join(BASE_PATH, 'locale') hscommon.trans.install_gettext_trans_under_qt(locale_folder, lang) # Many strings are translated at import time, so this is why we only import after the translator # has been installed from qt.app import MoneyGuru app.setApplicationVersion(MoneyGuru.VERSION) mgapp = MoneyGuru() install_excepthook() exec_result = app.exec_() del mgapp # Since PyQt 4.7.2, I had crashes on exit, and from reading the mailing list, it seems to be # caused by some weird crap about C++ instance being deleted with python instance still living. # The worst part is that Phil seems to say this is expected behavior. So, whatever, this # gc.collect() below is required to avoid a crash. gc.collect() return exec_result
def main(): app = QApplication(sys.argv) QCoreApplication.setOrganizationName('Hardcoded Software') QCoreApplication.setApplicationName(__appname__) QCoreApplication.setApplicationVersion(__version__) setupQtLogging() settings = QSettings() lang = settings.value('Language') locale_folder = op.join(BASE_PATH, 'locale') install_gettext_trans_under_qt(locale_folder, lang) # Handle OS signals setUpSignals() # Let the Python interpreter runs every 500ms to handle signals. This is # required because Python cannot handle signals while the Qt event loop is # running. from PyQt5.QtCore import QTimer timer = QTimer() timer.start(500) timer.timeout.connect(lambda: None) # Many strings are translated at import time, so this is why we only import after the translator # has been installed from qt.app import DupeGuru app.setWindowIcon(QIcon(QPixmap(":/{0}".format(DupeGuru.LOGO_NAME)))) global dgapp dgapp = DupeGuru() install_excepthook('https://github.com/hsoft/dupeguru/issues') 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
def main(argv): app = QApplication(argv) app.setWindowIcon(QIcon(QPixmap(":/logo_small"))) app.setOrganizationName("Hardcoded Software") app.setApplicationName(__appname__) app.setApplicationVersion(__version__) setupQtLogging() install_qt_trans('en') from qt.app import PdfMasher pmapp = PdfMasher() install_excepthook() result = app.exec() # Avoid "QObject::startTimer: QTimer can only be used with threads started with QThread" on shutdown del pmapp gc.collect() return result
def main(): parser = get_parser() args = parser.parse_args() app = QApplication([]) app.setWindowIcon(QIcon(QPixmap(":/logo_small"))) app.setOrganizationName('Hardcoded Software') app.setApplicationName('moneyGuru') settings = QSettings() if args.debug: LOGGING_LEVEL = logging.DEBUG else: LOGGING_LEVEL = logging.DEBUG if adjust_after_deserialization( settings.value('DebugMode')) else logging.WARNING setupQtLogging(level=LOGGING_LEVEL, log_to_stdout=args.log_to_stdout) logging.debug('started in debug mode') if ISLINUX: stylesheetFile = QFile(':/stylesheet_lnx') else: stylesheetFile = QFile(':/stylesheet_win') stylesheetFile.open(QFile.ReadOnly) textStream = QTextStream(stylesheetFile) style = textStream.readAll() stylesheetFile.close() app.setStyleSheet(style) lang = settings.value('Language') locale_folder = op.join(BASE_PATH, 'locale') hscommon.trans.install_gettext_trans_under_qt(locale_folder, lang) # Many strings are translated at import time, so this is why we only import after the translator # has been installed from qt.app import MoneyGuru app.setApplicationVersion(MoneyGuru.VERSION) mgapp = MoneyGuru(filepath=args.filepath) install_excepthook('https://github.com/hsoft/moneyguru/issues') exec_result = app.exec_() del mgapp # Since PyQt 4.7.2, I had crashes on exit, and from reading the mailing list, it seems to be # caused by some weird crap about C++ instance being deleted with python instance still living. # The worst part is that Phil seems to say this is expected behavior. So, whatever, this # gc.collect() below is required to avoid a crash. gc.collect() return exec_result
def main(): app = QApplication(sys.argv) QCoreApplication.setOrganizationName('Hardcoded Software') QCoreApplication.setApplicationName(__appname__) QCoreApplication.setApplicationVersion(__version__) setupQtLogging() settings = QSettings() lang = settings.value('Language') locale_folder = op.join(BASE_PATH, 'locale') install_gettext_trans_under_qt(locale_folder, lang) # Many strings are translated at import time, so this is why we only import after the translator # has been installed from qt.app import DupeGuru app.setWindowIcon(QIcon(QPixmap(":/{0}".format(DupeGuru.LOGO_NAME)))) dgapp = DupeGuru() install_excepthook('https://github.com/hsoft/dupeguru/issues') 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
from hscommon.plat import ISWINDOWS from hscommon.trans import install_gettext_trans_under_qt from qtlib.error_report_dialog import install_excepthook from qtlib.util import setupQtLogging from qt.base import dg_rc from qt.base.platform import BASE_PATH from core_{edition} import __version__, __appname__ if ISWINDOWS: import qt.base.cxfreeze_fix if __name__ == "__main__": app = QApplication(sys.argv) QCoreApplication.setOrganizationName('Hardcoded Software') QCoreApplication.setApplicationName(__appname__) QCoreApplication.setApplicationVersion(__version__) setupQtLogging() settings = QSettings() lang = settings.value('Language') locale_folder = op.join(BASE_PATH, 'locale') install_gettext_trans_under_qt(locale_folder, lang) # Many strings are translated at import time, so this is why we only import after the translator # has been installed from qt.{edition}.app import DupeGuru app.setWindowIcon(QIcon(QPixmap(":/{0}".format(DupeGuru.LOGO_NAME)))) dgapp = DupeGuru() if not ISWINDOWS: dgapp.model.registered = True install_excepthook() sys.exit(app.exec_())