예제 #1
0
TEST_DIR = os.path.normpath(os.path.abspath(os.path.dirname(__file__)))
TEST_TEMP_DIR = os.path.normpath(os.path.join(TEST_DIR, "temp"))

if not os.path.isdir(TEST_TEMP_DIR):
    os.mkdir(TEST_TEMP_DIR)


def make_temp_dir(dir_name, base_dir=TEST_TEMP_DIR):
    _temp_dir = os.path.normpath(os.path.join(base_dir, dir_name))
    if os.path.isdir(_temp_dir):
        shutil.rmtree(_temp_dir)
    os.mkdir(_temp_dir)
    return _temp_dir


EDI_DATA_DIR = os.path.normpath(
    os.path.join(TEST_MTPY_ROOT, 'examples/data/edi_files'))
EDI_DATA_DIR2 = os.path.normpath(
    os.path.join(TEST_MTPY_ROOT, 'examples/data/edi_files_2'))
AUS_TOPO_FILE = os.path.normpath(
    os.path.join(TEST_MTPY_ROOT, 'examples/data/AussieContinent_etopo1.asc'))
SAMPLE_DIR = os.path.normpath(
    os.path.join(
        TEST_MTPY_ROOT,
        'examples/model_files'))  # r'E:\Githubz\mtpy\examples\model_files'
M2D_DIR = os.path.normpath(
    os.path.join(TEST_MTPY_ROOT, 'examples/data/mare2dem'))

# set test logging configure
MtPyLog.load_configure(os.path.join(TEST_DIR, "logging.yml"))
예제 #2
0
                        # remove the window
                        del self._main_ui.subwindows[title]
                    else:
                        subwindow.hide()

    @deprecated(
        "This is an dummy action that should be used only when the required function hasn't been implemented"
    )
    def dummy_action(self, *args, **kwargs):
        pass


if __name__ == "__main__":
    if __debug__:
        MtPyLog.load_configure(
            os.path.join(os.path.abspath("tests"),
                         "logging.yml"))  # debug only
        # handle uncaught exceptions to log as since PYQT5.5 will not display any uncaught exceptions
        # ref: http://pyqt.sourceforge.net/Docs/PyQt5/incompatibilities.html#unhandled-python-exceptions
        logger = MtPyLog.get_mtpy_logger(__name__)
        sys.excepthook = lambda exc_type, exc_value, exc_trace: logger.error(
            "Uncaught exception", exc_info=(exc_type, exc_value, exc_trace))

    app = QApplication.instance()
    if app is None:
        app = QApplication(sys.argv)
    smartMT = StartGUI()
    smartMT.show()

    # hack to fix the "python has stopped working" error,
    # the possible cause is the QtGui4.dll crashes, need to test it on linux environment
예제 #3
0
# define mtpy release version below
# see https://packaging.python.org/guides/single-sourcing-package-version/
__version__ = "1.1.3"

# load mtpy default logging config
from mtpy.utils.mtpylog import MtPyLog

MtPyLog.load_configure()