Beispiel #1
0
 def __init__(self, win):
     Action.__init__(self,
                     win,
                     "Paraview",
                     "Will launch Paraview",
                     menuText='&Paraview',
                     iconId=wx.ART_EXECUTABLE_FILE)
Beispiel #2
0
 def __init__(self, win, param_mgr):
     Action.__init__(self,
                     win,
                     "Plot results over time",
                     '',
                     iconId=wx.ART_FILE_OPEN)
     self.param_mgr = param_mgr
Beispiel #3
0
 def createRedoAndUndoActions(self, win):
     self._undo_action = Action(win, "Undo", "Undo the last edit"
                     , accelerator = 'CTRL+Z', iconId = wx.ART_UNDO, callback=self.undo)
     self._undo_action.setDisabled(True)
     self._redo_action = Action(win, "Redo", "Redo the last undone edit"
                     , accelerator = 'CTRL+Y', iconId = wx.ART_REDO, callback=self.redo)
     self._redo_action.setDisabled(True)
Beispiel #4
0
 def __init__(self, win):
     Action.__init__(self,
                     win,
                     "Gmsh",
                     "Will launch Gmsh",
                     menuText='&Gmsh',
                     iconId=wx.ART_EXECUTABLE_FILE)
Beispiel #5
0
 def __init__(self, win, param_mgr):
     Action.__init__(
         self,
         win,
         "Open...",
         'Open and load a Geoi file holding the configuration settings for a case/study',
         accelerator='CTRL+O',
         iconId=wx.ART_FILE_OPEN)
     self.param_mgr = param_mgr
Beispiel #6
0
 def __init__(self, win):
     Action.__init__(
         self,
         win,
         "Open Py&Shell Window",
         'An interactive interpreter window with the demo app and frame objects in the namespace',
         accelerator='F5',
         iconId='wx.ART_IMAGES_' + 'pyshell')
     self.shell = None
Beispiel #7
0
 def __init__(self, win, param_mgr):
     Action.__init__(
         self,
         win,
         "Open...",
         "Open and load a Geoi file holding the configuration settings for a case/study",
         accelerator="CTRL+O",
         iconId=wx.ART_FILE_OPEN,
     )
     self.param_mgr = param_mgr
Beispiel #8
0
 def __init__(self, win, param_mgr, name="Save"
              , description='Save a Geoi file holding the configuration settings for a case/study'
              ,iconId=wx.ART_FILE_SAVE
              , SaveAs = False):
              
     if SaveAs == False:
         Action.__init__(self, win, name, description, accelerator='CTRL+S',iconId=iconId)
     else:
         Action.__init__(self, win, name, description, accelerator='CTRL+SHIFT+S',iconId=iconId)
     self.param_mgr = param_mgr
Beispiel #9
0
 def __init__(self,
              win,
              name,
              description,
              menuText=None,
              accelerator=None,
              iconId=None):
     Action.__init__(self, win, name, description, menuText, accelerator,
                     iconId)
     self._isToggled = False
Beispiel #10
0
 def __init__(self, win, params_mgr):
     Action.__init__(
         self,
         win,
         "New",
         "Reset parameters",
         menuText='&New',
         accelerator='CTRL+N',
         iconId=wx.ART_NEW,
     )
     self.params_mgr = params_mgr
Beispiel #11
0
 def createRedoAndUndoActions(self, win):
     self._undo_action = Action(win,
                                "Undo",
                                "Undo the last edit",
                                accelerator='CTRL+Z',
                                iconId=wx.ART_UNDO,
                                callback=self.undo)
     self._undo_action.setDisabled(True)
     self._redo_action = Action(win,
                                "Redo",
                                "Redo the last undone edit",
                                accelerator='CTRL+Y',
                                iconId=wx.ART_REDO,
                                callback=self.redo)
     self._redo_action.setDisabled(True)
Beispiel #12
0
 def addToCustomTreeCtrl(self, tree, parentItem):
     return Action.addToCustomTreeCtrl(self, tree, parentItem,
                                       TREE_CHECKBOX)
Beispiel #13
0
 def addToMenu(
     self,
     menu,
     id=None,
 ):
     return Action.addToMenu(self, menu, id, kind=wx.ITEM_CHECK)
Beispiel #14
0
 def __init__(self, win, name, description, menuText=None, accelerator=None, iconId=None):
     Action.__init__(self, win, name, description, menuText, accelerator, iconId)
     self._isToggled = False
Beispiel #15
0
class ParamsManager:
    """
    Manage different sets of Parameters : access to the current sets
    and store previous sets to be able to redo/_undo_action
    """

    def __init__(self):
        self.paramSets = [parameters.ParameterSet()]
        self._current_set = 0
        self.filename = None
        self.chemistry_db_path = None

        self._undo_action = None
        self._redo_action = None

    def createRedoAndUndoActions(self, win):
        self._undo_action = Action(win, "Undo", "Undo the last edit"
                        , accelerator = 'CTRL+Z', iconId = wx.ART_UNDO, callback=self.undo)
        self._undo_action.setDisabled(True)
        self._redo_action = Action(win, "Redo", "Redo the last undone edit"
                        , accelerator = 'CTRL+Y', iconId = wx.ART_REDO, callback=self.redo)
        self._redo_action.setDisabled(True)

    def getUndoAction(self):
        return self._undo_action

    def getRedoAction(self):
        return self._redo_action

    def undo(self):
#        print "_undo_action"
        self._undo_action.getParent().clearDialogPanel()
        self._current_set -= 1
        assert(self._current_set >= 0)
        self._updateUndoRedo()

    def redo(self):
#        print "redo"
        self._redo_action.getParent().clearDialogPanel()
        self._current_set += 1
        assert(self._current_set <= len(self.paramSets)-1)
        self._updateUndoRedo()

    def importCurrentChemistryDB(self, params):
        title = "import CurrentChemistry DB"
        filepath = params.getParam(parameters.CurrentDatabasePath).getValue()
        #
        # we call that function to enable import between users
        #
        if filepath != None:
            filepath = _userDatabaseExchangeEnabling(filepath)
        
        if not filepath:
            filename = self.getCurrentParamValue(parameters.DefaultDatabase)
            path = self.getChemistryDatabasePath()
            if not path:
                self._error(title
                            , "unable to find the path for the default database " + filename)
                return
            filepath = os.path.join(path, filename)
        if not os.path.exists(filepath):
            self._error(title, "file " + filepath + " does not exist, aborting...")
            return
        if filepath == None:
            filepath = os.environ.get("WRAPPER_DAT")+"/"+"phreeqc.dat"
        fh = None
        try:
            fh = open(filepath, "r")
        except:
            self._error(title, "could not open file " + filepath)
            return

        db = ChemistryDB()
        try:
            db.readFromPhreeqcFormat(fh)
        except Exception, err:
            traceback.print_exc()
            self._error(title, "Error importing database " + filepath + " : \n" + str(err))
            return

        params.getParam(parameters.CurrentDatabasePath).setValue(filepath)
        params.getParam(parameters.IMPORTED_CHEMISTRY_DB).setValue(db)
        self._info(title, "database " + filepath + " successfully imported !")
        return True
Beispiel #16
0
 def addToMenu(self, menu, id=None, ):
     return Action.addToMenu(self, menu, id, kind=wx.ITEM_CHECK)
Beispiel #17
0
 def __init__(self, win, param_mgr):
     Action.__init__(self, win, "ShowParams",
                     "Display the current parameters in a table")
     self.param_mgr = param_mgr
Beispiel #18
0
 def __init__(self, win, params_mgr):
     Action.__init__(self, win, "New", "Reset parameters", menuText='&New'
                     , accelerator='CTRL+N', iconId = wx.ART_NEW, )
     self.params_mgr=params_mgr
Beispiel #19
0
 def __init__(self, win, param_mgr):
     Action.__init__(self, win, "Plot results over time"
                     , ''
                     , iconId = wx.ART_FILE_OPEN)
     self.param_mgr = param_mgr
Beispiel #20
0
 def __init__(self, win):
     Action.__init__(self, win, "Dock the Dialog Pane"
                     , 'make the center dialog pane to be docked')
Beispiel #21
0
 def __init__(self, win):
     Action.__init__(self, win, "Float the Dialog Pane"
                     , 'make the center dialog pane to be floating around')
Beispiel #22
0
 def __init__(self, win, param_mgr):
     Action.__init__(self, win, "ShowParams", "Display the current parameters in a table")
     self.param_mgr = param_mgr
Beispiel #23
0
 def __init__(self, win):
     Action.__init__(self, win, "Gmsh", "Will launch Gmsh", menuText = '&Gmsh'
                     , iconId = wx.ART_EXECUTABLE_FILE)
Beispiel #24
0
 def addToCustomTreeCtrl(self, tree, parentItem):
     return Action.addToCustomTreeCtrl(self, tree, parentItem, TREE_CHECKBOX)
Beispiel #25
0
class ParamsManager:
    """
    Manage different sets of Parameters : access to the current sets
    and store previous sets to be able to redo/_undo_action
    """
    def __init__(self):
        self.paramSets = [parameters.ParameterSet()]
        self._current_set = 0
        self.filename = None
        self.chemistry_db_path = None

        self._undo_action = None
        self._redo_action = None

    def createRedoAndUndoActions(self, win):
        self._undo_action = Action(win,
                                   "Undo",
                                   "Undo the last edit",
                                   accelerator='CTRL+Z',
                                   iconId=wx.ART_UNDO,
                                   callback=self.undo)
        self._undo_action.setDisabled(True)
        self._redo_action = Action(win,
                                   "Redo",
                                   "Redo the last undone edit",
                                   accelerator='CTRL+Y',
                                   iconId=wx.ART_REDO,
                                   callback=self.redo)
        self._redo_action.setDisabled(True)

    def getUndoAction(self):
        return self._undo_action

    def getRedoAction(self):
        return self._redo_action

    def undo(self):
        #        print "_undo_action"
        self._undo_action.getParent().clearDialogPanel()
        self._current_set -= 1
        assert (self._current_set >= 0)
        self._updateUndoRedo()

    def redo(self):
        #        print "redo"
        self._redo_action.getParent().clearDialogPanel()
        self._current_set += 1
        assert (self._current_set <= len(self.paramSets) - 1)
        self._updateUndoRedo()

    def importCurrentChemistryDB(self, params):
        title = "import CurrentChemistry DB"
        filepath = params.getParam(parameters.CurrentDatabasePath).getValue()
        #
        # we call that function to enable import between users
        #
        if filepath != None:
            filepath = _userDatabaseExchangeEnabling(filepath)

        if not filepath:
            filename = self.getCurrentParamValue(parameters.DefaultDatabase)
            path = self.getChemistryDatabasePath()
            if not path:
                self._error(
                    title,
                    "unable to find the path for the default database " +
                    filename)
                return
            filepath = os.path.join(path, filename)
        if not os.path.exists(filepath):
            self._error(title,
                        "file " + filepath + " does not exist, aborting...")
            return
        if filepath == None:
            filepath = os.environ.get("WRAPPER_DAT") + "/" + "phreeqc.dat"
        fh = None
        try:
            fh = open(filepath, "r")
        except:
            self._error(title, "could not open file " + filepath)
            return

        db = ChemistryDB()
        try:
            db.readFromPhreeqcFormat(fh)
        except Exception, err:
            traceback.print_exc()
            self._error(
                title,
                "Error importing database " + filepath + " : \n" + str(err))
            return

        params.getParam(parameters.CurrentDatabasePath).setValue(filepath)
        params.getParam(parameters.IMPORTED_CHEMISTRY_DB).setValue(db)
        self._info(title, "database " + filepath + " successfully imported !")
        return True
Beispiel #26
0
 def __init__(self, win):
     Action.__init__(self, win, "Open Py&Shell Window"
                     , 'An interactive interpreter window with the demo app and frame objects in the namespace'
                     , accelerator = 'F5', iconId = 'wx.ART_IMAGES_' + 'pyshell')
     self.shell = None
Beispiel #27
0
 def __init__(self, win):
     Action.__init__(self, win, "Open &Widget Inspector"
                     , 'A tool that lets you browse the live widgets and sizers in an application'
                     , accelerator = 'F6', iconId = 'wx.ART_IMAGES_inspect')
Beispiel #28
0
 def __init__(self, win):
     Action.__init__(self, win, "Help", "Will show Help", menuText = '&Help'
                     , accelerator = 'CTRL+H', iconId = wx.ART_HELP)