OSDN Git Service

Undo is kept enabled during 'molload' and related calls. The 'do not keep logs' optio...
authortoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Thu, 6 May 2010 15:10:27 +0000 (15:10 +0000)
committertoshinagata1964 <toshinagata1964@a2be9bc6-48de-4e38-9406-05402d4bc13c>
Thu, 6 May 2010 15:10:27 +0000 (15:10 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/molby/trunk@39 a2be9bc6-48de-4e38-9406-05402d4bc13c

Scripts/loadsave.rb
wxSources/MyDocument.cpp

index abdf366..ff99962 100755 (executable)
@@ -108,13 +108,13 @@ class Molecule
 
     if natoms == 0
                new_unit = true
- #     raise MolbyError, "cannot load crd; the molecule is empty"
        else
                new_unit = false
     end
-       save_undo_enabled = self.undo_enabled?
-       self.undo_enabled = false
+#      save_undo_enabled = self.undo_enabled?
+#      self.undo_enabled = false
        self.update_enabled = false
+       show_progress_panel("Loading GAMESS log file...")
        begin
                fp = open(filename, "rb")
                if nframes > 0
@@ -181,15 +181,19 @@ class Molecule
                        end
                end
        ensure
-               self.undo_enabled = save_undo_enabled
+#              self.undo_enabled = save_undo_enabled
+        hide_progress_panel
                self.update_enabled = true
        end
+       if nframes > 0
+         select_frame(nframes - 1)
+       end
        (n > 0 ? true : false)
   end
   
   def loadxyz(filename)
-       save_undo_enabled = self.undo_enabled?
-       self.undo_enabled = false
+#      save_undo_enabled = self.undo_enabled?
+#      self.undo_enabled = false
        fp = open(filename, "rb")
        n = 0
        coords = []
@@ -249,7 +253,7 @@ class Molecule
 #              end
 #        }
 #      }
-       self.undo_enabled = save_undo_enabled
+#      self.undo_enabled = save_undo_enabled
        (n > 0 ? true : false)
   end
   
@@ -261,8 +265,8 @@ class Molecule
        else
                new_unit = false
     end
-       save_undo_enabled = undo_enabled?
-       self.undo_enabled = false
+#      save_undo_enabled = undo_enabled?
+#      self.undo_enabled = false
        fp = open(filename, "rb")
        if nframes > 0
                create_frame
@@ -271,6 +275,7 @@ class Molecule
        n = 0
        nf = 0
        use_input_orientation = false
+       show_progress_panel("Loading Gaussian out file...")
        while 1
                line = fp.gets
                if line == nil
@@ -324,13 +329,14 @@ class Molecule
                        nf += 1
                end
        end
-       self.undo_enabled = save_undo_enabled
+       hide_progress_panel
+#      self.undo_enabled = save_undo_enabled
        (n > 0 ? true : false)
   end
 
   def loadcom(filename)
-       save_undo_enabled = self.undo_enabled?
-       self.undo_enabled = false
+#      save_undo_enabled = self.undo_enabled?
+#      self.undo_enabled = false
        self.remove(All)
        fp = open(filename, "rb")
        section = 0
@@ -360,13 +366,13 @@ class Molecule
          end
        end
        fp.close
-       self.undo_enabled = save_undo_enabled
+#      self.undo_enabled = save_undo_enabled
        return true
   end
   
   def loadinp(filename)
-       save_undo_enabled = self.undo_enabled?
-       self.undo_enabled = false
+#      save_undo_enabled = self.undo_enabled?
+#      self.undo_enabled = false
        self.remove(All)
        fp = open(filename, "rb")
        section = 0
@@ -399,7 +405,7 @@ class Molecule
        end
        fp.close
        guess_bonds
-       self.undo_enabled = save_undo_enabled
+#      self.undo_enabled = save_undo_enabled
        return true
   end
   
index 04f617c..1e3073b 100755 (executable)
@@ -261,9 +261,9 @@ MyDocument::OnImport(wxCommandEvent& event)
        if (dialog->ShowModal() == wxID_OK) {
                char *p = strdup((const char *)(dialog->GetPath().mb_str(wxConvFile)));
                MoleculeLock(mol);
-               MolActionCallback_setUndoRegistrationEnabled(mol, 0);
+//             MolActionCallback_setUndoRegistrationEnabled(mol, 0);
                MolActionCreateAndPerform(mol, SCRIPT_ACTION("s"), "molload", p);
-               MolActionCallback_setUndoRegistrationEnabled(mol, 1);
+//             MolActionCallback_setUndoRegistrationEnabled(mol, 1);
                MoleculeUnlock(mol);
                free(p);
        }
@@ -915,9 +915,11 @@ MyDocument::OnInvokeAntechamber(wxCommandEvent &event)
                Molby_showError(status);
                return;
        }
-       
+       fix_dosish_path(ante_dir);
+       fix_dosish_path(log_dir);
+
        /*  Prepare the log directory  */
-       wxString dirname(log_dir, wxConvUTF8);
+       wxString dirname(log_dir, wxConvFile);
        if (!wxFileName::Mkdir(dirname, 0777, wxPATH_MKDIR_FULL)) {
                MyAppCallback_errorMessageBox("Cannot create log directory '%s'", log_dir);
                return;
@@ -998,11 +1000,11 @@ MyDocument::OnInvokeAntechamber(wxCommandEvent &event)
                        snprintf(buf, sizeof buf, "-nc %d -c bcc", net_charge);
                } else buf[0] = 0;
 
-               asprintf(&p, "%s/antechamber -i mol.pdb -fi pdb -o mol.ac -fo ac %s", ante_dir, buf);
+               asprintf(&p, "\"%s/antechamber\" -i mol.pdb -fi pdb -o mol.ac -fo ac %s", ante_dir, buf);
 
                status = MyAppCallback_callSubProcess(p, "antechamber");
                if (status == 0) {
-                       asprintf(&p, "%s/parmchk -i mol.ac -f ac -o frcmod", ante_dir);
+                       asprintf(&p, "\"%s/parmchk\" -i mol.ac -f ac -o frcmod", ante_dir);
                        status = MyAppCallback_callSubProcess(p, "parmchk");
                }
        }
@@ -1033,6 +1035,8 @@ MyDocument::OnInvokeAntechamber(wxCommandEvent &event)
                }
        }
        
+       wxFileName::SetCwd(cwd);
+
        /*  Erase log files  */
        bool success = true;
        wxString dir2;
@@ -1097,8 +1101,6 @@ MyDocument::OnInvokeAntechamber(wxCommandEvent &event)
                ((MoleculeView *)GetFirstView())->GetListCtrl()->Update();
                MyAppCallback_messageBox("Antechamber succeeded.", "Success", 0, 0);
        }
-       
-       wxFileName::SetCwd(cwd);
 }
 
 void