old_contents: '''
  Basic camera example
  Default picture is saved as /sdcard/org.test.cameraexample/enter_file_name_here.jpg
  '''
  
  from os import getcwd
  from os.path import exists
  from os.path import splitext
  
  import kivy
  kivy.require('1.8.0')
  
  from kivy.app import App
  from kivy.properties import ObjectProperty
  from kivy.uix.floatlayout import FloatLayout
  from kivy.uix.popup import Popup
  from kivy.logger import Logger
  
  from plyer import camera
  
  class CameraDemo(FloatLayout):
      def __init__(self):
          super(CameraDemo, self).__init__()
          self.cwd = getcwd() + "/"            
          self.ids.path_label.text = self.cwd
  
      def do_capture(self):
          filepath = self.cwd + self.ids.filename_text.text
          ext = splitext(filepath)[-1].lower()
  
          if(exists(filepath)):
              popup = MsgPopup(msg="Picture with this name already exists!")
              popup.open()
              return False
  
          try:
              camera.take_picture(filename=filepath, 
                                  on_complete=self.camera_callback)
          except NotImplementedError:
              popup = MsgPopup(msg="This feature has not yet been implemented for this platform.")
              popup.open()
  
      def camera_callback(self, filepath):
          if(exists(filepath)):
              popup = MsgPopup(msg="Picture saved!")
              popup.open()
          else:
              popup = MsgPopup(msg="Could not save your picture!")
              popup.open()
  
  class CameraDemoApp(App):
      def __init__(self):
          super(CameraDemoApp, self).__init__()
          self.demo = None
  
      def build(self):
          self.demo = CameraDemo()
          return self.demo
  
      def on_pause(self):
          return True
  
      def on_resume(self):
          pass
  
  class MsgPopup(Popup):
      def __init__(self, msg):
          super(MsgPopup, self).__init__()
          self.ids.message_label.text = msg
  
  if __name__ == '__main__':
      CameraDemoApp().run()
      
new_contents: '''
  Basic camera example
  Default picture is saved as
      /sdcard/org.test.cameraexample/enter_file_name_here.jpg
  '''
  
  from os import getcwd
  from os.path import exists
  from os.path import splitext
  
  import kivy
  kivy.require('1.8.0')
  
  from kivy.app import App
  from kivy.properties import ObjectProperty
  from kivy.uix.floatlayout import FloatLayout
  from kivy.uix.popup import Popup
  from kivy.logger import Logger
  
  from plyer import camera
  
  
  class CameraDemo(FloatLayout):
      def __init__(self):
          super(CameraDemo, self).__init__()
          self.cwd = getcwd() + "/"
          self.ids.path_label.text = self.cwd
  
      def do_capture(self):
          filepath = self.cwd + self.ids.filename_text.text
          ext = splitext(filepath)[-1].lower()
  
          if(exists(filepath)):
              popup = MsgPopup(msg="Picture with this name already exists!")
              popup.open()
              return False
  
          try:
              camera.take_picture(filename=filepath,
                                  on_complete=self.camera_callback)
          except NotImplementedError:
              msg = "This feature has not yet been implemented for this platform."
              popup = MsgPopup(msg=msg)
              popup.open()
  
      def camera_callback(self, filepath):
          if(exists(filepath)):
              popup = MsgPopup(msg="Picture saved!")
              popup.open()
          else:
              popup = MsgPopup(msg="Could not save your picture!")
              popup.open()
  
  
  class CameraDemoApp(App):
      def __init__(self):
          super(CameraDemoApp, self).__init__()
          self.demo = None
  
      def build(self):
          self.demo = CameraDemo()
          return self.demo
  
      def on_pause(self):
          return True
  
      def on_resume(self):
          pass
  
  
  class MsgPopup(Popup):
      def __init__(self, msg):
          super(MsgPopup, self).__init__()
          self.ids.message_label.text = msg
  
  
  if __name__ == '__main__':
      CameraDemoApp().run()
  
subject: Fix style.