GrandOrgue / OdfEdit

A tool for GrandOrgue ODF edition, and Hauptwerk to GrandOrgue ODF conversion.
GNU General Public License v3.0
9 stars 1 forks source link

Feature Request: Renumerating objects #28

Closed oleg68 closed 10 months ago

oleg68 commented 1 year ago

After adding a capability of exporting yaml combinations in GrandOrgue, the orrder of Stops, Switches and other elements in Manuals became significant, because the elements are enumerated in yaml in the same order.

So it would be great if OdfEdit brought the capability of changing order of elements in manuals.

NB usualy the global stop index is related to the index in the manual.

[Manual002]
...
Stop001=201
Stop002=202
...

so when changing a stop index in the manual, it's global index should be changed as well.

eturpault commented 1 year ago

OdfEdit already uses this rule (the first digit of a stop or coupler index is the index of the parent manual) for HW to GO convertion and when a stop is moved as child of another manual. I am no sure to understand well what you are suggesting to implement, could you please give an example of use case ? Thanks.

oleg68 commented 1 year ago

@eturpault

Now I have an ODF with the following manual section:

OdfEdit

I want to change numbers of stops that they become:

The best way of making this change would be drag-n-drop with a mouse in the Manual or in the Children window.

eturpault commented 1 year ago

Ok understood. Current OdfEdit version permits to rename the index of a section with the button Rename, but it doesn't shift automatically the index of the other sections. I add it to my TO DO list, trying the drag&drop method (if a Stop is dropped over another Stop of the same manual, its index will become the index + 1 of the targeted Stop and other stops indexes will be shifted if needed).

eturpault commented 1 year ago

@oleg68 : I improved the sections drag&drop visual behavior and I added the possibility to change order of sections of the same type between them (in sections list or tree widgets), as your requested in this issue. Could you please test it and let me know what you think about this implementation ? The new OdfEdit.py file is available in the branch 2.8beta.

oleg68 commented 1 year ago

@eturpault Thank you for the new version.

I tested it and I tried to renumerate stops in one manual.

ODFEdit has successfully changed names of [StopXXX], but it incorrectly changed the [ManualXXX] entries:

was

...
Stop001=001
Stop002=002
Stop003=003
...

became:

Stop001=002
Stop002=005
Stop003=004

I expected that the [ManualXXX] entries wouldn't be changed.

eturpault commented 1 year ago

The Manual entries are reflecting the stops renaming done by the Stop shift operation. For example with the Demo sample set, in the First Manual, if one shifts the Bourdon 16' before the Montre 8' there are these Manual entries changes :

Section shift example Entry Stop001 refers to Montre 8' which has be renamed from Stop101 to Stop102 Entry Stop002 refers to Flute Harm. 8' which has be renamed from Stop102 to Stop103 Entry Stop003 refers to Bourdon 16' which has be renamed from Stop103 to Stop101

What you are expecting is that in this example OdfEdit sorts by ascending order the Stop references in the Manual section after the shift operation, is my understanding correct ?

oleg68 commented 1 year ago

What you are expecting is that in this example OdfEdit sorts by ascending order the Stop references in the Manual section after the shift operation, is my understanding correct ?

No, I don't.

I expect that the order of stops in the manual would be changed as well, so the StopXXX values would not be changed.

Ex:

Before

[Manula101]
NumberOfStops=2
Stop001=101     ; Montre 8'
Stop002=102     ; Bourdon 16'
...

[Stop101]
Name=Montre 8'
...

[Stop102]
Name=Bourdon 16'
...

after:

[Manula101]
NumberOfStops=2
Stop001=101     ; Bourdon 16'
Stop002=102     ; Montre 8'
...

[Stop101]
Name=Bourdon 16'
...

[Stop102]
Name=Montre 8'
...
eturpault commented 1 year ago

Ok clear, this is what I was meaning by "sorts by ascending order the Stop references in the Manual". I will implement this. The comments at the end of lines will have indeed to follow the references, you are right to put them in your example, however if there are comments between lines (as in the example below) they will be untouched by OdfEdit

NumberOfStops=2
; Bourdon 16'
Stop001=101
; Montre 8'
Stop002=102
oleg68 commented 1 year ago

Ok clear, this is what I was meaning by "sorts by ascending order the Stop references in the Manual".

I understand your sentence "sorts by ascending order the Stop references in the Manual" as

Stop002=101     ; Bourdon 16'
Stop001=102     ; Montre 8'

but I'd like to have

Stop001=101     ; Bourdon 16'
Stop002=102     ; Montre 8'

instead.

eturpault commented 1 year ago

While working on this implementation, I am wondering why in the General section the following attributes are required :

GrandOrgue knows in which manual a coupler or a stop is placed, why is it necessary to provide this information ? As it is a General section, it applies independently of the manuals, or I have not understood how a General section operates.

eturpault commented 1 year ago

@oleg68 : I have updated in the v2.8beta branch the OdfEdit.py file with the reordering that you suggested to do. Please say me if the drag&drop feature is ok like that. Thank you.

eturpault commented 1 year ago

This is implemented in OdfEdit v2.8

oleg68 commented 12 months ago

@eturpault Thank you for the new version 2.8.

I tried renumbering stops in the manuals. Everything seems all right, but I have a problem with ODF-defined GeneralXXXs.

For example, before renumbering I had the following section:

[General001]
Name=GC
Protected=Y
NumberOfStops=88
; Pedal
StopManual001=000
StopNumber001=-001
StopManual002=000
StopNumber002=-002
StopManual003=000
StopNumber003=-003
StopManual004=000
StopNumber004=-004
StopManual005=000
StopNumber005=-005
StopManual006=000
StopNumber006=-006
StopManual007=000
StopNumber007=-007
StopManual008=000
StopNumber008=-008
StopManual009=000
StopNumber009=-009
StopManual010=000
StopNumber010=-010
StopManual011=000
StopNumber011=-011
StopManual012=000
StopNumber012=-012
StopManual013=000
StopNumber013=-013
StopManual014=000
StopNumber014=-014
StopManual015=000
StopNumber015=-015
StopManual016=000
StopNumber016=-016
StopManual017=000
StopNumber017=-017
StopManual018=000
StopNumber018=-018
StopManual019=000
StopNumber019=-019
StopManual020=000
StopNumber020=-020
; Hw
StopManual021=001
StopNumber021=-001
StopManual022=001
StopNumber022=-002
StopManual023=001
StopNumber023=-003
StopManual024=001
StopNumber024=-004
StopManual025=001
StopNumber025=-005
StopManual026=001
StopNumber026=-006
StopManual027=001
StopNumber027=-007
StopManual028=001
StopNumber028=-008
StopManual029=001
StopNumber029=-009
StopManual030=001
StopNumber030=-010
StopManual031=001
StopNumber031=-011
StopManual032=001
StopNumber032=-012
StopManual033=001
StopNumber033=-013
StopManual034=001
StopNumber034=-014
StopManual035=001
StopNumber035=-015
StopManual036=001
StopNumber036=-016
StopManual037=001
StopNumber037=-017
StopManual038=001
StopNumber038=-018
StopManual039=001
StopNumber039=-019
StopManual040=001
StopNumber040=-020
StopManual041=001
StopNumber041=-021
StopManual042=001
StopNumber042=-022
StopManual043=001
StopNumber043=-023
StopManual044=001
StopNumber044=-024
; Bw
StopManual045=002
StopNumber045=-001
StopManual046=002
StopNumber046=-002
StopManual047=002
StopNumber047=-003
StopManual048=002
StopNumber048=-004
StopManual049=002
StopNumber049=-005
StopManual050=002
StopNumber050=-006
StopManual051=002
StopNumber051=-007
StopManual052=002
StopNumber052=-008
StopManual053=002
StopNumber053=-009
StopManual054=002
StopNumber054=-010
StopManual055=002
StopNumber055=-011
StopManual056=002
StopNumber056=-012
StopManual057=002
StopNumber057=-013
StopManual058=002
StopNumber058=-014
StopManual059=002
StopNumber059=-015
StopManual060=002
StopNumber060=-016
StopManual061=002
StopNumber061=-017
StopManual062=002
StopNumber062=-018
StopManual063=002
StopNumber063=-019
StopManual064=002
StopNumber064=-020
; Ow
StopManual065=003
StopNumber065=-001
StopManual066=003
StopNumber066=-002
StopManual067=003
StopNumber067=-003
StopManual068=003
StopNumber068=-004
StopManual069=003
StopNumber069=-005
StopManual070=003
StopNumber070=-006
StopManual071=003
StopNumber071=-007
StopManual072=003
StopNumber072=-008
StopManual073=003
StopNumber073=-009
StopManual074=003
StopNumber074=-010
StopManual075=003
StopNumber075=-011
StopManual076=003
StopNumber076=-012
StopManual077=003
StopNumber077=-013
StopManual078=003
StopNumber078=-014
StopManual079=003
StopNumber079=-015
StopManual080=003
StopNumber080=-016
StopManual081=003
StopNumber081=-017
StopManual082=003
StopNumber082=-018
StopManual083=003
StopNumber083=-019
StopManual084=003
StopNumber084=-020
StopManual085=003
StopNumber085=-021
StopManual086=003
StopNumber086=-022
StopManual087=003
StopNumber087=-023
StopManual088=003
StopNumber088=-024

After renumbering I received:

[General001]
Name=GC
Protected=Y
NumberOfStops=24
; Pedal
StopNumber001=-001
StopManual001=000
StopNumber002=-002
StopManual002=000
StopNumber003=-003
StopManual003=000
StopNumber004=-004
StopManual004=000
StopNumber005=-005
StopManual005=000
StopNumber006=-006
StopManual006=000
StopNumber007=-007
StopManual007=000
StopNumber008=-008
StopManual008=000
StopNumber009=-009
StopManual009=000
StopNumber010=-010
StopManual010=000
StopNumber011=-011
StopManual011=000
StopNumber012=-012
StopManual012=000
StopNumber013=-013
StopManual013=000
StopNumber014=-014
StopManual014=000
StopNumber015=-015
StopManual015=000
StopNumber016=-016
StopManual016=000
StopNumber017=-017
StopManual017=000
StopNumber018=-018
StopManual018=000
StopNumber019=-019
StopManual019=
StopNumber020=-020
StopManual020=000
StopNumber021=-021
StopManual021=
StopNumber022=-022
StopManual022=
StopNumber023=-023
StopManual023=
StopNumber024=-024
StopManual024=
StopManual019=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual018=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual018=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual017=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual017=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual018=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual016=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual016=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual017=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual018=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual019=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual014=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual014=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual015=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual016=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual017=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual018=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual013=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual013=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual014=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual015=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual016=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual017=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual011=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual011=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual012=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual013=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual014=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual010=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual010=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual011=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual012=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual013=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual009=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual009=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual010=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual011=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual012=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual008=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual008=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual009=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual010=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual011=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual012=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual013=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual014=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual015=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual016=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual017=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual018=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual019=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual007=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual007=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual008=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual009=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual006=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual006=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual007=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual008=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual009=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual010=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual011=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual004=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual004=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual003=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual003=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual004=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual005=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual006=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual007=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual008=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual009=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual010=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual011=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual012=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual013=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual014=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual015=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual016=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual001=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual001=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual002=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual003=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual004=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual005=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual006=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual007=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual008=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual009=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual010=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual011=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual012=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual013=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual014=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual015=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual016=
StopManual020=
StopManual021=
StopManual022=
StopManual023=
StopManual021=
StopManual022=
StopManual023=
StopManual024=
StopManual025=

I expected that this section shouln't be changed.

eturpault commented 12 months ago

@oleg68 : this is clearly a bug... If stops are renumbered inside the same manual, according to you the General sections shouldn't be changed consequently ? If yes it is ok for me, the processing will be simpler than today.

oleg68 commented 11 months ago

I prefer that they would stay in their order than would be renumbered.

Otherwise I will ask you to add a new feature Sort for Generals, that would order all entries in the General by (ManualNumber, StopNumber)

eturpault commented 10 months ago

@oleg68 : I pushed in v2.9beta branch a new version of OdfEdit.py which adds a menu item permitting to sort in the selected section the references to other sections. It applies for General but also to other type of sections which contain referencing to other sections. I reworked the function which do the references sorting and made other stuff (see the commit message for details). The bug that you reported on Dec 3, 2023 should be fixed, but I was not able to reproduce it with OdfEdit v2.8. Could you please test it and let me know what you think ?

I will deliver OdfEdit v2.9 once GrandOrgue 3.14.0 has been delivered as it contains the support of the new keys Pipe999Attack999LoopCrossfadeLength, Pipe999Attack999ReleaseCrossfadeLength, Pipe999Release999ReleaseCrossfadeLength.

oleg68 commented 10 months ago

@eturpault I'm not familiar with python. So could you post there a binary?

eturpault commented 10 months ago

@oleg68, yes of course, binary for Linux or Windows ?

oleg68 commented 10 months ago

For linux

eturpault commented 10 months ago

The file is too big to be shared here, here is a link to recover it : https://drive.google.com/file/d/1mPcozucgN4W18tv2lwrOc7IwsUkxW33Q/view?usp=sharing There is a new menu item permitting to reorder the references present in the selected section.

eturpault commented 10 months ago

Google estimates that the file is suspect, so you cannot download it. I asked Google security team to allow it, it may take some time.

oleg68 commented 10 months ago

Prease pack the executable into .zip and attach it here.

eturpault commented 10 months ago

It was already packed inside a .zip file. I have put in a .7z file, here is the link : https://drive.google.com/file/d/1mbBiN5zYqjT_VkOgMcuZQvLJaDyl6HyF/view?usp=sharing

eturpault commented 10 months ago

New version with some bug fixes and the implementation of the MIDIInputNumber attribute set in Manual and Enclosure sections on converting HW to GO ODF as suggested in https://github.com/GrandOrgue/OdfEdit/issues/39 https://drive.google.com/file/d/1mo6SJC-I5BiksD2sa5Si-G2b6Esv3IbP/view?usp=sharing

oleg68 commented 10 months ago

@eturpault I tested 2.9 beta. Seems the renumbering works fine. Thank you.

eturpault commented 10 months ago

Implemented in OdfEdit v2.8 and fixes/improvements made in OdfEdit v2.9