<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_rectangle(self, rectangle, scroll_y):
 """ Updates the given Widget rectangle. :param rectangle: Rectangle to update. :type rectangle: QRect :param scroll_y: Amount of pixels the viewport was scrolled. :type scroll_y: int :return: Method success. :rtype: bool """


        if scroll_y:
            self.scroll(0, scroll_y)
        else:
            self.update(0, rectangle.y(), self.width(), rectangle.height())

        if rectangle.contains(self.__editor.viewport().rect()):
            self.set_editor_viewport_margins(0)
        return True