moove symbols to common
|
@ -3,15 +3,18 @@ from os import path, remove, listdir
|
|||
from PIL import Image # pip install Pillow
|
||||
|
||||
# constants
|
||||
PATH_WA = "../../apps/" # path before editors
|
||||
PATH_WA = "../../../../" # path before editors
|
||||
PATH_HELP = "/main/resources/help/images/" # path after editor directory
|
||||
NAME_CSS = "sprite.css"
|
||||
pathEditors = ["documenteditor", "presentationeditor", "spreadsheeteditor"] # names of editor directories
|
||||
NAME_SMB_CSS = "symbols.css"
|
||||
pathEditors = ["documenteditor", "presentationeditor", "spreadsheeteditor","common"] # names of editor directories
|
||||
|
||||
# sprites names
|
||||
cssClassNames = ["big","icon", "smb"]
|
||||
cssClassNames = ["big","icon"]
|
||||
cssClassSmbName = "smb"
|
||||
# directories names
|
||||
spriteDirNames = ["src/big", "src/icons", "src/symbols"]
|
||||
spriteDirNames = ["big", "icons"]
|
||||
spriteSmbDirName ="symbols"
|
||||
|
||||
# Class for image
|
||||
class ImgClass:
|
||||
|
@ -84,11 +87,11 @@ class Fit:
|
|||
return self._right
|
||||
|
||||
def __str__(self):
|
||||
strFit = "used:" + str(self.used) +"\n"
|
||||
strFit += "x:" + str(self.x) +"\n"
|
||||
strFit += "y:" + str(self.y) +"\n"
|
||||
strFit += "width:" + str(self.width) +"\n"
|
||||
strFit += "height:" + str(self.height) +"\n"
|
||||
strFit = "\tused:" + str(self.used) +"\n"
|
||||
strFit += "\tx:" + str(self.x) +"\n"
|
||||
strFit += "\ty:" + str(self.y) +"\n"
|
||||
strFit += "\twidth:" + str(self.width) +"\n"
|
||||
strFit += "\theight:" + str(self.height) +"\n"
|
||||
return strFit
|
||||
|
||||
#Image with fit
|
||||
|
@ -205,16 +208,16 @@ class GrowingPacker:
|
|||
return None
|
||||
|
||||
# create sprite
|
||||
def createSprite (dirName, adrSprite, cssClassName):
|
||||
imgAdrArr = listdir(adrDir+dirName)
|
||||
def createSprite (dirName, adrSprite, cssClassName, urlDirImage):
|
||||
imgAdrArr = listdir(adrDir+"src/"+dirName)
|
||||
for i in range(len(imgAdrArr)):
|
||||
imgAdrArr[i] = adrDir+dirName +"/" + imgAdrArr[i]
|
||||
imgAdrArr[i] = adrDir +"src/"+dirName +"/" + imgAdrArr[i]
|
||||
gp = GrowingPacker(imgAdrArr)
|
||||
gp.fit()
|
||||
spriteFile = open(adrSprite,'a')
|
||||
img = Image.new("RGBA", (gp.root.width, gp.root.height), (0,0,0,0))
|
||||
|
||||
strCSS = "." + cssClassName +"{\nbackground-image: url(../images/" + dirName + ".png);\n"
|
||||
strCSS = "." + cssClassName +"{\n\tbackground-image: url(" + urlDirImage + dirName + ".png);\n"
|
||||
strCSS += "\tbackground-repeat: no-repeat;\n\tdisplay: inline-block;\n}\n\n"
|
||||
|
||||
spriteFile.write(strCSS)
|
||||
|
@ -231,10 +234,21 @@ def createSprite (dirName, adrSprite, cssClassName):
|
|||
#crreate all sprites
|
||||
for index_editor in range(len(pathEditors)):
|
||||
adrDir = PATH_WA + pathEditors[index_editor] + PATH_HELP
|
||||
if(path.exists(adrDir + NAME_CSS)):
|
||||
remove(adrDir + NAME_CSS)
|
||||
for index_spr in range(len(spriteDirNames)):
|
||||
createSprite(spriteDirNames[index_spr], adrDir + NAME_CSS, cssClassNames[index_spr])
|
||||
|
||||
spriteName = adrDir + NAME_CSS
|
||||
isCommon = (pathEditors[index_editor]=="common")
|
||||
if(isCommon):
|
||||
spriteName = adrDir + NAME_SMB_CSS
|
||||
if(path.exists(spriteName)):
|
||||
remove(spriteName)
|
||||
if(isCommon):
|
||||
createSprite(spriteSmbDirName, spriteName, cssClassSmbName, "../../../../../common/main/resources/help/images/")
|
||||
else:
|
||||
spriteFile = open(spriteName,'a')
|
||||
spriteFile.write('@import "../../../../../common/main/resources/help/images/symbols.css";\n\n')
|
||||
spriteFile.close()
|
||||
for index_spr in range(len(spriteDirNames)):
|
||||
createSprite(spriteDirNames[index_spr], spriteName, cssClassNames[index_spr],"../images/")
|
||||
|
||||
|
||||
|
||||
|
|
Before Width: | Height: | Size: 157 B After Width: | Height: | Size: 157 B |
Before Width: | Height: | Size: 117 B After Width: | Height: | Size: 117 B |
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 320 B |
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 257 B |
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 261 B |
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 220 B |
Before Width: | Height: | Size: 230 B After Width: | Height: | Size: 230 B |
Before Width: | Height: | Size: 357 B After Width: | Height: | Size: 357 B |
Before Width: | Height: | Size: 214 B After Width: | Height: | Size: 214 B |
Before Width: | Height: | Size: 165 B After Width: | Height: | Size: 165 B |
Before Width: | Height: | Size: 171 B After Width: | Height: | Size: 171 B |
Before Width: | Height: | Size: 186 B After Width: | Height: | Size: 186 B |
Before Width: | Height: | Size: 234 B After Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 105 B After Width: | Height: | Size: 105 B |
Before Width: | Height: | Size: 108 B After Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 120 B After Width: | Height: | Size: 120 B |
Before Width: | Height: | Size: 139 B After Width: | Height: | Size: 139 B |
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 208 B |
Before Width: | Height: | Size: 160 B After Width: | Height: | Size: 160 B |
Before Width: | Height: | Size: 205 B After Width: | Height: | Size: 205 B |
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 291 B After Width: | Height: | Size: 291 B |
Before Width: | Height: | Size: 205 B After Width: | Height: | Size: 205 B |
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 218 B |
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 331 B |
Before Width: | Height: | Size: 308 B After Width: | Height: | Size: 308 B |
Before Width: | Height: | Size: 382 B After Width: | Height: | Size: 382 B |
Before Width: | Height: | Size: 116 B After Width: | Height: | Size: 116 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 225 B |
Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 271 B |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 277 B |
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 114 B |
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 269 B |
Before Width: | Height: | Size: 123 B After Width: | Height: | Size: 123 B |
Before Width: | Height: | Size: 135 B After Width: | Height: | Size: 135 B |
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 122 B |
Before Width: | Height: | Size: 131 B After Width: | Height: | Size: 131 B |
Before Width: | Height: | Size: 195 B After Width: | Height: | Size: 195 B |
Before Width: | Height: | Size: 205 B After Width: | Height: | Size: 205 B |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
Before Width: | Height: | Size: 101 B After Width: | Height: | Size: 101 B |
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 216 B |
Before Width: | Height: | Size: 553 B After Width: | Height: | Size: 553 B |
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 375 B |
Before Width: | Height: | Size: 101 B After Width: | Height: | Size: 101 B |
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 122 B |
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 144 B |
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 292 B |
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 290 B |
Before Width: | Height: | Size: 181 B After Width: | Height: | Size: 181 B |
Before Width: | Height: | Size: 154 B After Width: | Height: | Size: 154 B |
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 266 B |
Before Width: | Height: | Size: 370 B After Width: | Height: | Size: 370 B |
Before Width: | Height: | Size: 124 B After Width: | Height: | Size: 124 B |
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 208 B |
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 210 B |
Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 217 B |
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 199 B |
Before Width: | Height: | Size: 199 B After Width: | Height: | Size: 199 B |
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 114 B |
Before Width: | Height: | Size: 326 B After Width: | Height: | Size: 326 B |
Before Width: | Height: | Size: 359 B After Width: | Height: | Size: 359 B |
Before Width: | Height: | Size: 183 B After Width: | Height: | Size: 183 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 114 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 264 B |
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 384 B |
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 265 B |
Before Width: | Height: | Size: 150 B After Width: | Height: | Size: 150 B |
Before Width: | Height: | Size: 273 B After Width: | Height: | Size: 273 B |
Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 247 B |
Before Width: | Height: | Size: 164 B After Width: | Height: | Size: 164 B |
Before Width: | Height: | Size: 166 B After Width: | Height: | Size: 166 B |
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 252 B |
Before Width: | Height: | Size: 130 B After Width: | Height: | Size: 130 B |
Before Width: | Height: | Size: 101 B After Width: | Height: | Size: 101 B |
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 129 B |
Before Width: | Height: | Size: 121 B After Width: | Height: | Size: 121 B |
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 250 B After Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 305 B After Width: | Height: | Size: 305 B |
Before Width: | Height: | Size: 269 B After Width: | Height: | Size: 269 B |
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 295 B |
Before Width: | Height: | Size: 222 B After Width: | Height: | Size: 222 B |
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
Before Width: | Height: | Size: 293 B After Width: | Height: | Size: 293 B |
Before Width: | Height: | Size: 304 B After Width: | Height: | Size: 304 B |
Before Width: | Height: | Size: 246 B After Width: | Height: | Size: 246 B |
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 208 B |
Before Width: | Height: | Size: 209 B After Width: | Height: | Size: 209 B |
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 198 B |
Before Width: | Height: | Size: 288 B After Width: | Height: | Size: 288 B |
Before Width: | Height: | Size: 331 B After Width: | Height: | Size: 331 B |
Before Width: | Height: | Size: 341 B After Width: | Height: | Size: 341 B |
Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 251 B |