def GetRowsOfPresentationTextsWithNamespaces( self, render_for_user: bool, sibling_decoration_allowed: bool, child_rows_allowed: bool ) -> typing.List[typing.List[typing.Tuple[str, str]]]: # this should be with counts or whatever, but we need to think about this more lad (namespace, subtag) = HydrusTags.SplitTag(self._tag) tag_text = ClientTags.RenderTag(self._tag, render_for_user) first_row_of_texts_with_namespaces = [(tag_text, namespace)] if sibling_decoration_allowed and self._ideal_tag is not None: self._AppendIdealTagTextWithNamespace( first_row_of_texts_with_namespaces, render_for_user) rows_of_texts_with_namespaces = [first_row_of_texts_with_namespaces] if self._parent_tags is not None: if child_rows_allowed: self._AppendParentsTextWithNamespaces( rows_of_texts_with_namespaces, render_for_user) elif sibling_decoration_allowed: self._AppendParentSuffixTagTextWithNamespace( first_row_of_texts_with_namespaces) return rows_of_texts_with_namespaces
def _AppendIdealTagTextWithNamespace(self, texts_with_namespaces, render_for_user): (namespace, subtag) = HydrusTags.SplitTag(self._ideal_tag) ideal_text = ' (displays as {})'.format( ClientTags.RenderTag(self._ideal_tag, render_for_user)) texts_with_namespaces.append((ideal_text, namespace))
def _AppendParentsTextWithNamespaces(self, rows_of_texts_with_namespaces, render_for_user): indent = ' ' for parent in self._parent_tags: (namespace, subtag) = HydrusTags.SplitTag(parent) tag_text = ClientTags.RenderTag(parent, render_for_user) texts_with_namespaces = [(indent + tag_text, namespace)] rows_of_texts_with_namespaces.append(texts_with_namespaces)
def GetRowsOfPresentationTextsWithNamespaces( self, render_for_user: bool, sibling_decoration_allowed: bool, child_rows_allowed: bool ) -> typing.List[typing.List[typing.Tuple[str, str]]]: rows_of_texts_and_namespaces = [] first_row_of_texts_and_namespaces = self._predicate.GetTextsAndNamespaces( render_for_user, or_under_construction=self._i_am_an_or_under_construction) if sibling_decoration_allowed and self._predicate.HasIdealSibling(): ideal_sibling = self._predicate.GetIdealSibling() (ideal_namespace, ideal_subtag) = HydrusTags.SplitTag(ideal_sibling) ideal_text = ' (displays as {})'.format( ClientTags.RenderTag(ideal_sibling, render_for_user)) first_row_of_texts_and_namespaces.append( (ideal_text, ideal_namespace)) rows_of_texts_and_namespaces.append(first_row_of_texts_and_namespaces) parent_preds = self._predicate.GetParentPredicates() if len(parent_preds) > 0: if child_rows_allowed: for parent_pred in self._predicate.GetParentPredicates(): rows_of_texts_and_namespaces.append( parent_pred.GetTextsAndNamespaces(render_for_user)) elif sibling_decoration_allowed: parents_text = ' ({} parents)'.format( HydrusData.ToHumanInt(len(parent_preds))) first_row_of_texts_and_namespaces.append((parents_text, '')) return rows_of_texts_and_namespaces
def GetRowsOfPresentationTextsWithNamespaces( self, render_for_user: bool, sibling_decoration_allowed: bool, child_rows_allowed: bool ) -> typing.List[typing.List[typing.Tuple[str, str]]]: # this should be with counts or whatever, but we need to think about this more lad (namespace, subtag) = HydrusTags.SplitTag(self._tag) tag_text = ClientTags.RenderTag(self._tag, render_for_user) if self._include_actual_counts: if self._current_count > 0: tag_text += ' ({})'.format( HydrusData.ToHumanInt(self._current_count)) if self._pending_count > 0: tag_text += ' (+{})'.format( HydrusData.ToHumanInt(self._pending_count)) if self._petitioned_count > 0: tag_text += ' (-{})'.format( HydrusData.ToHumanInt(self._petitioned_count)) if self._deleted_count > 0: tag_text += ' (X{})'.format( HydrusData.ToHumanInt(self._deleted_count)) else: if self._pending_count > 0: tag_text += ' (+)' if self._petitioned_count > 0: tag_text += ' (-)' if self._deleted_count > 0: tag_text += ' (X)' first_row_of_texts_with_namespaces = [(tag_text, namespace)] if sibling_decoration_allowed and self._ideal_tag is not None: self._AppendIdealTagTextWithNamespace( first_row_of_texts_with_namespaces, render_for_user) rows_of_texts_with_namespaces = [first_row_of_texts_with_namespaces] if self._parent_tags is not None: if child_rows_allowed: self._AppendParentsTextWithNamespaces( rows_of_texts_with_namespaces, render_for_user) elif sibling_decoration_allowed: self._AppendParentSuffixTagTextWithNamespace( first_row_of_texts_with_namespaces) return rows_of_texts_with_namespaces