Esempio n. 1
0
  def onDiscoverButton(self):
    logic = ServiceDiscoveryLogic()

    self.serviceTree.clear()

    try:
      data = logic.run(self.urlBoxManagedConnection.text)
    except:
      slicer.util.messageBox("Error during service discovery")

    for modality in data.keys():
      mod_item = qt.QTreeWidgetItem()
      mod_item.setText(0, 'Modality: ' + str(modality))

      self.serviceTree.addTopLevelItem(mod_item)

      for anatomy in data[modality].keys():
        anatom_item = qt.QTreeWidgetItem()
        anatom_item.setText(0, 'Anatomy: ' + str(anatomy))

        mod_item.addChild(anatom_item)

        for task in data[modality][anatomy].keys():
          dim_item = qt.QTreeWidgetItem()
          dim_item.setText(0, 'Task: ' + str(task))

          anatom_item.addChild(dim_item)

          for entry in data[modality][anatomy][task]:
            elem = ServiceEntry()
            elem.setText(0, 'Service: ' + entry['name'] + '. Sid:' + entry['SID'])
            elem.endpoint_data = entry
            dim_item.addChild(elem)
Esempio n. 2
0
def _newItemPlaceholderItem(parent):
    palette = parent.palette
    color = qt.QColor(palette.text().color())
    color.setAlphaF(0.5)

    item = qt.QTreeWidgetItem()
    item.setText(0, "(New item)")
    item.setForeground(0, qt.QBrush(color))

    return item
    def contributors(self, value):
        self.ui.contributorsList.clear()
        for c in re.split("(?<=[)])\s*,", value):
            c = c.strip()
            item = qt.QTreeWidgetItem()

            try:
                n = c.index("(")
                item.setText(0, c[:n].strip())
                item.setText(1, c[n + 1:-1].strip())

            except ValueError:
                qt.qWarning("%r: badly formatted contributor" % c)
                item.setText(0, c)

            self.ui.contributorsList.addItem(item)
Esempio n. 4
0
 def add_top_level(name, children):
     item = qt.QTreeWidgetItem([name])
     item.addChildren([qt.QTreeWidgetItem([c]) for c in children])
     members.addTopLevelItem(item)