[Mumps2Py:] [77] file_create_m2p now works even if an input file hasn' t already been open and parsed. |
[ Thread Index |
Date Index
| More lists.mumps2py.org/discuss Archives
]
Revision: 77
Author: pgallot
Date: 2008-02-01 20:15:49 +0000 (Fri, 01 Feb 2008)
Log Message:
-----------
file_create_m2p now works even if an input file hasn't already been open and parsed.
Modified Paths:
--------------
trunk/mumps2py_ui.pyw
Modified: trunk/mumps2py_ui.pyw
===================================================================
--- trunk/mumps2py_ui.pyw 2008-01-31 21:43:21 UTC (rev 76)
+++ trunk/mumps2py_ui.pyw 2008-02-01 20:15:49 UTC (rev 77)
@@ -294,21 +294,30 @@
""" saves what is in the After window to a file."""
if self.modules:
base_fname = self.modules[0].input_file
- suggest_name = "%s.m2p" % ( \
- os.path.splitext(base_fname)[0] )
-
- m2p_fname = tkFileDialog.asksaveasfilename(parent = self.root,
- initialfile = suggest_name)
- if m2p_fname:
- input_fname = tkFileDialog.askopenfilename(\
- parent = self.root,
- filetypes = [ ("RSA files","*.rsa"), ("RTN files","*.rtn")],
- initialdir = os.path.abspath(base_fname),
- initialfile = os.path.basename(base_fname))
- if input_fname:
- create_m2p_file(m2p_fname, input_fname)
- self.message(m2p_fname + " created.")
-
+ dlg_title = "confirm input file"
+ else:
+ base_fname = "./tesfiles/fm22.rsa"
+ dlg_title = "select input file"
+
+ input_fname = tkFileDialog.askopenfilename(\
+ parent = self.root,
+ title = dlg_title,
+ filetypes = [ ("RSA files","*.rsa"), ("RTN files","*.rtn")],
+ initialdir = os.path.abspath(base_fname),
+ initialfile = os.path.basename(base_fname))
+
+ if not input_fname:
+ return
+
+ suggest_name = "%s.m2p" % (os.path.splitext(input_fname)[0])
+ m2p_fname = tkFileDialog.asksaveasfilename( \
+ parent = self.root, initialfile = suggest_name,
+ title = " Save the mp2 file as..."
+ )
+ if m2p_fname:
+ if input_fname:
+ create_m2p_file(m2p_fname, input_fname)
+ self.message(m2p_fname + " created.")
def save_and_run(self):
"""save the result of the translation to a file and execute it"""