Dup Ver Goto 📝

EnlargeTrackTitle7

PT2/music/daw/reaper/themes does not exist
To
73 lines, 245 words, 1896 chars Page 'EnlargeTrackTitle7' does not exist.

The procedure is this:

  1. Go into Reaper resources folder.
  2. Unpack the default theme.
  3. Edit rtconfig.txt.
  4. Find the line with
    define_parameter LayoutA-tcpLabelLength 'Layout A - TCP Label Length' 100 40 300

    and change the first 100 to something like 300 so that it now reads

    define_parameter LayoutA-tcpLabelLength 'Layout A - TCP Label Length' 300 40 300
  5. Zip it all (with 0% compression) to make a new .ReaperThemeZip file.

See ../jda7.ReaperThemeZip for the default 7 theme with this change made.

Updater script

This takes the 7 default theme and makes the above modification, producing a new .ReaperThemeZip. Usage

./setTrackTitleWidth.py Default_7.0.ReaperThemeZip out.ReaperThemeZip 200

to set the width to 200.

The script

#!/usr/bin/env python
import sys
from zipfile import ZipFile
import os
import re

args = sys.argv[1:]
try:
  zfn, ozfn, newsize = args
  newsize = int(newsize)
except ValueError:
  print(f"{sys.argv[0]} <zipfilename> <outzipfilename> <newsize>")
  exit(1)

fn = "Default_7.0_unpacked/rtconfig.txt"
with ZipFile(zfn,"r") as zf:
  with zf.open(fn,"r") as rt:
    rtd = rt.read()
lines = rtd.decode().splitlines()
for i,line in enumerate(lines):
  if "LayoutA-tcpLabelLength" in line:
    sep = "'Layout A - TCP Label Length'"
    l,r = line.split(sep,1)
    r = re.sub('\d+',str(newsize),r,count=1)
    line = sep.join((l,r))
    lines[i] = line
    break
else:
  print(f"Couldn't find the line to change")
  exit(2)
rtd = "\r\n".join(lines).encode()
with ZipFile(zfn,"r") as zfi:
  with ZipFile(ozfn,"w") as zfo:
    nl = zfi.namelist()
    for x in nl:
      if x == fn:
        zfo.writestr(fn,rtd,compresslevel=0)
      else:
        with zfi.open(x,"r") as f:
          data = f.read()
        with zfo.open(x,"w") as f:
          f.write(data)
print("Written",ozfn)