コード例 #1
0
  def _createView(self):
    """Set up a view for the traits."""

    items = []

    if self.showProgressBar:
      items.append(Item('progress', show_label=False,
                        editor=ProgressEditor(callback=self._seek)))

    # Controls
    items.append(
      alignCenter(
        Item('backwardButton', style='custom',
          enabled_when='not object.running and object.mainloopRunning '
                      +'and object.sensors and object.iteration > 1'),
        Item('runButton', style='custom',
          enabled_when='object.pause and not object.done'),
        Item('pauseButton', style='custom',
          enabled_when='not (object.pause or object.done)'),
        Item('stepButton', style='custom',
          enabled_when='object.pause and not object.done'),
        show_labels=False,
        orientation='horizontal'
      ))

    # Repeat button and pause target buttons
    items.append(
      alignCenter(
        Item('repeatButton', show_label=False,
             enabled_when='not object.running and object.mainloopRunning '
                          'and object.iteration > 0'),
        Item('nextTargetButton', show_label=False,
             editor=ButtonEditor(label_value='targetButtonLabel'),
             enabled_when='not object.running and object.mainloopRunning '
                          'and object.pauseTarget'),
        Item('customTargetButton', show_label=False,
              enabled_when='not object.running and object.mainloopRunning')
      ))

    # Speed control
    items.append(Item('speed', style='custom', show_label=False,
                      editor=EnumEditor(cols=1, values={
                        1   : '1: Slow (update on every iteration)',
                        10  : '2: Medium (update every 10 iterations)',
                        100 : '3: Fast (update every 100 iterations)'
                      })
                 ))


    items.extend([
      Group(
        Item('pauseAtNextStep'),
        show_left=False
      ),
      alignLeft(
        Item('stopButton', show_label=False, enabled_when='object.iteration')
      )
    ])

    self.traits_view = View(*items)
コード例 #2
0
    def _createView(self):
        """Set up the view for the traits."""

        # Make our display width and height have the same aspect ratio as the region's
        #  width and height
        regionWidth = self.dimsPerLayer[0][0]
        regionHeight = self.dimsPerLayer[0][1]

        displayWidth = 180
        displayHeight = displayWidth * float(regionHeight) / float(regionWidth)

        imageItems = []
        if hasattr(self, 'topDownImage'):
            imageItems.append(
                alignCenter(
                    Item(name='topDownImage',
                         editor=ImageEditor(width=displayWidth,
                                            height=displayHeight,
                                            caption='TopDown Outputs',
                                            interpolate=False),
                         style='custom',
                         show_label=False)))
            self.topDownImageInfo = 'max output value: %f at (%d,%d)' % (
                1.0, 10, 10)
            imageItems.append(
                alignCenter(
                    Item(name='topDownImageInfo',
                         style='readonly',
                         show_label=False)))

        if hasattr(self, 'bottomUpImage'):
            imageItems.append(
                alignCenter(
                    Item(name='bottomUpImage',
                         editor=ImageEditor(width=displayWidth,
                                            height=displayHeight,
                                            caption='BottomUp Outputs',
                                            interpolate=False),
                         style='custom',
                         show_label=False)))
            self.bottomUpImageInfo = 'max output value: %f at (%d,%d)' % (
                1.0, 10, 10)
            imageItems.append(
                alignCenter(
                    Item(name='bottomUpImageInfo',
                         style='readonly',
                         show_label=False)))

        self.traits_view = View(Group(*imageItems), title='OutputImages')
コード例 #3
0
  def _createView(self):
    """Set up the view for the traits."""

    self.traits_view = View(
      Group(
        Group(
          alignCenter(
            Item('loadFile', show_label=False,
              editor=FileOrDirectoryEditor(buttonLabel="Load file...")),
            Item('appendFile', show_label=False,
              editor=FileOrDirectoryEditor(buttonLabel="Append file..."))
          ),
          label='Data',
          show_border=True
        ),
        Group(
          Item('position'),
          Item('repeatCount'),
          Item('scalingMode'),
          Item('activeOutputCount', style='readonly'),
          Item('maxOutputVectorCount', style='readonly'),
          Item('vectorCount', style='readonly'),
          Item('recentFile', style='readonly'),
          label='Parameters',
          show_border=True
        )
      ),
      title='Data'
    )
コード例 #4
0
ファイル: OutputImagesTab.py プロジェクト: plexzhang/nupic-1
    def _createView(self):
        """Set up the view for the traits."""

        # Make our display width and height have the same aspect ratio as the region's
        #  width and height
        regionWidth = self.dimsPerLayer[0][0]
        regionHeight = self.dimsPerLayer[0][1]

        displayWidth = 180
        displayHeight = displayWidth * float(regionHeight) / float(regionWidth)

        imageItems = []
        if hasattr(self, "topDownImage"):
            imageItems.append(
                alignCenter(
                    Item(
                        name="topDownImage",
                        editor=ImageEditor(
                            width=displayWidth, height=displayHeight, caption="TopDown Outputs", interpolate=False
                        ),
                        style="custom",
                        show_label=False,
                    )
                )
            )
            self.topDownImageInfo = "max output value: %f at (%d,%d)" % (1.0, 10, 10)
            imageItems.append(alignCenter(Item(name="topDownImageInfo", style="readonly", show_label=False)))

        if hasattr(self, "bottomUpImage"):
            imageItems.append(
                alignCenter(
                    Item(
                        name="bottomUpImage",
                        editor=ImageEditor(
                            width=displayWidth, height=displayHeight, caption="BottomUp Outputs", interpolate=False
                        ),
                        style="custom",
                        show_label=False,
                    )
                )
            )
            self.bottomUpImageInfo = "max output value: %f at (%d,%d)" % (1.0, 10, 10)
            imageItems.append(alignCenter(Item(name="bottomUpImageInfo", style="readonly", show_label=False)))

        self.traits_view = View(Group(*imageItems), title="OutputImages")
コード例 #5
0
  def __init__(self, region):
    RegionInspectorTab.__init__(self, region)

    self.width = self.region.getParameter('width')
    self.height = self.region.getParameter('height')

    self.add_trait('image', Instance(Image.Image))
    self.add_trait('mode', Str('erode'))

    self.traits_view = View(
      Group(alignCenter(Item('mode', style='readonly')),
            alignCenter(Item('image',
                             editor=ImageEditor(width=self.width,
                                                height=self.height,
                                                caption='Alpha Image'),
                             show_label=False))),
      title='Alpha'
    )
コード例 #6
0
    def __init__(self, region):
        RegionInspectorTab.__init__(self, region)

        self.width = self.region.getParameter('width')
        self.height = self.region.getParameter('height')

        self.add_trait('image', Instance(Image.Image))
        self.add_trait('mode', Str('erode'))

        self.traits_view = View(Group(
            alignCenter(Item('mode', style='readonly')),
            alignCenter(
                Item('image',
                     editor=ImageEditor(width=self.width,
                                        height=self.height,
                                        caption='Alpha Image'),
                     show_label=False))),
                                title='Alpha')
コード例 #7
0
    def __init__(self, region):

        RegionInspectorTab.__init__(self, region)

        self.traits_view = View(Group(
            Item('outputFile', style='text'),
            alignCenter(Item('flushFile', show_label=False),
                        Item('closeFile', show_label=False))),
                                title='Data')
コード例 #8
0
  def __init__(self, region):

    RegionInspectorTab.__init__(self, region)

    self.traits_view = View(
      Group(
        Item('outputFile', style='text'),
        alignCenter(
          Item('flushFile', show_label=False),
          Item('closeFile', show_label=False)
        )
      ),
      title='Data'
    )
コード例 #9
0
    def _createView(self):
        """Set up a view for the traits."""

        items = []

        if self.showProgressBar:
            items.append(
                Item('progress',
                     show_label=False,
                     editor=ProgressEditor(callback=self._seek)))

        # Controls
        items.append(
            alignCenter(Item(
                'backwardButton',
                style='custom',
                enabled_when='not object.running and object.mainloopRunning ' +
                'and object.sensors and object.iteration > 1'),
                        Item('runButton',
                             style='custom',
                             enabled_when='object.pause and not object.done'),
                        Item('pauseButton',
                             style='custom',
                             enabled_when='not (object.pause or object.done)'),
                        Item('stepButton',
                             style='custom',
                             enabled_when='object.pause and not object.done'),
                        show_labels=False,
                        orientation='horizontal'))

        # Repeat button and pause target buttons
        items.append(
            alignCenter(
                Item(
                    'repeatButton',
                    show_label=False,
                    enabled_when='not object.running and object.mainloopRunning '
                    'and object.iteration > 0'),
                Item(
                    'nextTargetButton',
                    show_label=False,
                    editor=ButtonEditor(label_value='targetButtonLabel'),
                    enabled_when='not object.running and object.mainloopRunning '
                    'and object.pauseTarget'),
                Item(
                    'customTargetButton',
                    show_label=False,
                    enabled_when='not object.running and object.mainloopRunning'
                )))

        # Speed control
        items.append(
            Item('speed',
                 style='custom',
                 show_label=False,
                 editor=EnumEditor(
                     cols=1,
                     values={
                         1: '1: Slow (update on every iteration)',
                         10: '2: Medium (update every 10 iterations)',
                         100: '3: Fast (update every 100 iterations)'
                     })))

        items.extend([
            Group(Item('pauseAtNextStep'), show_left=False),
            alignLeft(
                Item('stopButton',
                     show_label=False,
                     enabled_when='object.iteration'))
        ])

        self.traits_view = View(*items)