Exemple #1
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.versionString = "unknown version"
   currentVersionString = self.modrana.paths.getVersionString()
   if currentVersionString is not None:
     # check version string validity
     self.versionString = currentVersionString
Exemple #2
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.minimalSpeed = 2 #  in kmh, we don't update the avg speed if the current speed is like this
   self.lastT = None
   self.maxSpeed = 0
   self.avg1 = 0
   self.avg2 = 0
Exemple #3
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.nodes = []
   self.pos = 0
   self.numNodes = 0
   self.updateTime = 0
   self.replayPeriod = 1 # second
Exemple #4
0
  def __init__(self, m, d, i):
    ranaModule.__init__(self, m, d, i)

    self.defaultTheme = 'default'
    self.themesFolderPath = 'themes/'
    self.cantLoad = []
    self.imageOrderList = [] # for cache trimming
    self.maxImages = 200 # default 200
    self.images = {}

    self.currentTheme = self.defaultTheme
    self.themeList = []

    # structure -> color_key:color_object
    self.defaultColors = {} # default color set
    self.colors = {} # main combined color set
    defaultThemeConfig = os.path.join(self.themesFolderPath, self.defaultTheme, 'theme.conf')
    self.updateThemeList()
    # TODO: make themes GUI toolkit independent
    if gs.GUIString == "GTK":
      # load the default set of colors
      defaultColors = self.loadColorsFromFile(defaultThemeConfig)
      self.defaultColors = defaultColors
      self.colors = defaultColors.copy()
      self.colorInfoSubscribers = {}

      #color shortcuts
      self.buttonOutlineColor = (0,0,0,1)
      self.buttonFillColor = (1,1,1,1)
Exemple #5
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.loggingEnabled = False
   self.loggingPaused = False
   self.loggingStartTimestamp = None
   self.logInterval = 1 #loggin interval in seconds
   self.saveInterval = 10 #saving interval in seconds
   self.lastUpdateTimestamp = None
   self.lastCoords = None
   self.logName = None #name of the current log
   self.logFilename = None #name of the current log
   self.logPath = None #path to the current log
   # primary and secondary AOWay objects for
   # persistent log storage during logging
   self.log1 = None
   self.log2 = None
   # timer ids
   self.updateLogTimerId = None
   self.saveLogTimerId = None
   # statistics
   self.maxSpeed = None
   self.avg1 = 0
   self.avg2 = 0
   self.avgSpeed = None
   self.distance = None
   self.toolsMenuDone = False
   self.category='logs'
   # trace
   self.traceColor = 'blue'
   self.lastTracePoint = None
   self.traceIndex = 0
   self.pxpyIndex = deque()
Exemple #6
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   """
   # we consider 2km/h as as stationary 
   (to filter out the standard GPS drift while not moving)
   """
   self.notMovingSpeed  = 2
   self._updateUnitTable()
Exemple #7
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.activePOI = None
   self.visiblePOI = []
   self.listMenusDirty = False
   self.drawActivePOI = False
   self.expectPoint = False
   self.expectLock = threading.Lock()
Exemple #8
0
 def __init__(self, m, d, i):
     ranaModule.__init__(self, m, d, i)
     self.espaekProcess = None
     # this lock is used to make sure there is only one voice speaking at once
     self.voiceLock = threading.Lock()
     # default espeak string for manual editing
     self.defaultStrings = {"espeak": "espeak -v %language% -s 120 -a %volume% -m %qmessage%"}
     self.defaultProvider = "espeak"
Exemple #9
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.lines = ['hello', 'world']
   self.oldlines = ['','']
   self.mode = 0
   self.isGraphical = False
   self.modes = ['pos', 'gps', 'road', 'speed', 'maxSpeed', 'bearing', 'time']
   self.unitString = ""
Exemple #10
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.tiles = {}
   self.style_d = 0
   self.style_c = 0
   self.lastColour = (-1,-1,-1)
   self.lastWidth = -1
   self.line_d = 0
   self.line_c = 0
Exemple #11
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.db = None
   self.tempOnlinePOI = None # temporary slot for an uncommitted POI from online search
   # to which menu to return after the POI is stored
   # NOTE: False => unset, None => map screen
   self.menuNameAfterStorageComplete = False
   # connect to the POI database
   self.connectToDb()
Exemple #12
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.localSearchResults = None # GLS results from onlineServices
   self.scroll = 0
   self.list = None # processed results: (distance from pos, result, absolute index)
   self.maxIndex = 0 # based on the number of items in the list
   self.where='position'
   self.menuWatchId = None
   self.filters = {}
Exemple #13
0
  def __init__(self, m, d, i):
    ranaModule.__init__(self, m, d, i)
    self.points = []

    if(0): # to test
      m = self.m.get("menu", None)
      if(m):
        m.clearMenu('sketch', "set:menu:None")
        self.set("menu", "sketch")
Exemple #14
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   
   self.xyValid = False
   self.llValid = False
   self.needsEdgeFind = False
   
   # Scale is the number of display pixels per projected unit
   self.scale = tileSizePixels()
Exemple #15
0
  def __init__(self, m, d, i):
    ranaModule.__init__(self, m, d, i)
    self.images = [{}, {}] # the first dict contains normal image data, the second contains special tiles
    self.imagesLock = threading.RLock()
    self.threads = {}
    self.threadListCondition = threading.Condition(threading.Lock())
    self.maxImagesInMemory = 150 # to avoid a memory leak
    self.imagesTrimmingAmount = 30 # how many tiles to remove once the maximum is reached
    self.loadRequestCStackSize = 10 # size for the circular loading request stack
    """so that trim does not run always run after adding a tile"""
    self.tileSide = 256 # by default, the tiles are squares, side=256
    """ TODO: analyse memory usage,
              set appropriate value,
              platform dependent value,
              user configurable
    """
    self.loadRequestCStack = modrana_utils.SynchronizedCircularStack(self.loadRequestCStackSize)
    #    self.loadingNotifyQueue = Queue.Queue(1)
    self.downloadRequestPool = []
    self.downloadRequestPoolLock = threading.Lock()
    self.downloadRequestTimeout = 30 # in seconds
    self.startTileDownloadManagementThread()
    self.idleLoaderActive = False # report the idle tile loader is running

    self.shutdownAllThreads = False # notify the threads that shutdown is in progress

    specialTiles = [
      ('tileDownloading', 'themes/default/tile_downloading.png'),
      ('tileDownloadFailed', 'themes/default/tile_download_failed.png'),
      ('tileLoading', 'themes/default/tile_loading.png'),
      ('tileWaitingForDownloadSlot', 'themes/default/tile_waiting_for_download_slot.png'),
      ('tileNetworkError', 'themes/default/tile_network_error.png')
    ]

    if gs.GUIString == "GTK":
      self.loadSpecialTiles(specialTiles) # load the special tiles to the special image cache
      self.loadingTile = self.images[1]['tileLoading']
      self.downloadingTile = self.images[1]['tileDownloading']
      self.waitingTile = self.images[1]['tileWaitingForDownloadSlot']

    # local copy of the mapLayers dictionary
    # TODO: don't forget to update this after implementing
    #       map layer re/configuration at runtime
    self.mapLayers = self.modrana.getMapLayers()

    self.mapViewModule = None

    # cache the map folder path
    self.mapFolderPath = self.modrana.paths.getMapFolderPath()
    print(" @ mapTiles: map folder path: %s" % self.mapFolderPath)

    self._storeTiles = None

    self.connPools = {} # connection pool dictionary

    self.cacheImageSurfaces = gs.GUIString == "GTK"
Exemple #16
0
  def __init__(self, m, d, i):
    ranaModule.__init__(self, m, d, i)
    self.items = None
    self.routeProfileData = None
    self.nearestPoint = None
    self.nearestIndex = None
    self.distanceList = None # sorted distances from current position

    # colors
    self.widgetBackgroundColor = (0, 0, 1, 0.45) # transparent blue
    self.widgetTextColor = (1, 1, 1, 0.95) # slightly transparent white
Exemple #17
0
 def __init__(self, m, d, i):
     ranaModule.__init__(self, m, d, i)
     self.notificationText = ""
     self.timeout = 5
     self.position = "middle"
     self.expirationTimestamp = time.time()
     self.draw = False
     self.redrawn = None
     self.workInProgressOverlay = 0
     self.workStartTimestamp = None
     self.workInProgressOverlayText = ""
     """this indicates if the notification about background processing should be shown"""
Exemple #18
0
  def __init__(self, m, d, i):
    ranaModule.__init__(self, m, d, i)

    tileserver_callback_proxy.cb = self

    self.port = None
    self.server = None
    self.serverThread = None
    self._mapTiles = None

    if self.modrana.gui.needsLocalhostTileserver():
      self.startServer(9009)
Exemple #19
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   gui = self.modrana.gui
   # initial colors
   self.navigationBoxBackground = (0,0,1,0.3) # very transparent blue
   self.navigationBoxText = (1,1,1,1) # non-transparent white
   self.TBTWorker = None
   self.TBTWorkerEnabled = False
   self.goToInitialState()
   self.automaticRerouteCounter = 0 # counts consecutive automatic reroutes
   self.lastAutomaticRerouteTimestamp = time.time()
   # reroute even though the route was not yet reached (for special cases)
   self.overrideRouteReached = False
Exemple #20
0
  def __init__(self, m, d, i):
    ranaModule.__init__(self, m, d, i)

    self.fullscreen = False
    """according to documentation on:
    (http://wiki.maemo.org/PyMaemo/Python-osso_examples#Device_State),
    every display_blanking_pause() call pauses screenblank for 60 seconds,
    to make sure, we request it every 30 seconds"""
    self.pauseScreenBlankingEnabled = False
    self.msScreenBlankPauseIntervalMs = 30000

    self.checkMethod = None
    self.checkConditions = False
    self.checkConditionsInterval = 5 # how often to check blanking conditions
    self.lastCheckConditions = time.time()
Exemple #21
0
  def __init__(self, m, d, i):
    ranaModule.__init__(self, m, d, i)

    self.lineWidth = 7 #with of the line denoting GPX tracks
    self.distinctColors=[
                        'black',
                        'blue',
                        'green',
                        'pink',
                        'cyan',
                        'red',
                        'gold',
                        'magenta',
                        'yellow'
                        ]
    self.colorIndex=0
Exemple #22
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.stopThreading = True
   self.dlListLock = threading.Lock() # well, its actually a set
   self.currentDownloadList = [] # list of files and urls for the current download batch
   #    self.currentTilesToGet = [] # used for reporting the (actual) size of the tiles for download
   self.sizeThread = None
   self.getFilesThread = None
   self.aliasForSet = self.set
   self.lastMenuRedraw = 0
   self.notificateOnce = True
   self.scroll = 0
   self.onlineRequestTimeout = 30
   """ how often should be the download info
   updated during batch, in seconds"""
   self.batchInfoUpdateInterval = 0.5
   self.mapFolderPath = None
Exemple #23
0
  def __init__(self, m, d, i):
    ranaModule.__init__(self, m, d, i)
    self.tt = 0
    self.connected = False
    self.set('speed', None)
    self.set('metersPerSecSpeed', None)
    self.set('bearing', None)
    self.set('elevation', None)
    self.status = "Unknown"
    self.enabled = False
    self.provider = None

    # check if the device handles location by itself
    if not self.modrana.dmod.handlesLocation():
      method = self.modrana.dmod.getLocationType()
      if method == "qt_mobility":
        print(" @ location: using Qt Mobility")
        import qt_mobility
        self.provider = qt_mobility.QtMobility(self)
      else: # GPSD
        print(" @ location: using GPSD")
        import gps_daemon
        self.provider = gps_daemon.GPSD(self)
Exemple #24
0
  def __init__(self, m, d, i):
    ranaModule.__init__(self, m, d, i)
    self.layers = {}
    self.threadLayers = {}
    self.currentStorageVersion = 1
    self.maxDbFileSizeGibiBytes = 3.7 # maximum database file size (to avoid the FAT32 file size limitation) in GibiBytes
    self.maxTilesInQueue = 50
    self.sqliteTileQueue = Queue.Queue(self.maxTilesInQueue)
    """if there are more tiles in the buffer than maxTilesInBuffer,
       the whole buffer will be processed at once (flushed) to avoid a potential memory leak
    """
    self.processPerUpdate = 1 #how many tiles will be processed per update (updates should happen every 100ms)
    self.commitInterval = 5 # how often we commit to the database (only happens when there is something in the queue)
    self.lastCommit = time.time()
    self.dirty = set() # a set of connections, that have uncommitted data
    self.startLoadingThread()
    # locks
    """
    TODO: this lock might not be needed for python2.6+,
    as their sqlite version should be thread safe
    """
    self.lookupConnectionLock = threading.RLock()

    self._mapTiles = None
Exemple #25
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
Exemple #26
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.savedStdout = None
   self.fSock = None
   self.currentLogPath = ""
Exemple #27
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.poi = {}
   self.needUpdate = False
   self.scroll = 0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.scrollDict = {}
   self.currentNumItems = 0
   self.LTModule = None
Exemple #29
0
 def __init__(self, m, d, i):
   ranaModule.__init__(self, m, d, i)
   self.entryBoxVisible = False
Exemple #30
0
 def __init__(self, m, d, i):
     ranaModule.__init__(self, m, d, i)
     self.lastWaypoint = "(none)"
     self.lastWaypointAddTime = 0
     self.messageLingerTime = 2