source: orange/source/pyxtract/pyxtractstructures.py @ 6538:a5f65d7f0b2c

Revision 6538:a5f65d7f0b2c, 2.3 KB checked in by Mitar <Mitar@…>, 4 years ago (diff)

Made XPM version of the icon 32x32.

Line 
1
2class ClassDefinition:
3  def __init__(self, **argkw):
4    self.constructor=self.call=self.basetype=self.description=self.infile=self.datastructure=self.dictfield=None
5    self.properties={}
6    self.methods={}
7    self.specialmethods={}
8    self.constants={}
9    self.subconstants = {}
10    self.hidden = 0
11    self.imported = 0
12    self.used = 0
13    self.abstract = False
14    self.allows_empty_args = False
15    self.constructor_keywords = []
16    self.recognized_attributes = []
17    self.__dict__.update(argkw)
18
19  def hasSpecialProperties(self):
20    for property in self.properties.values():
21      if not property.builtin:
22        return 1
23    return 0
24
25
26class ConstructorDefinition:
27  def __init__(self, **argkw):
28    self.type=None
29    self.definition=self.arguments=self.description=None
30    self.__dict__.update(argkw)
31
32class CallDefinition:
33  def __init__(self, **argkw):
34    self.arguments=self.description=None
35    self.__dict__.update(argkw)
36
37class AttributeDefinition:
38  def __init__(self, **argkw):
39    self.description=None
40    self.builtin=0
41    self.hasget=0
42    self.hasset=0
43    self.__dict__.update(argkw)
44
45class MethodDefinition:
46  def __init__(self, **argkw):
47    self.description=self.arguments=self.argkw=None
48    self.__dict__.update(argkw)
49
50class FunctionDefinition:
51  def __init__(self, **argkw):
52    self.cname=self.argkw=self.definition=self.description=self.arguments=None
53    self.__dict__.update(argkw)
54 
55class ConstantDefinition:
56  def __init__(self, **argkw):
57    self.ccode=self.cfunc=self.description=None
58    self.__dict__.update(argkw)
59   
60
61def addClassDef(cds, typename, parsedFile, str="", val=1, warn=1):
62  """
63  If class is not been encountered yet, it creates a new class definition.
64  It sets the attribute str to value val.
65  If the attribute was non-null and warn=1, it gives a warning.
66  """
67 
68  if not cds.has_key(typename):
69    if str:
70      cds[typename]=apply(ClassDefinition, (), {str:val, 'infile':parsedFile})
71    else:
72      cds[typename]=ClassDefinition(infile=parsedFile)
73  elif str:
74    #if warn and hasattr(cds[typename], str):
75    #  print ("Warning: overriding definition of %s for %s", (str, typename))
76    setattr(cds[typename], str, val)
77    if parsedFile and cds[typename].infile!=parsedFile:
78      print ("Warning: %s appears in different files (%s, %s)" % (typename, cds[typename].infile, parsedFile))
Note: See TracBrowser for help on using the repository browser.