4.3.1. StandaloneTools package¶
Submodules¶
StandaloneTools.GenerateSecretKey module¶
GenerateSecretKey.py - program to generate a secret key.
StandaloneTools.LoadLocationData module¶
LoadLocationData.py - Load location data into Row/Bin/Tier and Location tables.
Although the Constraints table has the min/max or list values this program needs, the values are hard coded here because the records in the Constraints table are about to go away.
The philosophy used here is that there are certain essential rows, bins, and tiers that make up the components of warehouse locations. This program will add those rows, bins, tiers and locations to the database. This program doesn’t care if the descriptions for these records have changed, but requires that records with specific keys must be present in the database. Once the database has been pre-loaded, the users are free to make changes as desired.
-
StandaloneTools.LoadLocationData.
BIN_MAX
= 9¶ Maximum bin number
-
StandaloneTools.LoadLocationData.
BIN_MIN
= 1¶ Minimum bin number
-
StandaloneTools.LoadLocationData.
ECHO_SQL_TO_LOG
= True¶ Indicator of if the SQL statements should be copied to the log
-
class
StandaloneTools.LoadLocationData.
LoadLocationDataClass
[source]¶ Bases:
object
LoadLocationDataClass - Load location data into location tables.
-
connect
(user: str, password: str, db: str, host: str = 'localhost', port: int = 5432) → <module ‘sqlalchemy.engine’ from ‘/home/docs/checkouts/readthedocs.org/user_builds/food-pantry-inventory/envs/latest/lib/python3.7/site-packages/sqlalchemy/engine/__init__.py’>[source]¶ Establish a connection to the desired PostgreSQL database.
- Parameters
user –
password –
db –
host –
port –
- Returns
-
load_bin_table
(session: sessionmaker(class_=’Session’, bind=None, autoflush=True, autocommit=False, expire_on_commit=True))[source]¶ Load the bin table with values from min to max.
- Returns
-
load_location_table
(session: sessionmaker(class_=’Session’, bind=None, autoflush=True, autocommit=False, expire_on_commit=True))[source]¶ Construct location records from the row/bin/tier records.
The location code consists of the row code, bin code, and tier code jammed together into a six character id.
- Returns
-
load_row_table
(session: sessionmaker(class_=’Session’, bind=None, autoflush=True, autocommit=False, expire_on_commit=True))[source]¶ Load the row table with values from min to max.
- Session
- Returns
-
-
class
StandaloneTools.LoadLocationData.
Main
[source]¶ Bases:
object
Main class to start things rolling.
-
StandaloneTools.LoadLocationData.
ROW_MAX
= 4¶ Maximum row number
-
StandaloneTools.LoadLocationData.
ROW_MIN
= 1¶ Minimum row number
-
StandaloneTools.LoadLocationData.
TIER_LIST
= ['A1', 'A2', 'B1', 'B2', 'C1', 'C2']¶ List of valid tier names
-
StandaloneTools.LoadLocationData.
log
= None¶ # # # # # Constants # # # # #
StandaloneTools.QRCodePrinter module¶
Standalone tool to print QR codes.
- Usage:
QRCodePrinter.py -p=<URL_prefix> -s <nnn> -c <nnn> -o <file> QRCodePrinter.py -h | –help QRCodePrinter.py –version
Options:
- -p <URL_prefix>, --prefix=<URL_prefix>
The URL prefix for the box number
- -s <nnn>, --start=<nnn>
Starting box number to use
- -c <nnn>, --count=<nnn>
Number of QR codes to print
- -o <file>, --output=<file>
Output file name
- -h, --help
Show this help and quit.
- -v, --version
Show the version of this program and quit.
-
class
StandaloneTools.QRCodePrinter.
LabelPosition
(page_offset: dataclasses.InitVar, lower_left_offset: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0), lower_right_offset: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0), upper_left_offset: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0), upper_right_offset: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0), offset_on_page: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0), image_start: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0), title_start: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0))[source]¶ Bases:
object
Container for measurements for one label.
All measurements are in points. x denotes horizontal measurement y denotes vertical origin is in lower left corner label is assumed to be 2 in x 2 in ( 144 pt x 144 pt)
-
image_start
: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0)¶
-
lower_left_offset
: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0)¶
-
lower_right_offset
: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0)¶
-
offset_on_page
: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0)¶
-
page_offset
: InitVar[Point]¶
-
title_start
: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0)¶
-
upper_left_offset
: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0)¶
-
upper_right_offset
: StandaloneTools.QRCodePrinter.Point = Point(x=0, y=0)¶
-
-
class
StandaloneTools.QRCodePrinter.
Point
(x: int, y: int)[source]¶ Bases:
object
Horizontal (x) and vertical (y) coordinate.
-
x
: int¶
-
y
: int¶
-
-
class
StandaloneTools.QRCodePrinter.
QRCodePrinterClass
(workdir: pathlib.Path)[source]¶ Bases:
object
QRCodePrinterClass - Print QR Codes
-
compute_box_dimensions
()[source]¶ Compute the dimensions and bounding boxes for each label on the page. :return:
-
connect
(user, password, db, host='localhost', port=5432)[source]¶ Establish a connection to the desired PostgreSQL database.
- Parameters
user –
password –
db –
host –
port –
- Returns
-
draw_bounding_box
(label_pos: int)[source]¶ Draw a bounding box around the specified label.
- Parameters
label_pos – position in the labels locations list.
- Returns
-
get_next_box_number
() -> (<class 'str'>, <class 'int'>)[source]¶ Search for the next box number to go on a label.
- Returns
-
get_next_box_url
() -> (<class 'str'>, <class 'str'>)[source]¶ Build the URL for the next box. :return:
-
get_next_qr_img
() -> (<class 'str'>, <class 'str'>)[source]¶ Build the QR image for the next box label.
- Returns
a QR code image ready to print
-