1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
|
#
# Copyright (c) 2002, 2003 Art Haas
#
# This file is part of PythonCAD.
#
# PythonCAD is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PythonCAD is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with PythonCAD; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# menu code
#
# the menu things below should remain interface neutral
#
primary_menus = [('_File', 'FILE_MENU', 'file_menu_init'),
('_Edit', 'EDIT_MENU', 'edit_menu_init'),
('_Draw', 'DRAW_MENU', 'draw_menu_init'),
('_Modify', 'MODIFY_MENU', 'modify_menu_init'),
('D_imensions', 'DIMENSION_MENU', 'dimension_menu_init'),
('De_bug', 'DEBUG_MENU', 'debug_menu_init'),
]
submenus = {}
file_menu = [ ['_New', 'file_new', 'NEW', 'N' ],
['_Open', 'file_open', 'OPEN', 'O'],
['_Close', 'file_close', 'CLOSE', 'W'],
[None],
['_Save', 'file_save', 'SAVE', 'S'],
['Save As ...', 'file_save_as', 'SAVE_AS', None],
['Save Layer As ...', 'file_save_layer', None, None],
[None],
['Print Screen', 'file_print_screen', None, None],
['_Print', 'file_print', 'PRINT', 'P'],
['_Quit', 'file_quit', 'QUIT', 'Q'],
]
submenus['FILE_MENU'] = file_menu
edit_menu = [ ['Undo', 'edit_undo', 'UNDO', 'Z'],
['Redo', 'edit_redo', 'REDO', None],
[None],
['Cut', 'edit_cut', 'CUT', 'X'],
['Copy', 'edit_copy', 'COPY', 'C'],
['Paste', 'edit_paste', 'PASTE', 'V'],
[None],
['Select', 'select_cb', None, None],
['Select All ...', 'EDIT_SELECT_ALL_MENU', 'select_all_init'],
[None],
['Preferences', 'prefs', 'PREFS', None]
]
submenus['EDIT_MENU'] = edit_menu
edit_select_all_menu = [ ['Points', 'select_all_points', None, None],
['Segments', 'select_all_segments', None, None],
['Circles', 'select_all_circles', None, None],
['Arcs', 'select_all_arcs', None, None],
['HCLines', 'select_all_hclines', None, None],
['VCLines', 'select_all_vclines', None, None],
['ACLines', 'select_all_aclines', None, None],
['CLines', 'select_all_clines', None, None],
['CCircles', 'select_all_ccircles', None, None],
['Linear Dims', 'select_all_ldims', None, None],
['Horiz. Dims', 'select_all_hdims', None, None],
['Vert. Dims', 'select_all_vdims', None, None],
['Radial Dims.', 'select_all_rdims', None, None],
['Angular Dims.', 'select_all_adims', None, None],
['TextBlocks', 'select_all_tblocks', None, None],
['Chamfers', 'cb', None, None],
['Fillets', 'cb', None, None],
]
submenus['EDIT_SELECT_ALL_MENU'] = edit_select_all_menu
draw_menu = [ ['Basic', 'DRAW_BASIC_MENU', 'draw_basic_init'],
['Con. Lines', 'DRAW_CONLINES_MENU', 'draw_conlines_init'],
['Con. Circles', 'DRAW_CONCIRCS_MENU', 'draw_concircs_init'],
['Chamfer', 'draw_chamfer', None, None],
['Fillet', 'draw_fillet', None, None],
[None],
['Leader', 'draw_leader', None, None],
[None],
['Polyline', 'draw_polyline', None, None],
[None],
['Polygon', 'draw_polygon', None, None],
['Polygon (ext)', 'draw_ext_polygon', None, None],
[None],
['Text', 'draw_text', None, None],
[None],
['Set ...', 'DRAW_SET_MENU', 'draw_set_init'],
[None],
['Add New ...', 'DRAW_ADD_MENU', 'draw_add_init']
]
submenus['DRAW_MENU'] = draw_menu
draw_basic_menu = [ ['Points', 'draw_point' , None, None],
['Segments', 'draw_segment', None, None],
['Rectangles', 'draw_rectangle', None, None],
['Circle (cen)', 'draw_circle_center', None, None],
['Circle (2 pts)', 'draw_circle_tp', None, None],
['Arc', 'draw_arc_center', None, None],
]
submenus['DRAW_BASIC_MENU'] = draw_basic_menu
draw_conlines_menu = [ ['Horizontal', 'draw_hcl', None, None],
['Vertical', 'draw_vcl', None, None],
['Angled', 'draw_acl', None, None],
['Two-Point', 'draw_cl', None, None],
['Perpendicular', 'draw_perpendicular_cline', None, None],
['Tangent', 'draw_tangent_cline', None, None],
['Tangent 2 Circs', 'draw_tangent_two_ccircles', None, None],
['Parallel', 'draw_poffset_cline', None, None],
]
submenus['DRAW_CONLINES_MENU'] = draw_conlines_menu
draw_concircs_menu = [ ['Center Point', 'draw_ccirc_cp', None, None],
['Two-Point', 'draw_ccirc_tp', None, None],
['Tangent', 'DRAW_TANGENT_CCIRCLE_MENU', 'draw_tangent_ccircle_menu_init']
]
submenus['DRAW_CONCIRCS_MENU'] = draw_concircs_menu
draw_tangent_ccircle_menu = [ ['One object', 'draw_tangent_single_conobj', None, None],
['Two objects', 'draw_tangent_two_conobjs', None, None],
]
submenus['DRAW_TANGENT_CCIRCLE_MENU'] = draw_tangent_ccircle_menu
draw_set_menu = [ ['Style', 'draw_set_style', None, None],
['Linetype', 'draw_set_linetype', None, None],
['Color', 'draw_set_color', None, None],
['Thickness', 'draw_set_thickness', None, None],
]
submenus['DRAW_SET_MENU'] = draw_set_menu
draw_add_menu = [ ['Style', 'cb', None, None],
['Linetype', 'cb', None, None],
['Color', 'cb', None, None],
]
submenus['DRAW_ADD_MENU'] = draw_add_menu
modify_menu = [ ['Move ...', 'MODIFY_MOVE_MENU', 'modify_move_init'],
['Stretch ...', 'MODIFY_STRETCH_MENU', 'modify_stretch_init'],
['Split', 'split', None, None],
['Mirror', 'mirror', None, None],
['Transfer', 'transfer', None, None],
[None],
['Delete', 'delete', 'DELETE', None],
[None],
['Change ...', 'MODIFY_CHANGE_MENU', 'modify_change_init'],
[None],
['Zoom', 'zoom', None, None],
['Zoom In', 'zoom_in', 'ZOOM_IN', None],
['Zoom Out', 'zoom_out', 'ZOOM_OUT', None],
['Zoom Fit', 'zoom_fit', 'ZOOM_FIT', None],
]
submenus['MODIFY_MENU'] = modify_menu
modify_move_menu = [ ['Horizontal' ,'move_horiz', None, None],
['Vertical', 'move_vert', None, None],
['Both', 'move_twopoint', None, None],
]
submenus['MODIFY_MOVE_MENU'] = modify_move_menu
modify_stretch_menu = [ ['Horizontal', 'stretch_horiz', None, None],
['Vertical', 'stretch_vert', None, None],
['Both', 'stretch_twopoint', None, None],
]
submenus['MODIFY_STRETCH_MENU'] = modify_stretch_menu
modify_change_menu = [ ['Style', 'change_style', None, None],
['Linetype', 'change_linetype', None, None],
['Color', 'change_color', None, None],
['Thickness', 'change_thickness', None, None],
['Text ...', 'MODIFY_TEXTBLOCK_MENU', 'modify_textblock_init'],
['Dimension ...', 'MODIFY_DIMENSION_MENU', 'modify_dimension_init'],
]
submenus['MODIFY_CHANGE_MENU'] = modify_change_menu
modify_textblock_menu = [ ['Family', 'change_textblock_family', None, None],
['Weight', 'change_textblock_weight', None, None],
['Style', 'change_textblock_style', None, None],
['Color', 'change_textblock_color', None, None],
['Size', 'change_textblock_size', None, None],
# ['Angle', 'cb', None, None],
['Alignment', 'change_textblock_alignment', None, None]
]
submenus['MODIFY_TEXTBLOCK_MENU'] = modify_textblock_menu
modify_dimension_menu = [ ['Endpoint', 'change_dim_endpoint', None, None],
['Endpoint Size', 'change_dim_endpoint_size', None, None],
['Offset Length', 'change_dim_offset', None, None],
['Extension Length', 'change_dim_extension', None, None],
['Dual Mode', 'change_dim_dual_mode', None, None],
['Dual Mode Offset', 'change_dim_dual_mode_offset', None, None],
['Thickness', 'change_dim_thickness', None, None],
['Color', 'change_dim_color', None, None],
# ['Text Position', 'cb', None, None],
# ['Text Pos. Offset', 'cb, None, None],
['Primary Dimstring', 'change_primary_dim', None, None],
['Secondary Dimstring', 'change_secondary_dim', None, None],
]
submenus['MODIFY_DIMENSION_MENU'] = modify_dimension_menu
dimension_menu = [ ['Linear', 'dimension_linear' , None, None ],
['Horizontal', 'dimension_horiz', None, None ],
['Vertical', 'dimension_vert', None, None ],
['Radial', 'dimension_rad', None, None],
['Angular', 'dimension_ang', None, None ],
]
submenus['DIMENSION_MENU'] = dimension_menu
debug_menu = [ ['Focus', 'get_focus_widget', None, None],
['UndoStack', 'undo_stack', None, None],
['RedoStack', 'redo_stack', None, None],
['ImageUndo', 'image_undo', None, None],
['ImageRedo', 'image_redo', None, None],
['GC', 'collect_garbage', None, None],
]
submenus['DEBUG_MENU'] = debug_menu
|