( self )
| 78 | |
| 79 | # Prints out what the image will look like on the display |
| 80 | def preview( self ): |
| 81 | # Top border first |
| 82 | display = "+" |
| 83 | for pixel in range( 0, self.width ): |
| 84 | display += "-" |
| 85 | display += "+\n" |
| 86 | |
| 87 | # Each Page |
| 88 | for page in range( self.page_count - 1, -1, -1 ): |
| 89 | # Each Bit (Line) |
| 90 | for line in range( 7, -1, -1 ): |
| 91 | # Border |
| 92 | display += "|" |
| 93 | |
| 94 | # Each Byte (Column/Pixel) |
| 95 | for byte in range( 0, self.width ): |
| 96 | if self.page_data[ page ][ byte ] & (1 << line): |
| 97 | display += "*" |
| 98 | else: |
| 99 | display += " " |
| 100 | |
| 101 | # Border |
| 102 | display += "|\n" |
| 103 | |
| 104 | # Bottom border |
| 105 | display += "+" |
| 106 | for pixel in range( 0, self.width ): |
| 107 | display += "-" |
| 108 | display += "+\n" |
| 109 | |
| 110 | return display |
| 111 | |
| 112 | |
| 113 | class StandardError(ValueError): |
no outgoing calls
no test coverage detected