diff options
| author | Håkon Solbjørg <hlsolbjorg@gmail.com> | 2019-04-02 19:58:09 +0200 | 
|---|---|---|
| committer | Håkon Solbjørg <hlsolbjorg@gmail.com> | 2019-04-02 20:04:54 +0200 | 
| commit | cf5ca630fe3e34172ba1216e7e33d0f284d43ba7 (patch) | |
| tree | 183d0401c34d71cbcc936241366b5f390391834f /tech-support/labels/old | |
| parent | 7b2c213167401f8100031f38c61679b161d5d73e (diff) | |
chore: Move tech support label scripts to own folder.
After importing all the scripts from another repo.
Diffstat (limited to 'tech-support/labels/old')
| -rw-r--r-- | tech-support/labels/old/README.txt | 29 | ||||
| -rw-r--r-- | tech-support/labels/old/cable_labels.pl | 16 | ||||
| -rw-r--r-- | tech-support/labels/old/switch_labels.py | 120 | 
3 files changed, 165 insertions, 0 deletions
| diff --git a/tech-support/labels/old/README.txt b/tech-support/labels/old/README.txt new file mode 100644 index 0000000..fa02d44 --- /dev/null +++ b/tech-support/labels/old/README.txt @@ -0,0 +1,29 @@ +Disse filene brukes for � generere merking av kabler og switcher til The Gathering (Eller andre event med lignende behov) + +############## +switch_lables.py: +############## +Brukes til � generere lapper som henges opp p� switcher/switchstativer for enkel identifisering. + + +Howto: +Endre configen i filen (Antall rader, antall switcher, filnavn + eventuell config for Creativia), og kj�r filen med python. + +Den lager en HTML fil med valgt navn, som s� kan printes i en vanlig printer. + + +############## +cable_lables.pl +############## +Brukes til � generere teksten til lappene som settes i begge ender av alle kablene i hallen. + +CSV-filen mates inn i dymo programvaren og formatteres der. Husk at alle lapper m� skrives ut i to eksemplarer. + +Howto: +Kj�r filen med perl, sett variablene og pipe ut til csv med passende navn. + +Variablene filen spiser er f�lgende: Antall rader, antall switcher per rad, antall kabler per switch. + +Eksempel:  + +perl cable_lables.pl 82 4 4 > Lapper.csv diff --git a/tech-support/labels/old/cable_labels.pl b/tech-support/labels/old/cable_labels.pl new file mode 100644 index 0000000..b461d03 --- /dev/null +++ b/tech-support/labels/old/cable_labels.pl @@ -0,0 +1,16 @@ +#!/usr/bin/perl +  +use strict; +use warnings; +  +my ($rows, $switches, $cables) = @ARGV; +  +for my $row (1 .. $rows) { +    next if (!($row & 1)); +  +    for my $switch (1 .. $switches) { +        for my $cable (1 .. $cables) { +            print join('-', ($row, $switch, $cable)) . ';' . "\n"; +        } +    } +} diff --git a/tech-support/labels/old/switch_labels.py b/tech-support/labels/old/switch_labels.py new file mode 100644 index 0000000..867c5ab --- /dev/null +++ b/tech-support/labels/old/switch_labels.py @@ -0,0 +1,120 @@ +#!/usr/bin/python +#coding: utf-8 +# +#	@version: 0.1 +#	@date:	19.04.2011 +# +#	@description: A quick script to output a html page that prints  +#				  switch labels in the format: <row>-<switch>  +#				  i.e:  71-4. One label per page.    +#				 +#				  NB! only makes odd number labels.  +# +#	@author:	technocake +#	Found at: 	blog.technocake.net +#-------------------------------------------- + +import sys + +###################################### +#	Configuration +###################################### +rows 		= 84	#rows +switches 	= 4	#switches per row +outFile 	= "tg-switch-labels-print-me.html" + + +#### CREATIVIA #### +creative_rows		= 12 +creative_prepend	= "C" + + +output = "" + +# the top of the html page +def head(): +        return """<!Doctype html> +<html> <head> +<style> +	div.a4 { +		font-size: 24em; +		text-align: center; +		@page size: A4 landscape; +		 +		/* this is the part that makes each div print per page. */ +		page-break-after: always; 	 +	} +</style> +</head> +<body> +""" + +#the bottom of the html page +def tail(): +        return  "</body></html>"  + +#ONE switch label +def a4(s ): +	return "<div class='a4'> %s </div>" % (s, ) + + +def saveToFile(data, fileName): +	f = open(fileName, 'w+') +	f.write( data ) +	f.close() + +#	In python 3, raw_input is renamed to input. In python v <3. input does something else. +#	this function fixes that +def prompt(text): +        try: +                return raw_input(text) +        except: +                try: +                        return input(text) + +                except: +                        exit() +	 + +################################################### +#	This is where the actual generating	takes place +###################################################	 + + +if __name__ == "__main__": +	output += head()  + + +	#Generating all the labels for the switches +	for row in range(1, rows+1, 2): +		for SWITCH in range(1, switches+1): +			output += a4("%s-%s\n" % (row, SWITCH) )  + + +	# Generating all the labels for the CREATIVE area +	for row in range(1, creative_rows+1): +		output += a4("%s-%s\n" % (creative_prepend, row)) + + +			 +	output += tail()  + +	#	Taking it out to the big tg-world + +	if len(sys.argv) > 1:	 +		#Printing to stdout if second argument is passed to the script +		print ( output ) +	else: +		saveToFile(output, outFile)	 +		#normally, this is what happens. Saving it to a new html file + + +	print ( """  +	Generated labels for %d switches per row and %d rows. \n +	The html file is in this folder, and is named %s \n +	Pages to print:  %d \n\n +	"""  +		% (switches, rows, outFile, (switches*rows)/2 + creative_rows) +	) +	 +	prompt( "Press any key to exit...")
\ No newline at end of file | 
