Menu

[r1]: / DeclarationList.py  Maximize  Restore  History

Download this file

114 lines (52 with data), 2.3 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
from Translator import *
import SimpleList
class SSSDeclarationList(SimpleList.SSSSimpleList):
def __init__(self, parentObject = None):
super(SSSDeclarationList, self).__init__(parentObject)
def isDirective(self, cssText):
if (strpos(trim(cssText), '@') == 0):
return trim(substr(cssText, 0, strpos(cssText,' ')))
return False
def _insertRule(self, obj, index): #// returns value of index argument
return self.insertRule(obj, index)
def appendRule(self, obj):
return self.appendItem(obj)
def __call(self, method, args):
return super(SSSDeclarationList, self).__call(method, args)
def getPropertyText(self):
string = ''
#foreach (self.items as key=>$item):
for key in self.items:
if (get_class(self.items[key]) == 'SSSProperty'):
string += "\t" + item.cssText
return string
def getRuleText(self):
string = ''
#foreach (self.items as key=>$item):
for key in self.items:
if (get_class(self.items[key]) != 'SSSProperty'):
string += item.cssText
return string
def get_cssText(self):
return self.__str__()
cssText = property(get_cssText)
propertyText = property(getPropertyText)
ruleText = property(getRuleText)
def __str__(self):
string = ''
addLogMessage(get_class(self) + " __str__: Outputting SSSDeclarationList...")
for item in self.items:
string += item.cssText
addLogMessage(get_class(self) + " __str__: string = " + string)
return string
def getPropertyValue(self, propertyName):
item = self.getPropertyCSSValue(propertyName)
if (item):
return item.value
return None
def setProperty(self, propertyName, value, priority = ''):
item = self.getPropertyCSSValue(propertyName)
if (item): #// property currently exists...
item.setValue(value)
#// Need to add property and value
return self.appendItem(obj)
MongoDB Logo MongoDB