Ejemplo n.º 1
0
    def __init__(self, WD=None, name='Main Frame', dmodel=None):
        try:
            version= pmag.get_version()
        except:
            version = ""
        title = "MagIC GUI   version: %s"%version
        if sys.platform in ['win32', 'win64']:
            title += "  Powered by Enthought Canopy"
        wx.Frame.__init__(self, None, wx.ID_ANY, title, name=name)
        #
        self.grid_frame = None
        self.panel = wx.Panel(self, size=wx.GetDisplaySize(), name='main panel')
        print('-I- Fetching working directory')
        self.WD = os.path.realpath(WD) or os.getcwd()

        print('-I- Initializing magic data object')
        if dmodel is None:
            dmodel = validate_upload.get_data_model()
        self.data_model = dmodel
        self.er_magic = builder.ErMagicBuilder(self.WD, self.data_model)
        self.edited = False
        self.validation_mode = False

        # initialize magic data object
        # attempt to read magic_measurements.txt, and all er_* and pmag_* files
        print('-I- Read in any available data from working directory')
        self.er_magic.get_all_magic_info()

        # POSSIBLY RELOCATE THIS EVENTUALLY:
        print('-I- Initializing headers')
        self.er_magic.init_default_headers()
        self.er_magic.init_actual_headers()
        #
        print('-I- Initializing interface')
        self.InitUI()
Ejemplo n.º 2
0
"""
tests for magic_gui
"""

import wx
import unittest
import os
from programs import magic_gui2 as magic_gui
from pmagpy import builder2 as builder
from pmagpy import pmag
from dialogs import grid_frame2 as grid_frame
from dialogs import pmag_widgets
from pmagpy import validate_upload2 as validate_upload

# set constants
DMODEL = validate_upload.get_data_model()
WD = pmag.get_test_WD() #find_pmag_dir.get_pmag_dir() # sys.prefix

#@unittest.skip('seg fault')
class TestMainFrame(unittest.TestCase):

    def setUp(self):
        self.app = wx.App()
        self.frame = magic_gui.MainFrame(WD, "zebra", DMODEL)
        self.app.frame=self.frame
        self.pnl = self.frame.GetChildren()[0]

    def tearDown(self):
        wx.CallAfter(self.frame.Destroy)
        wx.CallAfter(self.app.Destroy)
        os.chdir(WD)
Ejemplo n.º 3
0
#    if dmodel==2.5:
#        # constants for 2.5
#        dmodel2 = validate_upload.get_data_model()
#        project2_WD = os.path.join(TEST_DIR, 'data_files', 'testing', 'my_project')
#        core_depthplot_WD = os.path.join(TEST_DIR, 'data_files',
#                                         'testing', 'core_depthplot')
#    else:
#        #constants for 3.0
#        DMODEL = data_model.DataModel()
#        PROJECT_WD = os.path.join(TEST_DIR, "data_files", "Pmag_GUI", "3_0")


# get WD before all the Pmag GUI stuff starts to happen
TEST_DIR = pmag.get_test_WD()
# constants for 2.5
dmodel2 = validate_upload.get_data_model()
project2_WD = os.path.join(TEST_DIR, 'data_files', 'testing', 'my_project')
core_depthplot_WD = os.path.join(TEST_DIR, 'data_files',
                                 'testing', 'core_depthplot')
# constants for 3.0
DMODEL = data_model.DataModel()
PROJECT_WD = os.path.join(TEST_DIR, "data_files", "Pmag_GUI", "3_0")


class TestMainFrame2(unittest.TestCase):

    def setUp(self):
        self.app = wx.App()
        self.frame = pmag_gui.MagMainFrame(project2_WD, dmodel=dmodel2, DM=2.5)
        self.pnl = self.frame.GetChildren()[0]
        #wx.lib.inspection.InspectionTool().Show()
Ejemplo n.º 4
0
#    TEST_DIR = os.getcwd()
#    if dmodel==2.5:
#        # constants for 2.5
#        dmodel2 = validate_upload.get_data_model()
#        project2_WD = os.path.join(TEST_DIR, 'data_files', 'testing', 'my_project')
#        core_depthplot_WD = os.path.join(TEST_DIR, 'data_files',
#                                         'testing', 'core_depthplot')
#    else:
#        #constants for 3.0
#        DMODEL = data_model.DataModel()
#        PROJECT_WD = os.path.join(TEST_DIR, "data_files", "Pmag_GUI", "3_0")

# get WD before all the Pmag GUI stuff starts to happen
TEST_DIR = pmag.get_test_WD()
# constants for 2.5
dmodel2 = validate_upload.get_data_model()
project2_WD = os.path.join(TEST_DIR, 'data_files', 'testing', 'my_project')
core_depthplot_WD = os.path.join(TEST_DIR, 'data_files', 'testing',
                                 'core_depthplot')
# constants for 3.0
DMODEL = data_model.DataModel()
PROJECT_WD = os.path.join(TEST_DIR, "data_files", "Pmag_GUI", "3_0")


class TestMainFrame2(unittest.TestCase):
    def setUp(self):
        self.app = wx.App()
        self.frame = pmag_gui.MagMainFrame(project2_WD, dmodel=dmodel2, DM=2.5)
        self.pnl = self.frame.GetChildren()[0]
        #wx.lib.inspection.InspectionTool().Show()
Ejemplo n.º 5
0
"""
tests for magic_gui
"""

import wx
import unittest
import os
from programs import magic_gui2 as magic_gui
from pmagpy import builder2 as builder
from pmagpy import pmag
from dialogs import grid_frame2 as grid_frame
from dialogs import pmag_widgets
from pmagpy import validate_upload2 as validate_upload

# set constants
DMODEL = validate_upload.get_data_model()
WD = pmag.get_test_WD()  #find_pmag_dir.get_pmag_dir() # sys.prefix


#@unittest.skip('seg fault')
class TestMainFrame(unittest.TestCase):
    def setUp(self):
        self.app = wx.App()
        self.frame = magic_gui.MainFrame(WD, "zebra", DMODEL)
        self.app.frame = self.frame
        self.pnl = self.frame.GetChildren()[0]

    def tearDown(self):
        wx.CallAfter(self.frame.Destroy)
        wx.CallAfter(self.app.Destroy)
        os.chdir(WD)