Skip to content

Commit

Permalink
New option --reset-small-staffs
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-Friedrich committed Feb 3, 2024
1 parent 42e6949 commit 550ad00
Show file tree
Hide file tree
Showing 15 changed files with 3,955 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ CLI Usage
[--staff-space <dimension>]
[--page-size <width> <height>] [--a4] [--letter]
[--margin <dimension>] [--header | --no-header]
[--footer | --no-footer]
[--footer | --no-footer] [--reset-small-staffs]
[<path> ...]

The next generation command line tool to manipulate the XML based "*.mscX" and "*.mscZ" files of the notation software MuseScore.
Expand Down Expand Up @@ -744,6 +744,7 @@ CLI Usage
Show or hide the header
--footer, --no-footer
Show or hide the footer.
--reset-small-staffs Reset all small staffs to normal size.

Configuration file
==================
Expand Down
3 changes: 2 additions & 1 deletion autocomplete.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@



_shtab_musescore_manager_option_strings=('-h' '--help' '--print-completion' '-V' '--version' '-b' '--backup' '--bail' '--catch-errors' '-k' '--colorize' '-C' '--config-file' '-d' '--dry-run' '-m' '--mscore' '--save-in-mscore' '--diff' '-e' '--executable' '-v' '--verbose' '-E' '--export' '--compress' '-c' '--clean-meta' '-D' '--delete-duplicates' '-i' '--distribute-fields' '-j' '--json' '-l' '--log' '-y' '--synchronize' '-S' '--set-field' '--metatag' '--metatag-meta' '--vbox' '--vbox-meta' '--title' '--subtitle' '--composer' '--lyricist' '-x' '--extract' '--extract-lyrics' '-r' '--remap' '--remap-lyrics' '-F' '--fix' '--fix-lyrics' '--rename' '-t' '--target' '--only-filename' '-A' '--alphanum' '-a' '--ascii' '-n' '--no-whitespace' '-K' '--skip-if-empty' '-L' '--list-files' '-g' '--glob' '--mscz' '--mscx' '-s' '--style' '--clean' '-Y' '--style-file' '--s3' '--styles-v3' '--s4' '--styles-v4' '--list-fonts' '--text-font' '--title-font' '--musical-symbol-font' '--musical-text-font' '--staff-space' '--page-size' '--a4' '--din-a4' '--letter' '--margin' '--header' '--no-header' '--footer' '--no-footer')
_shtab_musescore_manager_option_strings=('-h' '--help' '--print-completion' '-V' '--version' '-b' '--backup' '--bail' '--catch-errors' '-k' '--colorize' '-C' '--config-file' '-d' '--dry-run' '-m' '--mscore' '--save-in-mscore' '--diff' '-e' '--executable' '-v' '--verbose' '-E' '--export' '--compress' '-c' '--clean-meta' '-D' '--delete-duplicates' '-i' '--distribute-fields' '-j' '--json' '-l' '--log' '-y' '--synchronize' '-S' '--set-field' '--metatag' '--metatag-meta' '--vbox' '--vbox-meta' '--title' '--subtitle' '--composer' '--lyricist' '-x' '--extract' '--extract-lyrics' '-r' '--remap' '--remap-lyrics' '-F' '--fix' '--fix-lyrics' '--rename' '-t' '--target' '--only-filename' '-A' '--alphanum' '-a' '--ascii' '-n' '--no-whitespace' '-K' '--skip-if-empty' '-L' '--list-files' '-g' '--glob' '--mscz' '--mscx' '-s' '--style' '--clean' '-Y' '--style-file' '--s3' '--styles-v3' '--s4' '--styles-v4' '--list-fonts' '--text-font' '--title-font' '--musical-symbol-font' '--musical-text-font' '--staff-space' '--page-size' '--a4' '--din-a4' '--letter' '--margin' '--header' '--no-header' '--footer' '--no-footer' '--reset-small-staffs')

_shtab_musescore_manager_pos_0_COMPGEN=_shtab_compgen_files
_shtab_musescore_manager__C_COMPGEN=_shtab_compgen_files
Expand Down Expand Up @@ -84,6 +84,7 @@ _shtab_musescore_manager___header_nargs=0
_shtab_musescore_manager___no_header_nargs=0
_shtab_musescore_manager___footer_nargs=0
_shtab_musescore_manager___no_footer_nargs=0
_shtab_musescore_manager___reset_small_staffs_nargs=0


# $1=COMP_WORDS[1]
Expand Down
2 changes: 1 addition & 1 deletion autocomplete.tcsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


complete musescore-manager \
'c/--/(a4 alphanum ascii backup bail catch-errors clean clean-meta colorize composer compress config-file delete-duplicates diff din-a4 distribute-fields dry-run executable export extract extract-lyrics fix fix-lyrics footer glob header help json letter list-files list-fonts log lyricist margin metatag metatag-meta mscore mscx mscz musical-symbol-font musical-text-font no-footer no-header no-whitespace only-filename page-size print-completion remap remap-lyrics rename s3 s4 save-in-mscore set-field skip-if-empty staff-space style style-file styles-v3 styles-v4 subtitle synchronize target text-font title title-font vbox vbox-meta verbose version)/' \
'c/--/(a4 alphanum ascii backup bail catch-errors clean clean-meta colorize composer compress config-file delete-duplicates diff din-a4 distribute-fields dry-run executable export extract extract-lyrics fix fix-lyrics footer glob header help json letter list-files list-fonts log lyricist margin metatag metatag-meta mscore mscx mscz musical-symbol-font musical-text-font no-footer no-header no-whitespace only-filename page-size print-completion remap remap-lyrics rename reset-small-staffs s3 s4 save-in-mscore set-field skip-if-empty staff-space style style-file styles-v3 styles-v4 subtitle synchronize target text-font title title-font vbox vbox-meta verbose version)/' \
'c/-/(- A C D E F K L S V Y a b c d e g h i j k l m n r s t v x y)/' \
'n/--print-completion/(bash zsh tcsh)/' \
'n/-C/f/' \
Expand Down
1 change: 1 addition & 0 deletions autocomplete.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ _shtab_musescore_manager_options=(
"--margin[Set the top, right, bottom and left margins to the same value.]:style_margin:"
{--header,--no-header}"[Show or hide the header]:style_show_header:"
{--footer,--no-footer}"[Show or hide the footer.]:style_show_footer:"
"--reset-small-staffs[Reset all small staffs to normal size.]"
"(*)::Path to a \"\*.msc\[zx\]\" file or a folder containing \"\*.msc\[zx\]\" files. can be specified several times.:_files"
)

Expand Down
3 changes: 2 additions & 1 deletion docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Comande line interface
[--staff-space <dimension>]
[--page-size <width> <height>] [--a4] [--letter]
[--margin <dimension>] [--header | --no-header]
[--footer | --no-footer]
[--footer | --no-footer] [--reset-small-staffs]
[<path> ...]

The next generation command line tool to manipulate the XML based "*.mscX" and "*.mscZ" files of the notation software MuseScore.
Expand Down Expand Up @@ -411,4 +411,5 @@ Comande line interface
Show or hide the header
--footer, --no-footer
Show or hide the footer.
--reset-small-staffs Reset all small staffs to normal size.

12 changes: 12 additions & 0 deletions mscxyz/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,13 @@ def _split_lines(self, text: typing.Text, width: int) -> typing.List[str]:
help="Show or hide the footer.",
)

group_style.add_argument(
"--reset-small-staffs",
dest="style_reset_small_staffs",
action="store_true",
help="Reset all small staffs to normal size.",
)

###############################################################################
# last positional parameter
###############################################################################
Expand Down Expand Up @@ -793,6 +800,11 @@ def list_styles(version: int) -> None:
if args.style_show_footer is not None:
score.style.show_footer = args.style_show_footer

if args.style_reset_small_staffs:
score.style.reset_small_staffs()

# lyrics

if args.lyrics_remap:
score.lyrics.remap(args.lyrics_remap)

Expand Down
1 change: 1 addition & 0 deletions mscxyz/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class DefaultArguments:
style_margin: Optional[str] = None
style_show_header: Optional[bool] = None
style_show_footer: Optional[bool] = None
style_reset_small_staffs: bool = False

# positional argument
path: str = "."
Expand Down
23 changes: 23 additions & 0 deletions mscxyz/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -1197,3 +1197,26 @@ def measure_number_offset(self) -> Offset:
@measure_number_offset.setter
def measure_number_offset(self, value: Offset) -> None:
self.set("measureNumberOffset", cast(AttibutesDict, value))

def reset_small_staffs(self) -> None:
"""
Reset all small staffs to normal size.
.. code-block:: xml
<Part id="1">
<Staff id="1">
<StaffType group="pitched">
<name>stdNormal</name>
<small>1</small>
</StaffType>
</Staff>
<trackName>Voice</trackName>
<Instrument id="voice">
<trackName>Voice</trackName>
<minPitchP>36</minPitchP>
<maxPitchP>94</maxPitchP>
"""
for element in self.xml.findall(".//StaffType/small"):
if element.text == "1":
self.xml.remove(element)
Loading

0 comments on commit 550ad00

Please sign in to comment.