198
198
#print "LOAD: "+line[:-1]
199
199
parts = line[:-1].split('=', 1)
200
200
if len(parts) > 1:
201
# undocumented feature to resize screenlet dynamically on first launch
201
# undocumented features to resize screenlet dynamically on first launch
202
# width, height must precede rel_x and rel_y with "_"
202
203
# by boamaod for Estobuntu
205
if parts[1].startswith("*"): # if * is added, take distance from the opposite side
206
parts[1] = parts[1].strip("*")
208
if parts[1].startswith("_"): # if _ is added, take it to be right corner
209
add_width = int(float(self.__instances[id]["width"])*float(self.__instances[id]["scale"]))
210
print "ADD W", add_width
211
parts[1] = str(gtk.gdk.screen_width() - int(parts[1].strip("_")) - add_width)
212
print ">>>X", parts[1]
214
if parts[1].startswith("*"): # if * is added, take distance from the opposite side
215
parts[1] = parts[1].strip("*")
217
if parts[1].startswith("_"): # if _ is added, take it to be bottom corner
218
add_height = int(float(self.__instances[id]["height"])*float(self.__instances[id]["scale"]))
219
print "ADD H", add_height
220
parts[1] = str(gtk.gdk.screen_height() - int(parts[1].strip("_")) - add_height)
221
print ">>>Y", parts[1]
203
222
if parts[0] == 'rel_x':
205
parts[1] = str(int(gtk.gdk.screen_width()*float(parts[1])))
225
if parts[1].startswith("_"): # if _ is added, take it to be right corner
226
add_width = int(float(self.__instances[id]["width"])*float(self.__instances[id]["scale"]))
227
print "ADD W", add_width
228
parts[1] = str(int(gtk.gdk.screen_width()*float(parts[1].strip("_"))) - add_width)
229
print ">>>X", parts[1]
206
230
if parts[0] == 'rel_y':
208
parts[1] = str(int(gtk.gdk.screen_height()*float(parts[1])))
233
if parts[1].startswith("_"): # if _ is added, take it to be bottom corner
234
add_height = int(float(self.__instances[id]["height"])*float(self.__instances[id]["scale"]))
235
print "ADD H", add_height
236
parts[1] = str(int(gtk.gdk.screen_height()*float(parts[1].strip("_"))) - add_height)
237
print ">>>Y", parts[1]
209
238
if parts[0] == 'rel_scale':
210
239
parts[0] = 'scale'
211
parts[1] = str(gtk.gdk.screen_height()/float(parts[1]))
240
scale = float(self.__instances[id]["scale"])
241
initial_scale = scale + float(gtk.gdk.screen_height()*gtk.gdk.screen_width())/float(parts[1])
242
if initial_scale < 1.5:
244
if initial_scale > 3:
246
parts[1] = str(initial_scale)
247
# parts[1] = str(gtk.gdk.screen_height()/float(parts[1]))
248
print ">>>SCALE", parts[1]
249
if parts[0] == 'rel_font_name':
250
parts[0] = 'font_name'
251
print "|||", parts[1]
252
font_parts = parts[1].split(" ")
254
for fp in font_parts:
255
if len(fp.strip("0123456789.")) == 0:
256
parts[1]+= str( round(float(fp)*float(self.__instances[id]["scale"]), 1) ) + " "
259
parts[1] = parts[1].strip(" ")
260
print ">>>FONT_NAME", parts[1]
261
# End of dynamic resize section
212
262
print "%s='%s'" % (parts[0], parts[1])
213
263
self.__instances[id][parts[0]] = parts[1]