Mercurial > libervia-desktop-kivy
comparison cagou/plugins/plugin_transfer_android_photo.py @ 491:203755bbe0fe
massive refactoring from camelCase -> snake_case. See backend commit log for more details
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 08 Apr 2023 13:44:32 +0200 |
parents | 3c9ba4a694ef |
children |
comparison
equal
deleted
inserted
replaced
490:962d17c4078c | 491:203755bbe0fe |
---|---|
47 | 47 |
48 def __init__(self, callback, cancel_cb): | 48 def __init__(self, callback, cancel_cb): |
49 self.callback = callback | 49 self.callback = callback |
50 self.cancel_cb = cancel_cb | 50 self.cancel_cb = cancel_cb |
51 filename = time.strftime("%Y-%m-%d_%H:%M:%S.jpg", time.gmtime()) | 51 filename = time.strftime("%Y-%m-%d_%H:%M:%S.jpg", time.gmtime()) |
52 tmp_dir = self.getTmpDir() | 52 tmp_dir = self.get_tmp_dir() |
53 tmp_file = os.path.join(tmp_dir, filename) | 53 tmp_file = os.path.join(tmp_dir, filename) |
54 log.debug("Picture will be saved to {}".format(tmp_file)) | 54 log.debug("Picture will be saved to {}".format(tmp_file)) |
55 camera.take_picture(tmp_file, self.callback) | 55 camera.take_picture(tmp_file, self.callback) |
56 # we don't delete the file, as it is nice to keep it locally | 56 # we don't delete the file, as it is nice to keep it locally |
57 | 57 |
58 def getTmpDir(self): | 58 def get_tmp_dir(self): |
59 if sys.platform == "android": | 59 if sys.platform == "android": |
60 dcim_path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() | 60 dcim_path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM).getAbsolutePath() |
61 return dcim_path | 61 return dcim_path |
62 else: | 62 else: |
63 return tempfile.mkdtemp() | 63 return tempfile.mkdtemp() |