reviewboard.reviews.ui.image¶
A Review UI for image files.
- class SerializedRegionComment[source]¶
Bases:
SerializedComment
Serialized data for an image comment.
This must be kept in sync with the definitions in
reviewboard/static/rb/js/reviews/models/commentData.ts
.New in version 7.0.
- __annotations__ = {'comment_id': ForwardRef('int', module='reviewboard.reviews.ui.base'), 'height': ForwardRef('int', module='reviewboard.reviews.ui.image'), 'html': ForwardRef('str', module='reviewboard.reviews.ui.base'), 'issue_opened': ForwardRef('bool', module='reviewboard.reviews.ui.base'), 'issue_status': ForwardRef('str', module='reviewboard.reviews.ui.base'), 'localdraft': ForwardRef('bool', module='reviewboard.reviews.ui.base'), 'reply_to_id': ForwardRef('int', module='reviewboard.reviews.ui.base'), 'review_id': ForwardRef('int', module='reviewboard.reviews.ui.base'), 'review_request_id': ForwardRef('int', module='reviewboard.reviews.ui.base'), 'rich_text': ForwardRef('bool', module='reviewboard.reviews.ui.base'), 'text': ForwardRef('str', module='reviewboard.reviews.ui.base'), 'url': ForwardRef('str', module='reviewboard.reviews.ui.base'), 'user': ForwardRef('SerializedCommentUser', module='reviewboard.reviews.ui.base'), 'width': ForwardRef('int', module='reviewboard.reviews.ui.image'), 'x': ForwardRef('int', module='reviewboard.reviews.ui.image'), 'y': ForwardRef('int', module='reviewboard.reviews.ui.image')}¶
- __closed__ = False¶
- __extra_items__ = None¶
- __mutable_keys__ = frozenset({'comment_id', 'height', 'html', 'issue_opened', 'issue_status', 'localdraft', 'reply_to_id', 'review_id', 'review_request_id', 'rich_text', 'text', 'url', 'user', 'width', 'x', 'y'})¶
- __optional_keys__ = frozenset({})¶
- __orig_bases__ = (<class 'reviewboard.reviews.ui.base.SerializedComment'>,)¶
- __readonly_keys__ = frozenset({})¶
- __required_keys__ = frozenset({'comment_id', 'height', 'html', 'issue_opened', 'issue_status', 'localdraft', 'reply_to_id', 'review_id', 'review_request_id', 'rich_text', 'text', 'url', 'user', 'width', 'x', 'y'})¶
- __total__ = True¶
- user: SerializedCommentUser¶
- class ImageReviewUI(review_request: ReviewRequest, obj: ReviewableType)[source]¶
Bases:
ReviewUI
[FileAttachment
,FileAttachmentComment
,SerializedRegionComment
]A Review UI for image files.
- supported_mimetypes: ClassVar[list[str]] = ['image/*'][source]¶
The list of MIME types that this Review UI supports.
- allow_inline: ClassVar[bool] = True[source]¶
Whether the Review UI can be rendered inline in diffs and other places.
If set, the Review UI will be able to be displayed within the diff viewer (and potentially other locations).
- supports_diffing: ClassVar[bool] = True[source]¶
Whether this Review UI supports diffing two objects.
- supports_file_attachments: ClassVar[bool] = True[source]¶
Whether this Review UI supports reviewing FileAttachment objects.
- get_page_cover_image_url()[source]¶
Return the URL to an image used to depict this on other sites.
The returned image URL will be used for services like Facebook, Slack, Twitter, etc. when linking to this file attachment.
- Returns:
The absolute URL to an image used to depict this file attachment.
- Return type:
- get_js_model_data() JSONDict [source]¶
Return data to pass to the JavaScript Model during instantiation.
This data will be passed as attributes to the reviewable model when constructed.
- Returns:
The attributes to pass to the model.
- Return type:
- serialize_comments(comments: Sequence[FileAttachmentComment]) Dict[str, List[SerializedRegionComment]] [source]¶
Serialize the comments for the file attachment.
- Parameters:
comments (
list
of :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:`` :class:``reviewboard.reviews.models.FileAttachmentComment
) – The list of objects to serialize. This will be the result ofget_comments()
.- Returns:
The serialized comment data.
- Return type:
SerializedCommentBlocks
- get_comment_thumbnail(comment: FileAttachmentComment) Optional[str] [source]¶
Generate and return a thumbnail representing this comment.
This will find the appropriate lines the comment applies to and return it as HTML suited for rendering in reviews.
- Parameters:
comment (
reviewboard.reviews.models.FileAttachmentComment
) – The comment to render the thumbnail for.- Returns:
The rendered comment thumbnail.
- Return type:
- __annotations__ = {'allow_inline': 'ClassVar[bool]', 'css_bundle_names': 'ClassVar[list[str]]', 'diff_against_obj': 'Optional[ReviewableType]', 'diff_type_mismatch': 'ClassVar[bool]', 'js_bundle_names': 'ClassVar[list[str]]', 'js_files': 'ClassVar[list[str]]', 'js_model_class': 'str', 'js_view_class': 'str', 'name': 'ClassVar[str]', 'obj': 'ReviewableType', 'request': 'Optional[HttpRequest]', 'supported_mimetypes': 'ClassVar[list[str]]', 'supports_diffing': 'ClassVar[bool]', 'supports_file_attachments': 'ClassVar[bool]', 'template_name': 'ClassVar[str]'}¶
- __orig_bases__ = (reviewboard.reviews.ui.base.ReviewUI[reviewboard.attachments.models.FileAttachment, reviewboard.reviews.models.file_attachment_comment.FileAttachmentComment, reviewboard.reviews.ui.image.SerializedRegionComment],)¶
- __parameters__ = ()¶