Package mrv :: Package maya :: Package ui :: Package browse :: Module option
[hide private]
[frames] | no frames]

Source Code for Module mrv.maya.ui.browse.option

 1  # -*- coding: utf-8 -*- 
 2  """module with option implementations, to be shown in finder layouts""" 
 3  __docformat__ = "restructuredtext" 
 4   
 5  from interface import iOptions 
 6  import mrv.maya.ui as ui 
 7  import mrv.maya 
 8  import mrv.maya.util 
 9  Mel = mrv.maya.Mel 
10  opts = mrv.maya.util.optionvars 
11   
12 -class FileOpenOptions(ui.ColumnLayout, iOptions):
13 """Options implementation providing options useful during file-open""" 14 15 #{ Configuration 16 kOVExecuteScriptNodes = 'fileExecuteSN' 17 kOVIgnoreVersion = 'fileOpenIgnoreVersion' 18 kOVSelectivePreload = 'fileSelPreload' 19 kOVRefLoadSetting = 'fileOpenRefLoadSetting' 20 #} END configuration 21
22 - def __init__(self):
25
26 - def _create_ui_elements(self):
27 self.cbScriptNodes = ui.CheckBox(label="Execute ScriptNodes", value=1) 28 self.cbIgnoreVersion = ui.CheckBox(label="Ignore Version") 29 30 self.omReference = ui.OptionMenu(label="Load Settings") 31 32 ui.MenuItem(label="Load Default References") 33 ui.MenuItem(label="Load All References") 34 ui.MenuItem(label="Load Top References") 35 ui.MenuItem(label="Load No References") 36 37 self.cbSelectivePreload = ui.CheckBox(label="Selective Preload")
38
39 - def _restore_saved_values(self):
40 self.cbScriptNodes.p_value = opts.get(self.kOVExecuteScriptNodes, True) 41 self.cbIgnoreVersion.p_value = opts.get(self.kOVIgnoreVersion, False) 42 self.cbSelectivePreload.p_value = opts.get(self.kOVSelectivePreload, False) 43 self.omReference.p_select = opts.get(self.kOVRefLoadSetting, 1)
44
45 - def fileOptions(self):
46 """:return: dict with keyword options reflecting the settings of the 47 interface. These should be given to the file command""" 48 options = dict() 49 options['ignoreVersion'] = self.cbIgnoreVersion.p_value 50 options['executeScriptNodes'] = self.cbScriptNodes.p_value 51 52 # TODO: Handle selective Preload ! 53 54 # TODO: use conditionals to work in older maya versions as well 55 refsl = self.omReference.p_sl 56 if refsl == 2: 57 options['loadAllReferences'] = True 58 elif refsl == 3: 59 options['loadReferenceDepth'] = "topOnly" 60 elif refsl == 4: 61 options['loadNoReferences'] = True 62 63 return options
64