Ejemplo n.º 1
0
    def test_parse_3(self):
        """tests parsing of the pyNastranGUI command line"""
        with open('fem.bdf', 'w') as unused_bdf_file:
            pass
        keys_to_remove = ['noupdate', 'log', 'test', 'qt',
                          'plugin', 'is_groups', 'groups', 'user_geom', 'user_points', 'debug']

        args = ['pyNastranGUI', 'fem.bdf', '--geomscript', 'myscript.py']
        if os.path.exists('myscript.py'):  # pragma: no cover
            os.remove('myscript.py')
        with self.assertRaises(FileNotFoundError):
            out = get_inputs(print_inputs=False, argv=args)

        args = ['pyNastranGUI', 'fem.bdf', '--postscript', 'myscript.py']
        with self.assertRaises(FileNotFoundError):
            out = get_inputs(print_inputs=False, argv=args)

        #------------------------------------------------------
        with open('myscript.py', 'w') as unused_py_file:
            pass

        args = ['pyNastranGUI', 'fem.bdf', '--geomscript', 'myscript.py']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': ['nastran'], 'output': [], 'postscript': None, 'input': ['fem.bdf'], 'geomscript': 'myscript.py'}, out

        args = ['pyNastranGUI', 'fem.bdf', '--postscript', 'myscript.py']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': ['nastran'], 'output': [], 'postscript': 'myscript.py', 'input': ['fem.bdf'], 'geomscript': None}, out
        os.remove('fem.bdf')
Ejemplo n.º 2
0
    def test_parse_2(self):
        """tests parsing of the pyNastranGUI command line"""
        with open('fem.bdf', 'w') as unused_bdf_file:
            pass
        keys_to_remove = ['noupdate', 'log', 'test', 'geomscript', 'postscript', 'qt',
                          'plugin', 'is_groups', 'groups', 'debug']

        # user_points
        args = ['pyNastranGUI', 'fem.bdf', '--points_fname', 'fem.dat']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': ['nastran'], 'user_geom': None, 'output': [], 'user_points': ['fem.dat'], 'input': ['fem.bdf']}, out

        args = ['pyNastranGUI', 'fem.bdf', '--points_fname', 'fem.dat', '--points_fname', 'fem2.dat']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': ['nastran'], 'user_geom': None, 'output': [], 'user_points': ['fem.dat', 'fem2.dat'], 'input': ['fem.bdf']}, out

        # user_geom
        args = ['pyNastranGUI', 'fem.bdf', '--user_geom', 'fem.dat']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': ['nastran'], 'user_geom': ['fem.dat'], 'output': [], 'user_points': None, 'input': ['fem.bdf']}, out

        args = ['pyNastranGUI', 'fem.bdf', '--user_geom', 'fem.dat', '--user_geom', 'fem2.dat']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': ['nastran'], 'user_geom': ['fem.dat', 'fem2.dat'], 'output': [], 'user_points': None, 'input': ['fem.bdf']}, out
        os.remove('fem.bdf')
Ejemplo n.º 3
0
def main():
    inputs = get_inputs('wx')
    app = wx.App(redirect=False)
    appFrm = AppFrame(inputs)
    #appFrm.Show()
    print("launching gui")
    app.MainLoop()
Ejemplo n.º 4
0
def main():
    app = QApplication(sys.argv)
    QApplication.setOrganizationName("pyCart3d")
    QApplication.setOrganizationDomain(pyNastran.__website__)
    QApplication.setApplicationName("pyCart3d")
    QApplication.setApplicationVersion(pyNastran.__version__)

    inputs = get_inputs()
    window = MainWindow(inputs)
    sys.exit(app.exec_())
Ejemplo n.º 5
0
def main():
    app = QtGui.QApplication(sys.argv)
    QtGui.QApplication.setOrganizationName("pyCart3d")
    QtGui.QApplication.setOrganizationDomain(pyNastran.__website__)
    QtGui.QApplication.setApplicationName("pyCart3d")
    QtGui.QApplication.setApplicationVersion(pyNastran.__version__)

    inputs = get_inputs()
    window = MainWindow(inputs)
    sys.exit(app.exec_())
Ejemplo n.º 6
0
def cmd_line():
    """the setup.py entry point for ``pyNastranGUI``"""
    app = QApplication(sys.argv)
    QApplication.setOrganizationName("pyNastran")
    QApplication.setOrganizationDomain(pyNastran.__website__)
    QApplication.setApplicationName("pyNastran")
    QApplication.setApplicationVersion(pyNastran.__version__)
    inputs = get_inputs()
    MainWindow(inputs)
    sys.exit(app.exec_())
Ejemplo n.º 7
0
    def test_parse_1(self):
        """tests parsing of the pyNastranGUI command line"""
        keys_to_remove = ['noupdate', 'log', 'test', 'geomscript', 'postscript', 'qt',
                          'plugin', 'is_groups', 'groups', 'user_geom', 'user_points', 'debug']
        with open('fem.bdf', 'w') as unused_bdf_file:
            pass
        with open('fem.op2', 'w') as unused_op2_file:
            pass
        with open('fem.tri', 'w') as unused_tri_file:
            pass

        args = ['pyNastranGUI']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': None, 'output': None, 'input': None}, out
        #print(out, '\n')

        args = ['pyNastranGUI', 'fem.bdf']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': ['nastran'], 'output': [], 'input': ['fem.bdf']}, out
        #print(out, '\n')

        args = ['pyNastranGUI', 'fem.tri']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': ['cart3d'], 'output': [], 'input': ['fem.tri']}, out
        #print(out, '\n')

        args = ['pyNastranGUI', '-f', 'nastran', 'fem.bdf']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': ['nastran'], 'output': [], 'input': ['fem.bdf']}, out
        #print(out, '\n')

        args = ['pyNastranGUI', '-f', 'nastran', '-i', 'fem.bdf']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': ['nastran'], 'output': [], 'input': ['fem.bdf']}, out
        #print(out, '\n')

        args = ['pyNastranGUI', '-f', 'nastran', '-i', 'fem.bdf', '-o', 'fem.op2']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': ['nastran'], 'output': ['fem.op2'], 'input': ['fem.bdf']}, out
        #print(out, '\n')

        args = ['pyNastranGUI', 'fem.bdf', 'fem.op2']
        out = get_inputs(print_inputs=False, argv=args)
        remove_args(out, *keys_to_remove)
        assert out == {'format': ['nastran'], 'output': ['fem.op2'], 'input': ['fem.bdf']}, out
        os.remove('fem.bdf')
        os.remove('fem.op2')
        os.remove('fem.tri')
Ejemplo n.º 8
0
def cmd_line():
    """the setup.py entry point for ``pyNastranGUI``"""
    # this fixes the icon shown in the windows taskbar to be the custom one (not the python one)
    if sys.platform == 'win32':
        myappid = 'pynastran.pynastrangui.%s' % (pyNastran.__version__
                                                 )  # arbitrary string
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)

    app = QApplication(sys.argv)
    QApplication.setOrganizationName("pyNastran")
    QApplication.setOrganizationDomain(pyNastran.__website__)
    QApplication.setApplicationName("pyNastran")
    QApplication.setApplicationVersion(pyNastran.__version__)
    inputs = get_inputs()
    MainWindow(inputs)
    app.exec_()
Ejemplo n.º 9
0
def main(argv=None):
    if argv is None:
        argv = []
        print('jupyter.amain; argv was None -> %s' % argv)

    app_created = False
    app = QCoreApplication.instance()
    if app is None:
        app = QApplication(sys.argv)
        app_created = True

    QApplication.setOrganizationName("pyNastran")
    QApplication.setOrganizationDomain(pyNastran.__website__)
    QApplication.setApplicationName("pyNastran")
    QApplication.setApplicationVersion(pyNastran.__version__)

    inputs = get_inputs(argv)
    window = MainWindow(inputs)
    try:
        from IPython.lib.guisupport import start_event_loop_qt4
        start_event_loop_qt4(app)
    except ImportError:
        app.exec_()
Ejemplo n.º 10
0
def cmd_line():
    """the setup.py entry point for ``pyNastranGUI``"""
    # this fixes the icon shown in the windows taskbar to be the custom one (not the python one)
    if sys.platform == 'win32':
        myappid = 'pynastran.pynastrangui.%s' % (pyNastran.__version__
                                                 )  # arbitrary string
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)

    from qtpy.QtWidgets import QApplication
    app = QApplication(sys.argv)

    if 0:  # pragma: no cover
        try:
            import qtmodern.styles
        except ImportError:
            pass
        else:
            qtmodern.styles.dark(app)

    #app.setStyle('Fusion')
    #app.setStyle('WindowsXP')

    #if 0:
    #import qtpy.QtGui as QtGui
    #import qtpy.QtCore as QtCore
    #palette = QtGui.QPalette()
    #palette.setColor(QtGui.QPalette.Window, QtGui.QColor(53,53,53))
    #palette.setColor(QtGui.QPalette.WindowText, QtCore.Qt.white)
    #palette.setColor(QtGui.QPalette.Base, QtGui.QColor(15,15,15))
    #palette.setColor(QtGui.QPalette.AlternateBase, QtGui.QColor(53,53,53))
    #palette.setColor(QtGui.QPalette.ToolTipBase, QtCore.Qt.white)
    #palette.setColor(QtGui.QPalette.ToolTipText, QtCore.Qt.white)
    #palette.setColor(QtGui.QPalette.Text, QtCore.Qt.white)
    #palette.setColor(QtGui.QPalette.Button, QtGui.QColor(53,53,53))
    #palette.setColor(QtGui.QPalette.ButtonText, QtCore.Qt.white)
    #palette.setColor(QtGui.QPalette.BrightText, QtCore.Qt.red)

    #palette.setColor(QtGui.QPalette.Highlight, QtGui.QColor(142,45,197).lighter())
    #palette.setColor(QtGui.QPalette.HighlightedText, QtCore.Qt.black)
    #app.setPalette(palette)

    #if 1:
    stylesheet = get_stylesheet()
    if stylesheet:
        app.setStyleSheet(stylesheet)

    if 0:  # pragma: no cover
        import qtpy.QtGui as QtGui
        #import qtpy.QtCore as QtCore
        from qtpy.QtGui import QPalette, QColor
        dark_palette = QtGui.QPalette()
        dark_palette.setColor(QPalette.WindowText, QColor(180, 180, 180))
        dark_palette.setColor(QPalette.Button, QColor(53, 53, 53))
        dark_palette.setColor(QPalette.Light, QColor(180, 180, 180))
        dark_palette.setColor(QPalette.Midlight, QColor(90, 90, 90))
        dark_palette.setColor(QPalette.Dark, QColor(35, 35, 35))
        dark_palette.setColor(QPalette.Text, QColor(180, 180, 180))
        dark_palette.setColor(QPalette.BrightText, QColor(180, 180, 180))
        dark_palette.setColor(QPalette.ButtonText, QColor(180, 180, 180))
        dark_palette.setColor(QPalette.Base, QColor(42, 42, 42))
        dark_palette.setColor(QPalette.Window, QColor(53, 53, 53))
        dark_palette.setColor(QPalette.Shadow, QColor(20, 20, 20))
        dark_palette.setColor(QPalette.Highlight, QColor(42, 130, 218))
        dark_palette.setColor(QPalette.HighlightedText, QColor(180, 180, 180))
        dark_palette.setColor(QPalette.Link, QColor(56, 252, 196))
        dark_palette.setColor(QPalette.AlternateBase, QColor(66, 66, 66))
        dark_palette.setColor(QPalette.ToolTipBase, QColor(53, 53, 53))
        dark_palette.setColor(QPalette.ToolTipText, QColor(180, 180, 180))

        # disabled
        dark_palette.setColor(QPalette.Disabled, QPalette.WindowText,
                              QColor(127, 127, 127))
        dark_palette.setColor(QPalette.Disabled, QPalette.Text,
                              QColor(127, 127, 127))
        dark_palette.setColor(QPalette.Disabled, QPalette.ButtonText,
                              QColor(127, 127, 127))
        dark_palette.setColor(QPalette.Disabled, QPalette.Highlight,
                              QColor(80, 80, 80))
        dark_palette.setColor(QPalette.Disabled, QPalette.HighlightedText,
                              QColor(127, 127, 127))
        app.setPalette(dark_palette)

    QApplication.setOrganizationName("pyNastran")
    QApplication.setOrganizationDomain(pyNastran.__website__)
    QApplication.setApplicationName("pyNastran")
    QApplication.setApplicationVersion(pyNastran.__version__)
    inputs = get_inputs(print_inputs=False)
    #inputs['app'] = app
    MainWindow(inputs)
    app.exec_()
Ejemplo n.º 11
0
"""
creates the pyNastranGUI
"""
# coding: utf-8

# we're intentionally putting this here to validate the imports
# before doing lots of work
from pyNastran.gui.arg_handling import get_inputs
get_inputs(print_inputs=True)

import sys
import ctypes
# kills the program when you hit Cntl+C from the command line
# doesn't save the current state as presumably there's been an error
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)

import pyNastran
from pyNastran.gui.main_window import MainWindow, get_stylesheet


def cmd_line():
    """the setup.py entry point for ``pyNastranGUI``"""
    # this fixes the icon shown in the windows taskbar to be the custom one (not the python one)
    if sys.platform == 'win32':
        myappid = 'pynastran.pynastrangui.%s' % (pyNastran.__version__
                                                 )  # arbitrary string
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)

    from qtpy.QtWidgets import QApplication
    app = QApplication(sys.argv)
Ejemplo n.º 12
0
"""
# coding: utf-8
from __future__ import division, unicode_literals, print_function

import ctypes
# kills the program when you hit Cntl+C from the command line
# doesn't save the current state as presumably there's been an error
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
import sys


# yes we're intentionally putting this here to validate the imports
# before doing lots of work
from pyNastran.gui.arg_handling import get_inputs
get_inputs()


import pyNastran
from pyNastran.gui.main_window import MainWindow


def cmd_line():
    """the setup.py entry point for ``pyNastranGUI``"""
    # this fixes the icon shown in the windows taskbar to be the custom one (not the python one)
    if sys.platform == 'win32':
        myappid = 'pynastran.pynastrangui.%s' % (pyNastran.__version__) # arbitrary string
        ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)

    from qtpy.QtWidgets import QApplication
    app = QApplication(sys.argv)
Ejemplo n.º 13
0
"""
# coding: utf-8
# pylint: disable=C0111
from __future__ import division, unicode_literals, print_function
#from six import string_types, iteritems
from six.moves import range

# standard library
import sys
import os.path
#import traceback
#import webbrowser
#webbrowser.open("http://xkcd.com/353/")

from pyNastran.gui.arg_handling import get_inputs
get_inputs()

from pyNastran.gui.qt_version import qt_version
if qt_version == 4:
    from PyQt4 import QtCore, QtGui
    from PyQt4.QtGui import QApplication, QMessageBox, qApp
    print("Using PyQt4")
elif qt_version == 5:
    from PyQt5 import QtCore, QtGui
    from PyQt5.QtWidgets import QApplication, QMessageBox, qApp
    print("Using PyQt5")
elif qt_version == 'pyside':
    from PySide import QtCore, QtGui
    from PySide.QtGui import QApplication, QMessageBox, qApp
else:
    raise NotImplementedError(qt_version)