Пример #1
0
def run_app(args):
    ## GUI
    app = QApplication(sys.argv)
    app.setApplicationName("StockMonitor")
    app.setOrganizationName("arnet")
    ### app.setOrganizationDomain("www.my-org.com")
    app.setQuitOnLastWindowClosed(False)

    setup_interrupt_handling()

    ## check is one instance is already running
    try:
        singleton.SingleInstance()
    except BaseException:
        _LOGGER.info("Already running, exiting.")
        QMessageBox.critical(
            None, AppWindow.appTitle,
            "One instance of application is already running, exiting.")
        return 3

    try:
        window = MainWindow()
        window.loadData()
        window.loadSettings()

        if args.minimized is True or window.appSettings.startMinimized is True:
            ## starting minimized
            pass
        else:
            window.show()

        _LOGGER.info("application initialization done")

        exitCode = app.exec_()

        if exitCode == 0:
            window.saveAll()

        return exitCode
    except BaseException as e:
        QMessageBox.critical(
            None, AppWindow.appTitle,
            str(e) + "\n\nInvestigate application logs for details")
        raise
app = QApplication(sys.argv)
app.setApplicationName("StockMonitor")
app.setOrganizationName("arnet")

dataObject = DataObject()
dataObject.loadDownloadedStocks()
# dataObject.wallet.add( "ALR", 111, 11.1 )
# dataObject.wallet.add( "EAT", 222, 22.2 )
# dataObject.wallet.add( "CDR", 333, 33.3 )
# dataObject.wallet.add( "XXX", 444, 44.4 )

dataObject.markers.add("ABC", 11, 22, MarkerEntry.OperationType.BUY)
dataObject.markers.add("XYZ", 33, 44, MarkerEntry.OperationType.BUY)
dataObject.markers.add("AAA1", 20, 100, MarkerEntry.OperationType.BUY)
dataObject.markers.add("AAA2", 5, 100, MarkerEntry.OperationType.BUY)
dataObject.markers.add("AAA3", 20, 100, MarkerEntry.OperationType.SELL, "red")
dataObject.markers.add("AAA4", 5, 100, MarkerEntry.OperationType.SELL,
                       "yellow")

# csvPath = data.get_data_root_path() + "/akcje_2020-04-14_15-50.csv"
# dataframe.to_csv( csvPath, encoding='utf-8', index=False )

setup_interrupt_handling()

widget = MarkersWidget()
widget.resize(1200, 768)
widget.connectData(dataObject)
widget.show()

sys.exit(app.exec_())