Beispiel #1
0
def run():
    '''Run the main application.'''

    # jump to the embedding client entry point if required
    if len(sys.argv) == 2 and sys.argv[1] == '--embed-remote':
        from veusz.embed_remote import runremote
        runremote()
        return

    # this function is spaghetti-like and has nasty code paths.
    # the idea is to postpone the imports until the splash screen
    # is shown

    app = qt4.QApplication(sys.argv)
    app.connect(app, qt4.SIGNAL('lastWindowClosed()'), app, qt4.SLOT('quit()'))

    # register a signal handler to catch ctrl+C
    signal.signal(signal.SIGINT, handleIntSignal)

    # parse command line options
    parser = optparse.OptionParser(usage='%prog [options] filename.vsz ...',
                                   version=copyr % utils.version())
    parser.add_option('--unsafe-mode',
                      action='store_true',
                      help='disable safety checks when running documents'
                      ' or scripts')
    parser.add_option('--listen',
                      action='store_true',
                      help='read and execute Veusz commands from stdin,'
                      ' replacing veusz_listen')
    parser.add_option('--quiet',
                      action='store_true',
                      help='if in listening mode, do not open a window but'
                      ' execute commands quietly')
    parser.add_option('--export',
                      action='append',
                      metavar='FILE',
                      help='export the next document to this'
                      ' output image file, exiting when finished')
    parser.add_option('--embed-remote',
                      action='store_true',
                      help=optparse.SUPPRESS_HELP)
    parser.add_option('--plugin',
                      action='append',
                      metavar='FILE',
                      help='load the plugin from the file given for '
                      'the session')
    parser.add_option('--translation',
                      metavar='FILE',
                      help='load the translation .qm file given')
    options, args = parser.parse_args(app.argv())

    # convert args to unicode from filesystem strings
    args = convertArgsUnicode(args)

    s = AppRunner(options, args)
    app.exec_()
Beispiel #2
0
        sys.exit(0)
    else:
        print("%i/%i tests FAILED" % (fails, passes + fails))
        sys.exit(fails)


oldflt = svg_export.fltStr


def fltStr(v, prec=1):
    """Only output floats to 1 dp."""
    return oldflt(v, prec=prec)


if __name__ == '__main__':
    app = qt4.QApplication([])

    setting.transient_settings['unsafe_mode'] = True

    # hack metrics object to always return same metrics
    # and replace text renderer with one that encodes unicode symbols
    utils.textrender.FontMetrics = StupidFontMetrics
    utils.FontMetrics = StupidFontMetrics
    utils.textrender.PartText = PartTextAscii

    # nasty hack to remove underlining
    del utils.textrender.part_commands[r'\underline']

    # dpi (use old values)
    svg_export.dpi = 90.
    svg_export.scale = 1.
Beispiel #3
0
        sys.exit(0)
    else:
        print("%i/%i tests FAILED" % (fails, passes + fails))
        sys.exit(fails)


oldflt = svg_export.fltStr


def fltStr(v, prec=1):
    """Only output floats to 1 dp."""
    return oldflt(v, prec=prec)


if __name__ == '__main__':
    app = qt.QApplication([])

    setting.transient_settings['unsafe_mode'] = True

    # hack metrics object to always return same metrics
    # and replace text renderer with one that encodes unicode symbols
    utils.textrender.FontMetrics = StupidFontMetrics
    utils.FontMetrics = StupidFontMetrics
    utils.textrender.PartText = PartTextAscii

    # nasty hack to remove underlining
    del utils.textrender.part_commands[r'\underline']

    # dpi (use old values)
    svg_export.fltStr = fltStr