コード例 #1
0
    def __init__(self,
                 parent,
                 region,
                 tabChangeCallback=None,
                 tabs=defaultTabs):

        RuntimeListener.__init__(self)

        self.parent = parent
        self.region = region
        self.tabChangeCallback = tabChangeCallback

        patchEnthoughtClasses()

        # Remove incompatible tabs
        self.tabs = [tab for tab in tabs if tab.isRegionSupported(region)]

        # Create tab instances
        self.tabs = [tab(region) for tab in self.tabs]

        # Strip titles from tab views, but save them for use as tab labels
        self.titles = []
        for tab in self.tabs:
            self.titles.append(tab.traits_view.title)
            tab.traits_view.title = ""

        # Add a trait for each tab
        for i, tab in enumerate(self.tabs):
            self.add_trait('tab%d' % i, tab)

        # Set the handler for each tab if it is not specified
        for tab in self.tabs:
            if not tab.traits_view.handler:
                tab.traits_view.handler = RegionInspectorTabHandler

        # Create the view
        items = [
            Item('tab%d' % i,
                 editor=InstanceEditor(view=tab.traits_view),
                 style='custom',
                 show_label=False,
                 springy=True) for i, tab in enumerate(self.tabs)
        ]
        if len(self.tabs) == 1:
            args = [items[0]]
        else:
            args = [
                Group(item, label=self.titles[i])
                for i, item in enumerate(items)
            ]
        self.handler = RegionInspectorHandler()
        kwargs = dict(handler=self.handler,
                      buttons=NoButtons,
                      title=self.region.getName())
        self.traits_view = View(*args, **kwargs)

        self.activeTabIndex = 0
        self.tabNeedsUpdate = [True] * len(self.tabs)
        self.tabNeedsSwitch = [False] * len(self.tabs)
        self.initCompleted = True
コード例 #2
0
    def __init__(self, parent, network):

        RuntimeListener.__init__(self)

        self.parent = parent
        self.network = network

        patchEnthoughtClasses()
コード例 #3
0
    def __init__(self, *args, **kwargs):

        Selector.__init__(self, *args, **kwargs)
        RuntimeListener.__init__(self)

        self.outputImage = None
        self.setDimensions()
        self.update()
コード例 #4
0
  def __init__(self, *args, **kwargs):

    Selector.__init__(self, *args, **kwargs)
    RuntimeListener.__init__(self)

    self.outputImage = None
    self.setDimensions()
    self.update()
コード例 #5
0
  def __init__(self, parent, network):

    RuntimeListener.__init__(self)

    self.parent = parent
    self.network = network

    patchEnthoughtClasses()
コード例 #6
0
  def __init__(self, parent, region, tabChangeCallback=None, tabs=defaultTabs):

    RuntimeListener.__init__(self)

    self.parent = parent
    self.region = region
    self.tabChangeCallback = tabChangeCallback

    patchEnthoughtClasses()

    # Remove incompatible tabs
    self.tabs = [tab for tab in tabs if tab.isRegionSupported(region)]

    # Create tab instances
    self.tabs = [tab(region) for tab in self.tabs]

    # Strip titles from tab views, but save them for use as tab labels
    self.titles = []
    for tab in self.tabs:
      self.titles.append(tab.traits_view.title)
      tab.traits_view.title = ""

    # Add a trait for each tab
    for i, tab in enumerate(self.tabs):
      self.add_trait('tab%d' % i, tab)

    # Set the handler for each tab if it is not specified
    for tab in self.tabs:
      if not tab.traits_view.handler:
        tab.traits_view.handler = RegionInspectorTabHandler

    # Create the view
    items = [Item('tab%d' % i,
                  editor=InstanceEditor(view=tab.traits_view),
                  style='custom',
                  show_label=False,
                  springy=True)
             for i, tab in enumerate(self.tabs)]
    if len(self.tabs) == 1:
      args = [items[0]]
    else:
      args = [Group(item, label=self.titles[i]) for i, item in enumerate(items)]
    self.handler = RegionInspectorHandler()
    kwargs = dict(handler=self.handler,
                  buttons=NoButtons,
                  title=self.region.getName())
    self.traits_view = View(*args, **kwargs)

    self.activeTabIndex = 0
    self.tabNeedsUpdate = [True] * len(self.tabs)
    self.tabNeedsSwitch = [False] * len(self.tabs)
    self.initCompleted = True