Custom SwitchList Templates not appearing in program

37 views
Skip to first unread message

Michael Anteau

unread,
Nov 9, 2017, 11:07:02 AM11/9/17
to SwitchList
Hi Robert,

I'm still working with SwitchList and I've been investigating custom switchlists.  I downloaded the templates and placed them in Library/Application Support/SwitchList/ but they are not appearing in my program.  
It seems the swtich lists available for selection are actually coming from the Application - Show Package Contents  The directory is then Contents/Resources.  The built-in templates appear in this directory, and also in a sub directory called builtin-templates.

These directories are all write protected.  I have to edit the permissions on the directories if I want to make any changes.  

I tried changing the Railroad Letterhead switchlist.html in Contents/Resources and this DID change what is used in the program.  I increased the size of the railroad owner name.  But this also messed up the template and it no longer read in variables, so I restored the original from a backup copy.

I'm not sure where to put the custom templates since the Application Support doesn't seem to be working.  Am I missing something?

I'm running OSX Sierra (10.12.6) if that makes a difference.

Thanks for all your help!
Michael

Robert Bowdidge

unread,
Nov 9, 2017, 12:42:17 PM11/9/17
to switc...@googlegroups.com
Hi, Michael,

Whoops - I didn't realize the old instructions for custom switchlists were scattered around so far.

The best way to install new templates is to run SwitchList, choose the "Install Template…" menu item in the File menu, and select your template file. SwitchList will copy the file to the correct location. You can keep changing the template and re-installing it - things should still work.

I'll change the documentation on the (well-out-of-date) code.google.com and elsewhere. It should have been documented in the set of sample templates (at least in the README file), but the old answer still seems to be in a bunch of other public places.

Let me know if you've got any other questions about custom templates.

Background / more details / lots of technical stuff:

Mac programs have a couple places where they can store files related to a given program. They can hide files inside the .app itself (that is, in /Applications/SwitchList.app/...), but those files get replaced every time the program is changed. Mac programs can also put stuff in a special place in your own set of files; this place doesn't get deleted if you delete the program, or if you install a new version. SwitchList checks both places when it decides which switchlist styles are available.

In the old days, the special, local place has been in your (hidden) Library folder, in Library/Application Support/SwitchList. (The programs got to choose the directory themselves, and the Mac didn't check that programs didn't mess with other programs' files.) Starting around Mac OS X 10.9, Apple borrowed a security idea from the iPhone and iPad software, and moved the per-application files to Library/Containers/com.blogspot.vasonabranch.SwitchListApp/… Doing this meant they could ensure apps didn't mess with other programs' data.

I added the menu item for copying templates so folks didn't have to know where to put the custom switch lists for their particular mac.

If you want to make editing tweaks to your custom switchlist but don't want to keep installing it through SwitchList, you can edit the file directly. It'll be in:

Library/Containers/com.blogspot.vasonabranch.SwitchListApp/Data/Library/Application Support/SwitchList

Robert
> --
> You received this message because you are subscribed to the Google Groups "SwitchList" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to switchlist+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Michael Anteau

unread,
Nov 9, 2017, 1:52:49 PM11/9/17
to SwitchList
Terrific, that's exactly what I needed, and it's MUCH easier.
I've gotten my custom switchlist to appear, now I'm trying to figure out how to change font sizes.  I want everything to be a little bigger.  I copied a switchlist.css from one of the other templates, and changed all the font sizes from 10 to 14.  But it doesn't seem to work.  Am I missing something here?  
This is the switchlist.css file I put in the same directory as switchlist.html.
switchlist.css

Robert Bowdidge

unread,
Nov 10, 2017, 1:52:13 AM11/10/17
to switc...@googlegroups.com

> On Nov 9, 2017, at 10:52 AM, Michael Anteau <antea...@gmail.com> wrote:
>
> Terrific, that's exactly what I needed, and it's MUCH easier.
> I've gotten my custom switchlist to appear, now I'm trying to figure out how to change font sizes. I want everything to be a little bigger. I copied a switchlist.css from one of the other templates, and changed all the font sizes from 10 to 14. But it doesn't seem to work. Am I missing something here?
> This is the switchlist.css file I put in the same directory as switchlist.html.


The Railroad Letterhead doesn't include a separate CSS file, so it doesn't know to look at switchlist.css. Instead, all the CSS formatting is at the top of the file, in between the <style> and </style> tags. All of the freight cars get drawn in a big HTML table, so changing the font size for <TD> tags (table data - one of the cells of the table) will change the size of all the text. You can do that by changing:


p,li,td {
font-family: Arial;
font-size: 10pt;
}

to

p,li {
font-family: Arial;
font-size: 10pt;
}
td {
font-family: Arial;
font-size: 12pt;
}

That change separates the formatting for table cells from regular text ("<p> blah </p>") and dotted lists ("<li>"), and says that the table data cells should be 12 point while all the other kinds of text should default to 10 point.

Note that you don't need to load a template into SwitchList to see it - you can also load it into Safari (open in Safari like any other file, or drag your template file from the Finder to Safari.) All the template stuff won't look right, but you'll quickly get an idea how the formatting looks without going through multiple steps in SwitchList.

Just in case you're new to web pages and CSS, here's a quick rundown of cascading style sheets (CSS): (To learn more about CSS, there's a bunch of great tutorials on the Internet. All this is not only useful for customizing switchlists, but is also lets you customize web pages in general.

The stuff in the <style> .. </style> tags or stuff in a css file included by a web page lets you add formatting to regular HTML all at once - change how big bold text is, adjust the widths of blocks of text, or do even more clever and crazy things. CSS really is the basis for modern web pages. Each group in curly brackets in the style section of an HTML file specifies some kind of HTML that should have its formatting changed (the "selector"), and then names all the formatting - changes to CSS properties - to apply to things that match. CSS can apply to all of the matching tag in a file:

td {
color: blue;
}

says all table cells in the document should use blue text to draw.

You can narrow that by identifying only tags with a specific class by adding dot in front:

.reportingMarks {
color: red;
}

This looks for tag with class="reportingMarks":

<span class="reportingMarks"> B&O 12305 </span>

This causes the text for B&O 12305 (and all other things labelled as reportingMarks) to be drawn as red.

You can also indicate only a single thing should have that attribute:

#letterhead {
text-align: center;
}

says that anything with id="letterhead" should be centered: There's only supposed to be one tag with a particular id value in an HTML document:

<div id="letterhead"> My Railroad <br> 1 Market Street <br> San Francisco </div>

would make a big centered block with

My Railroad
1 Market Street
San Francisco
all centered.


Hope this helps,

Robert



Michael Anteau

unread,
Nov 10, 2017, 3:25:15 PM11/10/17
to SwitchList
Hi Robert,
Wow, what a great rundown of the CSS and HTML.  I've said before, but have to again, you provide excellent, friendly support for this product and I really appreciate it!!

I've got my report looking the way I want (image below).  One more question if you don't mind . . . when I print, there is a large margin at top and bottom, and the list sometimes runs over.  Is there a way to control this margin, or is that caused by my printer/printer driver.  I can't find anywhere to make it smaller.

Thanks again!!

Reply all
Reply to author
Forward
0 new messages