Пример #1
0
	def __init__(self, visitor, name, section, row, col):
		Widget.__init__(self, visitor, name, row, col, WIDGET_TYPE_RC)

		if hasattr(visitor, "text_bignums_draw"):
			self.draw = visitor.text_bignums_draw
		elif hasattr(visitor, "graphic_bignums_draw"):
			self.draw = visitor.graphic_bignums_draw
		else:
			self.draw = None

		self.FB = Buffer()
		self.FB.buffer = ' ' * 16 * 24

		self.min = 0
		self.max = 0
		self.string = ''
		self.expression = Property(self.visitor, section, 'expression', '')
		self.expr_min = Property(self.visitor, section, 'min', None)
		self.expr_max = Property(self.visitor, section, 'max', None)

		self.length = visitor.cfg_fetch_num(section, 'length', 10)

		self.update = visitor.cfg_fetch_num(section, 'update', 500)

		self.fg_color = RGBA()
		self.fg_valid = self.widget_color(section, "foreground", self.fg_color)
		self.bg_color = RGBA()
		self.bg_valid = self.widget_color(section, "background", self.bg_color)

		self.layer = visitor.cfg_fetch_num(section, "layer", 0)
		
		self.ch = {}

		self.id_source = None
		self.id_signal = visitor.connect("display-disconnected-before", self.stop)
Пример #2
0
class WidgetTimer(Widget):
	def __init__(self, visitor, name, section):
		Widget.__init__(self, visitor, name, 0, 0, WIDGET_TYPE_TIMER)

		self.expression = Property(self.visitor, section, 'expression', '')

		self.update = visitor.cfg_fetch_num(section, "update", 500)

		self.source_id = None
		self.id_signal = visitor.connect("display-disconnected-before", self.stop)

	def start(self, data=None):
		if self.update is None:
			return
		if self.source_id is None:
			self.source_id = gobject.timeout_add(self.update, self.timer_update)

	def stop(self, data=None):
		if self.source_id is not None:
			gobject.source_remove(self.source_id)
			self.source_id = None

	def timer_update(self):

		self.expression.eval()

		return True
Пример #3
0
    def _multiple_properties(self, name, value_type, values, property_obj=None):
        "Processes set/get for Properties that can have multiple instances."

        comp = self.inner_component()

        # Set value
        if values != None:
            if not isinstance(values, TupleType) and not isinstance(values, ListType):
                raise TypeError, "%s is not a tuple or list."

            # Delete old properties
            for p in comp.properties(name):
                comp.remove_property(p)

            for v in values:
                if property_obj:  # Specialized properties
                    if not isinstance(v, property_obj):  # Make new object
                        new_prop = property_obj()
                        new_prop.value(v)
                    else:  # Use existing object
                        new_prop = v
                else:  # Generic properties
                    new_prop = Property(name)
                    # new_prop.value_type(value_type)
                    new_prop.value(v)

                comp.add_property(new_prop)

        # Get value
        else:
            return Collection(self, comp.properties(name))
Пример #4
0
	def __init__(self, visitor, name, section, row, col):
		Widget.__init__(self, visitor, name, row, col, WIDGET_TYPE_RC)
		if hasattr(visitor, "text_draw"):
			self.draw = visitor.text_draw
		elif hasattr(visitor, "graphic_draw"):
			self.draw = visitor.graphic_draw
		else:
			self.draw = None

		self.row = row
		self.col = col

		self.string = ''
		self.prefix = Property(self.visitor, section, "prefix", '')
		self.postfix = Property(self.visitor, section, 'postfix', '')
		self.style = Property(self.visitor, section, 'style', '')
		self.value = Property(self.visitor, section, 'expression', '')
		self.width = visitor.cfg_fetch_num(section, 'width', 10)
		self.precision = visitor.cfg_fetch_num(section, 'precision', 0xDEAD)
		self.align = visitor.cfg_fetch_raw(section, 'align', 'L')
		self.update = visitor.cfg_fetch_num(section, 'update', 1000)
		self.scroll = visitor.cfg_fetch_num(section, 'scroll', 500)
		self.speed = visitor.cfg_fetch_num(section, 'speed', 500)
		self.fg_color = RGBA()
		self.bg_color = RGBA()
		self.fg_valid = self.widget_color(section, "foreground", self.fg_color)
		self.bg_valid = self.widget_color(section, "background", self.bg_color)
		self.layer = visitor.cfg_fetch_num(section, "layer", 0)
		
		self.id_source = None
		self.scroll_source = None
		self.buffer = ' ' * self.width
		self.id_signal = visitor.connect("display-disconnected-before", self.stop)
Пример #5
0
class WidgetKey(Widget):
	def __init__(self, visitor, name, section):
		Widget.__init__(self, visitor, name, 0, 0, WIDGET_TYPE_KEYPAD)

		self.expression = Property(self.visitor, section, 'expression', '')

		self.key = visitor.cfg_fetch_num(section, "key", 0)

		self.signal_id = None
		self.id_signal = visitor.connect("display-disconnected-before", self.stop)

	def start(self, data=None):
		if self.signal_id is None:
			self.signal_id = self.visitor.connect("key-packet-ready", self.key_packet_ready)

	def stop(self, data=None):
		if self.signal_id is not None:
			self.visitor.disconnect(self.signal_id)
			self.signal_id = None

	def key_packet_ready(self, device, key):
		if key == self.key and self.expression.valid():
			self.expression.eval()

		return True
Пример #6
0
    def __init__(self, arg={}):

        assert(isinstance(arg, DictType))

        ref = None
        if arg != {}:
            ref = arg['ref']
        Property.__init__(self, type='ORGANIZER', ref=ref)
Пример #7
0
def ParsePropertyName(text):
    from settings import PrivateDefinition,PublicDefinition
    from settings import ProtectedDefinition,StaticDefinition
    p = Property()
    words = text.split()
    for word in words:
        if (word==PrivateDefinition.replace(" ","")):
            p.Private=True
            text=text.replace(word,"")
        elif (word==PublicDefinition.replace(" ","")):
            p.Public =True
            text=text.replace(word,"")
        elif (word==ProtectedDefinition.replace(" ","")):
            p.Protected=True
            text=text.replace(word,"")
        elif (word==StaticDefinition.replace(" ","")):
            p.Static=True
            text=text.replace(word,"")
        elif (word in DataTypes):
            p.Type=word
            text=text.replace(word,"")    
            
    if len(text.split())==2:
        p.Type=text.split()[0]
        p.Name=text.split()[1]
    elif len(text.split())==1:
        p.Name=text.split()[0]
    else:
        raise ValueError("nerozpoznane paramtre v nazve property v pocte "+str(len(text.split()))+" text: ",text)    
    return p    
Пример #8
0
	def __init__(self, visitor, name, section, row, col):
		Widget.__init__(self, visitor, name, row, col, WIDGET_TYPE_RC)

		if hasattr(visitor, "text_bar_draw"):
			self.draw = visitor.text_bar_draw
		elif hasattr(visitor, "graphic_bar_draw"):
			self.draw = visitor.graphic_bar_draw
		else:
			self.draw = None

		self.min = 0
		self.max = 0
		self.string = ''
		self.expression = Property(self.visitor, section, 'expression', '')
		self.expression2 = Property(self.visitor, section, 'expression2', '')
		self.expr_min = Property(self.visitor, section, 'min', None)
		self.expr_max = Property(self.visitor, section, 'max', None)

		self.color_valid = resizeList([], 2, int)
		self.color = resizeList([], 2, RGBA)
		self.color_valid[0] = self.widget_color(section, "barcolor0", self.color[0])
		self.color_valid[1] = self.widget_color(section, "barcolor1", self.color[1])

		self.layer = visitor.cfg_fetch_num(section, 'layer', 0)

		self.length = visitor.cfg_fetch_num(section, 'length', 10)
		c = visitor.cfg_fetch_raw(section, "direction", "E")

		if c.upper() == "E":
			self.direction = DIR_EAST
		elif c.upper() == "W":
			self.direction = DIR_WEST
		else:
			error("widget %s has unknown direction '%s'; Use E(ast) or W(est). Using E." % (self.name, c))
			self.direction = DIR_EAST

		self.update = visitor.cfg_fetch_num(section, 'update', 1000)

		c = visitor.cfg_fetch_raw(section, "style", "O")

		if c.upper() == "H":
			self.style = STYLE_HOLLOW
		elif c.upper() == "N" or c.upper == "O":
			self.style = STYLE_NORMAL
		else:
			error("widget %s has unknown style '%s'; known styles 'N' or 'H'; using 'N'" % (self.name, c))
			self.style = STYLE_NORMAL

		self.ch = {}

		self.id_source = None
		self.id_signal = visitor.connect("display-disconnected-before", self.stop)
Пример #9
0
	def __init__(self, visitor, name, section, row, col):
		Widget.__init__(self, visitor, name, row, col, WIDGET_TYPE_RC)

		if hasattr(visitor, "text_histogram_draw"):
			self.draw = visitor.text_histogram_draw
		elif hasattr(visitor, "graphic_histogram_draw"):
			self.draw = visitor.graphic_histogram_draw
		else:
			self.draw = None

		
		self.min = 0
		self.max = 0
		self.string = ''
		self.expression = Property(self.visitor, section, 'expression', '')
		self.expr_min = Property(self.visitor, section, 'min', None)
		self.expr_max = Property(self.visitor, section, 'max', None)

		self.length = visitor.cfg_fetch_num(section, 'length', 10)

		self.height = visitor.cfg_fetch_num(section, 'height', 1)

		self.gap = visitor.cfg_fetch_num(section, "gap", 0)

		self.layer = visitor.cfg_fetch_num(section, "layer", 0)

		self.history = resizeList([], self.length, int)

		c = visitor.cfg_fetch_raw(section, "direction", "E")

		if c.upper() == "E":
			self.direction = DIR_EAST
		elif c.upper() == "W":
			self.direction = DIR_WEST
		else:
			error("widget %s has unknown direction '%s'; Use E(ast) or W(est). Using E." % (self.name, c))
			self.direction = DIR_EAST

		self.update = visitor.cfg_fetch_num(section, 'update', 1000)

		self.fg_color = RGBA()
		self.fg_valid = self.widget_color(section, "foreground", self.fg_color)
		self.bg_color = RGBA()
		self.bg_valid = self.widget_color(section, "background", self.bg_color)

		self.ch = {}

		self.id_source = None
		self.id_signal = visitor.connect("display-disconnected-before", self.stop)
Пример #10
0
    def _prop_from_ref(self, p):

        if (p == None or p == WrapperNULL):
            return None

        d = {}
        d['value'] = icalproperty_get_value_as_string(p)
        d['name'] = icalproperty_get_property_name(p)

        propkind = icalproperty_string_to_kind(d['name'])
        kind = icalproperty_kind_to_value_kind(propkind)
        d['value_type'] = icalvalue_kind_to_string(kind)
        d['ref'] = p

        #~ print p, Property(ref=p).name()
        if not self.cached_props.has_key(p):

            if d['value_type'] == 'DATE-TIME' or d['value_type'] == 'DATE':
                prop = Time(d, )
            elif d['value_type'] == 'PERIOD':
                prop = Period(d)
            elif d['value_type'] == 'DURATION':
                prop = Duration(d)
            elif d['name'] == 'ATTACH':
                prop = Attach(d)
            elif d['name'] == 'ATTENDEE':
                prop = Attendee(d)
            elif d['name'] == 'ORGANIZER':
                prop = Organizer(d)
            else:
                prop = Property(ref=p)

            self.cached_props[p] = prop
Пример #11
0
 def clear(self):
     ''' Clear the property tree and remove from model
     '''
     
     self.beginRemoveRows(QtCore.QModelIndex(), 0, self.rowCount())
     self.rootItem = Property("Root", None, self)
     self.endRemoveRows()
Пример #12
0
 def value(self, v=None):
     "Returns or sets the value of the property."
     if v != None:
         if isinstance(v, StringType):  # Is a URI
             self._desc['value'] = v
             Property.value_type(self, 'URI')
         else:
             try:
                 tempStr = v.read()
             except:
                 raise TypeError,"%s must be a URL string or file-ish type"\
                       % str(v)
             self._desc['value'] = base64.encodestring(tempStr)
             Property.value_type(self, 'BINARY')
     else:
         return self._desc['value']
Пример #13
0
 def value(self, v=None):
     "Returns or sets the value of the property."
     if v != None:
         if isinstance(v, StringType):  # Is a URI
             self._desc['value']=v
             Property.value_type(self, 'URI')
         else:
             try:
                 tempStr = v.read()
             except:
                 raise TypeError,"%s must be a URL string or file-ish type"\
                       % str(v)
             self._desc['value'] = base64.encodestring(tempStr)
             Property.value_type(self, 'BINARY')
     else:
         return self._desc['value']
Пример #14
0
    def _prop_from_ref(self, p):

        if (p == None or p == WrapperNULL):
            return None

        d_string = icallangbind_property_eval_string(p, ":")

        d = eval(d_string)
        d['ref'] = p

        if not self.cached_props.has_key(p):

            if d['value_type'] == 'DATE-TIME' or d['value_type'] == 'DATE':
                prop = Time(d, )
            elif d['value_type'] == 'PERIOD':
                prop = Period(d)
            elif d['value_type'] == 'DURATION':
                prop = Duration(d)
            elif d['name'] == 'ATTACH':
                prop = Attach(d)
            elif d['name'] == 'ATTENDEE':
                prop = Attendee(d)
            elif d['name'] == 'ORGANIZER':
                prop = Organizer(d)
            else:
                prop = Property(ref=p)

            self.cached_props[p] = prop
Пример #15
0
 class Operation(Bunch):
     d = Property()
     def __init__(self,f,d):
         self.f = f
         self.d = d
     def __call__(self,*x):
         return self.f(self.d,*x)
Пример #16
0
    def _addItems(self, properties, parentItem, rindex=0):
        '''Recursively add external properties to the model
        
        :Parameters:
        
        properties : list
                     List of properties
        parentItem : Property
                     Parent of current property set
        rindex : int
                Current row index for grouping
        '''

        for propertyObject in properties:
            #name = getattr(propertyObject.__class__, 'DisplayName', propertyObject.__class__.__name__) #.replace('_', '-'))
            name = propertyObject.__class__.__name__
            _logger.debug("Add item %s - %d - child: %d" %
                          (name, rindex, len(propertyObject._children)))
            currentItem = Property(name, rindex, None, None, parentItem)

            props = []
            for propName in dir(propertyObject.__class__):
                metaProperty = getattr(propertyObject.__class__, propName)
                if not issubclass(metaProperty.__class__, qtProperty): continue
                props.append(propName)
            '''
            props = dir(propertyObject.__class__)
            oprops = list(props)
            last = -1
            for propName in oprops:
                metaProperty = getattr(propertyObject.__class__, propName)
                if not issubclass(metaProperty.__class__, qtProperty): continue
                try:
                    props[metaProperty.order_index]=propName
                    if metaProperty.order_index > last: last = metaProperty.order_index
                except:
                    _logger.error("%s - %d < %d"%(propName, metaProperty.order_index, len(oprops)))
                    raise
            props = props[:last+1]
            '''

            props = [
                prop for prop in props if isinstance(
                    getattr(propertyObject.__class__, prop), qtProperty)
            ]
            #props = [prop for prop in dir(propertyObject.__class__) if isinstance(getattr(propertyObject.__class__, prop), qtProperty) ]

            for propName in props:
                metaProperty = getattr(propertyObject.__class__, propName)
                for propertyClass in Property.PROPERTIES:
                    p = propertyClass.create(propName, rindex, propertyObject,
                                             metaProperty, currentItem)
                    if p is not None: break
                if p is not None:
                    p.propertyValidity.connect(self.firePropertyValidity)
                row = p.row() if p is not None else -1
                _logger.debug("Add property %s - %d" % (propName, row))
            self._addItems(propertyObject._children, currentItem, rindex)
            if parentItem == self.rootItem: rindex += 1
Пример #17
0
    def __init__(self, arg, name="DTSTART", zone=None):
        """ 
        Create a new Time from a string or number of seconds past the 
        POSIX epoch

        Time("19970325T123000Z")  Construct from an iCalendar string
        Time(8349873494)          Construct from seconds past POSIX epoch
        
        """
        e1=icalerror_supress("MALFORMEDDATA")
        e2=icalerror_supress("BADARG")

        if isinstance(arg, DictType):
            # Dictionary -- used for creating from Component
            self.tt = icaltime_from_string(arg['value'])
            Property.__init__(self, ref=arg['ref'])
        else:
            if isinstance(arg, StringType):
                # Create from an iCal string
                self.tt = icaltime_from_string(arg)
            elif isinstance(arg, IntType) or   \
                 isinstance(arg, FloatType): 
                # Create from seconds past the POSIX epoch
		if zone:
                	self.tt = icaltime_from_timet_with_zone(int(arg),0,icaltimezone_get_builtin_timezone(zone))
		else:
                	self.tt = icaltime_from_timet_with_zone(int(arg),0,icaltimezone_get_utc_timezone())
            elif isinstance(arg, Time):
                # Copy an instance
                self.tt = arg.tt
            else:
                self.tt = icaltime_null_time()

            Property.__init__(self,type=name)

        icalerror_restore("MALFORMEDDATA",e1)
        icalerror_restore("BADARG",e2)

        if icaltime_is_null_time(self.tt):
            raise Property.ConstructorFailedError("Failed to construct a Time")

        try:
            self._update_value()
        except Property.UpdateFailedError:
            raise Property.ConstructorFailedError("Failed to construct a Time")
Пример #18
0
    def add_property_object(self, obj):
        properties = vars(obj)
        self.beginInsertRows(QtCore.QModelIndex(), self.rowCount(self._root),
                             self.rowCount(self._root))

        for key, value in properties.items():
            self._items.append(Property(key, obj, self.get_root()))

        self.endInsertRows()
Пример #19
0
	def __init__(self, visitor, name, section):
		Widget.__init__(self, visitor, name, 0, 0, WIDGET_TYPE_TIMER)

		self.expression = Property(self.visitor, section, 'expression', '')

		self.update = visitor.cfg_fetch_num(section, "update", 500)

		self.source_id = None
		self.id_signal = visitor.connect("display-disconnected-before", self.stop)
Пример #20
0
def deserializePropertyData(propertyDataJson: dict) -> Property:
    averageAreaIncome = propertyDataJson["averageAreaIncome"]
    averageAreaNumberOfRooms = propertyDataJson["averageAreaNumberOfRooms"]
    averageAreaHouseAge = propertyDataJson["averageAreaHouseAge"]
    averageAreaNumberOfBedrooms = propertyDataJson["averageAreaNumberOfBedrooms"]
    areaPopulation = propertyDataJson["areaPopulation"]

    property = Property(averageAreaIncome, averageAreaNumberOfRooms, averageAreaHouseAge, averageAreaNumberOfBedrooms, areaPopulation)
    return property
Пример #21
0
	def __init__(self, visitor, name, section):
		Widget.__init__(self, visitor, name, 0, 0, WIDGET_TYPE_KEYPAD)

		self.expression = Property(self.visitor, section, 'expression', '')

		self.key = visitor.cfg_fetch_num(section, "key", 0)

		self.signal_id = None
		self.id_signal = visitor.connect("display-disconnected-before", self.stop)
Пример #22
0
    def __init__(self, properties=None, multimap=None):
        if properties is None:
            self.properties = []
        else:
            self.properties = properties

        if multimap is not None:
            for k, l in multimap.iteritems():
                for v in l:
                    self.properties.append(Property(k, v))
Пример #23
0
    def addDynamicProperties(self, parent, propertyObject):
        ''' Add dynamic properties to the tree
        
        :Parameters:
        
        parent : Property
                 Parent of the Property object to monitor
        propertyObject : QObject
                         Property object to maintain
        '''

        dynamicProperties = propertyObject.dynamicPropertyNames()
        for child in parent.children():
            if not child.property("__Dynamic").toBool(): continue
            index = dynamicProperties.indexOf(child.objectName())
            if index != -1:
                dynamicProperties.removeAt(index)
                continue
        i = 0
        while i < len(dynamicProperties):
            if dynamicProperties[i].startsWith("_") or propertyObject.property(
                    dynamicProperties[i]).isValid():
                dynamicProperties.removeAt(i)
            else:
                i += 1

        if len(dynamicProperties) == 0: return

        parentIndex = self.createIndex(parent.row(), 0, parent)
        rows = self.rowCount(parentIndex)
        self.beginInsertRows(parentIndex, rows,
                             rows + dynamicProperties.count() - 1)

        for dynProp in dynamicProperties:
            #v = propertyObject.property(dynProp)
            p = None
            if len(self.userCallbacks) > 0:
                for callback in self.userCallbacks:
                    p = callback(property.name(), propertyObject, parent)
                    if p is not None: break
            if p is None: p = Property(dynProp, propertyObject, parent)
            p.setProperty("__Dynamic", True)
        self.endInsertRows()
Пример #24
0
    def addOptions(self,
                   option_list,
                   option_groups,
                   option_values,
                   parent=None,
                   rindex=0):
        ''' Add command line options to the Property Tree Model
        
        :Parameters:
        
        option_list, option_groups, option_values
        '''

        if parent is None: parent = self.rootItem
        self.beginInsertRows(
            QtCore.QModelIndex(), self.rowCount(),
            self.rowCount() + len(option_list) + len(option_groups))

        if not hasattr(option_values, 'setProperty'):

            def setProperty(obj, key, val):
                setattr(obj, key, val)

            option_values.setProperty = types.MethodType(
                setProperty, option_values)
        if not hasattr(option_values, 'property'):

            def property(obj, key):
                return getattr(obj, key)

            option_values.property = types.MethodType(property, option_values)

        for option in option_list:
            for propertyClass in Property.PROPERTIES:
                p = propertyClass.create(option,
                                         rindex,
                                         option_values,
                                         parent=parent)
                if p is not None: break
            if p is None:
                print 'Error', option.dest, getattr(option_values, option.dest)
            assert (p is not None)
            #if p.required:
            p.propertyValidity.connect(self.firePropertyValidity)

        for group in option_groups:
            if group.is_child() and len(group.get_config_options()) > 0:
                current = Property(group.title, rindex, parent=parent)
                self.addOptions(group.get_config_options(),
                                group.option_groups, option_values, current)

        # groups
        self.endInsertRows()
Пример #25
0
def Trigger(arg):        
    class Trigger_Time(Time): 
        def __init__(self,arg): Time.__init__(self,arg,"TRIGGER")
    
    class Trigger_Duration(Duration):
        def __init__(self,arg): Duration.__init__(self,arg,"TRIGGER")

    p = None
    for c in [Trigger_Duration, Trigger_Time]:
        try: return c(arg)
        except Property.ConstructorFailedError, d: pass        
    raise Property.ConstructorFailedError("Failed to construct TRIGGER from "+str(arg))
Пример #26
0
def GetRandomProperties(types):
    propertyTypes = []
    for i in range(0, SafeRandomRange(1, 4)):
        typeIndex = SafeRandomRange(0, len(types))
        propertyTypes.append(types[typeIndex])

    typeIndex = SafeRandomRange(0, len(types))
    returnType = types[typeIndex]

    propertyIndex = SafeRandomRange(0, len(properties))
    propertyName = properties[propertyIndex]

    return Property(propertyName, returnType, propertyTypes)
Пример #27
0
def RDate(arg):

    class RDate_Time(Time):
        def __init__(self,arg): Time.__init__(self,arg,"RDATE")
    
    class RDate_Period(Period):
        def __init__(self,arg): Period.__init__(self,arg,"RDATE")

    p = None
    for c in [RDate_Time, RDate_Period]:
        try: return c(arg)
        except Property.ConstructorFailedError, d: pass
    raise Property.ConstructorFailedError("Failed to construct RDATE from "+str(arg))
Пример #28
0
 def addDynamicProperties(self, parent, propertyObject):
     ''' Add dynamic properties to the tree
     
     :Parameters:
     
     parent : Property
              Parent of the Property object to monitor
     propertyObject : QObject
                      Property object to maintain
     '''
     
     dynamicProperties = propertyObject.dynamicPropertyNames()
     for child in parent.children():
         if not child.property("__Dynamic").toBool() : continue
         index = dynamicProperties.indexOf( child.objectName() )
         if index != -1:
             dynamicProperties.removeAt(index)
             continue
     i = 0
     while i < len(dynamicProperties):
         if dynamicProperties[i].startsWith("_") or propertyObject.property( dynamicProperties[i] ).isValid(): dynamicProperties.removeAt(i)
         else: i+= 1
     
     if len(dynamicProperties) == 0: return
     
     parentIndex = self.createIndex(parent.row(), 0, parent)
     rows = self.rowCount(parentIndex)
     self.beginInsertRows(parentIndex, rows, rows + dynamicProperties.count() - 1 )
     
     for dynProp in dynamicProperties:
         #v = propertyObject.property(dynProp)
         p = None
         if len(self.userCallbacks) > 0:
             for callback in self.userCallbacks:
                 p = callback(property.name(), propertyObject, parent)
                 if p is not None: break
         if p is None: p = Property(dynProp, propertyObject, parent)
         p.setProperty("__Dynamic", True)
     self.endInsertRows()
Пример #29
0
    def __init__(self, arg, name="DURATION"):
        """
        Create a new duration from an RFC2445 string or number of seconds.
        Construct the duration from an iCalendar string or a number of seconds.

        Duration("P3DT2H34M45S")   Construct from an iCalendar string
        Duration(3660)             Construct from seconds 
        """ 

        self.dur = None

        e=icalerror_supress("MALFORMEDDATA")

        if isinstance(arg, DictType):
            
            self.dur = icaldurationtype_from_string(arg['value'])
            Property.__init__(self,ref=arg['ref'])
        else:
            if isinstance(arg, StringType):
                self.dur = icaldurationtype_from_string(arg)
            elif isinstance(arg, IntType): 
                self.dur = icaldurationtype_from_int(arg)
            elif isinstance(arg,Duration):
                self.dur = arg.dur
            else:
                self.dur = icaldurationtype_null_duration()

            Property.__init__(self,type=name)

        icalerror_restore("MALFORMEDDATA",e)

        if self.dur == None or icaldurationtype_is_null_duration(self.dur):
            raise Property.ConstructorFailedError("Failed to construct Duration from " +str(arg))

        try:
            self._update_value()
        except Property.UpdateFailedError:
            raise Property.ConstructorFailedError("Failed to construct Duration from  " + str(arg))
Пример #30
0
def import_properties():
    property_list = []
    colour_list = []
    data = read_properties()
    colour = ''
    for index, entry in enumerate(data):
        name, price, rent, col = entry.strip().split(",")
        property_list.append(
            Property(name=name, cost=price, colour=col, rent=rent,
                     index=index))
        if colour != col:
            colour = col
            colour_list.append(col)
    return property_list, colour_list
Пример #31
0
 def __init__(self, parent=None):
     "Initialize the Property Model"
     
     QtCore.QAbstractItemModel.__init__(self, parent)
     self.rootItem = Property("Root", parent=self)
     self.userCallbacks = []
     self.background_colors = [QtGui.QColor.fromRgb(250, 191, 143), 
                               QtGui.QColor.fromRgb(146, 205, 220),
                               QtGui.QColor.fromRgb(149, 179, 215),
                               QtGui.QColor.fromRgb(178, 161, 199),
                               QtGui.QColor.fromRgb(194, 214, 155),
                               QtGui.QColor.fromRgb(217, 149, 148),
                               QtGui.QColor.fromRgb(84, 141, 212),
                               QtGui.QColor.fromRgb(148, 138, 84)]
Пример #32
0
    def _multiple_properties(self,
                             name,
                             value_type,
                             values,
                             property_obj=None):
        "Processes set/get for Properties that can have multiple instances."

        comp = self.inner_component()

        # Set value
        if values != None:
            if not isinstance(values, TupleType) \
               and not isinstance(values, ListType):
                raise TypeError, "%s is not a tuple or list."

            # Delete old properties
            for p in comp.properties(name):
                comp.remove_property(p)

            for v in values:
                if property_obj:  # Specialized properties
                    if not isinstance(v, property_obj):  # Make new object
                        new_prop = property_obj()
                        new_prop.value(v)
                    else:  # Use existing object
                        new_prop = v
                else:  # Generic properties
                    new_prop = Property(name)
                    # new_prop.value_type(value_type)
                    new_prop.value(v)

                comp.add_property(new_prop)

        # Get value
        else:
            return Collection(self, comp.properties(name))
Пример #33
0
    def __init__(self,arg,name='FREEBUSY'):
        """ """

        Property.__init__(self, type = name)

        self.pt=None
        
        #icalerror_clear_errno()
        e1=icalerror_supress("MALFORMEDDATA")
        e2=icalerror_supress("BADARG")

        if isinstance(arg, DictType):
            

            es=icalerror_supress("MALFORMEDDATA")
            self.pt = icalperiodtype_from_string(arg['value'])
            icalerror_restore("MALFORMEDDATA",es)

            Property.__init__(self, ref=arg['ref'])
        else:
            if isinstance(arg, StringType):

                self.pt = icalperiodtype_from_string(arg)

            else:
                self.pt = icalperiodtype_null_period()

            Property.__init__(self,type=name)
                
        icalerror_restore("MALFORMEDDATA",e1)
        icalerror_restore("BADARG",e2)


        if self.pt == None or icalperiodtype_is_null_period(self.pt):
            raise Property.ConstructorFailedError("Failed to construct Period")

        
        try:
            self._update_value()
        except Property.UpdateFailedError:
            raise Property.ConstructorFailedError("Failed to construct Period")
Пример #34
0
    def __init__(self, arg, name="DTSTART", zone=None):
        """ 
        Create a new Time from a string or number of seconds past the 
        POSIX epoch

        Time("19970325T123000Z")  Construct from an iCalendar string
        Time(8349873494)          Construct from seconds past POSIX epoch
        
        """
        e1 = icalerror_supress("MALFORMEDDATA")
        e2 = icalerror_supress("BADARG")

        if isinstance(arg, DictType):
            # Dictionary -- used for creating from Component
            self.tt = icaltime_from_string(arg['value'])
            Property.__init__(self, ref=arg['ref'])
        else:
            if isinstance(arg, StringType):
                # Create from an iCal string
                self.tt = icaltime_from_string(arg)
            elif isinstance(arg, IntType) or   \
                 isinstance(arg, FloatType):
                # Create from seconds past the POSIX epoch
                if zone:
                    self.tt = icaltime_from_timet_with_zone(
                        int(arg), 0, icaltimezone_get_builtin_timezone(zone))
                else:
                    self.tt = icaltime_from_timet_with_zone(
                        int(arg), 0, icaltimezone_get_utc_timezone())
            elif isinstance(arg, Time):
                # Copy an instance
                self.tt = arg.tt
            else:
                self.tt = icaltime_null_time()

            Property.__init__(self, type=name)

        icalerror_restore("MALFORMEDDATA", e1)
        icalerror_restore("BADARG", e2)

        if icaltime_is_null_time(self.tt):
            raise Property.ConstructorFailedError("Failed to construct a Time")

        try:
            self._update_value()
        except Property.UpdateFailedError:
            raise Property.ConstructorFailedError("Failed to construct a Time")
Пример #35
0
    def __init__(self,arg,name='FREEBUSY'):
        """ """

        Property.__init__(self, type = name)

        self.pt=None

        #icalerror_clear_errno()
        e1=icalerror_supress("MALFORMEDDATA")
        e2=icalerror_supress("BADARG")

        if isinstance(arg, DictType):


            es=icalerror_supress("MALFORMEDDATA")
            self.pt = icalperiodtype_from_string(arg['value'])
            icalerror_restore("MALFORMEDDATA",es)

            Property.__init__(self, ref=arg['ref'])
        else:
            if isinstance(arg, StringType):

                self.pt = icalperiodtype_from_string(arg)

            else:
                self.pt = icalperiodtype_null_period()

            Property.__init__(self,type=name)

        icalerror_restore("MALFORMEDDATA",e1)
        icalerror_restore("BADARG",e2)


        if self.pt == None or icalperiodtype_is_null_period(self.pt):
            raise Property.ConstructorFailedError("Failed to construct Period")


        try:
            self._update_value()
        except Property.UpdateFailedError:
            raise Property.ConstructorFailedError("Failed to construct Period")
Пример #36
0
    def __init__(self, arg, name="DURATION"):
        """
        Create a new duration from an RFC2445 string or number of seconds.
        Construct the duration from an iCalendar string or a number of seconds.

        Duration("P3DT2H34M45S")   Construct from an iCalendar string
        Duration(3660)             Construct from seconds
        """

        self.dur = None

        e = icalerror_supress("MALFORMEDDATA")

        if isinstance(arg, DictType):

            self.dur = icaldurationtype_from_string(arg['value'])
            Property.__init__(self, ref=arg['ref'])
        else:
            if isinstance(arg, StringType):
                self.dur = icaldurationtype_from_string(arg)
            elif isinstance(arg, IntType):
                self.dur = icaldurationtype_from_int(arg)
            elif isinstance(arg, Duration):
                self.dur = arg.dur
            else:
                self.dur = icaldurationtype_null_duration()

            Property.__init__(self, type=name)

        icalerror_restore("MALFORMEDDATA", e)

        if self.dur == None or icaldurationtype_is_null_duration(self.dur):
            raise Property.ConstructorFailedError(
                "Failed to construct Duration from " + str(arg))

        try:
            self._update_value()
        except Property.UpdateFailedError:
            raise Property.ConstructorFailedError(
                "Failed to construct Duration from  " + str(arg))
Пример #37
0
class WidgetHistogram(Widget):
	def __init__(self, visitor, name, section, row, col):
		Widget.__init__(self, visitor, name, row, col, WIDGET_TYPE_RC)

		if hasattr(visitor, "text_histogram_draw"):
			self.draw = visitor.text_histogram_draw
		elif hasattr(visitor, "graphic_histogram_draw"):
			self.draw = visitor.graphic_histogram_draw
		else:
			self.draw = None

		
		self.min = 0
		self.max = 0
		self.string = ''
		self.expression = Property(self.visitor, section, 'expression', '')
		self.expr_min = Property(self.visitor, section, 'min', None)
		self.expr_max = Property(self.visitor, section, 'max', None)

		self.length = visitor.cfg_fetch_num(section, 'length', 10)

		self.height = visitor.cfg_fetch_num(section, 'height', 1)

		self.gap = visitor.cfg_fetch_num(section, "gap", 0)

		self.layer = visitor.cfg_fetch_num(section, "layer", 0)

		self.history = resizeList([], self.length, int)

		c = visitor.cfg_fetch_raw(section, "direction", "E")

		if c.upper() == "E":
			self.direction = DIR_EAST
		elif c.upper() == "W":
			self.direction = DIR_WEST
		else:
			error("widget %s has unknown direction '%s'; Use E(ast) or W(est). Using E." % (self.name, c))
			self.direction = DIR_EAST

		self.update = visitor.cfg_fetch_num(section, 'update', 1000)

		self.fg_color = RGBA()
		self.fg_valid = self.widget_color(section, "foreground", self.fg_color)
		self.bg_color = RGBA()
		self.bg_valid = self.widget_color(section, "background", self.bg_color)

		self.ch = {}

		self.id_source = None
		self.id_signal = visitor.connect("display-disconnected-before", self.stop)

	def setup_chars(self):
		self.ch = {}

		for char in range(self.visitor.YRES):
			buffer = []
			i = self.visitor.YRES - 1
			while i >= 0:  
				buffer.append( [0, 2**(self.visitor.XRES-self.gap)-1][i < char] )
				i = i - 1

			reused = False

			for i in range(len(self.visitor.chars)):
				if buffer == self.visitor.chars[i]:
					self.ch[char] = i
					reused = True
					break

			if char not in self.ch.keys():	
				if self.visitor.CHARS - len(self.visitor.chars) < self.visitor.YRES-char:
					self.update = None
					error("widget %s unable to allocate special chars" % self.name)
					return

			if reused: continue
			self.visitor.chars.append(buffer)
			self.ch[char] = len(self.visitor.chars)-1

	def start(self, data=None):
		if self.update is None:
			return
		if self.id_source is not None:
			self.stop()
		self.id_source = gobject.timeout_add(self.update, self.histogram_update)
		self.histogram_update()

	def stop(self, data=None):
		if self.id_source is not None:
			gobject.source_remove(self.id_source)
		self.id_source = None

	def histogram_update(self):

		self.expression.eval()
		val = self.expression.P2N()

		if self.expr_min.valid():
			self.expr_min.eval()
			min = self.expr_min.P2N()
		else:
			min = self.min
			if val < min:
				min = val

		if self.expr_max.valid():
			self.expr_max.eval()
			max = self.expr_max.P2N()
		else:
			max = self.max
			if val > max:
				max = val	

		self.min = min
		self.max = max
		if max > min:
			val = (val - min) / (max - min)
		else:
			val = 0.0

		if self.direction == DIR_EAST:
			self.history[1:] = self.history[:-1]
			self.history[0] = val
		elif self.direction == DIR_WEST:
			self.history[:-1] = self.history[1:]
			self.history[self.length-1] = val

		if self.draw is not None:
			self.draw(self)
		else:
			error( "WidgetHistogram: no draw method" )

		
		return True
Пример #38
0
import json
from Property import Property as Props
# from Players import Players

#=================================

props = Props()
print(props.getPrice("Park_Place"))

props.setOwner("Park_Place", "Alan")
print(props.curOwner("Park_Place"))

print(props.getRent("Park_Place"))
# props.saveCurStateInJson("./guo.json")

#=================================
'''
player = Players()
player.addPlayer("guo")
player.addPlayer("alan")
player.addPlayer("kevin")

player.listCurentPlayers()

player.updateRollDiceOrder("kevin", 1)
player.updateRollDiceOrder("alan", 2)
player.updateRollDiceOrder("guo", 3)

player.listCurentPlayers()

player.reorderPlayersAsItWasSet()
Пример #39
0
 def name(self):
     return Property.name(self)
Пример #40
0
 def value_type(self):
     return Property.value_type(self)
Пример #41
0
 def __init__(self, value=None, parameter_dict={}):
     Property.__init__(self, parameter_dict)
     Property.name(self, 'ATTACH')
     self.value(value)
Пример #42
0
 def __init__(self, name, propertyList, parent=None):
     super(ListProperty, self).__init__(name, None, parent)
     self._list = []
     for i, item in enumerate(propertyList):
         self._list.append(Property(str(i), item, self))
Пример #43
0
 def name(self):
     return Property.name(self)
Пример #44
0
 def name(self):
     "Returns the name of the property."
     return Property.name(self)
Пример #45
0
 def value_type(self):
     return Property.value_type(self)
Пример #46
0
class WidgetBar(Widget):
	def __init__(self, visitor, name, section, row, col):
		Widget.__init__(self, visitor, name, row, col, WIDGET_TYPE_RC)

		if hasattr(visitor, "text_bar_draw"):
			self.draw = visitor.text_bar_draw
		elif hasattr(visitor, "graphic_bar_draw"):
			self.draw = visitor.graphic_bar_draw
		else:
			self.draw = None

		self.min = 0
		self.max = 0
		self.string = ''
		self.expression = Property(self.visitor, section, 'expression', '')
		self.expression2 = Property(self.visitor, section, 'expression2', '')
		self.expr_min = Property(self.visitor, section, 'min', None)
		self.expr_max = Property(self.visitor, section, 'max', None)

		self.color_valid = resizeList([], 2, int)
		self.color = resizeList([], 2, RGBA)
		self.color_valid[0] = self.widget_color(section, "barcolor0", self.color[0])
		self.color_valid[1] = self.widget_color(section, "barcolor1", self.color[1])

		self.layer = visitor.cfg_fetch_num(section, 'layer', 0)

		self.length = visitor.cfg_fetch_num(section, 'length', 10)
		c = visitor.cfg_fetch_raw(section, "direction", "E")

		if c.upper() == "E":
			self.direction = DIR_EAST
		elif c.upper() == "W":
			self.direction = DIR_WEST
		else:
			error("widget %s has unknown direction '%s'; Use E(ast) or W(est). Using E." % (self.name, c))
			self.direction = DIR_EAST

		self.update = visitor.cfg_fetch_num(section, 'update', 1000)

		c = visitor.cfg_fetch_raw(section, "style", "O")

		if c.upper() == "H":
			self.style = STYLE_HOLLOW
		elif c.upper() == "N" or c.upper == "O":
			self.style = STYLE_NORMAL
		else:
			error("widget %s has unknown style '%s'; known styles 'N' or 'H'; using 'N'" % (self.name, c))
			self.style = STYLE_NORMAL

		self.ch = {}

		self.id_source = None
		self.id_signal = visitor.connect("display-disconnected-before", self.stop)

	def setup_chars(self):
		self.ch = {}
		if self.style == STYLE_HOLLOW and not self.expression2.valid():
			for i in range(4):
				for j in range(len(self.visitor.chars)):
					if self.visitor.chars[j] == CHAR[i]:
						self.ch[i] = j

			for i in range(6):
				if i not in self.ch.keys():
					if len(self.visitor.chars) >= self.visitor.CHARS:
						error("Can not allot char for widget: %s" % name)
						self.update = None
						return
					self.visitor.chars.append(CHAR[i])
					self.ch[i] = len(self.visitor.chars) - 1
		elif self.style == STYLE_NORMAL:
			for j in range(len(self.visitor.chars)):
				if self.visitor.chars[j] == CHAR[0]:
					self.ch[0] = j
				if self.visitor.chars[j] == CHAR[4]:
					self.ch[1] = j
				if self.visitor.chars[j] == CHAR[5]:
					self.ch[2] = j
			if 0 not in self.ch.keys():
				if len(self.visitor.chars) >= self.visitor.CHARS:
					error("Can not allot char for bar widget: %s" % self.widget_base)
					self.update = None
					return
				self.visitor.chars.append(CHAR[0])
				self.ch[0] = len(self.visitor.chars) - 1
			if 1 not in self.ch.keys() and self.expression2.valid():
				if len(self.visitor.chars) >= self.visitor.CHARS:
					error("Can not allot char for bar widget: %s" % self.widget_base)
					return
				self.visitor.chars.append(CHAR[4])
				self.ch[1] = len(self.visitor.chars) - 1
			if 2 not in self.ch.keys() and self.expression2.valid():
				if len(self.visitor.chars) >= self.visitor.CHARS:
					error("Can not allot char for bar widget: %s" % self.widget_base)
					return
				self.visitor.chars.append(CHAR[5])
				self.ch[2] = len(self.visitor.chars) - 1

		else:
			error("%s: Either choose style hollow or have a 2nd expression, not both" % self.widget_base)
			self.update = None

	def start(self, data=None):
		if self.update is None:
			return
		if self.id_source is not None:
			self.stop()
		self.id_source = gobject.timeout_add(self.update, self.bar_update)
		self.bar_update()

	def stop(self, data=None):
		if self.id_source is not None:
			gobject.source_remove(self.id_source)
		self.id_source = None

	def bar_update(self):
		self.expression.eval()
		val1 = self.expression.P2N()
		if self.expression2.valid():
			self.expression2.eval()
			val2 = self.expression2.P2N()
		else:
			val2 = val1

		if self.expr_min.valid():
			self.expr_min.eval()
			min = self.expr_min.P2N()
		else:
			min = self.min
			if val1 < min:
				min = val1
			if val2 < min:
				min = val2

		if self.expr_max.valid():
			self.expr_max.eval()
			max = self.expr_max.P2N()
		else:
			max = self.max
			if val1 > max:
				max = val1
			if val2 > max:
				max = val2

		self.min = min
		self.max = max
		if max > min:
			self.val1 = (val1 - min) / (max - min)
			self.val2 = (val2 - min) / (max - min)
		else:
			self.val1 = 0.0
			self.val2 = 0.0

		if self.draw is not None:
			self.draw(self)
		else:
			error( "WidgetBar: no draw method" )

		
		return True
Пример #47
0
    def __init__(self, name, propertyDict, parent=None):
        super(DictProperty, self).__init__(name, None, parent)

        for i, j in propertyDict.items():
            parent = Property(str(i), j, self)
Пример #48
0
    class TestClass(OrderedBunch):
        a = Property('a')

        def __init__(self):
            self.a = 'hidden!'
            self.b = 'hello!'
Пример #49
0
def RDate(arg):
    class RDate_Time(Time):
        def __init__(self, arg):
            Time.__init__(self, arg, "RDATE")

    class RDate_Period(Period):
        def __init__(self, arg):
            Period.__init__(self, arg, "RDATE")

    p = None
    for c in [RDate_Time, RDate_Period]:
        try:
            return c(arg)
        except Property.ConstructorFailedError, d:
            pass
    raise Property.ConstructorFailedError("Failed to construct RDATE from " +
                                          str(arg))


def Trigger(arg):
    class Trigger_Time(Time):
        def __init__(self, arg):
            Time.__init__(self, arg, "TRIGGER")

    class Trigger_Duration(Duration):
        def __init__(self, arg):
            Duration.__init__(self, arg, "TRIGGER")

    p = None
    for c in [Trigger_Duration, Trigger_Time]:
        try:
            return c(arg)
Пример #50
0
class WidgetBigNumbers(Widget):
	def __init__(self, visitor, name, section, row, col):
		Widget.__init__(self, visitor, name, row, col, WIDGET_TYPE_RC)

		if hasattr(visitor, "text_bignums_draw"):
			self.draw = visitor.text_bignums_draw
		elif hasattr(visitor, "graphic_bignums_draw"):
			self.draw = visitor.graphic_bignums_draw
		else:
			self.draw = None

		self.FB = Buffer()
		self.FB.buffer = ' ' * 16 * 24

		self.min = 0
		self.max = 0
		self.string = ''
		self.expression = Property(self.visitor, section, 'expression', '')
		self.expr_min = Property(self.visitor, section, 'min', None)
		self.expr_max = Property(self.visitor, section, 'max', None)

		self.length = visitor.cfg_fetch_num(section, 'length', 10)

		self.update = visitor.cfg_fetch_num(section, 'update', 500)

		self.fg_color = RGBA()
		self.fg_valid = self.widget_color(section, "foreground", self.fg_color)
		self.bg_color = RGBA()
		self.bg_valid = self.widget_color(section, "background", self.bg_color)

		self.layer = visitor.cfg_fetch_num(section, "layer", 0)
		
		self.ch = {}

		self.id_source = None
		self.id_signal = visitor.connect("display-disconnected-before", self.stop)

	def setup_chars(self):
		for i in range(8):
			if len(self.visitor.chars) >= self.visitor.CHARS:
				error("Can not allot char for widget: %s" % name)
				self.update = None
				return
			self.visitor.chars.append(CHAR[i])
			self.ch[i] = len(self.visitor.chars) - 1

	def start(self, data=None):
		if self.update is None:
			return
		if self.id_source is not None:
			self.stop()
		self.id_source = gobject.timeout_add(self.update, self.bignums_update)
		self.bignums_update()

	def stop(self, data=None):
		if self.id_source is not None:
			gobject.source_remove(self.id_source)
		self.id_source = None

	def bignums_update(self):

		self.expression.eval()
		val = self.expression.P2N()

		if self.expr_min.valid():
			self.expr_min.eval()
			min = self.expr_min.P2N()
		else:
			min = self.min
			if val < min:
				min = val

		if self.expr_max.valid():
			self.expr_max.eval()
			max = self.expr_max.P2N()
		else:
			max = self.max
			if val > max:
				max = val	

		self.min = min
		self.max = max
		if max > min:
			self.val = int((val - min) / (max - min) * 100)
		else:
			self.val = 0

		
		text = str(self.val)
		pad = 3 - len(text)
		self.FB.buffer = ' ' * 16 * 24
		for i in range(len(text)):
			c = ord(text[i]) - ord('0')
			for row in range(16):
				for col in range(8):
					if (CHAR[c][row] & 1<<7-col) != 0:
						self.FB[row * 24 + (i + pad) * 8 + col] = '.'

		if self.draw is not None:
			self.draw(self)
		else:
			error( "WidgetBigNumbers: no draw method" )

		
		return True
Пример #51
0
 def name(self):
     "Returns the name of the property."
     return Property.name(self)
Пример #52
0
class PropertyModel(QtCore.QAbstractItemModel):
    ''' Defines the property data maintained by a QTreeView
        
    :Parameters:
    
    parent : QObject
             Parent of the Property Model
    '''
    
    propertyValidity = qtSignal(object, object, bool)
    
    def __init__(self, parent=None):
        "Initialize the Property Model"
        
        QtCore.QAbstractItemModel.__init__(self, parent)
        self.rootItem = Property("Root", parent=self)
        self.userCallbacks = []
        self.background_colors = [QtGui.QColor.fromRgb(250, 191, 143), 
                                  QtGui.QColor.fromRgb(146, 205, 220),
                                  QtGui.QColor.fromRgb(149, 179, 215),
                                  QtGui.QColor.fromRgb(178, 161, 199),
                                  QtGui.QColor.fromRgb(194, 214, 155),
                                  QtGui.QColor.fromRgb(217, 149, 148),
                                  QtGui.QColor.fromRgb(84, 141, 212),
                                  QtGui.QColor.fromRgb(148, 138, 84)]
        
    def addOptionList(self, option_list):
        ''' Add options from list/dict format
        '''
        
        from arachnid.core.app import settings
        parser = settings.OptionParser('', version='0.0.1', description="")
        for option in option_list:
            parser.add_option("", **option)
        values = parser.get_default_values()
        names = vars(values).keys()
        self.addOptions(parser.get_config_options(), parser.option_groups, values)
        return values, names
    
    def addOptions(self, option_list, option_groups, option_values, parent=None, rindex=0):
        ''' Add command line options to the Property Tree Model
        
        :Parameters:
        
        option_list, option_groups, option_values
        '''
        
        if parent is None: parent = self.rootItem
        self.beginInsertRows(QtCore.QModelIndex(), self.rowCount(), self.rowCount()+len(option_list)+len(option_groups))
        
        if not hasattr(option_values, 'setProperty'):
            def setProperty(obj, key, val): setattr(obj, key, val)
            option_values.setProperty = types.MethodType( setProperty, option_values )
        if not hasattr(option_values, 'property'):
            def property(obj, key): return getattr(obj, key)
            option_values.property = types.MethodType( property, option_values )
        
        for option in option_list:
            for propertyClass in Property.PROPERTIES:
                p = propertyClass.create(option, rindex, option_values, parent=parent)
                if p is not None: break
            if p is None: print 'Error', option.dest, getattr(option_values, option.dest)
            assert(p is not None)
            #if p.required: 
            p.propertyValidity.connect(self.firePropertyValidity)
        
        for group in option_groups:
            if group.is_child() and len(group.get_config_options()) > 0:
                current = Property(group.title, rindex, parent=parent)
                self.addOptions(group.get_config_options(), group.option_groups, option_values, current)
        
        # groups
        self.endInsertRows()
    
    def firePropertyValidity(self, prop, valid):
        '''
        '''
        
        self.propertyValidity.emit(self, prop, valid)
    
    def _addItems(self, properties, parentItem, rindex=0):
        '''Recursively add external properties to the model
        
        :Parameters:
        
        properties : list
                     List of properties
        parentItem : Property
                     Parent of current property set
        rindex : int
                Current row index for grouping
        '''
            
        for propertyObject in properties:
            #name = getattr(propertyObject.__class__, 'DisplayName', propertyObject.__class__.__name__) #.replace('_', '-'))
            name = propertyObject.__class__.__name__
            _logger.debug("Add item %s - %d - child: %d"%(name, rindex, len(propertyObject._children)))
            currentItem = Property(name, rindex, None, None, parentItem)
            
            props=[]
            for propName in dir(propertyObject.__class__):
                metaProperty = getattr(propertyObject.__class__, propName)
                if not issubclass(metaProperty.__class__, qtProperty): continue
                props.append(propName)
            
            '''
            props = dir(propertyObject.__class__)
            oprops = list(props)
            last = -1
            for propName in oprops:
                metaProperty = getattr(propertyObject.__class__, propName)
                if not issubclass(metaProperty.__class__, qtProperty): continue
                try:
                    props[metaProperty.order_index]=propName
                    if metaProperty.order_index > last: last = metaProperty.order_index
                except:
                    _logger.error("%s - %d < %d"%(propName, metaProperty.order_index, len(oprops)))
                    raise
            props = props[:last+1]
            '''
            
            props = [prop for prop in props if isinstance(getattr(propertyObject.__class__, prop), qtProperty) ]
            #props = [prop for prop in dir(propertyObject.__class__) if isinstance(getattr(propertyObject.__class__, prop), qtProperty) ]
            
            
            
            for propName in props:
                metaProperty = getattr(propertyObject.__class__, propName)
                for propertyClass in Property.PROPERTIES:
                    p = propertyClass.create(propName, rindex, propertyObject, metaProperty, currentItem)
                    if p is not None: break
                if p is not None:
                    p.propertyValidity.connect(self.firePropertyValidity)
                row = p.row() if p is not None else -1
                _logger.debug("Add property %s - %d"%(propName,row))
            self._addItems(propertyObject._children, currentItem, rindex)
            if parentItem == self.rootItem: rindex += 1
    
    def addItem(self, propertyObject):
        ''' Add a property object to the tree
        
        :Parameters:
        
        propertyObject : QObject
                        Property object to monitor
        '''
        
        _logger.debug("Add item: %s"%str(propertyObject.__class__.__name__))
        if hasattr(propertyObject, 'todict') or hasattr(propertyObject, '_children'):
            #if hasattr(propertyObject, '_children'): propertyObject = [propertyObject]
            
            props = [prop for prop in dir(propertyObject.__class__) if isinstance(getattr(propertyObject.__class__, prop), qtProperty)]
            if len(props) != 0:
                _logger.debug("Tab as root")
                if hasattr(propertyObject, '_children'): propertyObject = [propertyObject]
            else:
                if hasattr(propertyObject, '_children'): propertyObject = propertyObject._children
            self.beginInsertRows(QtCore.QModelIndex(), self.rowCount(), self.rowCount()+len(propertyObject))
            self._addItems(propertyObject, self.rootItem)
            self.endInsertRows()
        elif hasattr(propertyObject, 'external_properties'):
            # Insert properties for classes
            self.beginInsertRows(QtCore.QModelIndex(), self.rowCount(), self.rowCount()+len(propertyObject.external_properties))
            self._addItems(propertyObject.external_properties, self.rootItem)
            self.endInsertRows()
        else:
            # Create property/class hierarchy
            propertyMap = {}
            classList = []
            pypropertyMap = dict([(prop, getattr(propertyObject.__class__, prop)) for prop in dir(propertyObject.__class__) if isinstance(getattr(propertyObject.__class__, prop), qtProperty) ])
            classMap = {}
            classObject = propertyObject.__class__
            metaObject = propertyObject.metaObject()
            while metaObject is not None:
                for i in xrange(metaObject.propertyOffset(), metaObject.propertyCount()):
                    prop = metaObject.property(i)
                    if not prop.isUser(): continue
                    propertyMap[prop] = metaObject
                classList.append(metaObject)
                classMap[metaObject.className()] = classObject
                metaObject = metaObject.superClass()
                classObject = classObject.__bases__[0]
            
            # Remove empty classes
            finalClassList = []
            for obj in classList:
                found = False
                for obj2 in propertyMap.itervalues():
                    if obj2 == obj:
                        found = True
                        break
                if found: finalClassList.append(obj)
            
            # Insert properties for classes
            self.beginInsertRows(QtCore.QModelIndex(), self.rowCount(), self.rowCount()+len(finalClassList))
            
            propertyItem = None
            for rindex, metaObject in enumerate(finalClassList):
                name = metaObject.className()
                name = getattr(classMap[name], 'DisplayName', name)
                propertyItem = Property(name, rindex, None, None, self.rootItem)
                keys = propertyMap.keys()
                keys.sort()
                #for prop, obj in propertyMap.iteritems():
                for prop in keys:
                    obj = propertyMap[prop]
                    if obj != metaObject: continue
                    metaProperty = QtCore.QMetaProperty(prop)
                    try:
                        extProperty = pypropertyMap[prop.name()]
                    except:
                        print 'Error', prop.name(), "-->", pypropertyMap
                        raise
                    p = None
                    for propertyClass in Property.PROPERTIES:
                        p = propertyClass.create(metaProperty.name(), rindex, propertyObject, extProperty, propertyItem)
                        if p is not None: break
                    if p is not None:
                        p.propertyValidity.connect(self.firePropertyValidity)
            self.endInsertRows()
            if propertyItem: self.addDynamicProperties(propertyItem, propertyObject)
    
    def updateItem(self, propertyObject, parent = QtCore.QModelIndex()):
        '''Update a property object in the tree
        
        :Parameters:
        
        propertyObject : QObject
                        Property object to monitor
        parent : QModelIndex
                 Index of parent in the tree
        '''
        
        parentItem = self.rootItem
        if parent.isValid():
            parentItem = parent.internalPointer()
        if parentItem.property_object() != propertyObject:
            parentItem = parentItem.findPropertyObject(propertyObject)
        if parentItem:
            itemIndex = self.createIndex(parentItem.row(), 0, parentItem)
            self.dataChanged(itemIndex, self.createIndex(parentItem.row(), 1, parentItem))
            dynamicProperties = propertyObject.dynamicPropertyNames()
            children = parentItem.parent().children()
            removed = 0
            for i in xrange(len(children)):
                obj = children[i]
                if obj.property("__Dynamic").toBool() or dynamicProperties.contains(obj.objectName()): continue
                self.beginRemoveRows(itemIndex.parent(), i - removed, i - removed)
                removed += 1
                self.endRemoveRows()
            self.addDynamicProperties(parentItem.parent(), propertyObject)
    
    def addDynamicProperties(self, parent, propertyObject):
        ''' Add dynamic properties to the tree
        
        :Parameters:
        
        parent : Property
                 Parent of the Property object to monitor
        propertyObject : QObject
                         Property object to maintain
        '''
        
        dynamicProperties = propertyObject.dynamicPropertyNames()
        for child in parent.children():
            if not child.property("__Dynamic").toBool() : continue
            index = dynamicProperties.indexOf( child.objectName() )
            if index != -1:
                dynamicProperties.removeAt(index)
                continue
        i = 0
        while i < len(dynamicProperties):
            if dynamicProperties[i].startsWith("_") or propertyObject.property( dynamicProperties[i] ).isValid(): dynamicProperties.removeAt(i)
            else: i+= 1
        
        if len(dynamicProperties) == 0: return
        
        parentIndex = self.createIndex(parent.row(), 0, parent)
        rows = self.rowCount(parentIndex)
        self.beginInsertRows(parentIndex, rows, rows + dynamicProperties.count() - 1 )
        
        for dynProp in dynamicProperties:
            #v = propertyObject.property(dynProp)
            p = None
            if len(self.userCallbacks) > 0:
                for callback in self.userCallbacks:
                    p = callback(property.name(), propertyObject, parent)
                    if p is not None: break
            if p is None: p = Property(dynProp, propertyObject, parent)
            p.setProperty("__Dynamic", True)
        self.endInsertRows()
    
    def clear(self):
        ''' Clear the property tree and remove from model
        '''
        
        self.beginRemoveRows(QtCore.QModelIndex(), 0, self.rowCount())
        self.rootItem = Property("Root", None, self)
        self.endRemoveRows()
    
    #### overridden virtual functions
    
    def buddy(self, index):
        ''' Returns a model index for the buddy of the item represented by index. When the user wants 
        to edit an item, the view will call this function to check whether another item in the model 
        should be edited instead. Then, the view will construct a delegate using the model index returned 
        by the buddy item.
        
        :Parameters:
        
        index : QModelIndex
                Index of a model item
        
        :Returns:
        
        val : QModelIndex
              Index of the buddy
        '''
        
        if index.isValid() and index.column() == 0:
            return self.createIndex(index.row(), 1, index.internalPointer())
        return index
    
    def headerData(self, section, orientation, role=QtCore.Qt.DisplayRole):
        '''Returns the data for the given role and section in the header with the specified orientation
        
        :Parameters:
        
        section : QModelIndex
                  Index of a model item
        orientation : QModelIndex
                      Index of a model item
        role : QModelIndex
               Role of data to return
        
        :Returns:
        
        val : ItemFlags
              Flags for item at index
        '''
        
        if (orientation, role) == (QtCore.Qt.Horizontal, QtCore.Qt.DisplayRole):
            if section == 0: return self.tr("Name")
            if section == 1: return self.tr("Value")
        return None
    
    def flags(self, index):
        '''Returns the item flags for the given index
        
        :Parameters:
        
        index : QModelIndex
                Index of a model item
        
        :Returns:
        
        val : ItemFlags
              Flags for item at index
        '''
        
        if not index.isValid(): return QtCore.Qt.ItemIsEnabled
        item = index.internalPointer()
        
        if item.isRoot():       flags = QtCore.Qt.ItemIsEnabled
        elif item.isReadOnly(): flags = QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsSelectable
        else:                   flags = QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable
        if item.isBool():       flags = flags | QtCore.Qt.ItemIsUserCheckable
        return flags
    
    def setData(self, index, value, role = QtCore.Qt.EditRole):
        ''' Sets the role data for the item at index to value
        
        :Parameters:
        
        index : QModelIndex
                Index of a model item
        value : object
                New value for item at index with role
        role : enum
               Data role
        
        :Returns:
        
        val : bool
              True if successful
        '''
        
        if index.isValid():
            if role == QtCore.Qt.EditRole:
                item = index.internalPointer()
                item.setValue(value)
                self.emit(QtCore.SIGNAL("dataChanged (const QModelIndex&,const QModelIndex&)"), index, index)
                return True
        return False
    
    def data(self, index, role = QtCore.Qt.DisplayRole):
        ''' Returns the data stored under the given role for the item referred to by the index
        
        :Parameters:
        
        index : QModelIndex
                Index of a model item
        role : enum
               Data role
        
        :Returns:
        
        val : object
              Data object
        '''
        
        if not index.isValid(): return None
        item = index.internalPointer()
        
        if role == QtCore.Qt.ForegroundRole and index.column() == 0 and 'required' in item.hints and item.hints['required']:
            return QtGui.QColor(QtCore.Qt.blue)
        if role == QtCore.Qt.BackgroundRole and index.column() == 1 and 'required' in item.hints and item.hints['required']:
            if not item.isValid():
                return QtGui.QColor('#F0E68C')
        
        if (role == QtCore.Qt.ToolTipRole or role == QtCore.Qt.StatusTipRole) and item.doc is not None:
            return "<FONT COLOR=black>"+item.doc+"<FONT>"
        elif role == QtCore.Qt.ToolTipRole or role == QtCore.Qt.DecorationRole or role == QtCore.Qt.DisplayRole or role == QtCore.Qt.EditRole:
            if index.column() == 0: return item.displayName
            if index.column() == 1: return str(item.value(role))
        #if role == QtCore.Qt.BackgroundRole:
        #    if item.isRoot(): return QtGui.QApplication.palette("QTreeView").brush(QtGui.QPalette.Normal, QtGui.QPalette.Button).color()
            '''
                group = item.group
                while group > len(self.background_colors): group -= len(self.background_colors)
                color = self.background_colors[group]
                return QtGui.QBrush(color)
            '''
        if role == QtCore.Qt.CheckStateRole:
            if index.column() == 1 and item.isBool(): return item.value(role)
        return None
    
    def rowCount(self, parent = QtCore.QModelIndex()):
        ''' Get the number of rows for the parent item
        
        :Parameters:
    
        parent : QModelIndex
                 Parent of item
        
        :Returns:
        
        val : int
              Number of rows
        '''
        
        parentItem = self.rootItem
        if parent.isValid(): parentItem = parent.internalPointer()
        return len(parentItem.children())
    
    def maximumTextWidth(self, fontMetric, indent, column=0, parent = QtCore.QModelIndex()):
        ''' Get the maximum text with of a table column
        
        :Parameters:
        
        fontMetric : QFontMetrics
                     Font metric used to measure text width
        indent : int
                 Width of indent
        column : int
                 Column index
        parent : QModelIndex
                 Parent of item
        
        :Returns:
        
        val : int
              Maximum width of text in a column
        '''
        
        parentItem = self.rootItem
        if parent.isValid(): parentItem = parent.internalPointer()
        return parentItem.maximumNameWidth(fontMetric, indent)
    
    def columnCount(self, parent = QtCore.QModelIndex()):
        ''' Get the number of columns - 2
        
        :Parameters:
    
        parent : QModelIndex
                 Parent of item
        
        :Returns:
        
        val : int
              Return value: 2
        '''
        
        return 2
    
    def parent(self, index):
        '''Returns the parent of the model item with the given index. If the item has no parent, an invalid QModelIndex is returned
        
        :Parameters:
        
        index : QModelIndex
                Index of a model item
        
        :Returns:
        
        index : QModelIndex
                Parent of the model item
        '''
        
        if not index.isValid(): return QtCore.QModelIndex()
        childItem = index.internalPointer()
        parentItem = childItem.parent()
        if parentItem is None or parentItem == self.rootItem: return QtCore.QModelIndex()
        return self.createIndex(parentItem.row(), 0, parentItem)
    
    def index(self, row, column, parent = QtCore.QModelIndex()):
        ''' Returns the index of the item in the model specified by the given row, column and parent index
        
        :Parameters:
        
        row : int
              Row of item
        column : int
                Column of item
        parent : QModelIndex
                 Parent of item
        
        :Returns:
        
        index : QModelIndex
                Current index of item
        '''
        
        parentItem = self.rootItem
        if parent.isValid(): 
            parentItem = parent.internalPointer()
        if row >= len(parentItem.children()) or row < 0: 
            return QtCore.QModelIndex()
        return self.createIndex(row, column, parentItem.children()[row])
    
    def saveState(self, settings, parent = QtCore.QModelIndex()):
        ''' Save the state of the properties in the tree
        
        :Parameters:
        
        settings : QSettings
                   Save settings to platform specific location
        parent : QModelIndex
                 Parent of item
        '''
        
        parentItem = self.rootItem
        if parent.isValid(): parentItem = parent.internalPointer()
        parentItem.saveState(settings)
    
    def restoreState(self, settings, parent = QtCore.QModelIndex()):
        ''' Restore the state of the properties in the tree
        
        :Parameters:
        
        settings : QSettings
                   Load settings from platform specific location
        parent : QModelIndex
                 Parent of item
        '''
        
        parentItem = self.rootItem
        if parent.isValid(): parentItem = parent.internalPointer()
        parentItem.restoreState(settings)
    
    def totalInvalid(self):
        ''' Count the total number of children under this node.
        
        :Returns:
        
        total : int
                Total number of invalid, but required children
        '''
        
        return self.rootItem.totalInvalid()
Пример #53
0
 def __init__(self, dict={}):
     Time.__init__(self, dict)
     Property.name(self, 'RECURRENCE-ID')
Пример #54
0
def main():
    property = Property()
    rent = Rent()
    rent.PayRent("kevin", "guo", 200)
Пример #55
0
                ImageURL_list.append(dataset.Image_URL[i])
                Area_list.append(dataset.FloorArea[i])
                #Price_list.append(dataset.Price_in_Lacs[i])
                BHK_list.append(dataset.BHKs[i])
        #print(len(PropertyURL_list))
        #print(len(ImageURL_list))
        #print(len(Area_list))
        #print(len(Price_list))
        #print(len(BHK_list))

        return PropertyURL_list, ImageURL_list, Area_list, BHK_list


if __name__ == '__main__':
    scraper = Scraper()
    properties = Property()
    dataset = scraper.loadData()
    dataset = scraper.scrapeData(properties, dataset)
    dataset = scraper.processData(dataset)
    if (scraper.writeData(dataset)):
        print("Dataset Successfully Updated")
    else:
        print("Dataset updation failed. Please re-run scraper")
"""    
if(get_places()):
    dataset = load_data()
    dataset = process_data(dataset)
    if(write_data(dataset)):
        print("Dataset Successfully Updated")
    else:
        print("Dataset updation failed. Please re-run scraper")
Пример #56
0
class WidgetText(Widget):
	def __init__(self, visitor, name, section, row, col):
		Widget.__init__(self, visitor, name, row, col, WIDGET_TYPE_RC)
		if hasattr(visitor, "text_draw"):
			self.draw = visitor.text_draw
		elif hasattr(visitor, "graphic_draw"):
			self.draw = visitor.graphic_draw
		else:
			self.draw = None

		self.row = row
		self.col = col

		self.string = ''
		self.prefix = Property(self.visitor, section, "prefix", '')
		self.postfix = Property(self.visitor, section, 'postfix', '')
		self.style = Property(self.visitor, section, 'style', '')
		self.value = Property(self.visitor, section, 'expression', '')
		self.width = visitor.cfg_fetch_num(section, 'width', 10)
		self.precision = visitor.cfg_fetch_num(section, 'precision', 0xDEAD)
		self.align = visitor.cfg_fetch_raw(section, 'align', 'L')
		self.update = visitor.cfg_fetch_num(section, 'update', 1000)
		self.scroll = visitor.cfg_fetch_num(section, 'scroll', 500)
		self.speed = visitor.cfg_fetch_num(section, 'speed', 500)
		self.fg_color = RGBA()
		self.bg_color = RGBA()
		self.fg_valid = self.widget_color(section, "foreground", self.fg_color)
		self.bg_valid = self.widget_color(section, "background", self.bg_color)
		self.layer = visitor.cfg_fetch_num(section, "layer", 0)
		
		self.id_source = None
		self.scroll_source = None
		self.buffer = ' ' * self.width
		self.id_signal = visitor.connect("display-disconnected-before", self.stop)

	def _get(self):
		return "".join(self._buffer)

	def _set(self, val):
		self._buffer = [x for x in val]

	def _del(self):
		del(self._buffer)
		self._buffer = []

	buffer = property(_get, _set, _del, "WidgetText buffer")

	def start(self, data=None):
		if self.id_source or self.scroll_source:
			self.stop()
		self.id_source = gobject.timeout_add(self.update, self.text_update)
		if self.align == ALIGN_MARQUEE or self.align == ALIGN_AUTOMATIC or self.align == ALIGN_PINGPONG:
			self.scroll_source = gobject.timeout_add(self.speed, self.text_scroll)
		self.text_update()

	def stop(self, data=None):
		if self.id_source: 
			gobject.source_remove(self.id_source)
		self.id_source = None
		if self.scroll_source:
			gobject.source_remove(self.scroll_source)
		self.scroll_source = None
		

	def text_update(self):
		update = 0
		update = update + self.prefix.eval()
		update = update + self.postfix.eval()
		update = update + self.style.eval()

		self.value.eval()

		if self.precision == 0xDEAD:
			string = self.value.P2S()
		else:
			number = self.value.P2N()
			precision = self.precision
			width = self.width - len(self.prefix.P2S()) - len(self.postfix.P2S())
			string = "%.*f" % (precision, number)
			size = len(string)
			if width < 0:
				width = 0
			if size > width and precision > 0:
				delta = size - width
				if delta > precision:
					delta = precision
				precision =  precision - delta
				size = size - delta

			if size > width:
				string = "*" * width

		if not self.string or strcmp(self.string, string) != 0:
			update = update + 1
			self.string = string

		if update:
			self.scroll = 0

		if self.align == ALIGN_PINGPONG:
			self.direction = 0
			self.delay = PINGPONGWAIT

		if self.align != ALIGN_MARQUEE or self.align != ALIGN_AUTOMATIC or self.align != ALIGN_PINGPONG:
			self.text_scroll()

		if self.update == 0:
			return False
		return True

	def text_scroll(self):
		prefix = self.prefix.P2S()
		postfix = self.postfix.P2S()

		string = self.string

		num = 0
		length = len(string)
		width = self.width - len(prefix) - len(postfix)
		if width < 0:
			width = 0

		if self.align == ALIGN_LEFT:
			pad = 0
		elif self.align == ALIGN_CENTER:
			pad = (width - length) / 2
			if pad < 0:
				pad = 0
		elif self.align == ALIGN_RIGHT:
			pad = width - length
			if pad < 0:
				pad = 0
		elif self.align == ALIGN_AUTOMATIC:
			if length <= width:
				pad = 0
		elif self.align == ALIGN_MARQUEE:
			pad = width - self.scroll
			self.scroll = self.scroll + 1
			if self.scroll >= width + length:
				self.scroll = 0
		elif self.align == ALIGN_PINGPONG:
			if length <= width:
				pad = (width - length) / 2
			else:
				if self.direction == 1:
					self.scroll = self.scroll + 1
				else:
					self.scroll = self.scroll - 1

			pad = 0 - self.scroll

			if pad < 0 - (length - width):
				if self.delay < 1:
					self.direction = 0
					self.delay = PINGPONGWAIT
					self.scroll = self.scroll - PINGPONGWAIT
				self.delay = self.delay - 1
				pad = 0 - (length - width)
			elif pad > 0:
				if self.delay < 1:
					self.direction = 1
					self.delay = PINGPONGWAIT
					self.scroll = self.scroll + PINGPONGWAIT
				self.delay = self.delay - 1
				pad = 0

			
		else:
			pad = 0

		dst = 0
		num = 0
		src = prefix
		for i in range(len(src)):
			if dst >= len(self.buffer):
				break
			self._buffer[dst] = src[i]
			dst = dst + 1
			num =  num + 1

		src = string

		while dst < len(self.buffer) and pad > 0 and num < self.width:
			self._buffer[dst] = ' '
			#print "num", num, "pad", pad, "width", self.width
			dst = dst + 1
			num = num + 1
			pad = pad - 1

		while pad < 0:
			src = src[1:] 
			pad = pad + 1

		i = 0
		while dst <  len(self.buffer) and i < len(src) and num < self.width:
			self._buffer[dst] = src[i]
			dst = dst + 1
			i = i + 1
			num = num + 1

		src = postfix
		length = len(src)

		while dst < len(self.buffer) and num < self.width - length:
			self._buffer[dst] = ' '
			dst = dst + 1
			num = num + 1

		i = 0
		while dst < len(self.buffer) and i < length and num < self.width:
			self._buffer[dst] = src[i]
			dst = dst + 1
			i = i + 1
			num = num + 1

		if self.draw is not None:
			self.draw(self)
		else:
			error("WidgetText: No draw method")

		return True
Пример #57
0
 def __init__(self, value=None, parameter_dict={}):
     Property.__init__(self, parameter_dict)
     Property.name(self, 'ATTACH')
     self.value(value)
Пример #58
0
 def __init__(self, dict={}):
     Time.__init__(self, dict)
     Property.name(self, 'RECURRENCE-ID')