Esempio n. 1
0
    def setattr(self, info, object, name, value):
        """Update the inspector when the selected region changes."""

        if name == 'item':
            if value.startswith('-'):
                # Divider
                return
            elif value == 'run':
                # Check that no other RuntimeInspectors are registered
                if 'runtimeInspectorActive' in globals():
                    print "Only one RuntimeInspector may be active at a time"
                    return
                else:
                    globals()['runtimeInspectorActive'] = True
            elif value != 'run' and object.item == 'run':
                globals().pop('runtimeInspectorActive')
            else:
                # Check if it is a NetworkInspector
                for inspector, shortName, longName in object.networkInspectors:
                    if value == shortName:
                        supported = inspector.isNetworkSupported(object.root)
                        if supported is not True:
                            if supported and isinstance(supported, basestring):
                                # Show a dialog explaining why the inspector is not supported
                                dialog = wx.MessageDialog(
                                    None, supported,
                                    '"%s" not supported' % longName,
                                    wx.OK | wx.ICON_ERROR)
                                dialog.ShowModal()
                                dialog.Destroy()
                            return
                        break

        Handler.setattr(self, info, object, name, value)
        if info.ui.history:
            info.ui.history.clear()
        try:
            if name == 'item':
                # Switch inspectors
                object.switchItem()
            elif name == 'index0':
                # Switch dimensions if MRG
                object.switchDimensions(updateScale=False)
            if name != 'item':
                # Switch region with existing inspector
                object.switchRegion()
        except:
            traceback.print_exc()
            os._exit(1)
Esempio n. 2
0
  def setattr(self, info, object, name, value):
    """Update the inspector when the selected region changes."""

    if name == 'item':
      if value.startswith('-'):
        # Divider
        return
      elif value == 'run':
        # Check that no other RuntimeInspectors are registered
        if 'runtimeInspectorActive' in globals():
          print "Only one RuntimeInspector may be active at a time"
          return
        else:
          globals()['runtimeInspectorActive'] = True
      elif value != 'run' and object.item == 'run':
        globals().pop('runtimeInspectorActive')
      else:
        # Check if it is a NetworkInspector
        for inspector, shortName, longName in object.networkInspectors:
          if value == shortName:
            supported = inspector.isNetworkSupported(object.root)
            if supported is not True:
              if supported and isinstance(supported, basestring):
                # Show a dialog explaining why the inspector is not supported
                dialog = wx.MessageDialog(None,
                                          supported,
                                          '"%s" not supported' % longName,
                                          wx.OK | wx.ICON_ERROR)
                dialog.ShowModal()
                dialog.Destroy()
              return
            break

    Handler.setattr(self, info, object, name, value)
    if info.ui.history:
      info.ui.history.clear()
    try:
      if name == 'item':
        # Switch inspectors
        object.switchItem()
      elif name == 'index0':
        # Switch dimensions if MRG
        object.switchDimensions(updateScale=False)
      if name != 'item':
        # Switch region with existing inspector
        object.switchRegion()
    except:
      traceback.print_exc()
      os._exit(1)
Esempio n. 3
0
  def setattr(self, info, object, name, value):
    """Send parameters and execute commands to the RuntimeRegion."""

    Handler.setattr(self, info, object, name, value)
    if info.ui.history:
      # Clear automatic undo history
      info.ui.history.clear()
    if type(value) is unicode:
      value = str(value)

    ns = object.region.spec
    if name in ns.parameters and ns.parameters[name].accessMode == 'ReadWrite':
      # Settable parameter
      object.region.setParameter(name, value)
    elif name in ns.commands:
      object.region.executeCommand([name, str(value)])
    else:

      if hasattr(object.region.getSelf(), name):
        print 'Executing unknown command command:', name
        object.region.executeCommand([name, str(value)])
Esempio n. 4
0
    def setattr(self, info, object, name, value):
        """Send parameters and execute commands to the RuntimeRegion."""

        Handler.setattr(self, info, object, name, value)
        if info.ui.history:
            # Clear automatic undo history
            info.ui.history.clear()
        if type(value) is unicode:
            value = str(value)

        ns = object.region.spec
        if name in ns.parameters and ns.parameters[
                name].accessMode == 'ReadWrite':
            # Settable parameter
            object.region.setParameter(name, value)
        elif name in ns.commands:
            object.region.executeCommand([name, str(value)])
        else:

            if hasattr(object.region.getSelf(), name):
                print 'Executing unknown command command:', name
                object.region.executeCommand([name, str(value)])
Esempio n. 5
0
 def setattr( self, info, object, name, value ):
     Handler.setattr( self, info, object, name, value )
     info.object._updated += 1
Esempio n. 6
0
 def __init__(self,window=None):
     Handler.__init__(self)
     self.window = window
Esempio n. 7
0
    def setattr(self, info, object, name, value):
        """Clear the automatic undo history."""

        Handler.setattr(self, info, object, name, value)
        if info.ui.history:
            info.ui.history.clear()
 def setattr(self, info, object, name, value):
     Handler.setattr(self, info, object, name, value)
     info.object.updated = True
     print(("setattr", name))
Esempio n. 9
0
  def setattr(self, info, object, name, value):
    """Clear the automatic undo history."""

    Handler.setattr(self, info, object, name, value)
    if info.ui.history:
      info.ui.history.clear()
Esempio n. 10
0
 def setattr(self, info, object, name, value):
     print "setting attribute", name
     Handler.setattr(self, info, object, name, value)
     info.object._updated += 1
Esempio n. 11
0
 def setattr(self, info, object, name, value):
     Handler.setattr(self, info, object, name, value)
     info.object._updated = True
 def setattr(self, info, object, name, value): 
     Handler.setattr(self, info, object, name, value)
     info.object.updated = True 
     print "setattr", name