import ctk
import qt
import slicer
from MRTrackingUtils.qcomboboxcatheter import *

class MRTrackingPanelBase():
  def __init__(self, label="Base"):

    self.label = label
    self.catheters = None     #CatheterCollection
    self.currentCatheter = None

  def setCatheterCollection(self, cath):

    self.catheters = cath

    
  def buildGUI(self, parent, showCatheterSelector=True):
    parentLayout = qt.QVBoxLayout(parent)

    # Catheter selector
    self.catheterComboBox = QComboBoxCatheter()
    self.catheterComboBox.setCatheterCollection(self.catheters)
    self.catheterComboBox.currentIndexChanged.connect(self.onCatheterSelected)
    
    if showCatheterSelector:
      selectorLayout = qt.QFormLayout(parent)
      parentLayout.addLayout(selectorLayout)
      selectorLayout.addRow("Catheter: ", self.catheterComboBox)

    # Main panel
    mainPanelFrame = qt.QFrame(parent)
    parentLayout.addWidget(mainPanelFrame)
    self.buildMainPanel(mainPanelFrame)
    

  def onCatheterSelected(self):
    self.currentCatheter = self.catheterComboBox.getCurrentCatheter()
    self.onSwitchCatheter()


  def switchCatheter(self, name):
    col = self.catheterComboBox.collection
    if col:
      index = col.getIndex(name)
      if index >= 0:
        self.catheterComboBox.setCurrentIndex(index)
    self.onCatheterSelected()

        
  def switchCatheterByIndex(self, index):
    col = self.catheterComboBox.collection
    if col:
      if index >= 0 and index < col.getNumberOfCatheters():
        self.catheterComboBox.setCurrentIndex(index)
    self.onCatheterSelected()
        
      
  def buildMainPanel(self, frame):
    #
    # Should be implemented in the child class
    # 
    pass


  def onSwitchCatheter(self):
    #
    # Should be implemented in the child class
    # 
    pass

d6d9b60a2baefd8f593a97bcd436b03264515744
<mask token>


class MRTrackingPanelBase:
    <mask token>

    def setCatheterCollection(self, cath):
        self.catheters = cath

    def buildGUI(self, parent, showCatheterSelector=True):
        parentLayout = qt.QVBoxLayout(parent)
        self.catheterComboBox = QComboBoxCatheter()
        self.catheterComboBox.setCatheterCollection(self.catheters)
        self.catheterComboBox.currentIndexChanged.connect(self.
            onCatheterSelected)
        if showCatheterSelector:
            selectorLayout = qt.QFormLayout(parent)
            parentLayout.addLayout(selectorLayout)
            selectorLayout.addRow('Catheter: ', self.catheterComboBox)
        mainPanelFrame = qt.QFrame(parent)
        parentLayout.addWidget(mainPanelFrame)
        self.buildMainPanel(mainPanelFrame)

    def onCatheterSelected(self):
        self.currentCatheter = self.catheterComboBox.getCurrentCatheter()
        self.onSwitchCatheter()
    <mask token>

    def switchCatheterByIndex(self, index):
        col = self.catheterComboBox.collection
        if col:
            if index >= 0 and index < col.getNumberOfCatheters():
                self.catheterComboBox.setCurrentIndex(index)
        self.onCatheterSelected()
    <mask token>

    def onSwitchCatheter(self):
        pass

<mask token>


class MRTrackingPanelBase:

    def __init__(self, label='Base'):
        self.label = label
        self.catheters = None
        self.currentCatheter = None

    def setCatheterCollection(self, cath):
        self.catheters = cath

    def buildGUI(self, parent, showCatheterSelector=True):
        parentLayout = qt.QVBoxLayout(parent)
        self.catheterComboBox = QComboBoxCatheter()
        self.catheterComboBox.setCatheterCollection(self.catheters)
        self.catheterComboBox.currentIndexChanged.connect(self.
            onCatheterSelected)
        if showCatheterSelector:
            selectorLayout = qt.QFormLayout(parent)
            parentLayout.addLayout(selectorLayout)
            selectorLayout.addRow('Catheter: ', self.catheterComboBox)
        mainPanelFrame = qt.QFrame(parent)
        parentLayout.addWidget(mainPanelFrame)
        self.buildMainPanel(mainPanelFrame)

    def onCatheterSelected(self):
        self.currentCatheter = self.catheterComboBox.getCurrentCatheter()
        self.onSwitchCatheter()
    <mask token>

    def switchCatheterByIndex(self, index):
        col = self.catheterComboBox.collection
        if col:
            if index >= 0 and index < col.getNumberOfCatheters():
                self.catheterComboBox.setCurrentIndex(index)
        self.onCatheterSelected()
    <mask token>

    def onSwitchCatheter(self):
        pass

<mask token>


class MRTrackingPanelBase:

    def __init__(self, label='Base'):
        self.label = label
        self.catheters = None
        self.currentCatheter = None

    def setCatheterCollection(self, cath):
        self.catheters = cath

    def buildGUI(self, parent, showCatheterSelector=True):
        parentLayout = qt.QVBoxLayout(parent)
        self.catheterComboBox = QComboBoxCatheter()
        self.catheterComboBox.setCatheterCollection(self.catheters)
        self.catheterComboBox.currentIndexChanged.connect(self.
            onCatheterSelected)
        if showCatheterSelector:
            selectorLayout = qt.QFormLayout(parent)
            parentLayout.addLayout(selectorLayout)
            selectorLayout.addRow('Catheter: ', self.catheterComboBox)
        mainPanelFrame = qt.QFrame(parent)
        parentLayout.addWidget(mainPanelFrame)
        self.buildMainPanel(mainPanelFrame)

    def onCatheterSelected(self):
        self.currentCatheter = self.catheterComboBox.getCurrentCatheter()
        self.onSwitchCatheter()
    <mask token>

    def switchCatheterByIndex(self, index):
        col = self.catheterComboBox.collection
        if col:
            if index >= 0 and index < col.getNumberOfCatheters():
                self.catheterComboBox.setCurrentIndex(index)
        self.onCatheterSelected()

    def buildMainPanel(self, frame):
        pass

    def onSwitchCatheter(self):
        pass

import ctk
import qt
import slicer
from MRTrackingUtils.qcomboboxcatheter import *


class MRTrackingPanelBase:

    def __init__(self, label='Base'):
        self.label = label
        self.catheters = None
        self.currentCatheter = None

    def setCatheterCollection(self, cath):
        self.catheters = cath

    def buildGUI(self, parent, showCatheterSelector=True):
        parentLayout = qt.QVBoxLayout(parent)
        self.catheterComboBox = QComboBoxCatheter()
        self.catheterComboBox.setCatheterCollection(self.catheters)
        self.catheterComboBox.currentIndexChanged.connect(self.
            onCatheterSelected)
        if showCatheterSelector:
            selectorLayout = qt.QFormLayout(parent)
            parentLayout.addLayout(selectorLayout)
            selectorLayout.addRow('Catheter: ', self.catheterComboBox)
        mainPanelFrame = qt.QFrame(parent)
        parentLayout.addWidget(mainPanelFrame)
        self.buildMainPanel(mainPanelFrame)

    def onCatheterSelected(self):
        self.currentCatheter = self.catheterComboBox.getCurrentCatheter()
        self.onSwitchCatheter()

    def switchCatheter(self, name):
        col = self.catheterComboBox.collection
        if col:
            index = col.getIndex(name)
            if index >= 0:
                self.catheterComboBox.setCurrentIndex(index)
        self.onCatheterSelected()

    def switchCatheterByIndex(self, index):
        col = self.catheterComboBox.collection
        if col:
            if index >= 0 and index < col.getNumberOfCatheters():
                self.catheterComboBox.setCurrentIndex(index)
        self.onCatheterSelected()

    def buildMainPanel(self, frame):
        pass

    def onSwitchCatheter(self):
        pass

import ctk
import qt
import slicer
from MRTrackingUtils.qcomboboxcatheter import *

class MRTrackingPanelBase():
  def __init__(self, label="Base"):

    self.label = label
    self.catheters = None     #CatheterCollection
    self.currentCatheter = None

  def setCatheterCollection(self, cath):

    self.catheters = cath

    
  def buildGUI(self, parent, showCatheterSelector=True):
    parentLayout = qt.QVBoxLayout(parent)

    # Catheter selector
    self.catheterComboBox = QComboBoxCatheter()
    self.catheterComboBox.setCatheterCollection(self.catheters)
    self.catheterComboBox.currentIndexChanged.connect(self.onCatheterSelected)
    
    if showCatheterSelector:
      selectorLayout = qt.QFormLayout(parent)
      parentLayout.addLayout(selectorLayout)
      selectorLayout.addRow("Catheter: ", self.catheterComboBox)

    # Main panel
    mainPanelFrame = qt.QFrame(parent)
    parentLayout.addWidget(mainPanelFrame)
    self.buildMainPanel(mainPanelFrame)
    

  def onCatheterSelected(self):
    self.currentCatheter = self.catheterComboBox.getCurrentCatheter()
    self.onSwitchCatheter()


  def switchCatheter(self, name):
    col = self.catheterComboBox.collection
    if col:
      index = col.getIndex(name)
      if index >= 0:
        self.catheterComboBox.setCurrentIndex(index)
    self.onCatheterSelected()

        
  def switchCatheterByIndex(self, index):
    col = self.catheterComboBox.collection
    if col:
      if index >= 0 and index < col.getNumberOfCatheters():
        self.catheterComboBox.setCurrentIndex(index)
    self.onCatheterSelected()
        
      
  def buildMainPanel(self, frame):
    #
    # Should be implemented in the child class
    # 
    pass


  def onSwitchCatheter(self):
    #
    # Should be implemented in the child class
    # 
    pass
