From e1e687892360cf3363246cfe83feaa60fb197f3f Mon Sep 17 00:00:00 2001 From: Mike Cifelli <1836280-mike-cifelli@users.noreply.gitlab.com> Date: Fri, 23 Dec 2022 18:31:04 -0500 Subject: [PATCH] Clean up code --- character_display.py | 35 ++++++++++++++--------------------- time_display.py | 2 +- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/character_display.py b/character_display.py index f42845b..7b55c44 100644 --- a/character_display.py +++ b/character_display.py @@ -18,28 +18,21 @@ class CharacterDisplay: self.minX = minX self.maxX = maxX - def displayDigit(self, x, y, digit, color): - if digit == 0: - self.displayZero(x, y, color) - elif digit == 1: - self.displayOne(x, y, color) - elif digit == 2: - self.displayTwo(x, y, color) - elif digit == 3: - self.displayThree(x, y, color) - elif digit == 4: - self.displayFour(x, y, color) - elif digit == 5: - self.displayFive(x, y, color) - elif digit == 6: - self.displaySix(x, y, color) - elif digit == 7: - self.displaySeven(x, y, color) - elif digit == 8: - self.displayEight(x, y, color) - elif digit == 9: - self.displayNine(x, y, color) + self.digits = { + 0: self.displayZero, + 1: self.displayOne, + 2: self.displayTwo, + 3: self.displayThree, + 4: self.displayFour, + 5: self.displayFive, + 6: self.displaySix, + 7: self.displaySeven, + 8: self.displayEight, + 9: self.displayNine + } + def displayDigit(self, x, y, digit, color): + self.digits[digit](x, y, color) self.unicorn.show() def clearDigit(self, x, y): diff --git a/time_display.py b/time_display.py index 07299bc..f8e28ba 100644 --- a/time_display.py +++ b/time_display.py @@ -9,7 +9,7 @@ class TimeDisplay: self.currentHour = [-1, -1] self.currentMinute = [-1, -1] self.currentColor = [0, 0, 0] - self.color = [255, 120, 0] + self.color = [255, 80, 0] self.hourStartColumn = -1 self.timeDotsColumn = 7 self.minuteStartColumn = 9