示例#1
0
def openFile():
    """Open a file and set it as the current file"""
    cur = GD.cfg.get('curfile',GD.cfg.get('workdir','.'))
    fn = qt.QFileDialog.getSaveFileName(
        cur,"pyformex scripts (*.frm *.py)",None,"save file dialog",
        "Choose a file to open (New or Exisiting)" )
    if fn:
        fn = str(fn)
        GD.cfg['workdir'] = os.path.dirname(fn)
        gui.setcurfile(fn)
示例#2
0
def openFile(exist=True):
    """Open a file selection dialog and set the selection as the current file.

    The default only accepts existing files. Use newFile() to accept new files.
    """
    cur = GD.cfg.get('curfile',GD.cfg.get('workdir','.'))
    fs = widgets.FileSelection(cur,"pyformex scripts (*.frm *.py)",exist=exist)
    fn = fs.getFilename()
    if fn:
        GD.cfg['workdir'] = os.path.dirname(fn)
        gui.setcurfile(fn)
示例#3
0
def runExample(i):
    """Run example i from the list of found examples."""
    global example
    gui.setcurfile(os.path.join(GD.cfg.exampledir,example[i]))
    play()