Example #1
0
 def take_photo(self):
     newfile = None
     uid = self.config.db.get("camera_uid", 0x101ffa86)
     try:
         newfile = pynewfile.take_photo(uid)
     except:
         if ut.get_debug_on():
             ut.print_exception()
         appuifw.note(u"Failed to take a photo", "error")
     if newfile is not None:
         self.card.set_picfile(newfile)
Example #2
0
 def run():
     try:
         try:
             run_app()
         finally:
             appuifw.app.exit_key_handler = orig_exit_key_handler
             appuifw.app.title = u'Console'
             appuifw.app.screen = 'normal'
             if ut.get_debug_on():
                 appuifw.app.body = ut.app_console.text
             appuifw.app.menu = [(u"Restart", restart)]
     except:
         ut.ensure_console()
         appuifw.app.body = ut.app_console.text
         import traceback
         traceback.print_exc()
Example #3
0
 def _init_gps_scanner(self):
     """
     It is valid for "self.gps_scanner" to be None, since the
     capabilities required to access GPS may not be available. If
     this method fails, then "self.gps_scanner" will be set to
     None, and will stay that way. To change the used positioning
     module, invoke the appropriate methods on the scanner.
     """
     self.gps_scanner = None
     if gps_avail:
         try:
             omid = self.config.db.get("gps_module_id", None)
             self.gps_scanner = GpsScanner(self._gps_scanned, omid)
         except:
             if ut.get_debug_on():
                 ut.print_exception()
                 ut.report("GPS scanner init failure")
             self.gps_scanner = None
     else:
         ut.report("GPS not available")
Example #4
0
 def read(self):
     amount = (ut.get_debug_on() and 1024 or (self.max - self.len))
     self.sock.read_some(amount, self._read, None)
Example #5
0
 def get_debug_on(self):
     return ut.get_debug_on()