<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def print_preview(self):

 """Print preview for current file"""

        from qtpy.QtPrintSupport import QPrintPreviewDialog

        editor = self.get_current_editor()
        printer = Printer(mode=QPrinter.HighResolution,
                          header_font=self.get_plugin_font('printer_header'))
        preview = QPrintPreviewDialog(printer, self)
        preview.setWindowFlags(Qt.Window)
        preview.paintRequested.connect(lambda printer: editor.print_(printer))
        self.redirect_stdio.emit(False)
        preview.exec_()
        self.redirect_stdio.emit(True)