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)
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)
def setupTemplates(self): self.templateManager = SlicerWizard.TemplateManager() builtinPath = builtinTemplatePath() if builtinPath is not None: try: self.templateManager.addPath(builtinPath) except: qt.qWarning("failed to add built-in template path %r" % builtinPath) qt.qWarning(traceback.format_exc()) # Read base template paths s = qt.QSettings() for path in _settingsList(s, userTemplatePathKey(), convertToAbsolutePaths=True): try: self.templateManager.addPath(path) except: qt.qWarning("failed to add template path %r" % path) qt.qWarning(traceback.format_exc()) # Read per-category template paths s.beginGroup(userTemplatePathKey()) for c in s.allKeys(): for path in _settingsList(s, c, convertToAbsolutePaths=True): try: self.templateManager.addCategoryPath(c, path) except: mp = (c, path) qt.qWarning( "failed to add template path %r for category %r" % mp) qt.qWarning(traceback.format_exc())
def setupTemplates(self): self.templateManager = SlicerWizard.TemplateManager() builtinPath = builtinTemplatePath() if builtinPath is not None: try: self.templateManager.addPath(builtinPath) except: qt.qWarning("failed to add built-in template path %r" % builtinPath) qt.qWarning(traceback.format_exc()) # Read base template paths s = qt.QSettings() for path in _settingsList(s, userTemplatePathKey()): try: self.templateManager.addPath(path) except: qt.qWarning("failed to add template path %r" % path) qt.qWarning(traceback.format_exc()) # Read per-category template paths s.beginGroup(userTemplatePathKey()) for c in s.allKeys(): for path in _settingsList(s, c): try: self.templateManager.addCategoryPath(c, path) except: mp = (c, path) qt.qWarning("failed to add template path %r for category %r" % mp) qt.qWarning(traceback.format_exc())