Archived:Simple file browser in PySymbian

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

The article is believed to be still valid for the original topic scope.

Article Metadata
Created: igordsm (01 Jun 2010)
Last edited: hamishwillee (31 May 2013)

This is a simple file browser class using appuifw. It's just a class to be used when you want the user to select a file from disk.

import appuifw
class FileBrowser:
def __init__(self):
self.entries = e32.drive_list()
self.path = []
def update_entries(self):
if self.path:
self.entries = os.listdir(os.path.join(*self.path))
self.entries.insert(0, u'..')
self.entries = e32.drive_list()
def run(self):
opt = 0
while opt is not None:
opt = appuifw.selection_list(self.entries)
if opt is not None:
if opt == 0 and self.path:
if not os.path.isdir(os.path.join(*self.path)):
return os.path.join(*self.path)

To use the above class, save it inside a file called filebrowser.py and do the following:

import filebrowser
selected_file = filebrowser.FileBrowser().run()

Right now it does not support calling and run more than once. I am planning to remove this hassal in the near future.

This page was last modified on 31 May 2013, at 04:10.
23 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.