mirror of
https://github.com/fergalmoran/picard.git
synced 2026-01-28 11:23:59 +00:00
Default implementation for Option.convert
Avoids pylint warnings about hidden attribute and makes the code more readable.
This commit is contained in:
@@ -422,8 +422,6 @@ class Option(QtCore.QObject):
|
||||
self.section = section
|
||||
self.name = name
|
||||
self.default = default
|
||||
if not hasattr(self, "convert"):
|
||||
self.convert = type(default)
|
||||
self.registry[key] = self
|
||||
|
||||
@classmethod
|
||||
@@ -439,6 +437,9 @@ class Option(QtCore.QObject):
|
||||
def exists(cls, section, name):
|
||||
return (section, name) in cls.registry
|
||||
|
||||
def convert(self, value):
|
||||
return type(self.default)(value)
|
||||
|
||||
|
||||
class TextOption(Option):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user