TKE  3.6
Advanced code editor for programmers
api Namespace Reference

Namespaces

 edit
 
 file
 
 menu
 
 plugin
 
 preferences
 
 sidebar
 
 theme
 
 utils
 

Functions

 tke_development interp pname
 
 get_plugin_source_directory interp pname
 
 get_plugin_data_directory interp pname
 
 get_images_directory interp pname
 
 get_home_directory interp pname
 
 normalize_filename interp pname host fname
 
 register_launcher interp pname description command
 
 unregister_launcher interp pname description
 
 log interp pname msg
 
 show_info interp pname msg args
 
 show_error interp pname msg ?detail?
 
 get_user_input interp pname msg pvar ?allow_vars?
 
 reset_text_focus interp pname ?txtt?
 

Function Documentation

§ get_home_directory()

api::get_home_directory   interp pname  
Returns
Returns the pathname to the user's home tke directory.

Definition at line 88 of file api.tcl.

88  proc get_home_directory {interp pname} {
89 
90  # Figure out the home directory
91  set home [file join $::tke_home plugins $pname]
92 
93  # If the home directory does not exist, create it
94  file mkdir $home
95 
96  if {[$interp issafe]} {
97  return [::safe::interpFindInAccessPath $interp $home]
98  } else {
99  return $home
100  }
101 
102  }

§ get_images_directory()

api::get_images_directory   interp pname  
Returns
Returns the pathname to the tke plugin images directory.

Definition at line 74 of file api.tcl.

74  proc get_images_directory {interp pname} {
75 
76  set img_dir [file join $::tke_dir plugins images]
77 
78  if {[$interp issafe]} {
79  return [::safe::interpFindInAccessPath $interp $img_dir]
80  } else {
81  return $img_dir
82  }
83 
84  }

§ get_plugin_data_directory()

api::get_plugin_data_directory   interp pname  
Returns
Returns the pathname to the plugin data directory.

Definition at line 55 of file api.tcl.

55  proc get_plugin_data_directory {interp pname} {
56 
57  set plugin_dir [file join $::tke_home plugins $pname]
58 
59  # Create the plugin directory if it does not exist
60  if {![file exists $plugin_dir]} {
61  catch { file mkdir $plugin_dir}
62  }
63 
64  if {[$interp issafe]} {
65  return [::safe::interpFindInAccessPath $interp $plugin_dir]
66  } else {
67  return $plugin_dir
68  }
69 
70  }

§ get_plugin_source_directory()

api::get_plugin_source_directory   interp pname  
Returns
Returns the pathname to the plugin source directory.

Definition at line 37 of file api.tcl.

37  proc get_plugin_source_directory {interp pname} {
38 
39  set iplugin_dir [file join $::tke_home iplugins $pname]
40 
41  if {![file exists $iplugin_dir]} {
42  set iplugin_dir [file join $::tke_dir plugins $pname]
43  }
44 
45  if {[$interp issafe]} {
46  return [::safe::interpFindInAccessPath $interp $iplugin_dir]
47  } else {
48  return $iplugin_dir
49  }
50 
51  }

§ get_user_input()

api::get_user_input   interp pname msg pvar ?allow_vars?  

Displays a widget that allows the user to provide input. This procedure will block until the user has either provided a response or has cancelled the input by hitting the escape key.

Parameters
msgMessage to display next to input field (prompt)
pvarReference to variable to store user input to
allow_varsIf set to 1, variables embedded in string will have substitutions performed; otherwise, the raw string will be returned. (Optional)
Returns
Returns a list containing two elements. The first element is set to a 1 if the user provided input; otherwise, returns 0 to indicate that the user cancelled the input operation. The second item is the user provided value (if the first value is set to 1).

Definition at line 190 of file api.tcl.

190  proc get_user_input {interp pname msg pvar {allow_vars 1}} {
191 
192  set var [$interp eval set $pvar]
193 
194  if {[gui::get_user_response $msg var -allow_vars $allow_vars]} {
195  $interp eval set $pvar [list $var]
196  return 1
197  }
198 
199  return 0
200 
201  }

§ log()

api::log   interp pname msg  

Logs the given information in the diagnostic logfile and standard output.

Parameters
msgMessage to display.

Definition at line 137 of file api.tcl.

137  proc log {interp pname msg} {
138 
139  puts $msg
140 
141  }

§ normalize_filename()

api::normalize_filename   interp pname host fname  
Returns
Returns a fully NFS normalized filename based on the given host.
Parameters
hostName of the host that contains the filename
fnameName of the file to normalize

Definition at line 109 of file api.tcl.

109  proc normalize_filename {interp pname host fname} {
110 
111  return [files::normalize $host $fname]
112 
113  }

§ register_launcher()

api::register_launcher   interp pname description command  

Registers the given description and command in the command launcher.

Definition at line 117 of file api.tcl.

117  proc register_launcher {interp pname description command} {
118 
119  launcher::register [format "%s-%s: %s" [msgcat::mc "Plugin"] $pname $description] "$interp eval $command"
120 
121  }

§ reset_text_focus()

api::reset_text_focus   interp pname ?txtt?  

Sets the text focus back to the last text widget to receive focus.

Definition at line 205 of file api.tcl.

205  proc reset_text_focus {interp pname {txtt ""}} {
206 
207  if {$txtt eq ""} {
208  after idle [list gui::set_txt_focus [gui::last_txt_focus]]
209  } else {
210  gui::get_info [winfo parent $txtt] txt tabbar tab
211  after idle [list gui::set_current_tab $tabbar $tab]
212  }
213 
214  }

§ show_error()

api::show_error   interp pname msg ?detail?  

Displays the given error message with detail information in a popup dialog window.

Parameters
msgMain error message
detailError message detailed information

Definition at line 169 of file api.tcl.

169  proc show_error {interp pname msg {detail ""}} {
170 
171  gui::set_error_message $msg $detail
172 
173  }

§ show_info()

api::show_info   interp pname msg args  

Displays the given message string in the information bar. The message must not contain any newline characters.

Parameters
msgMessage to display in the information bar
argsOptional arguments:

-clear_delay Specifies the number of milliseconds before the message be automatically removed from sight. -win If specified, the associated text widget path will be associated with the message such that if the text loses focus and then later regains the focus, the message will be redisplayed.

Definition at line 156 of file api.tcl.

156  proc show_info {interp pname msg args} {
157 
158  # Displays the given message
159  gui::set_info_message $msg {*}$args
160 
161  }

§ tke_development()

api::tke_development   interp pname  
Returns
Returns true if we are doing tke_development.

Definition at line 29 of file api.tcl.

29  proc tke_development {interp pname} {
30 
31  return [::tke_development]
32 
33  }

§ unregister_launcher()

api::unregister_launcher   interp pname description  

Unregisters a previously registered command launcher with the same description.

Definition at line 126 of file api.tcl.

126  proc unregister_launcher {interp pname description} {
127 
128  launcher::unregister [format "%s-%s: %s" [msgcat::mc "Plugin"] $pname $description]
129 
130  }