a16715080654094a1aba91dc6e19d61a3beec174
[debian/gnuradio] / grc / src / grc / Constants.py.in
1 """
2 Copyright 2008 Free Software Foundation, Inc.
3 This file is part of GNU Radio
4
5 GNU Radio Companion is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
9
10 GNU Radio Companion is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18 """
19 ##@package grc.Constants
20 #Global constants
21 #@author Josh Blum
22
23 import os
24
25 ######################################################################################################
26 ## Global Titles
27 ######################################################################################################
28
29 ##The current version of this code
30 VERSION = '@VERSION@'
31
32 ##The name to appear in the main window for a flow graph that has not been saved to file.
33 NEW_FLOGRAPH_TITLE = 'untitled'
34
35 ##The prefix title on the main window.
36 MAIN_WINDOW_PREFIX = "GRC"
37
38 ######################################################################################################
39 ## Signal block connector lengths
40 ######################################################################################################
41
42 ##The length that a connection must extend from the port until the length depends on the index of the port.
43 CONNECTOR_EXTENSION_INITIAL_LENGTH = 11
44
45 ##The length that a connection must extend from the initial length times the index of the port, after this length, the connection may have a bend.
46 CONNECTOR_EXTENSION_LENGTH = 11
47
48 ##The length of the connector arrow base in pixels
49 CONNECTOR_ARROW_BASE = 13
50
51 ##The length of the connector arrow height in pixels
52 CONNECTOR_ARROW_HEIGHT = 17
53
54 ######################################################################################################
55 ## Signal block rotations
56 ######################################################################################################
57
58 ##List of possible angles (in degrees) that a block can be rotated to.
59 POSSIBLE_ROTATIONS = (0, 90, 180, 270)
60
61 ##direction of rotation left.
62 DIR_LEFT = 'left'
63
64 ##direction of rotation right.
65 DIR_RIGHT = 'right'
66
67 ######################################################################################################
68 ## Dimension constraints for the various windows (in pixels)
69 ######################################################################################################
70
71 ##main window constraints
72 MIN_WINDOW_WIDTH = 600
73 MIN_WINDOW_HEIGHT = 400
74
75 ##dialog constraints
76 MIN_DIALOG_WIDTH = 500
77 MIN_DIALOG_HEIGHT = 500
78
79 ##static height of reports window
80 REPORTS_WINDOW_HEIGHT = 100
81
82 ##static width of block selection window
83 BLOCK_SELECTION_WINDOW_WIDTH = 200
84
85 ######################################################################################################
86 ## Constraints on displayable labels and ports
87 ######################################################################################################
88
89 LABEL_SEPARATION = 3
90 LABEL_PADDING_WIDTH = 9
91 LABEL_PADDING_HEIGHT = 9
92
93 PORT_SEPARATION = 17
94 PORT_HEIGHT = 15
95 PORT_WIDTH = 25
96 PORT_BORDER_SEPARATION = 9
97 MAX_NUM_PORTS = 7
98
99 PARAM_LABEL_FONT = 'Sans 9.5'
100 PARAM_FONT = 'Sans 7.5'
101 BLOCK_FONT = 'Sans 8'
102 PORT_FONT = 'Sans 7.5'
103
104 ######################################################################################################
105 ## Dragging, scrolling, and redrawing constants for the flow graph window in pixels
106 ######################################################################################################
107
108 ##How close can the mouse get to the window border before mouse events are ignored.
109 BORDER_PROXIMITY_SENSITIVITY = 50
110
111 ##How close the mouse can get to the edge of the visible window before scrolling is invoked.
112 SCROLL_PROXIMITY_SENSITIVITY = 30
113
114 ##When the window has to be scrolled, move it this distance in the required direction.
115 SCROLL_DISTANCE = 15
116
117 ##The redrawing sensitivity, how many seconds must pass between motion events before a redraw?
118 MOTION_DETECT_REDRAWING_SENSITIVITY = .02
119
120 ##How close the mouse click can be to a connection and register a connection select.
121 CONNECTION_SELECT_SENSITIVITY = 5
122
123 ######################################################################################################
124 # A state is recorded for each change to the flow graph, the size dictates how many states we can record
125 ######################################################################################################
126
127 ##The size of the state saving cache in the flow graph (for undo/redo functionality)
128 STATE_CACHE_SIZE = 42
129
130 ######################################################################################################
131 ## Constansts dealing with File Paths
132 ######################################################################################################
133
134 ##Location of external data files.
135 DATA_DIR = '@datadir@'
136
137 ##DTD validator for saved flow graphs.
138 FLOW_GRAPH_DTD = os.path.join(DATA_DIR, 'flow_graph.dtd')
139
140 ##The default file extension for flow graphs.
141 FLOW_GRAPH_FILE_EXTENSION = '.grc'
142
143 ##The default file extension for saving flow graph snap shots.
144 IMAGE_FILE_EXTENSION = '.png'
145
146 ##The default path for the open/save dialogs.
147 DEFAULT_FILE_PATH = os.getcwd()
148
149 ##The default icon for the gtk windows.
150 PY_GTK_ICON = os.path.join(DATA_DIR, 'grc-icon-256.png')
151
152 ##The users home directory.
153 HOME_DIR = os.path.expanduser('~')
154