示例#1
0
    magnetic = MagneticViewer()
    magnetic.centre()
    magnetic.show()

    # app.setStyle("Fusion")

    # TODO: Add DarkTheme
    # Now use a palette to switch to dark colors:
    # palette = QPalette()
    # palette.setColor(QPalette.Window, QColor(53, 53, 53))
    # palette.setColor(QPalette.WindowText, Qt.white)
    # palette.setColor(QPalette.Base, QColor(25, 25, 25))
    # palette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
    # palette.setColor(QPalette.ToolTipBase, Qt.white)
    # palette.setColor(QPalette.ToolTipText, Qt.white)
    # palette.setColor(QPalette.Text, Qt.white)
    # palette.setColor(QPalette.Button, QColor(53, 53, 53))
    # palette.setColor(QPalette.ButtonText, Qt.white)
    # palette.setColor(QPalette.BrightText, Qt.red)
    # palette.setColor(QPalette.Link, QColor(42, 130, 218))
    # palette.setColor(QPalette.Highlight, QColor(42, 130, 218))
    # palette.setColor(QPalette.HighlightedText, Qt.black)
    # app.setPalette(palette)

    sys.exit(app.exec_())


if __name__ == '__main__':
    args = get_arguments()
    main()
                    help=('A boolean indicating whether running this sample '
                          'will make changes. No changes will occur if this '
                          'is set True.'))


def main(doubleclick_bid_manager, body):
    # Construct the request.
    request = doubleclick_bid_manager.lineitems().uploadlineitems(body=body)
    response = request.execute()

    if 'uploadStatus' in response and 'errors' in response['uploadStatus']:
        for error in response['uploadStatus']['errors']:
            print(error)
    else:
        print('Upload Successful.')


if __name__ == '__main__':
    args = util.get_arguments(sys.argv, __doc__, parents=[parser])

    file_path = args.file_path
    if not os.path.isabs(file_path):
        file_path = os.path.expanduser(file_path)

    with open(file_path, 'rb') as handle:
        line_items = handle.read().decode('utf-8')

    BODY = {'dryRun': args.dry_run, 'lineItems': line_items}

    main(util.setup(args), BODY)