3 #======================================================================
10 # $Id: Gauge.py,v 1.2 2002-07-08 17:56:11 acampi Exp $
13 # (C) COPYRIGHT 2001, Eric Busboom <eric@softwarestudio.org>
14 # (C) COPYRIGHT 2001, Patrick Lewis <plewis@inetarena.com>
16 # This program is free software; you can redistribute it and/or modify
17 # it under the terms of either:
19 # The LGPL as published by the Free Software Foundation, version
20 # 2.1, available at: http://www.fsf.org/copyleft/lesser.html
24 # The Mozilla Public License Version 1.0. You may obtain a copy of
25 # the License at http://www.mozilla.org/MPL/
26 #======================================================================
28 from LibicalWrap import *
29 from Error import LibicalError
30 from Component import Component
37 class ConstructorFailedError(LibicalError):
38 "Failed to create a Guage "
40 class CloneFailedError(LibicalError):
41 "Failed to clone a component given Gauge "
43 class CompareFailedError(LibicalError):
44 "Failed to compare a component given Gauge "
46 def __init__(self,ref=None,sql=None,expand=0):
51 self._ref = icalgauge_new_from_sql(s,expand)
53 Gauge.ConstructorFailedError("No SQL Specified")
57 icalgauge_free(self._ref)
63 def compare(self, comp):
64 if not isinstance(comp,Component):
65 raise Gauge.CompareFailedError("Argument is not a component")
67 if comp.ref() == None:
68 raise Gauge.CompareFailedError("Argument is not a component")
70 return icalgauge_compare(self._ref, comp.ref())
72 # Pending Implementation
73 #def as_sql_string(self):
74 # return self.__str__()
77 # return icalgauge_as_sql(self._ref)
79 #def clone(self, comp):
80 # if not isinstance(comp,Component):
81 # raise Gauge.CloneFailedError("Argument is not a component")
83 # comp_ref = icalgauge_new_clone(self._ref, comp)
85 # if comp_ref == None:
88 # return Component(ref=comp_ref)