append(Stop3_983)
132 state = Note3_2543
133 try:
134 while not exit_flag:
135 new_state, add_to_stack=state()
136 if add_to_stack:
137 call_stack.append(state)
138 state = new_state
139 finally:
140 lock.signal()
141 appuifw.app.title=old_title
142 appuifw.app.exit_key_handler = None
143
144 if __name__ == "__main__":
145 main()
GENERATOR FOR PYTHON 183
is started with the main dispatcher with the ???try??? line (133). The loop continues until
exit_?¬‚ag is True; the Stop function sets the ?¬‚ag (line 125). In the loop, each function
executed inside Python will always return a tuple with information about the next
function and whether this current function needs to be stored on the stack. For
example, Note (line 55) and SendSMS (line 120) have the parameter value False and
they are not stored on the stack. In most of the other functions, add_to_stack is set to
True, and a new state will be added to call_stack.
When exit_?¬‚ag is True, lock.signal is included to ensure that the application is
???awake??? and closing goes smoothly. Finally, the old application title is returned and
the application??™s exit_key handler is reset (there can be customized handlers during
application execution). The last two lines show the standard way to start a Python
application.
8.6 FRAMEWORK SUPPORT
During DSM creation, the S60 mobile phone platform and the Python for S60
framework were taken as given: The language creator simply made the generator call
the services provided by the frameworks.
Pages:
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342