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)
# subject to the following conditions:
# 
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
# 
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import pynewfile
import sysinfo

# The UID to use depends on S60 version. There are at least two
# different Camera UIDs.
osv = sysinfo.os_version()
if osv == (2,0,1528): # N95
    uid = 0x101ffa86
if osv == (2,0,1177): # E71
    uid = 0x101ffa86
elif osv == (2,0,1071): # E61 or E61i
    uid = 0x101f857a # but E61 has no camera
else:
    raise "do not know what UID to use on this phone"

print repr(pynewfile.take_photo(uid))
# subject to the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

import pynewfile
import sysinfo

# The UID to use depends on S60 version. There are at least two
# different Camera UIDs.
osv = sysinfo.os_version()
if osv == (2, 0, 1528):  # N95
    uid = 0x101ffa86
if osv == (2, 0, 1177):  # E71
    uid = 0x101ffa86
elif osv == (2, 0, 1071):  # E61 or E61i
    uid = 0x101f857a  # but E61 has no camera
else:
    raise "do not know what UID to use on this phone"

print repr(pynewfile.take_photo(uid))
Example #4
0
import pynewfile

# This does not work as desired even though Gallery IS launched.

gallery_uid = 0x101f8599
print repr(pynewfile.take_photo(gallery_uid))