def __init__(self, GUIref, neardist=25, fardist=50, logmode=0):
        self.current_location = { }
        self.nearbyPOIs = [ ] #should be a list of dictionaries
        self.nearTolerance = neardist #how close we need to be to a POI to trigger it
        self.farTolerance = fardist #how far we must be from a POI before it's removed from the recent list
        self.logmode = logmode
        if logmode:
        	if e32.in_emulator():
        		logdir = u"c:\\python\\gps_log"
        	else:
        		logdir = u"e:\\python\\gps_log"
        	self.logpath = unicode(logdir + "\\gps_log.txt")
        	if not os.path.exists(logdir):
		    	os.makedirs(logdir)
        
        self.FILE = None
        self.actives = [ ]
        self.newActives = 0
        self.removedActives = [ ]
        self.total_scan_time = 0
        self.total_scans = 0
        
        # save a local reference to the GUI object
        self.GUI = GUIref
    
    	# server field defaults to None, must be set by object that owns gpsLocationProvider
        self.server = None
   
        self.nearbyLock = thread.allocate_lock()
        self.updateThread = thread.start_new_thread(self.Update, () )
Esempio n. 2
0
def test_main():
    if not e32.in_emulator():
        if e32.s60_version_info == (3, 2):
            # Not run on a 3.2 device because it does not have an internal
            # GPS receiver
            raise TestSkipped('Not run on a 3.2 device')
    else:
        raise TestSkipped('Cannot test on emulator')
    run_unittest(TestPositioning)
Esempio n. 3
0
def createImage():
    img = """\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x0f\x00\x00\x00p\x08\x02\x00\x00\x00N\xc0\xbd\t\x00\x00\x00\x01sRGB\x00\xae\xce\x1c\xe9\x00\x00\x00\tpHYs\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\x00\x00\x07tIME\x07\xd9\t\x13\x13\r9B\x92\x96+\x00\x00\x06)IDATX\xc3\xed\x97]h[\xe7\x19\xc7\x7f\xef\x89p\x8e\xe2\x8c\x8d:\x03\x07R\x08\x84\xc6\xd9RG\x9e\xe3\xc4a\x1f\xb1C\xa1\xf5`\x0c\xe1\xd0\x8b\xba\xbdh\x06\x19nWO2euVJ\xa4\xc0\x98b\xe8\xb0\x924\x8d\x87;t\xb1\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R"\x98\x06\xb1\x18\xd1(\xe1\xf0\x161\xa8\x1e\xce\xdf\x0f\xe7\xef\x87\xf3\xb7\xd3\xbf\xa1\xdd\x9e\x86\xccO\x1f\x94LH\xe5\xa3\x16\x08@\xa0b\x00\x93RV\x08T\x04\xee\xc0)\x18\x06\rJ\x8f|\x81\xd2\x051\xa8wr2\x0c\xfdp\x12>\x86]\xf0u\xd8\x05\x1f\xc3I\xe8\x87a\xa7\xb3\x99\x10\x05\r2\xd0\x0c\xae\xf6\xcdih\x86\x0ch\x10\x05\xd3\xb1m\xc1 \xa4\xe1\x08\xf4@\x1c^\x82#\x90\x86A\xb0\xca\xba\xa6\x82\x03p\xc9V\xb8\x02\x06\xdc\x80\xd2\xf6\xed\xaa\xa5\x82\x06x\x112\xd0\x02\xb5P\xd1\xbe]\xd2\x02\xf3p\x19\xd6m\x85\x8a\xf6mK\x0b\xccA\x0f\x1c\x05/\xbc\xe0\x8a\xc1\xd5\xbemi\r\xba\xed\xb0\xde\x00\xbf+\x86n\x97\x03\x9a\x0eA\xb0\xa0\x05\xa6\xc0\xd5\xbe\x19\x82)h\x01\x0b\x82\xa0;j]\xd0\x07\x7f\x82:X\x86\xff\xc02\xd4\xc1;\xb0\x1f\xba\x9c\x89#_\x9d \x00\x15\xed\x1b\x01\x03b\x10\x85\xf0V1\xf8e\xbd_z\x88\x07\x9d3\x0f\x1b\xa0@\xe7\x0f\t;O\x0e\x11H\xa9\xfc\xad\x11\xe0\xf7}\xfc\xb1\x9fk\xa5\xd6*\x88\xae\x138P\xedX\x0eT\xbf\x1dm\xc7[\xe9j\t\xd1\xd5\x07\x95\x97\x8d\r\xbc\n\xaf\xceo\xe2<\xdb\x81\xb8\x88e\xf7\xcb\x92\xe7B\xd5~\xe1\xea\xc8%\xcb\xfa\xb4\x19\xb9\xaa\xb4w{U\xc8T\xde/M\x10\x8c\x1d\xec0\x107\xf1\x8bu\xbf\xfc?\xce`\xd76\r\xf8<n\x00\x00\x00\x00IEND\xaeB`\x82"""
    if e32.in_emulator():
        fileImage = 'C:\\Python\\bpic15.png'
    else:
        fileImage = 'E:\\Python\\bpic15.png'
    if not os.path.exists(fileImage):
        imagem = open(fileImage,'wa')
        imagem.write(img)
        imagem.close()
Esempio n. 4
0
    def write(self, txt) :
        
        if e32.in_emulator() :
            t = appuifw.Text()
            t.write(txt)
            
            appuifw.app.body = t

        else :
            appuifw.app.body = appuifw.Text(txt)
Esempio n. 5
0
def test_main():
    global contacts_info
    if not e32.in_emulator():
        try:
            contacts_info = eval(open(contacts_store, 'rt').read())
        except:
            raise TestSkipped('Contact information not found')
        run_unittest(TestMessaging)
    else:
        raise TestSkipped('Cannot test on the emulator')
Esempio n. 6
0
def test_main():
    global contacts_info
    if not e32.in_emulator():
        try:
            contacts_info = eval(open(contacts_store, 'rt').read())
        except:
            raise TestSkipped('goldfile not present')
        run_unittest(LogsTest)
    else:
        raise TestSkipped('Cannot test on the emulator')
Esempio n. 7
0
def test_main():
    global contacts_info
    if not e32.in_emulator():
        try:
            contacts_info = eval(open(contacts_store, 'rt').read())
        except:
            raise TestSkipped('Contact information not found')
        # Not running OutboxFolderTest as it pops a error dialog on message
        # not being sent and thus requires a key press for its exit.
        run_unittest(InboxModuleTest)
    else:
        raise TestSkipped('Cannot test on emulator')
Esempio n. 8
0
	def __init__(self, inet_mode):
		self.server_host = "http://test.talking-points.org"
		self.inet_mode = inet_mode
		self.mac_tpid_mapping = {'00194fa4e262': 33, '000272c008cb': 31, '0010c65e9224': 34}
		
		if self.inet_mode == "online":
			ap_id = socket.select_access_point()
			apo = socket.access_point(ap_id)
			socket.set_default_access_point(apo)
		
		# make sure path exists
		if e32.in_emulator():  self.dir = u"c:\\python\\tp_offline"
		else:                  self.dir = u"e:\\python\\tp_offline"
		if not os.path.exists(self.dir):
			os.makedirs(self.dir)
Esempio n. 9
0
 def event_cb(arg):
     global _signaled
     global _sending
     if callback!=None:
         callback(arg)
         signal_lock()
     # The state received from 3.0 SDK under emulator:
     if e32.in_emulator():
         if arg==ENoServiceCentre:
             _sending=False
             signal_lock()
     # This is the default unlocking state,
     # the message was sent or sending failed
     if arg==EDeleted or arg==ESendFailed:
         _sending=False
         signal_lock()
     callback_error[0]=arg # XXX add error checking?
Esempio n. 10
0
 def event_cb(arg):
     global _signaled
     global _sending
     if callback != None:
         callback(arg)
         signal_lock()
     # The state received from 3.0 SDK under emulator:
     if e32.in_emulator():
         if arg == ENoServiceCentre:
             _sending = False
             signal_lock()
     # This is the default unlocking state,
     # the message was sent or sending failed
     if arg == EDeleted or arg == ESendFailed:
         _sending = False
         signal_lock()
     callback_error[0] = arg  # XXX add error checking?
Esempio n. 11
0
    def execute_dialog(self):
      self.uselm = False
      try:
        self.__init__() # Categories may have been changed by other app!
        self.__cnvt()

        menu = [
          (u"Landmark Editor", self.lmeditor),
          (u"Add Display Categories", self.showcat),
          (u"Remove Disp. Categories", self.hidecat),
          (u"Set Icons/Categories", self.addDefCat),
        ]
        #if e32.in_emulator() or __file__.lower() == r"e:\python\gpslog\gpsloglm.py":
        #  menu += [
        #  ]

        oldcat  = self.wptcat
        oldwarn = self.warncat

        try:
          gpslogutil.GpsLogBaseSettings.execute_dialog(self, menu)
        except:
          if e32.in_emulator(): raise
          self.reset()
          self.__init__()
          self.save()
          appuifw.note(u"Settings have been reset (new version?)", "error")
          gpslogutil.GpsLogBaseSettings.execute_dialog(self, menu)
        
        if self.lmico == "on":
          rc = appuifw.query(u"Icons are an experimental feature! Enable?", "query")
          if not rc: self.lmico = "off"
            
        self.__apply()
      
        if self.wptcat == -1:
          if not self.newCategory():
            self.wptcat = oldcat
        elif self.warncat == -1:
          if not self.newCategory(wptcat=False):
            self.warncat = oldwarn
        
        self.save()
      finally:
        self.uselm = True
Esempio n. 12
0
    def test_start_server(self):
        if e32.in_emulator():
            print "Cannot test e32.start_server on emulator"
            return
        server_script = u"c:\\data\\python\\test\\e32_start_server.py"

        # Create a test script which writes to a file
        f = open(server_script, "w")
        f.write(server_test_code)
        f.close()
        # Start the server and wait for a maximum of 20 seconds for the server
        # to write to the tempfile
        e32.start_server(server_script)
        for i in range(10):
            e32.ao_sleep(2)
            if os.path.exists(server_tempfile):
                break
        tempfile_text = open(server_tempfile, "r").read()
        self.failUnless(tempfile_text == 'start_server works!')
        os.remove(server_script)
        os.remove(server_tempfile)
Esempio n. 13
0
def test_main():
    if not e32.in_emulator():
        run_unittest(AudioTest)
    else:
        raise TestSkipped('Cannot test on the emulator')
            # If Testapp is executed by run_testapp, then test_set contains
            # the test set file name.
            testcase = test_set
        except:
            # Testapp is executed directly, get the first
            # file from testcase_dir
            listTestSets = os.listdir(testcase_dir)
            listTestSets.reverse()
            testcase = listTestSets[0]
        cmd = 'c:\\data\\python\\test\\regrtest.py'
        opt = '-f ' + testcase
        #Executes version.py before executing any of the test cases
        if testcase == "set_a.txt":
            execfile(sis_version)
        print "runtests_sets: " + testcase + "-> Started"
        if not e32.in_emulator():
            socket.set_default_access_point(u'Mobile Office')
            sys.argv = ['python.exe'] + ['-v'] + ['-u'] + \
                       ['network,urlfetch'] + ['-f'] + \
                       ['%s\\%s'%(testcase_dir,testcase)]
        else:
            sys.argv = ['python.exe'] + ['-v'] + ['-f'] + \
                       ['%s\\%s' % (testcase_dir, testcase)]
        test.regrtest.main()
except SystemExit:
    # Ignore the sys.exit at the end of regrtest's main()
    pass
except:
    import traceback
    traceback.print_exc()
finally:
Esempio n. 15
0
 def test_in_emulator(self):
     get_platform()
     self.failUnlessEqual(e32.in_emulator(), platform_emu)
Esempio n. 16
0
def start():
    """ Start pygame launcher """

    pygame.init()
    while True:

        # Don't handle events given for launched application
        pygame.event.clear()

        a = Application()
        # The executable is received
        path_to_app = a.run()

        # Clear cyclic references and the launcher out of the way
        # Not needed in PyS60 1.9.x
        del a.bg.sysdata
        del a.bg
        del a._main_menu.sysdata
        del a._main_menu.bg
        del a._main_menu._items
        del a._main_menu
        del a.focused
        del a.sysdata
        a.sprites.empty()
        del a

        if path_to_app:
            path_to_app = os.path.abspath(path_to_app)
            if sys.platform == "symbian_s60":
                import e32
                if e32.in_emulator():
                    # Run the application and restart launcher after app is completed.
                    # e32.start_exe does not work on emulator at the time of writing this
                    # See #3549 at garage.
                    execfile(
                        path_to_app, {
                            '__builtins__': __builtins__,
                            '__name__': '__main__',
                            '__file__': path_to_app,
                            'pygame': pygame
                        })
                else:
                    # The application is started in it's own process on device.
                    # S60 SDL does not show the selected application correctly when using double buffering,
                    # but it is needed to make application hide correctly on device.
                    datapath = os.path.join(THISDIR, "startapp.txt")
                    f = open(datapath, 'w')
                    f.write(path_to_app)
                    f.close()

                    # The launcher starts a new pygame.exe process for the selected application.
                    # This process must close before starting the new one.
                    p = os.path.abspath(join(THISDIR, "..", "pygame_main.py"))
                    #TODO: Use start_server
                    e32.start_exe("251_python_launcher.exe", p)

            else:
                # TODO: Use subprocess
                os.system("start pythonw " +
                          join(THISDIR, "..", "pygame_main.py") + " " +
                          path_to_app)

        # Exit launcher
        break

    pygame.quit()
Esempio n. 17
0
import e32
import sys
if e32.in_emulator(): # for emulator testing
	sys.path.append("c:\\python\\")
	sys.path.append("c:\\python\\tp")
else:
	sys.path.append("e:\\python\\")
	sys.path.append("e:\\python\\tp")
	

import string
import time
import appuifw

import gpsLocationProvider
import serverAPI
import GUI

inet_mode = "offline"

app_lock = e32.Ao_lock()
server = serverAPI.ServerAPI(inet_mode)
gui = GUI.GUI(app_lock)
gps = gpsLocationProvider.GpsLocProvider(gui, 25, 50, 1)
gps.server = server

#gui.location_cache.appendLocation(server.get_location(1))
#gui.location_cache.appendLocation(server.get_location(2))

gui.drawLocationList()
Esempio n. 18
0
import appuifw, os, e32, graphics

if os.path.exists(os.path.join(os.path.dirname(__file__), "gpslog.jpg")):
  IMGFILE = os.path.join(os.path.dirname(__file__), "gpslog.jpg")
else:
  IMGFILE = (e32.in_emulator() and r"C:\python\gpslog.jpg") or "gpslog.jpg"

__appbody = appuifw.app.body
__splash  = None
__img     = None
__msg     = None

def __draw(rect=None):
  if __splash and __img:
    __splash.clear(0)
    w, h   = __splash.size
    wi, hi = __img.size
    x, y = (w/2-wi/2, h/2-hi/2-15)    # sic!
    __splash.blit(__img, target=(x, y))
    if __msg:
      msr = __splash.measure_text(__msg, font="normal")[0]
      dx, dy = msr[2], msr[3]-msr[1]
      __splash.text((w/2-dx/2, h-dy-2), __msg, fill=0xffffff, font="normal")

def show(msg="Loading..."):
  # appuifw.app.body.set(u"Loading...")
  global __splash, __img, __msg
  __msg = unicode(msg)
  if not __splash:
    __splash = appuifw.Canvas(__draw)
    r = min(__splash.size[0],__splash.size[1])*2/3
Esempio n. 19
0
if not mydir:
    mydir = os.getcwd()

sys.path.append(mydir)

#sys.path.append(u"c:\\Data\\python")
import mktimefix as time
import datetime
import db
from operator import itemgetter



limit = 500
txNum = "1065502055203"
if(e32.in_emulator()):
	txNum = "700"

def read_all():
	inb = inbox.Inbox()
	msgs = inb.sms_messages()
	i = 0
	max = len(msgs)
	count = 0
	for i in range(max):
		id = msgs[i]
	
		if (i >= limit):
			break
		
		if (inb.address(id) != txNum):
def test_main():
    if e32.in_emulator():
        raise test.test_support.TestSkipped('Cannot test on emulator easily')
    test.test_support.run_unittest(BasicGraphicsTest)
Esempio n. 21
0
        return srcstring[:pos]

def load_voice_list():
    global voice,voicefile
    #read the voice file list
    voicefilecount=struct.unpack('i',voicefile.read(4))[0]
    voice={}
    i=0
    while i< voicefilecount:
        filename=remove_null_end(voicefile.read(32))
        fileoffset=struct.unpack('i',voicefile.read(4))[0]
        filelength=struct.unpack('i',voicefile.read(4))[0]
        voice[filename]=(fileoffset,filelength)
        i+=1

if e32.in_emulator():
    THIS_PATH=u'c:\\data\\python\\'
else:
    THIS_PATH=u'e:\\python\\'

vo=None
voice={}
voicefile=file(THIS_PATH+u'voice.pak','rb')
load_voice_list()
for i in voice:
    if vo:
        vo.stop()
        vo.close()
    print i
    load_voice(i)
    lowername=i.lower()
def start():
    """ Start pygame launcher """
         
    pygame.display.init()
    pygame.font.init() 
    while True:
        
        # Don't handle events given for launched application
        pygame.event.clear()
        
        a = Application()
        # The executable is received
        path_to_app = a.run()
                  
        # Clear cyclic references and the launcher out of the way        
        # Not needed in PyS60 1.9.x
        del a.bg.sysdata
        del a.bg
        del a._main_menu.sysdata
        del a._main_menu.bg
        del a._main_menu._items
        del a._main_menu
        del a.focused
        del a.sysdata
        a.sprites.empty()
        del a
        
        if path_to_app:
            path_to_app = os.path.abspath(path_to_app)
            if sys.platform == "symbian_s60":
                import e32
                if e32.in_emulator():
                    # Run the application and restart launcher after app is completed.
                    # e32.start_exe does not work on emulator at the time of writing this
                    # See #3549 at garage.
                    execfile(path_to_app, {'__builtins__': __builtins__,
                                           '__name__': '__main__',
                                           '__file__': path_to_app,
                                           'pygame' : pygame }
                    )
                else:
                    # The application is started in it's own process on device.
                    # S60 SDL does not show the selected application correctly when using double buffering,
                    # but it is needed to make application hide correctly on device.
                    datapath = os.path.join( THISDIR, "startapp.txt" )
                    f = open(datapath,'w')
                    f.write(path_to_app)
                    f.close()
                    
                    # The launcher starts a new pygame.exe process for the selected application.
                    # This process must close before starting the new one.
                    p = os.path.abspath( join( THISDIR, "..", "pygame_main.py") )
                    e32.start_server( p )

            else:         
                # TODO: Use subprocess
                os.system("start pythonw " + join( THISDIR, "..", "pygame_main.py") + " " + path_to_app )
                
        # Exit launcher
        break
        
    pygame.quit()
Esempio n. 23
0
VERSION = u'1.10'

# SENSOR: if exception, it's not available in this device
SENSOR_ACC = False
sensor_acc = None
try:
    import sensor
    from sensor import orientation
    SENSOR = True  # Sensor interface available
except ImportError:
    SENSOR = False  # Sensor interface not available

# Find "current directory"
FILE_PATH = None
if e32.in_emulator():
    # Use this with emulator
    # BUG: Use this with Application Shell in device
    try:
        raise Exception
    except Exception:
        fr = sys.exc_info()[2].tb_frame
        fpath = fr.f_code.co_filename
    fdir, fname = os.path.split(fpath)
    FILE_PATH = fdir
else:  #if __name__ == "__main__":
    # Use this with standalone SIS files
    FILE_PATH = os.getcwd()

# Try to load graphics
try:
Esempio n. 24
0

  def threadInit(self):
    pass

  def threadExit(self):
    pass

  def process(self):
    raise NotImplementedError
  
  def dataAvailable(self):
    raise NotImplementedError


if not sys.platform.startswith("symbian") or e32.in_emulator():
  # simulate bluetooth socket by IP
  AF_DEFAULT  = socket.AF_INET
  AF_BT       = socket.AF_INET
  bt_discover = lambda: ("192.168.1.4", {"gpsd": 2947})
else:
  AF_DEFAULT  = socket.AF_BT #@UndefinedVariable
  AF_BT       = socket.AF_BT #@UndefinedVariable
  bt_discover = socket.bt_discover #@UndefinedVariable
  

class AbstractSocketProvider(AbstractStreamProvider):
  "Abstract GPS socket communication class"
  name  = __doc__
  Super = AbstractStreamProvider
  
Esempio n. 25
0
def test_main():
    if e32.in_emulator():
        raise test.test_support.TestSkipped("Cannot test on emulator in " +
                                            "textshell mode")
    test.test_support.run_unittest(CalendarTest)
Esempio n. 26
0
def test_main():
    if e32.in_emulator():
        raise test.test_support.TestSkipped("Cannot test on emulator")
    test.test_support.run_unittest(LocationTest)
Esempio n. 27
0
import e32
import key_codes

appuifw.app.screen='full'
appuifw.app.body=canvas=appuifw.Canvas()
backup_image=Image.new(canvas.size)
canvas.clear(0)
center=[0,0]
zoom=1
zoomstepindex=0
screensize=canvas.size
screenrect=(0,0,screensize[0],screensize[1])
step=30
textloc=(screensize[0]*0.3,screensize[1]*.5)

if e32.in_emulator():
    imagedir=u'c:\\images'
else:
    imagedir=u'e:\\images'
files=map(unicode,os.listdir(imagedir))

index=appuifw.selection_list(files)

lock=e32.Ao_lock()

def fullupdate():
    backup_image.clear(bgcolor)
    update()
    
def nextpic():
    global index,finished
Esempio n. 28
0
sys.stdout.write("Free/total RAM (MB): %.2f / %.2f\n" % (sysinfo.free_ram()/1024/1024,sysinfo.total_ram()/1024/1024))
 
sys.stdout.write("Total ROM (MB): %.2f \n" % (sysinfo.total_rom()/1024/1024))
 
sys.stdout.write("Free disk space C/E (MB): %.2f / %.2f\n" % (sysinfo.free_drivespace()['C:']/1024/1024,sysinfo.free_drivespace()['E:']/1024/1024))

sys.stdout.write("Python version: %s (%s, %s)\n" % (e32.pys60_version,e32.pys60_version_info[0],e32.pys60_version_info[1]))
 
sys.stdout.write("Symbian version: (%s, %s)\n" % (e32.s60_version_info[0],e32.s60_version_info[1]))
 
sys.stdout.write("Available drives: \n")
print(e32.drive_list())
 
sys.stdout.write("Inactivity time: %s\n" % e32.inactivity())
 
sys.stdout.write("Platf. sec. capabilities: \n")
print(e32.get_capabilities())

sys.stdout.write("Check WriteUserData: %s\n" % e32.has_capabilities(['WriteUserData']))
 
sys.stdout.write("Check WriteUserData and ReadUserData: "+str(e32.has_capabilities(['WriteUserData','ReadUserData']))+"\n")
 
sys.stdout.write("Check if UI thread: %s\n" % e32.is_ui_thread())
 
sys.stdout.write("Check if in emulator: %s\n" % e32.in_emulator())

sys.stdout.write("Current time: %s\n" % time.strftime("%a, %d %b %Y, %H:%M:%S", time.localtime()))

sys.stdout.write("Curent dir: %s\n" % os.getcwd())