Skip to content

Commit

Permalink
Initial GUI support for output module settings
Browse files Browse the repository at this point in the history
Introduces OutputModuleConfigurationWidget; note that this has to be
set on each OutputModule, should have the ability to inherit from
parent classes...  Same widget works for all output modules.  Only
added to vtkRendererOutput right now.
  • Loading branch information
dakoop committed May 3, 2014
1 parent 61dfc45 commit fbfaabf
Show file tree
Hide file tree
Showing 3 changed files with 415 additions and 2 deletions.
21 changes: 20 additions & 1 deletion vistrails/core/modules/output_modules.py
Expand Up @@ -6,7 +6,7 @@

from vistrails.core.configuration import ConfigurationObject, ConfigField, ConfigPath, ConfigURL, get_vistrails_persistent_configuration, get_vistrails_temp_configuration
from vistrails.core.modules.vistrails_module import Module, NotCacheable, ModuleError
from vistrails.core.modules.config import IPort, OPort
from vistrails.core.modules.config import IPort, OPort, ModuleSettings
import vistrails.core.system

class OutputMode(object):
Expand Down Expand Up @@ -66,6 +66,23 @@ def get_field(cls, k):
cls_list.extend(c.__bases__)
return None

@classmethod
def get_all_fields(cls):
field_dicts = []
cls_list = [cls]
while len(cls_list) > 0:
c = cls_list.pop(0)
if issubclass(c, OutputModeConfig):
c.ensure_field_dict()
field_dicts.append(c._field_dict)
cls_list.extend(c.__bases__)
field_dict = {}
for fd in reversed(field_dicts):
field_dict.update(fd)
fields = field_dict.values()
fields.sort()
return fields

@classmethod
def get_default(cls, k):
f = cls.get_field(k)
Expand Down Expand Up @@ -145,6 +162,7 @@ class OutputModule(NotCacheable, Module):
_input_ports = [IPort('value', "Variant"),
IPort('mode_type', "String"),
IPort('configuration', "Dictionary")]
_settings = ModuleSettings(configure_widget="vistrails.gui.modules.output_configuration:OutputModuleConfigurationWidget")

# configuration is a dictionary of dictionaries where root-level
# keys are mode_types and the inner dictionaries are
Expand Down Expand Up @@ -208,6 +226,7 @@ def get_sorted_mode_list(cls):

mode_dict = {}
for c in reversed(cls_list):
c.ensure_mode_dict()
mode_dict.update(c._output_modes_dict)
mode_list = [c for c, _ in reversed(sorted(mode_dict.itervalues(),
key=lambda x: x[1]))]
Expand Down

0 comments on commit fbfaabf

Please sign in to comment.