Пример #1
0
def settings():
    """Interactively change the pyformex settings.

    Creates a dialog to change (most of) the pyformex user configuration.
    To change the canvas setttings, use viewportMenu.canvasSettings.
    """
    import plugins
    import sendmail
    from elements import elementTypes

    dia = None
    _actionbuttons = [ 'play', 'rerun', 'step', 'continue', 'stop', 'edit', 'info' ]

    def close():
        dia.close()

    def accept(save=False):
        dia.acceptData()
        res = dia.results
        res['_save_'] = save
        ok_plugins = utils.subDict(res,'_plugins/')
        res['gui/plugins'] = [ p for p in ok_plugins if ok_plugins[p]]
        res['gui/actionbuttons'] = [ t for t in _actionbuttons if res['_gui/%sbutton'%t ] ]
        if res['webgl/script'] == 'custom':
            res['webgl/script'] = 'file:'+res['_webgl_script']
        if res['webgl/guiscript'] == 'custom':
            res['webgl/guiscript'] = res['_webgl_guiscript']
        updateSettings(res)
        plugins.loadConfiguredPlugins()

    def acceptAndSave():
        accept(save=True)

    def autoSettings(keylist):
        return [_I(k,pf.cfg[k]) for k in keylist]

    def changeDirs(dircfg):
        """dircfg is a config variable that is a list of dirs"""
        setDirs(dircfg)
        dia.updateData({dircfg:pf.cfg[dircfg]})

    def changeScriptDirs():
        changeDirs('scriptdirs')
    def changeAppDirs():
        changeDirs('appdirs')

    enablers = []
    mouse_settings = autoSettings(['gui/rotfactor','gui/panfactor','gui/zoomfactor','gui/autozoomfactor','gui/dynazoom','gui/wheelzoom'])

    # Use _ to avoid adding these items in the config
    plugin_items = [ _I('_plugins/'+name,name in pf.cfg['gui/plugins'],text=text) for name,text in plugins.pluginMenus() ]

    bindings_choices = ['PyQt4','PySide']
    bindings_current =  bindings_choices[ 1 if pf.options.pyside else 0 ]
    appearance = [
        _I('gui/style',pf.app.currentStyle(),choices=pf.app.getStyles()),
        _I('gui/font',pf.app.font().toString(),'font'),
        ]

    toolbartip = "Currently, changing the toolbar position will only be in effect when you restart pyFormex"
    toolbars = [
        _I('gui/%s'%t,pf.cfg['gui/%s'%t],text=getattr(pf.GUI,t).windowTitle(),choices=['left','right','top','bottom'],tooltip=toolbartip) for t in [ 'camerabar','modebar','viewbar' ]
        ]
    # Use _ to avoid adding these items in the config
    actionbuttons = [
        _I('_gui/%sbutton'%t,t in pf.cfg['gui/actionbuttons'],text="%s Button" % t.capitalize()) for t in _actionbuttons
        ]

    # callback to set a filename
    def changeFilename(fn):
        fn = draw.askImageFile(fn)
        return fn

    cur = pf.cfg['gui/splash']
#    if not cur:
#        cur = pf.cfg.get('icondir','.')
    viewer = widgets.ImageView(cur,maxheight=200)

    def changeSplash(fn):
        fn = draw.askImageFile(fn)
        if fn:
            viewer.showImage(fn)
        return fn

    mail_settings = [
        _I('mail/sender',pf.cfg.get('mail/sender',sendmail.mail),text="My mail address"),
        _I('mail/server',pf.cfg.get('mail/server','localhost'),text="Outgoing mail server")
        ]

    xtkscripts = ["http://feops.ugent.be/pub/xtk/xtk.js", "http://get.goXTK.com/xtk_edge.js", "http://get.goXTK.com/xtk_release_10.js", 'custom']
    guiscripts = ["http://get.goXTK.com/xtk_xdat.gui.js", 'custom']
    webgl_settings = [
        _I('webgl/script',pf.cfg['webgl/script'],text='XTK base script',choices=xtkscripts),
        _I('_webgl_script','',text='Custom XTK URL',itemtype='button',func=changeFilename),
        _I('webgl/guiscript',pf.cfg['webgl/guiscript'],text='GUI base script',choices=guiscripts),
        _I('_webgl_guiscript','',text='Custom GUI URL'),
        _I('webgl/autogui',pf.cfg['webgl/autogui'],text='Always add a standard GUI'),
        _I('webgl/devel',pf.cfg['webgl/devel'],text='Use a source XTK version'),
        _I('webgl/devpath',pf.cfg['webgl/devpath'],text='Path to the XTK source'),
        ]
    enablers.extend([
        ('webgl/script','custom','_webgl_script'),
        ('webgl/guiscript','custom','_webgl_guiscript'),
        ('webgl/devel',True,'webgl/devpath'),
        ])

    dia = widgets.InputDialog(
        caption='pyFormex Settings',
        store=pf.cfg,
        items=[
            _T('General',[
                _I('syspath',tooltip="If you need to import modules from a non-standard path, you can supply additional paths to search here."),
                _I('editor',tooltip="The command to be used to edit a script file. The command will be executed with the path to the script file as argument."),
                _I('viewer',tooltip="The command to be used to view an HTML file. The command will be executed with the path to the HTML file as argument."),
                _I('browser',tooltip="The command to be used to browse the internet. The command will be executed with an URL as argument."),
                _I('help/docs'),
                _I('autorun',text='Startup script',tooltip='This script will automatically be run at pyFormex startup'),
                _I('scriptdirs',text='Script Paths',tooltip='pyFormex will look for scripts in these directories',buttons=[('Edit',changeScriptDirs)]),
                _I('appdirs',text='Applicationt Paths',tooltip='pyFormex will look for applications in these directories',buttons=[('Edit',changeAppDirs)]),
                _I('autoglobals',text='Auto Globals',tooltip='If checked, global Application variables of any Geometry type will automatically be copied to the pyFormex global variable dictionary (PF), and thus become available in the GUI'),
                _I('showapploaderrors',text='Show Application Load Error Traceback',tooltip='If checked, a traceback of exceptions occurring at Application Load time will be output. If unchecked, such exceptions will be suppressed, and the application will not run.'),
                _I('loadcurproj',text="Reload last project on startup"),
                _I('check_print',text="Check scripts for the use of the print statement"),
                _I('plot2d',text="Prefered 2D plot library",choices=['gnuplot','matplotlib']),
                _I('commands',text='Use commands module instead of subprocess',tooltip="If checked, pyFormex will use the Python 'commands' module for the execution of external commands. The default (unchecked) is to use the 'subprocess' module. If you notice a lot of command failures, or even hangups, you may want to switch."),
                ],
               ),
            _T('Startup',[
                _I('_info_01_','The settings on this page will only become active after restarting pyFormex',itemtype='info'),
                _I('gui/bindings',bindings_current,choices=bindings_choices,tooltip="The Python bindings for the Qt4 library"),
                _I('gui/splash',text='Splash image',itemtype='button',func=changeSplash),
                viewer,
                ]),
            _T('GUI',[
                _G('Appearance',appearance),
                _G('Components',toolbars+actionbuttons+[
                    _I('gui/coordsbox'),
                    _I('gui/showfocus',pf.cfg['gui/showfocus']),
                    _I('gui/runalloption',pf.cfg['gui/runalloption']),
                    _I('gui/timeoutbutton',pf.cfg['gui/timeoutbutton']),
                    _I('gui/timeoutvalue',pf.cfg['gui/timeoutvalue']),
                    ],
                 ),
                ]),
            _T('Canvas',[
                _I('_not_active_','The canvas settings can be set from the Viewport Menu',itemtype='info',text=''),
                ]),
            _T('Drawing',[
                _I('draw/rendermode',pf.cfg['draw/rendermode'],choices=canvas.CanvasSettings.RenderProfiles),
                _I('draw/wait',pf.cfg['draw/wait']),
                _I('draw/picksize',pf.cfg['draw/picksize']),
                _I('draw/disable_depth_test',pf.cfg['draw/disable_depth_test'],text='Disable depth testing for transparent actors'),
                _I('render/avgnormaltreshold',pf.cfg['render/avgnormaltreshold']),
                _I('_info_00_',itemtype='info',text='Changes to the options below will only become effective after restarting pyFormex!'),
                _I('draw/quadline',text='Draw as quadratic lines',itemtype='list',check=True,choices=elementTypes(1),tooltip='Line elements checked here will be drawn as quadratic lines whenever possible.'),
                _I('draw/quadsurf',text='Draw as quadratic surfaces',itemtype='list',check=True,choices=elementTypes(2)+elementTypes(3),tooltip='Surface and volume elements checked here will be drawn as quadratic surfaces whenever possible.'),
                ]),
            _T('Mouse',mouse_settings),
            _T('Plugins',plugin_items),
            _T('WebGL',webgl_settings),
            _T('Environment',[
                _G('Mail',mail_settings),
#                _G('Jobs',jobs_settings),
                ]),
            ],
        enablers=enablers,
        actions=[
            ('Close',close),
            ('Accept and Save',acceptAndSave),
            ('Accept',accept),
            ],
        )
    #dia.resize(800,400)
    dia.show()
Пример #2
0
def settings():
    import plugins
    import sendmail
    from elements import elementTypes
    
    dia = None

    def close():
        dia.close()
        
    def accept(save=False):
        dia.acceptData()
        res = dia.results
        res['_save_'] = save
        pf.debug(res)
        ok_plugins = utils.subDict(res,'_plugins/')
        res['gui/plugins'] = [ p for p in ok_plugins if ok_plugins[p]]
        updateSettings(res)
        plugins.loadConfiguredPlugins()

    def acceptAndSave():
        accept(save=True)

    def autoSettings(keylist):
        return [I(k,pf.cfg[k]) for k in keylist]

    def changeScriptDirs():
        setScriptDirs()
        pf.debug("SCRIPTDIRS NOW " % pf.cfg['scriptdirs'])
        dia.updateData({'scriptdirs':pf.cfg['scriptdirs']})


    mouse_settings = autoSettings(['gui/rotfactor','gui/panfactor','gui/zoomfactor','gui/autozoomfactor','gui/dynazoom','gui/wheelzoom'])
 
    plugin_items = [ I('_plugins/'+name,name in pf.cfg['gui/plugins'],text=text) for name,text in plugins.pluginMenus() ]
    #print plugin_items

    appearence = [
        I('gui/style',pf.GUI.currentStyle(),choices=pf.GUI.getStyles()),
        I('gui/font',pf.app.font().toString(),'font'),
        ]

    toolbartip = "Currently, changing the toolbar position will only be in effect when you restart pyFormex"
    toolbars = [
        I('gui/%s'%t,pf.cfg['gui/%s'%t],text=getattr(pf.GUI,t).windowTitle(),choices=['left','right','top','bottom'],tooltip=toolbartip) for t in [ 'camerabar','modebar','viewbar' ]
        ]

    cur = pf.cfg['gui/splash']
#    if not cur:
#        cur = pf.cfg.get('icondir','.')
    viewer = widgets.ImageView(cur,maxheight=200)

    def changeSplash(fn):
        #print "CURRENT %s" % fn
        fn = draw.askImageFile(fn)
        if fn:
            viewer.showImage(fn)
        return fn

    mail_settings = [
        I('mail/sender',pf.cfg.get('mail/sender',sendmail.mail),text="My mail address"),
        I('mail/server',pf.cfg.get('mail/server','localhost'),text="Outgoing mail server")
        ]

    dia = widgets.InputDialog(
        caption='pyFormex Settings',
        store=pf.cfg,
        items=[
            T('General',[
                I('syspath',tooltip="If you need to import modules from a non-standard path, you can supply additional paths to search here."),
                I('editor',tooltip="The command to be used to edit a script file. The command will be executed with the path to the script file as argument."),
                I('viewer',tooltip="The command to be used to view an HTML file. The command will be executed with the path to the HTML file as argument."),
                I('browser',tooltip="The command to be used to browse the internet. The command will be executed with an URL as argument."),
                I('help/docs'),
                I('autorun',text='Startup script',tooltip='This script will automatically be run at pyFormex startup'),
                I('scriptdirs',text='Script Paths',tooltip='pyFormex will look for scripts in these directories',buttons=[('Edit',changeScriptDirs)]),
                ],
             ),
            T('GUI',[
                G('Appearence',appearence),
                G('Components',toolbars+[
                    I('gui/coordsbox',pf.cfg['gui/coordsbox']),
                    I('gui/showfocus',pf.cfg['gui/showfocus']),
                    I('gui/timeoutbutton',pf.cfg['gui/timeoutbutton']),
                    I('gui/timeoutvalue',pf.cfg['gui/timeoutvalue']),
                    ],
                 ),
                I('gui/splash',text='Splash image',itemtype='button',func=changeSplash),
                viewer,
                ]),
            T('Drawing',[
                I('_info_00_',itemtype='info',text='Changes to these options currently only become effective after restarting pyFormex!'),
                I('draw/quadline',text='Draw as quadratic lines',itemtype='list',check=True,choices=elementTypes(1),tooltip='Line elements checked here will be drawn as quadratic lines whenever possible.'),
                I('draw/quadsurf',text='Draw as quadratic surfaces',itemtype='list',check=True,choices=elementTypes(2)+elementTypes(3),tooltip='Surface and volume elements checked here will be drawn as quadratic surfaces whenever possible.'),
                ]
              ),
            T('Mouse',mouse_settings),
            T('Plugins',plugin_items),
            T('Environment',[
                G('Mail',mail_settings),
#                G('Jobs',jobs_settings),
                ]),
            ],
        actions=[
            ('Close',close),
            ('Accept and Save',acceptAndSave),
            ('Accept',accept),
        ])
    dia.resize(800,400)
    dia.show()
Пример #3
0
def settings():
    """Interactively change the pyformex settings.

    Creates a dialog to change (most of) the pyformex user configuration.
    To change the canvas setttings, use viewportMenu.canvasSettings.
    """
    import plugins
    import sendmail
    from elements import elementTypes

    dia = None
    _actionbuttons = [
        'play', 'rerun', 'step', 'continue', 'stop', 'edit', 'info'
    ]

    def close():
        dia.close()

    def accept(save=False):
        dia.acceptData()
        res = dia.results
        res['_save_'] = save
        ok_plugins = utils.subDict(res, '_plugins/')
        res['gui/plugins'] = [p for p in ok_plugins if ok_plugins[p]]
        res['gui/actionbuttons'] = [
            t for t in _actionbuttons if res['_gui/%sbutton' % t]
        ]
        if res['webgl/script'] == 'custom':
            res['webgl/script'] = 'file:' + res['_webgl_script']
        if res['webgl/guiscript'] == 'custom':
            res['webgl/guiscript'] = res['_webgl_guiscript']
        updateSettings(res)
        plugins.loadConfiguredPlugins()

    def acceptAndSave():
        accept(save=True)

    def autoSettings(keylist):
        return [_I(k, pf.cfg[k]) for k in keylist]

    def changeDirs(dircfg):
        """dircfg is a config variable that is a list of dirs"""
        setDirs(dircfg)
        dia.updateData({dircfg: pf.cfg[dircfg]})

    def changeScriptDirs():
        changeDirs('scriptdirs')

    def changeAppDirs():
        changeDirs('appdirs')

    enablers = []
    mouse_settings = autoSettings([
        'gui/rotfactor', 'gui/panfactor', 'gui/zoomfactor',
        'gui/autozoomfactor', 'gui/dynazoom', 'gui/wheelzoom'
    ])

    # Use _ to avoid adding these items in the config
    plugin_items = [
        _I('_plugins/' + name, name in pf.cfg['gui/plugins'], text=text)
        for name, text in plugins.pluginMenus()
    ]

    bindings_choices = ['PyQt4', 'PySide']
    bindings_current = bindings_choices[1 if pf.options.pyside else 0]
    appearance = [
        _I('gui/style', pf.app.currentStyle(), choices=pf.app.getStyles()),
        _I('gui/font',
           pf.app.font().toString(), 'font'),
    ]

    toolbartip = "Currently, changing the toolbar position will only be in effect when you restart pyFormex"
    toolbars = [
        _I('gui/%s' % t,
           pf.cfg['gui/%s' % t],
           text=getattr(pf.GUI, t).windowTitle(),
           choices=['left', 'right', 'top', 'bottom'],
           tooltip=toolbartip) for t in ['camerabar', 'modebar', 'viewbar']
    ]
    # Use _ to avoid adding these items in the config
    actionbuttons = [
        _I('_gui/%sbutton' % t,
           t in pf.cfg['gui/actionbuttons'],
           text="%s Button" % t.capitalize()) for t in _actionbuttons
    ]

    # callback to set a filename
    def changeFilename(fn):
        fn = draw.askImageFile(fn)
        return fn

    cur = pf.cfg['gui/splash']
    #    if not cur:
    #        cur = pf.cfg.get('icondir','.')
    viewer = widgets.ImageView(cur, maxheight=200)

    def changeSplash(fn):
        fn = draw.askImageFile(fn)
        if fn:
            viewer.showImage(fn)
        return fn

    mail_settings = [
        _I('mail/sender',
           pf.cfg.get('mail/sender', sendmail.mail),
           text="My mail address"),
        _I('mail/server',
           pf.cfg.get('mail/server', 'localhost'),
           text="Outgoing mail server")
    ]

    xtkscripts = [
        "http://feops.ugent.be/pub/xtk/xtk.js",
        "http://get.goXTK.com/xtk_edge.js",
        "http://get.goXTK.com/xtk_release_10.js", 'custom'
    ]
    guiscripts = ["http://get.goXTK.com/xtk_xdat.gui.js", 'custom']
    webgl_settings = [
        _I('webgl/script',
           pf.cfg['webgl/script'],
           text='XTK base script',
           choices=xtkscripts),
        _I('_webgl_script',
           '',
           text='Custom XTK URL',
           itemtype='button',
           func=changeFilename),
        _I('webgl/guiscript',
           pf.cfg['webgl/guiscript'],
           text='GUI base script',
           choices=guiscripts),
        _I('_webgl_guiscript', '', text='Custom GUI URL'),
        _I('webgl/autogui',
           pf.cfg['webgl/autogui'],
           text='Always add a standard GUI'),
        _I('webgl/devel',
           pf.cfg['webgl/devel'],
           text='Use a source XTK version'),
        _I('webgl/devpath',
           pf.cfg['webgl/devpath'],
           text='Path to the XTK source'),
    ]
    enablers.extend([
        ('webgl/script', 'custom', '_webgl_script'),
        ('webgl/guiscript', 'custom', '_webgl_guiscript'),
        ('webgl/devel', True, 'webgl/devpath'),
    ])

    dia = widgets.InputDialog(
        caption='pyFormex Settings',
        store=pf.cfg,
        items=[
            _T(
                'General',
                [
                    _I('syspath',
                       tooltip=
                       "If you need to import modules from a non-standard path, you can supply additional paths to search here."
                       ),
                    _I('editor',
                       tooltip=
                       "The command to be used to edit a script file. The command will be executed with the path to the script file as argument."
                       ),
                    _I('viewer',
                       tooltip=
                       "The command to be used to view an HTML file. The command will be executed with the path to the HTML file as argument."
                       ),
                    _I('browser',
                       tooltip=
                       "The command to be used to browse the internet. The command will be executed with an URL as argument."
                       ),
                    _I('help/docs'),
                    _I('autorun',
                       text='Startup script',
                       tooltip=
                       'This script will automatically be run at pyFormex startup'
                       ),
                    _I('scriptdirs',
                       text='Script Paths',
                       tooltip=
                       'pyFormex will look for scripts in these directories',
                       buttons=[('Edit', changeScriptDirs)]),
                    _I('appdirs',
                       text='Applicationt Paths',
                       tooltip=
                       'pyFormex will look for applications in these directories',
                       buttons=[('Edit', changeAppDirs)]),
                    _I('autoglobals',
                       text='Auto Globals',
                       tooltip=
                       'If checked, global Application variables of any Geometry type will automatically be copied to the pyFormex global variable dictionary (PF), and thus become available in the GUI'
                       ),
                    _I('showapploaderrors',
                       text='Show Application Load Error Traceback',
                       tooltip=
                       'If checked, a traceback of exceptions occurring at Application Load time will be output. If unchecked, such exceptions will be suppressed, and the application will not run.'
                       ),
                    _I('loadcurproj', text="Reload last project on startup"),
                    _I('check_print',
                       text="Check scripts for the use of the print statement"
                       ),
                    _I('plot2d',
                       text="Prefered 2D plot library",
                       choices=['gnuplot', 'matplotlib']),
                    _I('commands',
                       text='Use commands module instead of subprocess',
                       tooltip=
                       "If checked, pyFormex will use the Python 'commands' module for the execution of external commands. The default (unchecked) is to use the 'subprocess' module. If you notice a lot of command failures, or even hangups, you may want to switch."
                       ),
                ],
            ),
            _T('Startup', [
                _I('_info_01_',
                   'The settings on this page will only become active after restarting pyFormex',
                   itemtype='info'),
                _I('gui/bindings',
                   bindings_current,
                   choices=bindings_choices,
                   tooltip="The Python bindings for the Qt4 library"),
                _I('gui/splash',
                   text='Splash image',
                   itemtype='button',
                   func=changeSplash),
                viewer,
            ]),
            _T('GUI', [
                _G('Appearance', appearance),
                _G(
                    'Components',
                    toolbars + actionbuttons + [
                        _I('gui/coordsbox'),
                        _I('gui/showfocus', pf.cfg['gui/showfocus']),
                        _I('gui/runalloption', pf.cfg['gui/runalloption']),
                        _I('gui/timeoutbutton', pf.cfg['gui/timeoutbutton']),
                        _I('gui/timeoutvalue', pf.cfg['gui/timeoutvalue']),
                    ],
                ),
            ]),
            _T('Canvas', [
                _I('_not_active_',
                   'The canvas settings can be set from the Viewport Menu',
                   itemtype='info',
                   text=''),
            ]),
            _T('Drawing', [
                _I('draw/rendermode',
                   pf.cfg['draw/rendermode'],
                   choices=canvas.CanvasSettings.RenderProfiles),
                _I('draw/wait', pf.cfg['draw/wait']),
                _I('draw/picksize', pf.cfg['draw/picksize']),
                _I('draw/disable_depth_test',
                   pf.cfg['draw/disable_depth_test'],
                   text='Disable depth testing for transparent actors'),
                _I('render/avgnormaltreshold',
                   pf.cfg['render/avgnormaltreshold']),
                _I('_info_00_',
                   itemtype='info',
                   text=
                   'Changes to the options below will only become effective after restarting pyFormex!'
                   ),
                _I('draw/quadline',
                   text='Draw as quadratic lines',
                   itemtype='list',
                   check=True,
                   choices=elementTypes(1),
                   tooltip=
                   'Line elements checked here will be drawn as quadratic lines whenever possible.'
                   ),
                _I('draw/quadsurf',
                   text='Draw as quadratic surfaces',
                   itemtype='list',
                   check=True,
                   choices=elementTypes(2) + elementTypes(3),
                   tooltip=
                   'Surface and volume elements checked here will be drawn as quadratic surfaces whenever possible.'
                   ),
            ]),
            _T('Mouse', mouse_settings),
            _T('Plugins', plugin_items),
            _T('WebGL', webgl_settings),
            _T(
                'Environment',
                [
                    _G('Mail', mail_settings),
                    #                _G('Jobs',jobs_settings),
                ]),
        ],
        enablers=enablers,
        actions=[
            ('Close', close),
            ('Accept and Save', acceptAndSave),
            ('Accept', accept),
        ],
    )
    #dia.resize(800,400)
    dia.show()
Пример #4
0
    F = [ Formex(v), Formex(v[e]), Formex(v[s],eltype=eltype) ]
    smooth()
    for Fi in F:
        clear()
        draw(Fi)
        sleep(1)
    wireframe()
    drawVertexNumbers(Fi)
    sleep(1)
        
if __name__ == "draw":

    view('iso')
    ElemList = []
    for ndim in [2,3]:
        ElemList += elements.elementTypes(ndim)
        
    res = askItems([('Element Type',None,'select',['All',]+ElemList),],legacy=True)
    if not res:
        exit()
        
    eltype = res['Element Type']
    if eltype == 'All':
        ellist = ElemList
    else:
        ellist = [eltype]
    for el in ellist:
        showElement(el)
    
    
# End
Пример #5
0
def settings():
    import plugins
    import sendmail
    from elements import elementTypes

    dia = None

    def close():
        dia.close()

    def accept(save=False):
        dia.acceptData()
        res = dia.results
        res["_save_"] = save
        pf.debug(res)
        ok_plugins = utils.subDict(res, "_plugins/")
        res["gui/plugins"] = [p for p in ok_plugins if ok_plugins[p]]
        updateSettings(res)
        plugins.loadConfiguredPlugins()

    def acceptAndSave():
        accept(save=True)

    def autoSettings(keylist):
        return [I(k, pf.cfg[k]) for k in keylist]

    def changeScriptDirs():
        setScriptDirs()
        pf.debug("SCRIPTDIRS NOW " % pf.cfg["scriptdirs"])
        dia.updateData({"scriptdirs": pf.cfg["scriptdirs"]})

    mouse_settings = autoSettings(
        ["gui/rotfactor", "gui/panfactor", "gui/zoomfactor", "gui/autozoomfactor", "gui/dynazoom", "gui/wheelzoom"]
    )

    plugin_items = [
        I("_plugins/" + name, name in pf.cfg["gui/plugins"], text=text) for name, text in plugins.pluginMenus()
    ]
    # print plugin_items

    appearence = [
        I("gui/style", pf.GUI.currentStyle(), choices=pf.GUI.getStyles()),
        I("gui/font", pf.app.font().toString(), "font"),
    ]

    toolbartip = "Currently, changing the toolbar position will only be in effect when you restart pyFormex"
    toolbars = [
        I(
            "gui/%s" % t,
            pf.cfg["gui/%s" % t],
            text=getattr(pf.GUI, t).windowTitle(),
            choices=["left", "right", "top", "bottom"],
            tooltip=toolbartip,
        )
        for t in ["camerabar", "modebar", "viewbar"]
    ]

    cur = pf.cfg["gui/splash"]
    #    if not cur:
    #        cur = pf.cfg.get('icondir','.')
    viewer = widgets.ImageView(cur, maxheight=200)

    def changeSplash(fn):
        # print "CURRENT %s" % fn
        fn = draw.askImageFile(fn)
        if fn:
            viewer.showImage(fn)
        return fn

    mail_settings = [
        I("mail/sender", pf.cfg.get("mail/sender", sendmail.mail), text="My mail address"),
        I("mail/server", pf.cfg.get("mail/server", "localhost"), text="Outgoing mail server"),
    ]

    dia = widgets.InputDialog(
        caption="pyFormex Settings",
        store=pf.cfg,
        items=[
            T(
                "General",
                [
                    I(
                        "syspath",
                        tooltip="If you need to import modules from a non-standard path, you can supply additional paths to search here.",
                    ),
                    I(
                        "editor",
                        tooltip="The command to be used to edit a script file. The command will be executed with the path to the script file as argument.",
                    ),
                    I(
                        "viewer",
                        tooltip="The command to be used to view an HTML file. The command will be executed with the path to the HTML file as argument.",
                    ),
                    I(
                        "browser",
                        tooltip="The command to be used to browse the internet. The command will be executed with an URL as argument.",
                    ),
                    I("help/docs"),
                    I(
                        "autorun",
                        text="Startup script",
                        tooltip="This script will automatically be run at pyFormex startup",
                    ),
                    I(
                        "scriptdirs",
                        text="Script Paths",
                        tooltip="pyFormex will look for scripts in these directories",
                        buttons=[("Edit", changeScriptDirs)],
                    ),
                ],
            ),
            T(
                "GUI",
                [
                    G("Appearence", appearence),
                    G(
                        "Components",
                        toolbars
                        + [
                            I("gui/coordsbox", pf.cfg["gui/coordsbox"]),
                            I("gui/showfocus", pf.cfg["gui/showfocus"]),
                            I("gui/timeoutbutton", pf.cfg["gui/timeoutbutton"]),
                            I("gui/timeoutvalue", pf.cfg["gui/timeoutvalue"]),
                        ],
                    ),
                    I("gui/splash", text="Splash image", itemtype="button", func=changeSplash),
                    viewer,
                ],
            ),
            T(
                "Drawing",
                [
                    I(
                        "_info_00_",
                        itemtype="info",
                        text="Changes to these options currently only become effective after restarting pyFormex!",
                    ),
                    I(
                        "draw/quadline",
                        text="Draw as quadratic lines",
                        itemtype="list",
                        check=True,
                        choices=elementTypes(1),
                        tooltip="Line elements checked here will be drawn as quadratic lines whenever possible.",
                    ),
                    I(
                        "draw/quadsurf",
                        text="Draw as quadratic surfaces",
                        itemtype="list",
                        check=True,
                        choices=elementTypes(2) + elementTypes(3),
                        tooltip="Surface and volume elements checked here will be drawn as quadratic surfaces whenever possible.",
                    ),
                ],
            ),
            T("Mouse", mouse_settings),
            T("Plugins", plugin_items),
            T(
                "Environment",
                [
                    G("Mail", mail_settings),
                    #                G('Jobs',jobs_settings),
                ],
            ),
        ],
        actions=[("Close", close), ("Accept and Save", acceptAndSave), ("Accept", accept)],
    )
    dia.resize(800, 400)
    dia.show()