From faca7a7bfd16559973178d3c87cb3b0c6667d4d3 Mon Sep 17 00:00:00 2001
From: Alexander Bus <busfromrus@gmail.com>
Date: Thu, 10 Oct 2019 00:20:10 +0700
Subject: [PATCH] Improve option parsing and various other things

Signed-off-by: Alexander Bus <busfromrus@gmail.com>
---
 README.md                      | 4 ++--
 cutelog/config.py              | 9 ++++++++-
 cutelog/listener.py            | 2 ++
 cutelog/logger_table_header.py | 2 +-
 setup.py                       | 2 +-
 5 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 0e6bc8d..32bc142 100644
--- a/README.md
+++ b/README.md
@@ -62,9 +62,9 @@ This will create "log namespaces" which allow you to filter out messages from va
 ## Attributions
 Free software used:
 * Qt via either:
-    * [PyQt5](https://riverbankcomputing.com/software/pyqt/intro) - GPLv3 License, Copyright (c) 2018 Riverbank Computing Limited <info@riverbankcomputing.com>
+    * [PyQt5](https://riverbankcomputing.com/software/pyqt/intro) - GPLv3 License, Copyright (c) 2019 Riverbank Computing Limited <info@riverbankcomputing.com>
     * [PySide2](https://wiki.qt.io/PySide2) - LGPLv3 License, Copyright (C) 2015 The Qt Company Ltd (http://www.qt.io/licensing/)
-* [QtPy](https://github.com/spyder-ide/qtpy) - MIT License, Copyright © 2009–2018 The Spyder Development Team
+* [QtPy](https://github.com/spyder-ide/qtpy) - MIT License, Copyright © 2009–2019 The Spyder Development Team
 * [ion-icons](https://github.com/ionic-team/ionicons) - MIT License, Copyright (c) 2015-present Ionic (http://ionic.io/)
 
 And thanks to [logview](https://pythonhosted.org/logview/) by Vinay Sajip for UI inspiration.
diff --git a/cutelog/config.py b/cutelog/config.py
index 770bf2c..2af282d 100644
--- a/cutelog/config.py
+++ b/cutelog/config.py
@@ -185,8 +185,15 @@ class Config(QObject):
             if option.type == bool:
                 value = str(value).lower()  # needed because QSettings stores bools as strings
                 value = True if value == "true" or value is True else False
+            elif option.type == int and value is None:
+                value = 0  # workaround for bug PYSIDE-820
             else:
-                value = option.type(value)
+                try:
+                    value = option.type(value)
+                except Exception:
+                    self.log.warn('Could not parse value "{}" for option "{}", falling back to the '
+                                  'default value "{}"'.format(value, option.name, option.default))
+                    value = option.default
             options[option.name] = value
         self.qsettings.endGroup()
         return options
diff --git a/cutelog/listener.py b/cutelog/listener.py
index db2bb4c..9d50c43 100644
--- a/cutelog/listener.py
+++ b/cutelog/listener.py
@@ -204,6 +204,8 @@ class LogConnection(QThread):
                 self.deserialize = self.serializers[value]
             else:
                 self.log.error('Serialization format "{}" is not supported'.format(value))
+        else:
+            self.log.error('No such command "{}"'.format(cmd))
 
 
 class BenchmarkConnection(LogConnection):
diff --git a/cutelog/logger_table_header.py b/cutelog/logger_table_header.py
index 444516c..5110ef6 100644
--- a/cutelog/logger_table_header.py
+++ b/cutelog/logger_table_header.py
@@ -100,7 +100,7 @@ class LoggerTableHeader(QObject):
     def regen_visible(self):
         self.visible_columns = [c for c in self.columns if c.visible]
         self.visible_names = set([c.name for c in self.visible_columns]) | SPECIAL_COLUMNS
-        print(self.visible_names)
+        # print(self.visible_names)
         for i, column in enumerate(self.visible_columns):
             self.header_view.resizeSection(i, column.width)
 
diff --git a/setup.py b/setup.py
index 179c59f..131121b 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ from setuptools import setup
 from setuptools.command.install import install
 
 
-VERSION = '2.0.2'
+VERSION = '2.0.3'
 
 
 def build_qt_resources():
-- 
GitLab