summaryrefslogtreecommitdiff
path: root/databases/mysql-workbench/patches/patch-library_grt_src_grtpp__shell__python__help.cpp
blob: ce610745a20ad6c64c83625784e8c79b1eaff79f (plain)
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
$NetBSD: patch-library_grt_src_grtpp__shell__python__help.cpp,v 1.1 2013/03/03 04:54:26 joerg Exp $

--- library/grt/src/grtpp_shell_python_help.cpp.orig	2013-02-28 22:36:13.000000000 +0000
+++ library/grt/src/grtpp_shell_python_help.cpp
@@ -36,149 +36,149 @@ struct HelpTopic
 
 static HelpTopic help_topics[]= {
 {"grt",
-"    GRT (Generic RunTime) is internal system used by Workbench to hold model"NL
-"document data and allow plugins and modules to interface between each other,"NL
-"with the Workbench application and the model."NL
-"    Workbench model data (diagrams, schemas, tables etc) is stored in a hierarchy"NL
-"of objects that can be accessed by any plugin. To allow that, the data is"NL
-"represented in 6 different datatypes that can be accessed from any language"NL
-"supported: integers, doubles, strings, dicts, lists and objects."NL
-"    When working from Python, simple data types (integers, doubles and strings) are"NL
-"seen as normal Python values of the corresponding type."NL
-"    Lists and dicts are kept in their internal representation but can be mostly"NL
-"treated as Python lists and dicts, meaning you can index lists and get items from"NL
-"dicts with the usual Python syntax (ie aList[0], len(aList), aDict['key'] etc)."NL
-"    Objects contain data fields and methods, but the GRT only recognizes objects"NL
-"from a pre-registered class hierarchy. You can see the list of existing classes in"NL
-"the 'grt' module in the 'classes' list or in the Classes tab in the Scripting Shell"NL
-"window."NL
-"    Workbench document data is kept in a tree-like structure that you can access and"NL
-"modify from Python. However, it is easy to corrupt a document beyond repair, so be"NL
-"careful when modifying the GRT tree for models and always make backups. Read-only"NL
-"access to the tree is safe and sufficient for many purposes."NL
-NL
-"    In Python, the GRT tree root node can be accessed as grt.root"NL
-"    Some examples of nodes that can be of interest:"NL
-NL
-"    grt.root.wb.doc.physicalModels[0].catalog.schemata"NL
-"        list of schemas in the open model"NL
-"    grt.root.wb.doc.physicalModels[0].diagrams"NL
-"        list of diagrams in the model"NL
-"    grt.root.wb.options"NL
-"        Workbench options and other state data"NL
-NL
-"    While you cannot create new classes in the GRT from Python, you can create"NL
-"modules and plugins that are usable from other Workbench parts, including from"NL
-"other languages. See the corresponding help topics for more information about"NL
-"calling and writing your own modules."NL
+"    GRT (Generic RunTime) is internal system used by Workbench to hold model" NL
+"document data and allow plugins and modules to interface between each other," NL
+"with the Workbench application and the model." NL
+"    Workbench model data (diagrams, schemas, tables etc) is stored in a hierarchy" NL
+"of objects that can be accessed by any plugin. To allow that, the data is" NL
+"represented in 6 different datatypes that can be accessed from any language" NL
+"supported: integers, doubles, strings, dicts, lists and objects." NL
+"    When working from Python, simple data types (integers, doubles and strings) are" NL
+"seen as normal Python values of the corresponding type." NL
+"    Lists and dicts are kept in their internal representation but can be mostly" NL
+"treated as Python lists and dicts, meaning you can index lists and get items from" NL
+"dicts with the usual Python syntax (ie aList[0], len(aList), aDict['key'] etc)." NL
+"    Objects contain data fields and methods, but the GRT only recognizes objects" NL
+"from a pre-registered class hierarchy. You can see the list of existing classes in" NL
+"the 'grt' module in the 'classes' list or in the Classes tab in the Scripting Shell" NL
+"window." NL
+"    Workbench document data is kept in a tree-like structure that you can access and" NL
+"modify from Python. However, it is easy to corrupt a document beyond repair, so be" NL
+"careful when modifying the GRT tree for models and always make backups. Read-only" NL
+"access to the tree is safe and sufficient for many purposes." NL
+NL
+"    In Python, the GRT tree root node can be accessed as grt.root" NL
+"    Some examples of nodes that can be of interest:" NL
+NL
+"    grt.root.wb.doc.physicalModels[0].catalog.schemata" NL
+"        list of schemas in the open model" NL
+"    grt.root.wb.doc.physicalModels[0].diagrams" NL
+"        list of diagrams in the model" NL
+"    grt.root.wb.options" NL
+"        Workbench options and other state data" NL
+NL
+"    While you cannot create new classes in the GRT from Python, you can create" NL
+"modules and plugins that are usable from other Workbench parts, including from" NL
+"other languages. See the corresponding help topics for more information about" NL
+"calling and writing your own modules." NL
 NL
-"    For practical tips and examples on how to write scripts, see 'scripting'."NL
-"    For more information about GRT Objects, see 'objects'"NL
+"    For practical tips and examples on how to write scripts, see 'scripting'." NL
+"    For more information about GRT Objects, see 'objects'" NL
 NL
 },
 {"objects",
 ""
 },
 {"scripting",
-"    To execute a Python script against the loaded model, you can simply input it"NL
-"in the Scripting Shell entry box. For doing quick tests and exploring it will be"NL
-"the quickest way. If you have a script file you want to execute, you can execute"NL
-"it through the 'Scripting -> Run Workbench Script File' menu item."NL
-NL
-"    If you have a script that is used often or that you want to distribute to other"NL
-"people, you may consider turning it into a plugin. A plugin will be accessible from"NL
-"the Workbench UI in the main menu or in certain context menus for model objects,"NL
-"depending on how you register it. See the 'plugins' section for more info about this."NL
-"    You can also put your scripts in a library of plain Python functions, and invoke"NL
-"them from the Scripting Shell. By placing the library in the libraries folder in your"NL
-"user's Workbench data folder (you can see its path printed in the Workbench Shell) it"NL
-"will automatically loaded when Workbench starts. This is a more flexible approach as"NL
-"you can easily pass any kind of argument to your scripts with little coding effort."NL
-NL
-"    Samples"NL
-"    -------"NL
-"    The following are some sample snippets for things you can do in Workbench,"NL
-"to view them type '? keyword'"NL
-NL
-"    iter.figures - iterate through figures in the diagram"NL
-"    iter.tables - iterate through tables in the 1st schema in the model"NL
-"    chcolor - change color of all figures matching some criteria"NL
-"    lowercase - rename titles of all tables and columns to lower case only"NL
+"    To execute a Python script against the loaded model, you can simply input it" NL
+"in the Scripting Shell entry box. For doing quick tests and exploring it will be" NL
+"the quickest way. If you have a script file you want to execute, you can execute" NL
+"it through the 'Scripting -> Run Workbench Script File' menu item." NL
+NL
+"    If you have a script that is used often or that you want to distribute to other" NL
+"people, you may consider turning it into a plugin. A plugin will be accessible from" NL
+"the Workbench UI in the main menu or in certain context menus for model objects," NL
+"depending on how you register it. See the 'plugins' section for more info about this." NL
+"    You can also put your scripts in a library of plain Python functions, and invoke" NL
+"them from the Scripting Shell. By placing the library in the libraries folder in your" NL
+"user's Workbench data folder (you can see its path printed in the Workbench Shell) it" NL
+"will automatically loaded when Workbench starts. This is a more flexible approach as" NL
+"you can easily pass any kind of argument to your scripts with little coding effort." NL
+NL
+"    Samples" NL
+"    -------" NL
+"    The following are some sample snippets for things you can do in Workbench," NL
+"to view them type '? keyword'" NL
+NL
+"    iter.figures - iterate through figures in the diagram" NL
+"    iter.tables - iterate through tables in the 1st schema in the model" NL
+"    chcolor - change color of all figures matching some criteria" NL
+"    lowercase - rename titles of all tables and columns to lower case only" NL
 "    "
 },
 {"iter.figures",
-"# iterate over figures from a diagram and prints some information about them"NL
-"def iter_figures(diagram):"NL
-"    for figure in diagram.figures:"NL
-"        print '%s %s (%i,%i)'%(figure.__grtclassname__, figure.name, figure.left, figure.top)"NL
+"# iterate over figures from a diagram and prints some information about them" NL
+"def iter_figures(diagram):" NL
+"    for figure in diagram.figures:" NL
+"        print '%s %s (%i,%i)'%(figure.__grtclassname__, figure.name, figure.left, figure.top)" NL
 NL
-"iter_figures(grt.root.wb.doc.physicalModels[0].diagrams[0])"NL
+"iter_figures(grt.root.wb.doc.physicalModels[0].diagrams[0])" NL
 },
 {"iter.tables",
-"# iterate over database tables in a given schema and print columns and foreign keys"NL
-"def iter_tables(schema):"NL
-"    for table in schema.tables:"NL
-"        print '%s <%s>' % (table.name, table.tableEngine)"NL
-"        print 'Columns:'"NL
-"        for column in table.columns:"NL
-"            print '%s%s : %s' % (column.name, table.isPrimaryKeyColumn(column) and 'PK' or '', column.formattedType())"NL
-"        print 'Foreign Keys:'"NL
-"        for fk in table.foreignKeys:"NL
-"            print '%s' % fk.name"NL
+"# iterate over database tables in a given schema and print columns and foreign keys" NL
+"def iter_tables(schema):" NL
+"    for table in schema.tables:" NL
+"        print '%s <%s>' % (table.name, table.tableEngine)" NL
+"        print 'Columns:'" NL
+"        for column in table.columns:" NL
+"            print '%s%s : %s' % (column.name, table.isPrimaryKeyColumn(column) and 'PK' or '', column.formattedType())" NL
+"        print 'Foreign Keys:'" NL
+"        for fk in table.foreignKeys:" NL
+"            print '%s' % fk.name" NL
 NL
-"iter_tables(grt.root.wb.doc.physicalModels[0].catalog.schemata[0])"NL
+"iter_tables(grt.root.wb.doc.physicalModels[0].catalog.schemata[0])" NL
 },
 {"chcolor",
-"# change color of all figures in diagram of a given class"NL
-"def change_color(diagram, klass, new_color):"NL
-"    for figure in diagram.figures:"NL
-"        if figure.__grtclassname__ == klass:"NL
-"            figure.color = new_color"NL
+"# change color of all figures in diagram of a given class" NL
+"def change_color(diagram, klass, new_color):" NL
+"    for figure in diagram.figures:" NL
+"        if figure.__grtclassname__ == klass:" NL
+"            figure.color = new_color" NL
 NL
-"change_color(grt.root.wb.doc.physicalModels[0].diagrams[0], 'workbench.physical.TableFigure', '#aa8844')"NL
+"change_color(grt.root.wb.doc.physicalModels[0].diagrams[0], 'workbench.physical.TableFigure', '#aa8844')" NL
 },
 {"lowercase",
-"# change name of all tables to lowercase"NL
-"def change_table_names(function, schema=None):"NL
-"    if schema is None:"NL
-"       schema = grt.root.wb.doc.physicalModels[0].catalog.schemata[0]"NL
-"    for table in schema.tables:"NL
-"        s = function(table.name)"NL
-"        if s != table.name:"NL
-"            table.name = s"NL
+"# change name of all tables to lowercase" NL
+"def change_table_names(function, schema=None):" NL
+"    if schema is None:" NL
+"       schema = grt.root.wb.doc.physicalModels[0].catalog.schemata[0]" NL
+"    for table in schema.tables:" NL
+"        s = function(table.name)" NL
+"        if s != table.name:" NL
+"            table.name = s" NL
 NL
-"change_table_names(lambda name: name.lower())"NL
+"change_table_names(lambda name: name.lower())" NL
 },
 {"modules",
-"    In the GRT, modules are libraries with a list of functions that are exported for use"NL
-"by code in other modules, scripts or Workbench itself. Modules can be currently written"NL
-"in C++, Lua and Python but the datatypes used in arguments and return value must be GRT"NL
-"types."NL
-"    To export certain functions from a Python source file as a module, you need to do the"NL
-"following:"NL
-"- the file must be placed in the user modules folder. You can see its path in the"NL
-"scripting shell window as 'Looking for user plugins in ...'. You can also install it"NL
-"using the Scripting -> Install Plugin/Module File... menu command."NL
-"- the filename must have the _grt.py suffix (ex: my_modules_grt.py)"NL
-"- define some module metadata using the DefineModule function in the 'wb' module:"NL
-"from wb import *"NL
-"ModuleInfo = DefineModule(name='MyStuff', author='me', version='1.0')"NL
-"- functions to be exported must have their signature declared with the export decorator"NL
-"in the previously created ModuleInfo object:"NL
-"@ModuleInfo.export(grt.INT, grt.STRING)"NL
-"def checkString(s):"NL
+"    In the GRT, modules are libraries with a list of functions that are exported for use" NL
+"by code in other modules, scripts or Workbench itself. Modules can be currently written" NL
+"in C++, Lua and Python but the datatypes used in arguments and return value must be GRT" NL
+"types." NL
+"    To export certain functions from a Python source file as a module, you need to do the" NL
+"following:" NL
+"- the file must be placed in the user modules folder. You can see its path in the" NL
+"scripting shell window as 'Looking for user plugins in ...'. You can also install it" NL
+"using the Scripting -> Install Plugin/Module File... menu command." NL
+"- the filename must have the _grt.py suffix (ex: my_modules_grt.py)" NL
+"- define some module metadata using the DefineModule function in the 'wb' module:" NL
+"from wb import *" NL
+"ModuleInfo = DefineModule(name='MyStuff', author='me', version='1.0')" NL
+"- functions to be exported must have their signature declared with the export decorator" NL
+"in the previously created ModuleInfo object:" NL
+"@ModuleInfo.export(grt.INT, grt.STRING)" NL
+"def checkString(s):" NL
 "..."
-"    The arguments to export is a list of GRT type names, starting with the"NL
-"return type of the function, followed by 0 or more argument types. The allowed type"NL
-"names are (note that they are in the grt module, which must be imported):"NL
-" - grt.INT integer values; also used for boolean values"NL
-" - grt.DOUBLE floating point numeric values"NL
-" - grt.STRING UTF-8 or ASCII string data"NL
-" - grt.DICT a key/value dictionary value; keys must be strings"NL
-" - grt.LIST a list of other values. You may specify the type of the contents as"NL
-"   a tuple in the form (grt.LIST, <type-or-class>), ex: (grt.LIST, grt.STRING) for a list"NL
-"of strings or (grt.LIST, grt.classes.db_Table) for a list of db.Table objects"NL
-" - grt.OBJECT an instance of a GRT object or a GRT class object, from grt.classes"NL
+"    The arguments to export is a list of GRT type names, starting with the" NL
+"return type of the function, followed by 0 or more argument types. The allowed type" NL
+"names are (note that they are in the grt module, which must be imported):" NL
+" - grt.INT integer values; also used for boolean values" NL
+" - grt.DOUBLE floating point numeric values" NL
+" - grt.STRING UTF-8 or ASCII string data" NL
+" - grt.DICT a key/value dictionary value; keys must be strings" NL
+" - grt.LIST a list of other values. You may specify the type of the contents as" NL
+"   a tuple in the form (grt.LIST, <type-or-class>), ex: (grt.LIST, grt.STRING) for a list" NL
+"of strings or (grt.LIST, grt.classes.db_Table) for a list of db.Table objects" NL
+" - grt.OBJECT an instance of a GRT object or a GRT class object, from grt.classes" NL
 },
 {"plugins",
 ""
@@ -191,28 +191,28 @@ void grt_shell_show_python_help(grt::GRT
 {
   if (!command || !*command)
     grt->send_output(
-       "Help Topics"NL
-       "-----------"NL
-       "grt        General information about the Workbench runtime"NL
-       "scripting  Practical information when working on scripts and modules for Workbench"NL
-       "wbdata     Summary about Workbench model data organization"NL
-       "modules    Information about Workbench module usage"NL
-       "plugins    Information about writing Plugins and Modules for Workbench"NL
-       "Type '? <topic>' to get help on the topic."NL
+       "Help Topics" NL
+       "-----------" NL
+       "grt        General information about the Workbench runtime" NL
+       "scripting  Practical information when working on scripts and modules for Workbench" NL
+       "wbdata     Summary about Workbench model data organization" NL
+       "modules    Information about Workbench module usage" NL
+       "plugins    Information about writing Plugins and Modules for Workbench" NL
+       "Type '? <topic>' to get help on the topic." NL
        NL
-       "Custom Python Modules"NL
-       "---------------------"NL
-       "grt        Module to work with Workbench runtime (grt) objects"NL
-       "   grt.root    The root object in the internal Workbench object hierarchy"NL
-       "   grt.modules Location where Workbench modules are available"NL
-       "   grt.classes List of classes known to the GRT system"NL
-       "mforms     A Module to access the cross-platform UI toolkit used in some Workbench features"NL
-       "wb         Utility module for creating Workbench plugins"NL
+       "Custom Python Modules" NL
+       "---------------------" NL
+       "grt        Module to work with Workbench runtime (grt) objects" NL
+       "   grt.root    The root object in the internal Workbench object hierarchy" NL
+       "   grt.modules Location where Workbench modules are available" NL
+       "   grt.classes List of classes known to the GRT system" NL
+       "mforms     A Module to access the cross-platform UI toolkit used in some Workbench features" NL
+       "wb         Utility module for creating Workbench plugins" NL
        NL
-       "Type 'help(<module/object/function>)' to get information about a module, object or function."NL
-       "'dir(<object>)' will give a quick list of methods an object has."NL
-       "For an introductory tutorial on the Python language, visit http://docs.python.org/tutorial/"NL
-       "For general Python and library reference documentation, visit http://python.org/doc/"NL
+       "Type 'help(<module/object/function>)' to get information about a module, object or function." NL
+       "'dir(<object>)' will give a quick list of methods an object has." NL
+       "For an introductory tutorial on the Python language, visit http://docs.python.org/tutorial/" NL
+       "For general Python and library reference documentation, visit http://python.org/doc/" NL
        );
   else
   {