示例#1
0
文件: IconTheme.py 项目: zester/pyxdg
 def checkGroup(self, group):
     # check if group header is valid
     if group == self.defaultGroup:
         try:
             self.name = self.content[group]["Name"]
         except KeyError:
             self.errors.append("Key 'Name' in Group '%s' is missing" %
                                group)
         try:
             self.name = self.content[group]["Comment"]
         except KeyError:
             self.errors.append("Key 'Comment' in Group '%s' is missing" %
                                group)
     elif group in self.getDirectories():
         try:
             self.type = self.content[group]["Type"]
         except KeyError:
             self.type = "Threshold"
         try:
             self.name = self.content[group]["Size"]
         except KeyError:
             self.errors.append("Key 'Size' in Group '%s' is missing" %
                                group)
     elif not (re.match("^\[X-", group) and is_ascii(group)):
         self.errors.append("Invalid Group name: %s" % group)
示例#2
0
 def checkGroup(self, group):
     # check if group header is valid
     if not (group == self.defaultGroup \
     or re.match("^Desktop Action [a-zA-Z0-9\-]+$", group) \
     or (re.match("^X-", group) and is_ascii(group))):
         self.errors.append("Invalid Group name: %s" % group)
     else:
         #OnlyShowIn and NotShowIn
         if ("OnlyShowIn" in self.content[group]) and ("NotShowIn" in self.content[group]):
             self.errors.append("Group may either have OnlyShowIn or NotShowIn, but not both")
示例#3
0
 def checkGroup(self, group):
     # check if group header is valid
     if group == self.defaultGroup:
         try:
             self.name = self.content[group]["Name"]
         except KeyError:
             self.errors.append("Key 'Name' in Group '%s' is missing" % group)
         try:
             self.name = self.content[group]["Comment"]
         except KeyError:
             self.errors.append("Key 'Comment' in Group '%s' is missing" % group)
     elif group in self.getDirectories():
         try:
             self.type = self.content[group]["Type"]
         except KeyError:
             self.type = "Threshold"
         try:
             self.name = self.content[group]["Size"]
         except KeyError:
             self.errors.append("Key 'Size' in Group '%s' is missing" % group)
     elif not (re.match("^\[X-", group) and is_ascii(group)):
         self.errors.append("Invalid Group name: %s" % group)
示例#4
0
文件: IconTheme.py 项目: zester/pyxdg
 def checkGroup(self, group):
     # check if group header is valid
     if not (group == self.defaultGroup \
     or (re.match("^\[X-", group) and is_ascii(group))):
         self.errors.append("Invalid Group name: %s" %
                            group.encode("ascii", "replace"))
示例#5
0
 def checkGroup(self, group):
     # check if group header is valid
     if not (group == self.defaultGroup \
     or (re.match("^\[X-", group) and is_ascii(group))):
         self.errors.append("Invalid Group name: %s" % group.encode("ascii", "replace"))