Skip to content

Commit 3a1e3f0

Browse files
Improved documentation
1 parent 2683522 commit 3a1e3f0

File tree

1 file changed

+40
-12
lines changed

1 file changed

+40
-12
lines changed

scripts/constants.py

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,34 @@
2525
2626
"""
2727
import os
28+
29+
# Obsolete: This will be autodetected at runtime
2830
SCREEN_W = 800 ## raspi touch
2931
SCREEN_H = 480 ## raspi touch
3032

33+
# Parameters for the three main effects
34+
# None: simple shot
35+
# Four: Collage of four shots
36+
# Animation : animated gif
3137
EFFECTS_PARAMETERS = {
3238
"None": {
33-
'snap_size' : (1640,1232),
34-
'logo_size' : 128,
35-
'logo_padding' : 32
39+
'snap_size' : (1640,1232), #(width, height) => preferably use integer division of camera resolution
40+
'logo_size' : 128, # height in pixels of the logo (will be thumbnailed to this size)
41+
'logo_padding' : 32 # bottom and right padding of the logo (pixels)
3642
},
3743
"Four": {
38-
'snap_size' : (820,616),
39-
'foreground_image' : "collage_four_square.png"
44+
'snap_size' : (820,616), #(width, height) of each shots of the 2x2 collage
45+
'foreground_image' : "collage_four_square.png" # Overlay image on top of the collage
4046
},
4147
"Animation": {
42-
'snap_size' : (500, 500),
43-
'frame_number' : 10,
44-
'snap_period_millis' : 200,
45-
'gif_period_millis' : 50
48+
'snap_size' : (500, 500), #(width, height) => Caution, gif animation can be huge, keep this small
49+
'frame_number' : 10, # number of frames in the animation
50+
'snap_period_millis' : 200, # time interval between two snapshots
51+
'gif_period_millis' : 50 # time interval in the animated gif
4652
}
4753
}
4854

55+
# Path to icons for the software buttons (no hardware buttons setup)
4956
SOFTWARE_BUTTONS = {
5057
"None": {
5158
"icon" : os.path.join("ressources","ic_photo.png")
@@ -58,12 +65,19 @@
5865
}
5966
}
6067

68+
# GPIO pin / Snapshots modes mapping
69+
# 'button_pins' are matched in this order ["No effect", "Four images", "Animation"]
70+
# 'pull_up_down' activates a pull_up or a pull_down on the GPIO pin itself (no external resistor needed)
71+
# 'active_state' should be 1 or 0: this is the value returned by the GPIO when switch is activated
6172
HARDWARE_BUTTONS = {
6273
"button_pins": [10,8,12], # Change this and the following to reflect your hardware buttons
6374
"pull_up_down": "pull_down", # pull_up or pull_down
6475
"active_state": 1 # active 1 GPIO (pull_down with switch to VDD)
6576
}
6677

78+
#Keyboard shorcuts for actions
79+
#shortcut list must be valid tkinter events
80+
#See : http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm
6781
ACTIONS_KEYS_MAPPING = {
6882
"snap_None": ["s","S","<F1>"],
6983
"snap_Four": ["f","F","<F2>"],
@@ -73,21 +87,35 @@
7387
#,"send_print":["P"] #Uncomment if you want to a keyboard shortcut for printing
7488
}
7589

90+
#Image list for in-preview countdown
91+
#Use as many as you want
92+
# COUNTDOWN_OVERLAY_IMAGES[0] will be used during the last second of countdown
93+
# COUNTDOWN_OVERLAY_IMAGES[1] will be used during 1s to 2s
94+
# ...
95+
# last image of the list will be used for greater counts
96+
# (e.g. during the first 5 secs of a 10 secs countdown in this case)
7697
COUNTDOWN_OVERLAY_IMAGES=[
7798
os.path.join("ressources","count_down_1.png"),
7899
os.path.join("ressources","count_down_2.png"),
79100
os.path.join("ressources","count_down_3.png"),
80101
os.path.join("ressources","count_down_4.png"),
81102
os.path.join("ressources","count_down_5.png"),
82103
os.path.join("ressources","count_down_ready.png")]
83-
COUNTDOWN_IMAGE_MAX_HEIGHT_RATIO = 0.2 #(0. - 1.) Ratio of the countdown images over screen height
104+
# this defines the height ratio of the countdown images wrt. the preview size
105+
COUNTDOWN_IMAGE_MAX_HEIGHT_RATIO = 0.2 #[0. - 1.] range
84106

107+
# Path to button icon ressources
85108
EMAIL_BUTTON_IMG = os.path.join("ressources","ic_email.png")
86109
PRINT_BUTTON_IMG = os.path.join("ressources","ic_print.png")
110+
111+
# Interval in ms between two authentication tokens refreshing
87112
OAUTH2_REFRESH_PERIOD = 1800000 # interval between two OAuth2 token refresh (ms)
88-
HARDWARE_POLL_PERIOD = 100 # poll interval for buttons (ms)
89113

114+
# Polling interval for hardware buttons (ms)
115+
HARDWARE_POLL_PERIOD = 100
116+
117+
# Path of various log and configuration files
90118
CONFIGURATION_FILE = "configuration.json"
91-
APP_ID_FILE = "client_id.json"
119+
APP_ID_FILE = "client_id.json"
92120
CREDENTIALS_STORE_FILE = "credentials.dat"
93121
EMAILS_LOG_FILE = os.path.join("..","sendmail.log") # you should activate 'enable_mail_logging' key in configuration.json

0 commit comments

Comments
 (0)