Hi There,

Below is a little function (also attached) that gives
you the command 'grepset' so you can grep settings
using a regexp.

Use it like this:
############### example  #######################
PyMOL>grepset dot|line
auto_show_lines                on
cgo_dot_radius                 -1.00000
cgo_dot_width                  2.00000
cgo_line_radius                -0.05000
cgo_line_width                 1.00000
dot_color                      default
dot_density                    2
dot_hydrogens                  on
dot_mode                       0
dot_radius                     0.00000
dot_solvent                    0
dot_width                      2.00000
line_radius                    0.00000
line_smooth                    on
line_width                     2.00000
roving_lines                   10.00000
sculpt_line_weight             1.00000
trim_dots                      on
18 settings matched
 
############ end example  #######################

To install:

Just put the code below in a file and 'run <file>'
from within pymol to get the command activated.

Cheers,
Zac

#### code below ####
from pymol import cmd
import pymol.setting

def grepset(regexp=''):
   '''
DESCRIPTION
   "grepset" greps through the list of settings using a python
   regular expression as defined in the 're' module.
   It returns a list of settings/values matching the regexp.
   No regexp returns every setting.

USAGE
   grepset [regexp]

EXAMPLE
   grepset line
   grepset ray

SEE ALSO
   Python re module
   '''

   from re import compile

   count=0
   regexp=compile(regexp)
   for a in pymol.setting.get_index_list():
      setting=pymol.setting._get_name(a)
      if regexp.search(setting):
         count = count + 1
         print '%-30s %s' % (setting, cmd.get_setting_text(a,'',-1))

   print '%d settings matched' % count
cmd.extend('grepset',grepset)
from pymol import cmd
import pymol.setting

def grepset(regexp=''):
   '''
DESCRIPTION
   "grepset" greps through the list of settings using a python
   regular expression as defined in the 're' module.
   It returns a list of settings/values matching the regexp.
   No regexp returns every setting.

USAGE
   grepset [regexp]

EXAMPLE
   grepset line
   grepset ray

SEE ALSO
   Python re module
   '''

   from re import compile

   count=0
   regexp=compile(regexp)
   for a in pymol.setting.get_index_list():
      setting=pymol.setting._get_name(a)
      if regexp.search(setting):
         count = count + 1
         print '%-30s %s' % (setting, cmd.get_setting_text(a,'',-1))

   print '%d settings matched' % count
cmd.extend('grepset',grepset)

Reply via email to