I designed an app using python, wxpython, and python-docx. I just need advice about my app. the idea of my app to merge docx files. the merged file will display on richtext box. As in MS word the changed original words will appear with strikethrough and next to it the corresponding changed word from other versions. I stored the changed words with its position"on textbox" in dictionary. whenever the users click on changed word there is a popup window to let the users either keep the original or select one of the other changes related to that clicked word. for example when the users select the change from version 1 then the original word and version 2 will be erased and all word position that come after this word will updated in the dictionary.
is using a dictionary a good idea? if not what is the best choice? is my method of accepting changes a good or there is a better way to do it?
and python-docx. I just need advice about my app. the idea of
my app to merge docx files. the merged file will display on
richtext box. As in MS word the changed original words will
appear with strikethrough and next to it the corresponding
changed word from other versions. I stored the changed words
with its position"on textbox" in dictionary. whenever the
users click on changed word there is a popup window to let the
users either keep the original or select one of the other
changes related to that clicked word. for example when the
users select the change from version 1 then the original word
and version 2 will be erased and all word position that come
after this word will updated in the dictionary.
is using a dictionary a good idea? if
not what is the best choice? is my method of accepting
changes a good or there is a better way to do it?
I've got a docx parser for wx.RichTextCtrl (based on python-docx) in
the works if you want to share resources. I’ve detoured a bit to
spend some time adding some features I need to python-docx, but it’s
coming along nicely. E-mail me off-list if you’re interested.
Just to make sure, you realize that Word has this ability built-in,
right? What you’re talking about is quite complicated.
What is the “key” in the dictionary? You can’t use the word itself,
since a given word might appear several times. I suppose the only
reliable key is the position of the change in the original document.
I’m not sure you want to do that. That’s a bookkeeping nightmare.
Wouldn’t it be better to store the original location, and then keep
track of a delta that tells you how far off you are from the
original at this point?
Well, that depends. Do you ever need to refer to the changes by
position? If you never need to look up by key, then you might as
well just use a list.
there is a popup window to let the users either keep the
original or select one of the other changes related to that
clicked word. for example when the users select the change
from version 1 then the original word and version 2 will be
erased and all word position that come after this word will
updated in the dictionary.
is using a dictionary a good idea? if
not what is the best choice? is my method of accepting
changes a good or there is a better way to do it?
Hi Tim,
yeah I knew the feature of the merging in MS word, but I’m classifying the changes in different way. I used the word as a key beside the position .
I agree that updating the positions is nightmare. could you please explain more about the delta (do you mean the length of the deleted word?)
Thank you for your help.
···
On Thursday, February 18, 2016 at 2:33:56 PM UTC-5, Tim Roberts wrote:
Just to make sure, you realize that Word has this ability built-in,
right? What you’re talking about is quite complicated.
I stored the changed words with its
position"on textbox" in dictionary.
What is the "key" in the dictionary? You can't use the word itself,
since a given word might appear several times. I suppose the only
reliable key is the position of the change in the original document.
whenever the users click on changed word
there is a popup window to let the users either keep the
original or select one of the other changes related to that
clicked word. for example when the users select the change
from version 1 then the original word and version 2 will be
erased and all word position that come after this word will
updated in the dictionary.
I'm not sure you want to do that. That's a bookkeeping nightmare.
Wouldn’t it be better to store the original location, and then keep
track of a delta that tells you how far off you are from the
original at this point?
is using a dictionary a good idea? if
not what is the best choice? is my method of accepting
changes a good or there is a better way to do it?
Well, that depends. Do you ever need to refer to the changes by
position? If you never need to look up by key, then you might as
well just use a list.
-- Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.
yeah I knew the feature of the merging in MS word, but I'm classifying
the changes in different way. I used the word as a key beside the
position .
Why? A given position only contains one word. The word is redundant.
I agree that updating the positions is nightmare. could you please
explain more about the delta (do you mean the length of the deleted word?)
Yes. The problem is, how do you uniquely identify a particular change?
The only way I can think of is to use the byte offset within the
original file. That means if you make a change by removing 3 letters at
some point, then you'll need to remember that there is a -3 difference
between the positions after that change, and the position of that same
location in the original file. But at least by doing that, you don't
have to renumber the keys every time you make a change.
The more I think about it, however, that's probably just as bad. I'm
just thinking about what happens if two changes overlap or are subsets
of each other. I'm afraid you could get in a situation where two
changes that are different points in the original text might end up
mapped to the same point in the modified text.
···
a.m.n.alsubhi@gmail.com wrote:
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.