Hog v9.51.0
add_hog_custom_button.tcl
Go to the documentation of this file.
1 #!/usr/bin/env tclsh
2 # Copyright 2018-2025 The University of Birmingham
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 # @file
17 # Creates two custom buttons in Vivado gui with Hog logo, to update automatically list files and hog.conf
18 
19 set hog_path [file normalize "[file dirname [info script]]/../.."]
20 
21 
22 remove_gui_custom_commands -quiet Hog_check
23 create_gui_custom_command -name Hog_check -description "Check Hog list files and hog.conf" -show_on_toolbar -toolbar_icon $hog_path/images/hog_check.png -command "if {\[info exists env(HOG_EXTERNAL_PATH)\]} {set argv \[list \"-ext_path\" \"\$env(HOG_EXTERNAL_PATH)\"]} else { set argv \"\" }; set proj_file \[get_property DIRECTORY \[current_project\]\]; set index \[string last \"Projects/\" \$proj_file\]; set index \[expr \$index - 2\]; set repo_path \[string range \$proj_file 0 \$index\];
24 source -notrace \$repo_path/Hog/Tcl/utils/check_list_files.tcl; set argv \[list\]"
25 
26 
27 remove_gui_custom_commands -quiet Hog_listFiles
28 create_gui_custom_command -name Hog_listFiles -description "Recreate Hog list files (overwrites the old ones)" -show_on_toolbar -toolbar_icon $hog_path/images/hog_list.png -command "if {\[info exists env(HOG_EXTERNAL_PATH)\]} {set argv \[list \"-recreate\" \"-force\"\ \"-ext_path\" \"\$env(HOG_EXTERNAL_PATH)\"]} else { set argv \[list \"-recreate\" \"-force\"\] }; set proj_file \[get_property DIRECTORY \[current_project\]\]; set index \[string last \"Projects/\" \$proj_file\]; set index \[expr \$index - 2\]; set repo_path \[string range \$proj_file 0 \$index\];
29 source -notrace \$repo_path/Hog/Tcl/utils/check_list_files.tcl; set argv \[list\]"
30 
31 
32 remove_gui_custom_commands -quiet Hog_conf
33 create_gui_custom_command -name Hog_conf -description "Recreate hog.conf (overwrites the old ones)" -show_on_toolbar -toolbar_icon $hog_path/images/hog_cfg.png -command "if {\[info exists env(HOG_EXTERNAL_PATH)\]} {set argv \[list \"-recreate_conf\" \"-force\"\ \"-ext_path\" \"\$env(HOG_EXTERNAL_PATH)\"]} else { set argv \[list \"-recreate_conf\" \"-force\"\] }; set proj_file \[get_property DIRECTORY \[current_project\]\]; set index \[string last \"Projects/\" \$proj_file\]; set index \[expr \$index - 2\]; set repo_path \[string range \$proj_file 0 \$index\]; source -notrace \$repo_path/Hog/Tcl/utils/check_list_files.tcl; set argv \[list\]"
34 
35 
36 remove_gui_custom_commands -quiet Hog_sim
37 create_gui_custom_command -name Hog_sim -description "Recreate hog sim list files (overwrites the old ones)" -show_on_toolbar -toolbar_icon $hog_path/images/hog_sim.png -command "if {\[info exists env(HOG_EXTERNAL_PATH)\]} {set argv \[list \"-recreate_sim\" \"-force\"\ \"-ext_path\" \"\$env(HOG_EXTERNAL_PATH)\"]} else { set argv \[list \"-recreate_sim\" \"-force\"\] }; set proj_file \[get_property DIRECTORY \[current_project\]\]; set index \[string last \"Projects/\" \$proj_file\]; set index \[expr \$index - 2\]; set repo_path \[string range \$proj_file 0 \$index\]; source -notrace \$repo_path/Hog/Tcl/utils/check_list_files.tcl; set argv \[list\]"