Package schrodinger :: Package ui :: Package qt :: Module appframework :: Class DialogParameters
[hide private]
[frames] | no frames]

Class DialogParameters


Class for holding dialog parameters.  Required by AppFramework Frame
Dialogs.

When creating an AppFramework instance, keyword 'dialogs' can be sent
with dictionary.  This dictionary should hold another dictionary of
options for each dialog the user wants to set options for, and the
key for that dictionary should be the name of the dialog.

Example:

dialogs = {'start': {'jobname': 'my_job',
                     'cpus': 0,
                    }
           'read':  {'filetypes': [('Input Files', '*.in'),],
                    }
           'write': {}
           }

Options need not be set upon creation of the AppFramework instance,
however.  You can set options at any point, causing the next call
for that dialog to generate itself with the new options.

The DialogParameters instance can be found as:
<AppFramework instance>.dialog_param

Thus if I wanted to turn off the number of cpus option in the start
dialog, I would have:

<AppFramework instance>.dialog_param.start['cpus'] = 0

or to change the file type for the read dialog:

<AppFramework instance>.dialog_param.read['filetypes'] =
                                                [('<Type>', '<.ext>')]

See the individual *Dialog classes for the supported configuration
options.

Instance Methods [hide private]
 
__init__(self)
See class docstring.
 
set(self, dialog, **kw)
As an alternative to the update() method, I could change the same start dialog options with the command:
 
update(self, dict)
Built in function for updating the DialogParameters class.
Method Details [hide private]

__init__(self)
(Constructor)

 

See class docstring.  Read dialogs parameters (askopenfilename options)
are set to...

    'initialdir': '.'
    'filetypes': [('Input Files', '*.in')]

...by default.

set(self, dialog, **kw)

 

As an alternative to the update() method, I could change the same start
dialog options with the command:

<DialogParameters object>.set('start',
                              jobname = '<my_new_jobname>',
                              tmpdir = 1)

The next time I brought up the dialog, the changes will have been made.

update(self, dict)

 

Built in function for updating the DialogParameters class.  Passing
a dictionary of the values that need to be changed or added will change
current values if he key already exists, or add a new key/value pair if
it doesn't.

Thus, if I wanted to change the start dialog behavior with regard to
jobname and tmpdir, I would probably do something like:

dict = {"start": {'jobname': '<my_new_jobname>',
                  'tmpdir': 1,
                  }
        }

<DialogParameters object>.update(dict)

The next time I brought up the dialog, the changes will have been made.