×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352

    Lightbulb Example of code with MISO library

    Hello , PDIS software has release a useful MISO Library http://pdis.hiit.fi/pdis/download/miso

    Here is some app about miso

    Code:
    from appuifw import *
    from e32 import *
    from key_codes import *
    from miso import *
    import os
    import sys
    
    class my_app:
       def __init__(self):
           self.script_lock = Ao_lock()
           self.app_name= u'pyinfo'
           self.app_ver= u'02'
           self.run_by = u''
           self.run_by_mode = u''
    
       def run(self):
           old_title = app.title
           app.title = self.app_name+u'\n'+self.app_ver
           app.body = Text()
           app.menu = [(u'Phone info ...',self.action),(u'About ...',self.about),(u'Quit', self.quit)]
           self.get_run_by()
           self.set_bind()
           app.exit_key_handler = self.dummy_quit
           self.script_lock.wait()
           app.title = old_title
           app.body = None
    
       def quit(self):
           app.exit_key_handler = None
           self.script_lock.signal()
    
       def dummy_quit(self):
           pass
    
       def about(self):
           note(self.app_name+u'\n'+self.app_ver+u'\n'+u'(c) GPL license 2005\n'+self.run_by_mode+u'\nCreated by cyke64', 'info')
    
    
       def action(self):
           app.body.clear()
           app.body.add(u'Phone : '+local_bt_name()+'\n')
           app.body.add(u'bt adr. : '+local_bt_address()+'\n')
           app.body.add(u'IMEI : '+imei_code()+'\n')
           app.body.add(u'C: '+unicode(disk_total_avail(2))+u' bytes free\n')
           app.body.add(u'D: '+unicode(disk_total_avail(3))+u' bytes free\n')
           app.body.add(u'E: '+unicode(disk_total_avail(4))+u' bytes free\n')
           app.body.add(u'Z: '+unicode(disk_total_avail(25))+u' bytes free\n')
    
    
       def set_bind(self):
           pass
    
       def set_exit_if_standalone(self):
           if self.run_by_mode == u'Python Installer':
              app.set_exit()
       
       def get_run_by(self):
           self.run_by = app.full_name()
           if self.run_by[-10:] == u'Python.app':
            self.run_by_mode = u'Python Interpreter'
           elif self.run_by[-10:] == u'appmgr.app':
            self.run_by_mode = u'Python Installer'
           else: 
            self.run_by_mode = u'Unknown ...'
    
    if __name__ == '__main__':
        my_app().run()

  2. #2
    Regular Contributor
    Join Date
    Jan 2005
    Location
    Bangkok, Thailand
    Posts
    148
    Thanks a lot for this info and update.

    The documentation for MISO is at
    http://pdis.hiit.fi/pdis/download/mi...-1.00-api.html

    It's not very comprehensive yet... But... here.

    take_photo()
    Takes a photo using the number 0 camera of the device, if any, and returns it as a JPEG. The operation can fail for a number of reasons, such as the camera being in use by another application. Any failure results in an exception being thrown. Only available on Symbian OS 7.0s and higher.

    I am very surprised and glad!

  3. #3
    Registered User
    Join Date
    Feb 2005
    Location
    Belgium (Europe)
    Posts
    1,352
    Hello ,

    Here is the same example but it's better code and fewer bugs ;-)

    Code:
    from appuifw import *
    from e32 import *
    from key_codes import *
    from miso import *
    from string import *
    import os
    import sys
    
    def diskname_free(diskname):
        diskn=ord(upper(diskname[0]))-ord(u'A')
        return(disk_total_avail(diskn))      
    
    class my_app:
       def __init__(self):
           self.script_lock = Ao_lock()
           self.app_name= u'pyinfo'
           self.app_ver= u'03'
           self.run_by = u''
           self.run_by_mode = u''
           
       def save_params(self):
           self.old_title = app.title
           self.old_body = app.body
           self.old_menu = app.menu
           self.exit=app.exit_key_handler        
           
       def restore_params(self):
           app.title = self.old_title
           app.body = self.old_body
           app.menu = self.old_menu
           app.exit_key_handler = self.exit
    
       def run(self):
           self.save_params()
           app.title = self.app_name+u'\n'+self.app_ver
           app.body = Text()
           app.menu = [(u'Phone info ...',self.action),(u'About ...',self.about),(u'Quit', self.quit)]
           self.get_run_by()
           self.set_bind()
           app.exit_key_handler = self.fquit
           self.script_lock.wait()
           self.restore_params()
    
       def quit(self):
           self.script_lock.signal()
           self.set_exit_if_standalone()
           
       def fquit(self):
           pass
    
       def about(self):
           note(u'%s\n%s\n(c) GPL license 2005\n%s\nCreated by Cyke64'%(self.app_name,self.app_ver,self.run_by_mode), 'info')
    
    
       def action(self):
           app.body.clear()
           app.body.add(u'Phone : %s\n'%local_bt_name())
           app.body.add(u'bt adr. : %s\n'%local_bt_address())
           app.body.add(u'IMEI : %s\n'%imei_code())
           app.body.add(u'C: %d bytes free\n'%diskname_free(u'c'))
           app.body.add(u'D: %d bytes free\n'%diskname_free(u'd:'))
           app.body.add(u'E: %d bytes free\n'%diskname_free('e:/'))
           app.body.add(u'Z: %d bytes free\n'%diskname_free('Z'))
           print(diskname_free('c'))
    
    
       def set_bind(self):
           pass
    
       def set_exit_if_standalone(self):
           if self.run_by_mode == u'Python Installer':
              app.set_exit()
       
       def get_run_by(self):
           self.run_by = app.full_name()
           if self.run_by[-10:] == u'Python.app':
            self.run_by_mode = u'Python Interpreter'
           elif self.run_by[-10:] == u'appmgr.app':
            self.run_by_mode = u'Python Installer'
           else: 
            self.run_by_mode = u'Unknown ...'
    
    if __name__ == '__main__':
        my_app().run()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×