예제 #1
0
    def imagensCasas(self):
	imagens = {}
	for x in range(len(CASAS)):
		imagens[CASAS[x]] = Image.open(self.getPathFigura(CASAS[x]))
		imagens["u"+ str(CASAS[x])] = Image.open(self.getPathFigura(CASAS[x], 'u'))

	for x in range(len(DEMARCADORES)):
		imagens[DEMARCADORES[x]] = Image.open(self.getPathFigura(DEMARCADORES[x]))

	for x in range(len(MASCARAS)):
		imagens[MASCARAS[x]] = Image.open(self.getPathFigura(MASCARAS[x]))
	
	return imagens
예제 #2
0
파일: gpslogimg.py 프로젝트: psla/pygpslog
def addIconModule(ico):

  if hasattr(ico, "ICONFILE") and hasattr(ico, "ICONDEF"):
    icopath = os.path.dirname(ico.__file__)
    img = Image.open(os.path.join(icopath, ico.ICONFILE))
    assert len(ico.ICONDEF) <= img.size[1] / ICONSIZE[1] * ICONS_PER_ROW, \
           "Not enough icons in image file"

    for idx in range(len(ico.ICONDEF)):
      icodef = ico.ICONDEF[idx]
      if type(icodef) in [list, tuple]:
        if len(icodef) < 3: icodef = icodef + (None,)
      else:
        icodef = (icodef, None, None)
      iconame, mifidx, mifmask = icodef
      if iconame in ICONS: del ICONS[iconame]
      if hasattr(ico, "ICONMIF") and os.path.exists(os.path.join(icopath, ico.ICONMIF)):
        miffile = os.path.abspath(os.path.join(icopath, ico.ICONMIF))
        if mifidx  == None: mifidx  = idx * 2
        if mifmask == None: mifmask = mifidx + 1
      else:
        miffile, mifidx, mifmask = [None]*3

      ICONS[iconame] = GpsIcon(img, idx, miffile, mifidx, mifmask)
    del img

  if hasattr(ico, "MARKERS"):
    global MARKERS, MARKERCAT
    MARKERS = ico.MARKERS[:]
    assert len(MARKERS) == 6, "MARKERS must have exactly 6 elements"
    if hasattr(ico, "MARKERCAT"):
      MARKERCAT = ico.MARKERCAT
    for m in MARKERS + [MARKERCAT]:
      if not m in ICONS:
        ICONS[m] = ICONS["Default"]
예제 #3
0
파일: mapys.py 프로젝트: Mbosco/mapys
 def getMapImage(self, centerLatLon, zoom, markerPositions):
         
         lat, lon = centerLatLon
         url = (GMAPS_URL % (lat, lon, zoom, self.width, self.height,
                            self.mapType, self.makeMarkerString(markerPositions)))
         
         file, ignoredHeaders = urllib.urlretrieve(url, TEMP_FILE)
         
         return Image.open(file)     
예제 #4
0
파일: mapys.py 프로젝트: Mbosco/mapys
 def favourites(self):
         def handle_redraw(rect):
                 canvas.blit(img)
         try:
             selector = FileSelector("e:\\myPlaces",".jpg")
             index = appuifw.selection_list(selector.GetKeys())
         except:
             appuifw.note(u"File does not exist", "info")
         img=Image.open(selector.GetFile(index))
         canvas=appuifw.Canvas(redraw_callback=handle_redraw)
         appuifw.app.body=canvas
         appuifw.app.menu = [(u"Back",self.back),(u"Exit", self.quit)]
예제 #5
0
def tile(tx, ty, left, top):
    t = (tx, ty, z)
    rect = (left, top, left+256, top+256)
    # here we use 2 level cache
    if t in cache[mode]:
        im = cache[mode][t]
    else:
        f = fmt_file % t + ext[mode]
        if not exists(f):
            c.rectangle(rect, fill=0xffffff)
            c.text((left+5, top+20), u'Loading')
            urlretrieve(tile_url(t), f)   # url cache
        cache[mode][t] = im = Image.open(f)   # object cache
    c.blit(im, target=rect)
예제 #6
0
 def __init__(self):
     self.keyboard = SymbianKeyboard()
     self.appuifw = appuifw
     self.app = appuifw.app
     self.app.title = u"Boxee Remote"
     # self.app.screen = 'large'
     self.body = appuifw.Canvas(event_callback=self.keyboard.handle_event, 
                                redraw_callback=None)
     self.app.body = self.body
     self.app.exit_key_handler = self.quit
     self.running = True
     self.get_accesspoint()
     host, port = self.get_host()
     self.remote = BoxeeRemote(host, port)
     self.body.blit(Image.open('e:\\Python\\gui_background.jpg'))
     self.menu()
예제 #7
0
 def __init__(q):
     q.mfo = (mf + 'CosmoTech\\FScreen\\')
     q.st = ini.read((q.mfo + 'position'))
     q.name = u'F-Screen'
     q.w1 = m.image((q.mfo + 'watermark'), 0)
     q.w2 = m.image((q.mfo + 'watermark'), 1)
     q.hc = q.sc = 0
     sz = q.w1.size
     q.im, q.ss = (IG.new(sz), IG.new(dpx()))
     q.cap = KCR(q.key)
     q.lo = (mg + 'fdrive.dat')
     q.cap.keys = (q.load(q.lo)[1], )
     q.cap.start()
     if q.load(q.lo)[0] == u'':
         q.b = 'None'
     else:
         q.b = q.load(q.lo)[0]
     if q.load(q.lo)[2] == u'':
         q.w = 'None'
     else:
         q.w = q.load(q.lo)[2]
     if q.load(q.lo)[1] == 8:
         ke = u'C (Delete)'
     else:
         ke = u'Green Key/Call'
     q.list = [(u'Status', u'Active'), (u'Shot Button', ke),
               (u'Watermark & Background',
                unicode(q.w[:-4] + ' | ' + path.split(q.b)[1])),
               (u'About', q.un('\xc2\xa9 2018, Cosmo TechZone'))]
     q.lb = LB(q.list, q.sel)
     AP.body = q.lb
     AP.title = u'F-Screen'
     AP.exit_key_handler = q.mi
     AP.menu_key_text = u'Options'
     AP.exit_key_text = u'Minimize'
     AP.menu = [(u'Change Watermark', q.cwm), (u'Change Background', q.cbg),
                (u'Clear Background', q.clr), (u'Exit', q.ex)]
     try:
         sw = q.load(q.lo)[0]
         q.bg = IG.open(sw).resize(sz)
     except:
         pass
예제 #8
0
def Unmake(mbmfile, outdir):


    rlelist = [(24, 1, 0, 0), (16, 1, 0, 0), (16, 1, 0, 3), (8, 0, 0, 0), (8, 0, 0, 1), (12, 1, 0, 2)]
    def readL(f, pos = None):
        if pos != None : 
            f.seek(pos)
        return unpack('i', f.read(4))[0]


    f = open(mbmfile)
    uids = f.read(20)
    trailer = readL(f, 16)
    num = readL(f, trailer)
    offset = [readL(f) for i in range(num)]
    result = []
    for i in range(num):
        start = offset[i]
        dl = readL(f, start)
        f.seek((start + 24))
        RLE = unpack('iiii', f.read(16))
        if RLE not in rlelist : 
            RLE = (12, 1, 0, 2)
        name = str(('00000000%s.png' % i))[-8 : ]
        f.seek(start)
        mbmf = open('d:\\temp.mbm', 'w')
        mbmf.write(('%s%s' % (uids, f.read(dl))))
        dl = mbmf.tell()
        mbmf.seek(16)
        mbmf.write(pack('i', dl))
        mbmf.seek(dl)
        mbmf.write(pack('ii', 16777216, 335544320))
        mbmf.close()
        img = Image.open('d:\\temp.mbm')
        img.save(outdir + name)
        result.append(outdir + name)
    remove('d:\\temp.mbm')
    return result
예제 #9
0
 def PACK(s, callback):
     offset = pack('i', len(s.files))
     f = open(s.out_file, 'w')
     f.write(pack('LLLLL', 268435511, 268435522, 0, 1194943545, 0))
     total = len(s.files)
     tt = 0
     for files in s.files:
         START = f.tell()
         offset += pack('i', START)
         NAME, RLE = files.split(':')
         img = Image.open(s.in_dir + NAME)
         x, y = img.size
         f.write(eval((" pack('LiLLLLLLLL',0,40,%s,%s,0,0,%s)" % (x, y, RLE))))
         if RLE == '8,0,0,0' : 
             s.RLE8000(f, img, x, y)
         if RLE == '8,0,0,1' : 
             s.RLE8001(f, img, x, y)
         if RLE == '12,1,0,2' : 
             s.RLE12102(f, img, x, y)
         if RLE == '16,1,0,0' : 
             s.RLE16100(f, img, x, y)
         if RLE == '16,1,0,3' : 
             s.RLE16103(f, img, x, y)
         if RLE == '24,1,0,0' : 
             s.RLE24100(f, img, x, y)
         END = f.tell()
         f.seek(START)
         f.write(pack('L', (END - START)))
         f.seek(END)
         tt += 1
         callback(((tt * 100) / total))
     f.seek(16)
     f.write(pack('L', END))
     f.seek(END)
     f.write(offset)
     f.close()
예제 #10
0
    def placarAzul(self):
	figura = Image.open(PATHICON + "placar.PNG")	
	palavra = u""+ str (self.jogador)
	figura.text((36, 43), palavra, font='normal')
	self.canvas.blit(figura, target = (7,257)) 
예제 #11
0
    def placarVermelho(self):
	figura = Image.open(PATHICON + "inimigo.PNG")	
	palavra = u""+ str (self.outro)
	figura.text((36, 47), palavra, font='normal')
	self.canvas.blit(figura, target = (149,256)) 
예제 #12
0
    def desenhaTotal(self):
	figura = Image.open(PATHICON + "total.PNG") 
	palavra = u""+ str (self.bombas)
	figura.text((14, 35), palavra, font='normal')
	self.canvas.blit(figura, target = (93,260)) 
예제 #13
0
run = 1
coba = 0
sc = 0

from sys import argv

drive = argv[0][:3]
pat = drive + 'dj\\lock\\'
del argv
readcon = ini.read(pat + 'config.ini')
warna = readcon['warna']
ukuran_garis_pola = readcon['ukuran_garis_pola']
margin_x = readcon['margin_x']
margin_y = readcon['margin_y']

point = Image.open(pat + 'point.png')
point1 = Image.open(pat + 'point1.png')
apname = application_list(1)[0]


def balik():
    global coba
    if coba == 0:
        switch_to_bg(application_list(1)[0])


def quit():
    global run, coba
    if coba == 0:
        run = 0
        app.set_exit()
예제 #14
0
파일: gpslogimg.py 프로젝트: psla/pygpslog
import sys, os, e32
from graphics import Image

ALLICONS = "gpsloglm.jpg"

def findImages(): # really: Install icons ;-)
  for d in [".", os.path.dirname(__file__), r"E:\Python", r"C:\Python"]:
    global thisdir
    thisdir = os.path.normcase(os.path.abspath(d))
    if os.path.exists(os.path.join(thisdir, ALLICONS)): break
findImages()

ICONSIZE      = (64,64)
ICONS_PER_ROW = 2
ALLICONS      = Image.open(os.path.join(thisdir, ALLICONS))
DEFALPHA      = [ 0x7f7f7f, 0x1f1f1f ]
ICONCAT       = [ "Default",  "Speed 30", "Speed 50", "Speed 60", "Speed 70",
                  "Speed 80", "Speed 100" ]
ICONS         = [ (ICONCAT[idx], idx) for idx in range(len(ICONCAT)) ]
MARKERS       = ICONCAT[1:]
MARKERCAT     = "Speed"

assert len(ICONS) <= ALLICONS.size[1] / ICONSIZE[1] * ICONS_PER_ROW, \
       "Not enough icons in image file"


class GpsIcon(object):

  def __init__(self, image, idx, miffile=None, mifidx=None, mifmask=None):
    self.img  = Image.new(ICONSIZE)
    self.mask = Image.new(ICONSIZE,"L")
예제 #15
0
import kaapython, ui
import table
import os
from graphics import Image
path = '%s\\' % os.path.dirname(table.__file__)


def func_table(x):
    body = aw.app.body
    body.set_input_mode(aw.ENumericInputMode)
    body.set_input_mode(aw.ETextInputMode)
    body.add(x[0])
    body.set_pos(body.get_pos() - x[1])


tb = table.Table(Image.open('%s1.png' % path), func_table, screen='normal')

tb.color_cursor = 0xff5500

tb.initialization()


def get_shortcuts(cls):
    menu = old_get_shortcuts()
    menu.append(ui.MenuItem(_('table'), target=tb.start_menu))
    return menu


_ = kaapython.get_plugin_translator(__file__)
old_get_shortcuts = kaapython.repattr(kaapython.PythonFileWindow,
                                      'get_shortcuts',