offline mode added
git-svn-id: http://www.neo1973-germany.de/svn@13 46df4e5c-bc4e-4628-a0fc-830ba316316d
This commit is contained in:
parent
6e33554db5
commit
fe715867ef
1 changed files with 21 additions and 14 deletions
|
@ -160,17 +160,18 @@ class TestView(edje.Edje):
|
||||||
#fill
|
#fill
|
||||||
for i in xrange((2*self.border+1)**2):
|
for i in xrange((2*self.border+1)**2):
|
||||||
self.icons.append(tile(self.evas_canvas.evas_obj.evas))
|
self.icons.append(tile(self.evas_canvas.evas_obj.evas))
|
||||||
#add all tiles that are not yet downloaded to a list
|
if not self.options.offline:
|
||||||
for i in xrange(2*self.border+1):
|
#add all tiles that are not yet downloaded to a list
|
||||||
for j in xrange(2*self.border+1):
|
for i in xrange(2*self.border+1):
|
||||||
if not os.path.exists("%d/%d/%d.png"%(self.z,self.x+i-self.border,self.y+j-self.border)):
|
for j in xrange(2*self.border+1):
|
||||||
self.tiles_to_download.append((self.z,self.x+i-self.border,self.y+j-self.border))
|
if not os.path.exists("%d/%d/%d.png"%(self.z,self.x+i-self.border,self.y+j-self.border)):
|
||||||
self.tiles_to_download_total = len(self.tiles_to_download)
|
self.tiles_to_download.append((self.z,self.x+i-self.border,self.y+j-self.border))
|
||||||
#if there are tiles to download, display progress bar
|
self.tiles_to_download_total = len(self.tiles_to_download)
|
||||||
if self.tiles_to_download_total > 0:
|
#if there are tiles to download, display progress bar
|
||||||
self.progress_bg.geometry = 39, self.size[1]/2-1, self.size[0]-78,22
|
if self.tiles_to_download_total > 0:
|
||||||
self.progress.geometry = 40, self.size[1]/2, 1,20
|
self.progress_bg.geometry = 39, self.size[1]/2-1, self.size[0]-78,22
|
||||||
self.overlay.part_text_set("progress", "downloaded 0 of %d tiles"%self.tiles_to_download_total)
|
self.progress.geometry = 40, self.size[1]/2, 1,20
|
||||||
|
self.overlay.part_text_set("progress", "downloaded 0 of %d tiles"%self.tiles_to_download_total)
|
||||||
ecore.timer_add(0.0, self.download_and_paint_current_tiles)
|
ecore.timer_add(0.0, self.download_and_paint_current_tiles)
|
||||||
|
|
||||||
def download_and_paint_current_tiles(self):
|
def download_and_paint_current_tiles(self):
|
||||||
|
@ -185,10 +186,12 @@ class TestView(edje.Edje):
|
||||||
for i in xrange(2*self.border+1):
|
for i in xrange(2*self.border+1):
|
||||||
for j in xrange(2*self.border+1):
|
for j in xrange(2*self.border+1):
|
||||||
#if some errors occurd replace with placeholder
|
#if some errors occurd replace with placeholder
|
||||||
if not os.path.exists("%d/%d/%d.png"%(self.z,self.x+i-self.border,self.y+j-self.border)):
|
#if not os.path.exists("%d/%d/%d.png"%(self.z,self.x+i-self.border,self.y+j-self.border)):
|
||||||
self.icons[(2*self.border+1)*i+j].file_set("404.png")
|
try:
|
||||||
else:
|
|
||||||
self.icons[(2*self.border+1)*i+j].file_set("%d/%d/%d.png"%(self.z,self.x+i-self.border,self.y+j-self.border))
|
self.icons[(2*self.border+1)*i+j].file_set("%d/%d/%d.png"%(self.z,self.x+i-self.border,self.y+j-self.border))
|
||||||
|
except:
|
||||||
|
self.icons[(2*self.border+1)*i+j].file_set("404.png")
|
||||||
|
|
||||||
self.icons[(2*self.border+1)*i+j].set_position((i-self.border)*256+self.size[0]/2-self.offset_x,(j-self.border)*256+self.size[1]/2-self.offset_y)
|
self.icons[(2*self.border+1)*i+j].set_position((i-self.border)*256+self.size[0]/2-self.offset_x,(j-self.border)*256+self.size[1]/2-self.offset_y)
|
||||||
self.icons[(2*self.border+1)*i+j].size = 256,256
|
self.icons[(2*self.border+1)*i+j].size = 256,256
|
||||||
self.icons[(2*self.border+1)*i+j].fill = 0, 0, 256, 256
|
self.icons[(2*self.border+1)*i+j].fill = 0, 0, 256, 256
|
||||||
|
@ -333,6 +336,10 @@ class myOptionParser(OptionParser):
|
||||||
"--no-fullscreen",
|
"--no-fullscreen",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="do not launch in fullscreen")
|
help="do not launch in fullscreen")
|
||||||
|
self.add_option("-o",
|
||||||
|
"--offline",
|
||||||
|
action="store_true",
|
||||||
|
help="do not attempt to download tiles")
|
||||||
self.add_option("-g",
|
self.add_option("-g",
|
||||||
"--geometry",
|
"--geometry",
|
||||||
type="string",
|
type="string",
|
||||||
|
|
Loading…
Reference in a new issue