def __init__(self, label, default=None, help=''): self._order = DataItem.count DataItem.count += 1 self._name = None self._default = default self._help = utf8_to_unicode(help) self._props = {} # a dict realm->dict containing realm-specific properties self.set_prop("display", col=0, colspan=None, label=utf8_to_unicode(label))
def get(self): """Override AbstractDataSetWidget method""" value = self.item.get() old_value = to_text_string(self.value()) if value is not None: if isinstance(value, QColor): # if item is a ColorItem object value = value.name() uvalue = utf8_to_unicode(value) if uvalue != old_value: self.edit.setText(utf8_to_unicode(value)) else: self.line_edit_changed(value)
def __init__(self, label, default=None, help=''): self._order = DataItem.count DataItem.count += 1 self._name = None self._default = default self._help = utf8_to_unicode(help) self._props = { } # a dict realm->dict containing realm-specific properties self.set_prop("display", col=0, colspan=None, label=utf8_to_unicode(label))
def _normalize_choice(self, idx, choice_tuple): if isinstance(choice_tuple, tuple): key, value = choice_tuple else: key = idx value = choice_tuple if isinstance(value, str): value = utf8_to_unicode(value) return (key, value, None)
def _normalize_choice(self, idx, choice_tuple): assert isinstance(choice_tuple, tuple) if len(choice_tuple) == 3: key, value, img = choice_tuple else: key = idx value, img = choice_tuple if isinstance(value, str): value = utf8_to_unicode(value) return (key, value, img)
def get_help(self, instance): """ Return data item's tooltip """ auto_help = utf8_to_unicode(self.get_auto_help(instance)) help = self._help if auto_help: if help: help = help + "\n(" + auto_help + ")" else: help = auto_help.capitalize() return help
def _compute_title_and_comment(self): """ Private method to compute title and comment of the data set """ comp_title = self.__class__.__name__ comp_comment = None if self.__doc__: doc_lines = utf8_to_unicode(self.__doc__).splitlines() # Remove empty lines at the begining of comment while doc_lines and not doc_lines[0].strip(): del doc_lines[0] if doc_lines: comp_title = doc_lines.pop(0).strip() if doc_lines: comp_comment = "\n".join([x.strip() for x in doc_lines]) return comp_title, comp_comment
def get(self): """Override AbstractDataSetWidget method""" value = self.item.get() if value is not None: self.edit.setPlainText(utf8_to_unicode(value)) self.text_changed()