Skip to content

Commit

Permalink
Add more header and footer related options
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef-Friedrich committed Feb 4, 2024
1 parent 884d93a commit 2bcb8cf
Show file tree
Hide file tree
Showing 9 changed files with 197 additions and 14 deletions.
18 changes: 17 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,13 @@ CLI Usage
[--page-size <width> <height>] [--a4] [--letter]
[--margin <dimension>]
[--show-header | --no-show-header]
[--header-first-page | --no-header-first-page]
[--different-odd-even-header | --no-different-odd-even-header]
[--header <left> <center> <right>]
[--header-odd-even <odd-left> <even-left> <odd-center> <even-center> <odd-right> <even-right>]
[--show-footer | --no-show-footer]
[--footer-first-page | --no-footer-first-page]
[--different-odd-even-footer | --no-different-odd-even-footer]
[--footer <left> <center> <right>]
[--footer-odd-even <odd-left> <even-left> <odd-center> <even-center> <odd-right> <even-right>]
[--reset-small-staffs]
Expand Down Expand Up @@ -747,13 +751,25 @@ CLI Usage
--margin <dimension> Set the top, right, bottom and left margins to the same
value.
--show-header, --no-show-header
Show or hide the header
Show or hide the header.
--header-first-page, --no-header-first-page
Show the header on the first page.
--different-odd-even-header, --no-different-odd-even-header
Use different header for odd and even pages.
--header <left> <center> <right>
Set the header for all pages.
--header-odd-even <odd-left> <even-left> <odd-center> <even-center> <odd-right> <even-right>
Set different headers for odd and even pages.
--show-footer, --no-show-footer
Show or hide the footer.
--footer-first-page, --no-footer-first-page
Show the footer on the first page.
--different-odd-even-footer, --no-different-odd-even-footer
Use different footers for odd and even pages.
--footer <left> <center> <right>
Set the footer for all pages.
--footer-odd-even <odd-left> <even-left> <odd-center> <even-center> <odd-right> <even-right>
Set different footers for odd and even pages.
--reset-small-staffs Reset all small staffs to normal size.

Configuration file
Expand Down
10 changes: 9 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' '--show-header' '--no-show-header' '--header' '--header-odd-even' '--show-footer' '--no-show-footer' '--footer' '--footer-odd-even' '--reset-small-staffs')
_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' '--show-header' '--no-show-header' '--header-first-page' '--no-header-first-page' '--different-odd-even-header' '--no-different-odd-even-header' '--header' '--header-odd-even' '--show-footer' '--no-show-footer' '--footer-first-page' '--no-footer-first-page' '--different-odd-even-footer' '--no-different-odd-even-footer' '--footer' '--footer-odd-even' '--reset-small-staffs')

_shtab_musescore_manager_pos_0_COMPGEN=_shtab_compgen_files
_shtab_musescore_manager__C_COMPGEN=_shtab_compgen_files
Expand Down Expand Up @@ -82,10 +82,18 @@ _shtab_musescore_manager___din_a4_nargs=0
_shtab_musescore_manager___letter_nargs=0
_shtab_musescore_manager___show_header_nargs=0
_shtab_musescore_manager___no_show_header_nargs=0
_shtab_musescore_manager___header_first_page_nargs=0
_shtab_musescore_manager___no_header_first_page_nargs=0
_shtab_musescore_manager___different_odd_even_header_nargs=0
_shtab_musescore_manager___no_different_odd_even_header_nargs=0
_shtab_musescore_manager___header_nargs=3
_shtab_musescore_manager___header_odd_even_nargs=6
_shtab_musescore_manager___show_footer_nargs=0
_shtab_musescore_manager___no_show_footer_nargs=0
_shtab_musescore_manager___footer_first_page_nargs=0
_shtab_musescore_manager___no_footer_first_page_nargs=0
_shtab_musescore_manager___different_odd_even_footer_nargs=0
_shtab_musescore_manager___no_different_odd_even_footer_nargs=0
_shtab_musescore_manager___footer_nargs=3
_shtab_musescore_manager___footer_odd_even_nargs=6
_shtab_musescore_manager___reset_small_staffs_nargs=0
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 footer-odd-even glob header header-odd-even help json letter list-files list-fonts log lyricist margin metatag metatag-meta mscore mscx mscz musical-symbol-font musical-text-font no-show-footer no-show-header no-whitespace only-filename page-size print-completion remap remap-lyrics rename reset-small-staffs s3 s4 save-in-mscore set-field show-footer show-header 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 different-odd-even-footer different-odd-even-header din-a4 distribute-fields dry-run executable export extract extract-lyrics fix fix-lyrics footer footer-first-page footer-odd-even glob header header-first-page header-odd-even help json letter list-files list-fonts log lyricist margin metatag metatag-meta mscore mscx mscz musical-symbol-font musical-text-font no-different-odd-even-footer no-different-odd-even-header no-footer-first-page no-header-first-page no-show-footer no-show-header no-whitespace only-filename page-size print-completion remap remap-lyrics rename reset-small-staffs s3 s4 save-in-mscore set-field show-footer show-header 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
14 changes: 9 additions & 5 deletions autocomplete.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,16 @@ _shtab_musescore_manager_options=(
{--a4,--din-a4}"[Set the paper size to DIN A4 (210 by 297 mm).]"
"--letter[Set the paper size to Letter (8.5 by 11 in).]"
"--margin[Set the top, right, bottom and left margins to the same value.]:style_margin:"
{--show-header,--no-show-header}"[Show or hide the header]:style_show_header:"
"--header[]:style_header_all:"
"--header-odd-even[]:style_header_odd_even:"
{--show-header,--no-show-header}"[Show or hide the header.]:style_show_header:"
{--header-first-page,--no-header-first-page}"[Show the header on the first page.]:style_header_first_page:"
{--different-odd-even-header,--no-different-odd-even-header}"[Use different header for odd and even pages.]:style_different_odd_even_header:"
"--header[Set the header for all pages.]:style_header_all:"
"--header-odd-even[Set different headers for odd and even pages.]:style_header_odd_even:"
{--show-footer,--no-show-footer}"[Show or hide the footer.]:style_show_footer:"
"--footer[]:style_footer_all:"
"--footer-odd-even[]:style_footer_odd_even:"
{--footer-first-page,--no-footer-first-page}"[Show the footer on the first page.]:style_footer_first_page:"
{--different-odd-even-footer,--no-different-odd-even-footer}"[Use different footers for odd and even pages.]:style_different_odd_even_footer:"
"--footer[Set the footer for all pages.]:style_footer_all:"
"--footer-odd-even[Set different footers for odd and even pages.]:style_footer_odd_even:"
"--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
18 changes: 17 additions & 1 deletion docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ Comande line interface
[--page-size <width> <height>] [--a4] [--letter]
[--margin <dimension>]
[--show-header | --no-show-header]
[--header-first-page | --no-header-first-page]
[--different-odd-even-header | --no-different-odd-even-header]
[--header <left> <center> <right>]
[--header-odd-even <odd-left> <even-left> <odd-center> <even-center> <odd-right> <even-right>]
[--show-footer | --no-show-footer]
[--footer-first-page | --no-footer-first-page]
[--different-odd-even-footer | --no-different-odd-even-footer]
[--footer <left> <center> <right>]
[--footer-odd-even <odd-left> <even-left> <odd-center> <even-center> <odd-right> <even-right>]
[--reset-small-staffs]
Expand Down Expand Up @@ -414,12 +418,24 @@ Comande line interface
--margin <dimension> Set the top, right, bottom and left margins to the same
value.
--show-header, --no-show-header
Show or hide the header
Show or hide the header.
--header-first-page, --no-header-first-page
Show the header on the first page.
--different-odd-even-header, --no-different-odd-even-header
Use different header for odd and even pages.
--header <left> <center> <right>
Set the header for all pages.
--header-odd-even <odd-left> <even-left> <odd-center> <even-center> <odd-right> <even-right>
Set different headers for odd and even pages.
--show-footer, --no-show-footer
Show or hide the footer.
--footer-first-page, --no-footer-first-page
Show the footer on the first page.
--different-odd-even-footer, --no-different-odd-even-footer
Use different footers for odd and even pages.
--footer <left> <center> <right>
Set the footer for all pages.
--footer-odd-even <odd-left> <even-left> <odd-center> <even-center> <odd-right> <even-right>
Set different footers for odd and even pages.
--reset-small-staffs Reset all small staffs to normal size.

57 changes: 55 additions & 2 deletions mscxyz/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,18 +656,35 @@ def _split_lines(self, text: typing.Text, width: int) -> typing.List[str]:
help="Set the top, right, bottom and left margins to the same value.",
)

# header

style_group.add_argument(
"--show-header",
dest="style_show_header",
action=argparse.BooleanOptionalAction,
help="Show or hide the header",
help="Show or hide the header.",
)

style_group.add_argument(
"--header-first-page",
dest="style_header_first_page",
action=argparse.BooleanOptionalAction,
help="Show the header on the first page.",
)

style_group.add_argument(
"--different-odd-even-header",
dest="style_different_odd_even_header",
action=argparse.BooleanOptionalAction,
help="Use different header for odd and even pages.",
)

style_group.add_argument(
"--header",
nargs=3,
dest="style_header_all",
metavar=("<left>", "<center>", "<right>"),
help="Set the header for all pages.",
)

style_group.add_argument(
Expand All @@ -682,20 +699,38 @@ def _split_lines(self, text: typing.Text, width: int) -> typing.List[str]:
"<odd-right>",
"<even-right>",
),
help="Set different headers for odd and even pages.",
)

# footer

style_group.add_argument(
"--show-footer",
dest="style_show_footer",
action=argparse.BooleanOptionalAction,
help="Show or hide the footer.",
)

style_group.add_argument(
"--footer-first-page",
dest="style_footer_first_page",
action=argparse.BooleanOptionalAction,
help="Show the footer on the first page.",
)

style_group.add_argument(
"--different-odd-even-footer",
dest="style_different_odd_even_footer",
action=argparse.BooleanOptionalAction,
help="Use different footers for odd and even pages.",
)

style_group.add_argument(
"--footer",
nargs=3,
dest="style_footer_all",
metavar=("<left>", "<center>", "<right>"),
help="Set the footer for all pages.",
)

style_group.add_argument(
Expand All @@ -710,9 +745,9 @@ def _split_lines(self, text: typing.Text, width: int) -> typing.List[str]:
"<odd-right>",
"<even-right>",
),
help="Set different footers for odd and even pages.",
)


style_group.add_argument(
"--reset-small-staffs",
dest="style_reset_small_staffs",
Expand Down Expand Up @@ -837,24 +872,42 @@ def list_styles(version: int) -> None:
if args.style_margin is not None:
score.style.margin = inch(args.style_margin)

# header

if args.style_show_header is not None:
score.style.show_header = args.style_show_header

if args.style_header_first_page is not None:
score.style.header_first_page = args.style_header_first_page

if args.style_different_odd_even_header is not None:
score.style.header_odd_even = args.style_different_odd_even_header

if args.style_header_all:
score.style.set_header_all(*args.style_header_all)

if args.style_header_odd_even:
score.style.set_header_odd_even(*args.style_header_odd_even)

# footer

if args.style_show_footer is not None:
score.style.show_footer = args.style_show_footer

if args.style_footer_first_page is not None:
score.style.footer_first_page = args.style_footer_first_page

if args.style_different_odd_even_footer is not None:
score.style.footer_odd_even = args.style_different_odd_even_footer

if args.style_footer_all:
score.style.set_footer_all(*args.style_footer_all)

if args.style_footer_odd_even:
score.style.set_footer_odd_even(*args.style_footer_odd_even)

# small staffs

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

Expand Down
4 changes: 4 additions & 0 deletions mscxyz/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,13 @@ class DefaultArguments:
style_page_size_letter: bool = False
style_margin: Optional[str] = None
style_show_header: Optional[bool] = None
style_header_first_page: Optional[bool] = None
style_different_odd_even_header: Optional[bool] = None
style_header_all: Optional[tuple[str, str, str]] = None
style_header_odd_even: Optional[tuple[str, str, str, str, str, str]] = None
style_different_odd_even_footer: Optional[bool] = None
style_show_footer: Optional[bool] = None
style_footer_first_page: Optional[bool] = None
style_footer_all: Optional[tuple[str, str, str]] = None
style_footer_odd_even: Optional[tuple[str, str, str, str, str, str]] = None
style_reset_small_staffs: bool = False
Expand Down
8 changes: 5 additions & 3 deletions mscxyz/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,8 @@ def max_system_distance(self) -> float:
def max_system_distance(self, value: float) -> None:
self.set("maxSystemDistance", value)

# header ###################################################################

@property
def show_header(self) -> bool:
"""
Expand Down Expand Up @@ -995,7 +997,7 @@ def header_odd_even(self) -> bool:

@header_odd_even.setter
def header_odd_even(self, value: bool) -> None:
self.set("headerFirstPage", int(value))
self.set("headerOddEven", int(value))

# even/odd header l/c/r ####################################################

Expand Down Expand Up @@ -1123,7 +1125,7 @@ def set_header_odd_even(
even_right: str,
) -> None:
"""
Set the header for odd and even pages.
Set different headers for odd and even pages.
:see: :attr:`even_header_left`
:see: :attr:`even_header_center`
Expand Down Expand Up @@ -1180,7 +1182,7 @@ def footer_first_page(self, value: bool) -> None:
@property
def footer_odd_even(self) -> bool:
"""
Show the footer on the first page.
Use different footers for odd and even pages.
.. code :: XML
Expand Down
Loading

0 comments on commit 2bcb8cf

Please sign in to comment.