I am writing configuration program for my own Linux distribution. The configuration is divided into sections: general, networking, session, etc.
- which groups similar options. E.g. in section general there are computer name, description, workgroup, language
options.
I think every section should be presented by the class, and each option should have corresponding property (getter and maybe setter).
Moreover it would be nice for generalization if there was function to test if given option is enabled (i.e. if system meets requirements for this option) i.e.:
class General(object):
@property
def name(self):
return self.get_computer_name()
@name.setter
def name(self, name):
self.set_computer_name(name)
def is_option_enabled(self, option):
return True_or_False
What is more I need these options (and sections too) link together with corresponding translated name and description (using gettext).
I know that hard coding presentation layer in classes is not good idea... I need something like design pattern, general idea/template how to implement this so it was high quality, easy to manage and extend.
I am going to create several front ends for these classes (text, gui, web) so I don't want every time to repeat same code.
I am thinking very hard, but unfortunately I don't have idea how to do this or have some doubts...
Thank you :)