mirror of
https://gitee.com/houstudio/Cdroid.git
synced 2024-11-29 18:59:14 +08:00
modify idgen.py,skip id from other packages
This commit is contained in:
parent
ff72f6ccf0
commit
12682733ba
@ -16,11 +16,26 @@ class CDROIDHandler( xml.sax.ContentHandler ):
|
||||
self.strings=[]
|
||||
self.namespace=namespace
|
||||
|
||||
def isMyNS(self,idname):#parse @android:id/ @+id/ @id/
|
||||
ns=""
|
||||
if idname.find(":")>0:
|
||||
ns = idname.split(":")
|
||||
ns =ns[0]
|
||||
else:
|
||||
pos = idname.find("id/")
|
||||
ns = idname[0:pos]
|
||||
ns= ns.replace("@","")
|
||||
ns= ns.replace("+","")
|
||||
#print(idname+"==>"+ns)
|
||||
if ns.strip():#not empty
|
||||
return (ns==namespace) or (ns=="android" and namespace=="cdroid") or (ns=="cdroid" and namespace=="android")
|
||||
return True
|
||||
def startElement(self, tag, attributes):
|
||||
for attr in attributes.getNames():
|
||||
value = attributes.get(attr)
|
||||
if ':id' in attr:
|
||||
self.addID(value)
|
||||
if self.isMyNS(value):
|
||||
self.addID(value)
|
||||
if 'string/' in value:
|
||||
self.addString(value)
|
||||
|
||||
@ -205,9 +220,8 @@ if ( __name__ == "__main__"):
|
||||
msg = "not changed "
|
||||
if not isIDSame:#True if same,otherwise False
|
||||
#content is changed,we must copy ftempids to fidxml(sys.argv[2]+"/values/ID.xml)
|
||||
print(namespace+"'s IDs is changed "+ftempids+":"+fidxml)
|
||||
shutil.copyfile(ftempids,fidxml)
|
||||
idgen.dict2RH(sys.argv[3])
|
||||
msg="changed "
|
||||
print(namespace+"'s IDs is:"+msg+ftempids+":"+fidxml)
|
||||
print(namespace+"'s IDs is:"+msg+ftempids+" : "+fidxml)
|
||||
os.remove(ftempids)
|
||||
|
@ -609,7 +609,7 @@ void Layout::drawText(Canvas&canvas,int firstLine,int lastLine){
|
||||
switch(mAlignment){
|
||||
case ALIGN_NORMAL:
|
||||
case ALIGN_LEFT :
|
||||
default : x = te.x_bearing ; break;
|
||||
default : x = 0 ; break;
|
||||
case ALIGN_CENTER: x = (mWidth-lw)/2 ; break;
|
||||
case ALIGN_OPPOSITE:
|
||||
case ALIGN_RIGHT : x = mWidth-lw ; break;
|
||||
|
Loading…
Reference in New Issue
Block a user