#!/usr/bin/env python
# -*- coding: utf-8 -*-
import wx
class CommonPanel(wx.Panel):
""" Common panel with some common functions
Overwrite the get/set parameters methods for save your values
"""
def __init__(self, parent):
"""
"""
super(CommonPanel, self).__init__(parent)
self._lst_widgetd = ()
def get_parameters(self):
""" Return the one-line parameters
"""
return ",".join( ( x.GetValue() for x in self._lst_widgetd ) )
def set_parameters(self, pars):
""" Set the parameters into the widgets
"""
if not pars.count(",") == len(self._lst_widgetd) -1:
raise ValueError("Invalid value passed! I have: %s I wait %s" % (pars.count(","), len(self._lst_widgetd)))
for val, widg in zip(pars.split(","), self._lst_widgetd):
widg.SetValue(val)
|