Discussion:
[BitPim-devel] file info feature
Simon C
2005-11-26 21:53:04 UTC
Permalink
I'd like to add an extra column to the fileviewer to display the purpose of
known files.

So for things like pim/pbgroups.dat the column would contain a brief
description of the purpose of the file like "Supported phonebook groups".

An alternative would be to have the description appear as a tooltip instead
of adding a column, this would work better with the new file view.

Right clicking and selecting a new menu option "properties" would allow the
user to see a more complete description (if available).

Each file would be have a type (unknown, binary, text, audio, image, video)
the file icon would represent the type.

For files of a known type the user would be able to open the file with an
appropriate viewer that would decode and present the file in a human
friendly format. The hex editor would still be an option for all file types
and the only option for unknown types. For binary types the viewer would
have to have a packet definition for the file and it would show all the
records and fields in the file in a tree view. We would be able to use the
existing packet definition for files that already exist. The binary viewer
would be a generic viewer that would display all records in the file even
ones that are empty or otherwise invalid. For audio, image and video files a
sub type or class would have to be provided to allow the viewer to decode
the file.

All viewers would be capable of saving the decoded data to file.



A list of files with brief descriptions, detailed descriptions, file types
and packet definitions (if applicable) would be defined for each phone type,
these would allow wildcard characters and be inheritable from one phone to
another.



I have some ideas about implementation, but I'd like to make sure that the
ideas and features are OK before going into those details.





Simon
Roger Binns
2005-11-28 03:35:02 UTC
Permalink
Post by Simon C
So for things like pim/pbgroups.dat the column would contain a brief
description of the purpose of the file like "Supported phonebook groups".
Good idea :-)
Post by Simon C
An alternative would be to have the description appear as a tooltip instead
of adding a column, this would work better with the new file view.
Columns are nicer because you can sort by them and you can take
screenshots.
Post by Simon C
Each file would be have a type (unknown, binary, text, audio, image, video)
the file icon would represent the type.
Note that we can't work out the type unless we suck the file over.
Post by Simon C
I have some ideas about implementation, but I'd like to make sure that the
ideas and features are OK before going into those details.
Sounds good to me. I suggest a file in the resource directory. If you want
to fluff up your resume you can use XML format. Try writing a non-trivial
amount of the file before doing any code. Here is a starter using mailbox
header format with commentary after pound signs:

Pattern: /sms/inbox*.dat # filename pattern
Phones: com_lgvx*,com_audiovox1234 # which phones do this
Exclude: com_lgvx1234 # except this model
Summary: Incoming SMS messages
Description: Received SMS messages. They are initially in
numerical order, but holes will appear as messages are
deleted.
Analyser: self.protocolclass.sms_in

Note that matching patterns could occur multiple times. For example
all the phones have the nvm files but they mean completely different
things on each model. I don't know how you'd express the type (binary,
text, audio etc) since you could put in the above but in many circumstances
you have to have the file. Maybe a display submenu with options of
'auto' (ie we pick the best possible format), 'analyser', 'hex', 'text'
etc would work?

Roger
Simon C
2005-12-04 17:18:34 UTC
Permalink
Post by Simon C
Post by Simon C
An alternative would be to have the description appear as a tooltip
instead
Post by Simon C
of adding a column, this would work better with the new file view.
Columns are nicer because you can sort by them and you can take
screenshots.
Ok, columns it is (not sure how I'll do this in the directory tree view,
maybe have to add the columns back in).

Would an option to enable this information make sense? I am thinking of a
right click menu checked item like "Enable detail view".
Post by Simon C
Post by Simon C
I have some ideas about implementation, but I'd like to make sure that
the
Post by Simon C
ideas and features are OK before going into those details.
Sounds good to me. I suggest a file in the resource directory. If you
want
to fluff up your resume you can use XML format. Try writing a non-trivial
amount of the file before doing any code. Here is a starter using mailbox
header format with commentary after pound signs:=
I was thinking to use the existing PACKET definitions for decoding files
rather than defining new ones.
I have not looked closely as the prototypes compiler, but a requirement
would be the ability to walk through the fields of the PACKET so that the
analyzer would not have to be coded for each different packet. The comments
on each field would be used (if available) to label the contents.
Using XML is OK, is expat an OK parser, there is a python version available,
it uses the BSD license.

Simon
Roger Binns
2005-12-04 23:44:28 UTC
Permalink
Post by Simon C
Would an option to enable this information make sense? I am thinking of a
right click menu checked item like "Enable detail view".
Nah, just have it always displayed. There is no need for multiple
code paths to maintain. Anyone already in the filesystem view is
playing with fire so there is no need to be delicate.
Post by Simon C
I was thinking to use the existing PACKET definitions for decoding files
rather than defining new ones.
Yes that is the idea. There will never be definitions for some files,
but for almost all phone models we already read information directly
from files in a lot of places.

This will greatly speed up development of new definitions (especially
with offline files).
Post by Simon C
I have not looked closely as the prototypes compiler, but a requirement
would be the ability to walk through the fields of the PACKET so that the
analyzer would not have to be coded for each different packet. The comments
on each field would be used (if available) to label the contents.
You can just bring up the analyser. All the code you need is already
there. You string it together something like this (untested):

def displayfile(filename, theclass):
buf=prototypes.buffer(self.getfilecontents(filename))
data=formatdata(buf, theclass)
frame=analyser.Analyser(parent=..., title=filename, data=data)
frame.Show(True)

def formatdata(buffer, klass):
# copied from guiwidgets.logdata (line 105)
data=("Data - "+`len(data)`+" bytes\n")
try:
data+="<#! %s.%s !#>\n" % (klass.__module__, klass.__name__)
except:
klass=klass.__class__
data+="<#! %s.%s !#>\n" % (klass.__module__, klass.__name__)
return data+common.datatohexstring(data)

To turn a string into a class object as in when you got something like
"self.protocolclass.pbgroups":

First look to see if the first item is named "self". If so then you
set that to be Phone instance from the current phone module. Then
use getattr for each remaining part and you'll finally have the object
that can be passed directly to displayfile.

If the first item is not "self" then pass the whole string to
common.getfullname() and use whatever it returns.
Post by Simon C
Using XML is OK, is expat an OK parser, there is a python version available,
it uses the BSD license.
Joe already got XML on his resume (and it looks like some Java programming
as well) :-) Check out update.py which does XML parsing for the auto update
checker.

I think we'll have to do a fund raising drive to buy him a new underscore
key soon :-)

Roger
Joe Pham
2005-12-06 22:51:51 UTC
Permalink
Post by Roger Binns
I think we'll have to do a fund raising drive to buy him a new
underscore key soon :-)
I second that! Though it's a tad late (I went through a few already), it's better late than never (and original IBM-PC/XT/AT keyboards only please) :-)

-Joe Pham



______________________________________________________________________
Call Anyone, Anytime, Anywhere in the World - FREE!
Free Internet calling from NetZero Voice
Visit http://www.netzerovoice.com today!

Loading...