From 8ddbe78128ba955bd68623376a14e6425386eb5d Mon Sep 17 00:00:00 2001 From: tassaron Date: Tue, 23 May 2017 18:54:31 -0400 Subject: rm duplicate code --- main.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'main.py') diff --git a/main.py b/main.py index 16697d6..d3a0b34 100644 --- a/main.py +++ b/main.py @@ -40,23 +40,13 @@ class Command(QtCore.QObject): # colour settings RGBError = 'Bad RGB input (use two commas)' # load colors as tuples from a comma-separated string - self.textColor = tuple([int(i) for i in self.settings.value("textColor", '255, 255, 255').split(',')]) - self.visColor = tuple([int(i) for i in self.settings.value("visColor", '255, 255, 255').split(',')]) + self.textColor = core.Core.RGBFromString(self.settings.value("textColor", '255, 255, 255')) + self.visColor = core.Core.RGBFromString(self.settings.value("visColor", '255, 255, 255')) if self.args.textcolor: - try: - r, g, b = self.args.textcolor.split(',') - except: - print(RGBError) - else: - self.textColor = (int(r), int(g), int(b)) + self.textColor = core.Core.RGBFromString(self.args.textcolor) if self.args.viscolor: - try: - r, g, b = self.args.viscolor.split(',') - except: - print(RGBError) - else: - self.visColor = (int(r), int(g), int(b)) - + self.visColor = core.Core.RGBFromString(self.args.viscolor) + # font settings if self.args.font: self.font = QFont(self.args.font) -- cgit v1.2.3