~ubuntu-branches/ubuntu/trusty/python-gnuplot/trusty

« back to all changes in this revision

Viewing changes to gnuplot_Suites.py

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2002-04-11 08:52:48 UTC
  • Revision ID: james.westby@ubuntu.com-20020411085248-r5kbl460aa2g9kdb
Tags: upstream-1.5
ImportĀ upstreamĀ versionĀ 1.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# $Id: gnuplot_Suites.py,v 2.5 2001/01/07 21:35:13 mhagger Exp $
 
2
 
 
3
# This file is provided as part of the Gnuplot.py package for the
 
4
# convenience of Mac users.  It was originally part of
 
5
# MacGnuplot.2.0b4.  Thanks to Anthony M. Ingraldi and Noboru Yamamoto
 
6
# for helping with this.
 
7
 
 
8
# file contains
 
9
#
 
10
#  class gnuplot_Suite
 
11
#  class odds_and_ends
 
12
#  class Standard_Suite
 
13
#  class Miscellaneous_Events
 
14
#
 
15
"""Suite gnuplot Suite: Events supplied by gnuplot
 
16
Level 1, version 1
 
17
 
 
18
Generated from Power HD:Applications:Analysis/Plotting:gnuplot.2.0a34:gnuplot (PPC)
 
19
AETE/AEUT resource version 1/0, language 0, script 0
 
20
"""
 
21
 
 
22
__cvs_version__ = '$Revision: 2.5 $'
 
23
 
 
24
import aetools
 
25
import MacOS
 
26
 
 
27
_code = 'GPSE'
 
28
 
 
29
_Enum_DIAG = {
 
30
   'label' : 'labl', # label dialog
 
31
   'offsets' : 'oset',  # offsets dialog
 
32
   'textformat' : 'text',  # text format dialog
 
33
   'gxtextformat' : 'gxtx',   # gx text format dialog
 
34
   'linestyles' : 'line',  # line styles dialog
 
35
   'preferences' : 'pref', # preferences dialog
 
36
}
 
37
 
 
38
_Enum_lyty = {
 
39
   'lines' : 'typ1', # lines
 
40
   'points' : 'typ2',   # points
 
41
   'impulses' : 'typ3', # impulses
 
42
   'linespoints' : 'typ4', # lines with points
 
43
   'dots' : 'typ5',  # dots
 
44
   'steps' : 'typ6', # steps
 
45
   'fsteps' : 'typ7',   # use two line segments
 
46
   'errorbars' : 'typ8',   # error bars
 
47
   'xerrorbars' : 'typ9',  # horizontal error bars
 
48
   'yerrorbars' : 'ty10',  # vertical error bars
 
49
   'xyerrorbars' : 'ty11', # horizontal and vertical error bars
 
50
   'boxes' : 'ty12', # boxes
 
51
   'boxerrorbars' : 'ty13',   # boxes and error bars
 
52
   'boxxyerrorbars' : 'ty14', # boxes and xy error bars
 
53
   'vector' : 'ty19',   # vector
 
54
}
 
55
 
 
56
class gnuplot_Suite:
 
57
 
 
58
   _argmap_exec = {
 
59
      'with_client' : 'CLIE',
 
60
      'with_creator' : 'CREA',
 
61
      'with_type' : 'TYPE',
 
62
   }
 
63
 
 
64
   def gnuexec(self, _object=None, _attributes={}, **_arguments):
 
65
      """gnuexec: execute a gnuplot command
 
66
      Required argument: a gnuplot command
 
67
      Keyword argument with_client: client application
 
68
      Keyword argument with_creator: creator code for any output
 
69
      Keyword argument with_type: file type for any output
 
70
      Keyword argument _attributes: AppleEvent attribute dictionary
 
71
      Returns: what gnuplot said
 
72
      """
 
73
      _code = 'GPSE'
 
74
      _subcode = 'exec'
 
75
 
 
76
      aetools.keysubst(_arguments, self._argmap_exec)
 
77
      _arguments['----'] = _object
 
78
 
 
79
      aetools.enumsubst(_arguments, 'with_client', self._argmap_exec)
 
80
      aetools.enumsubst(_arguments, 'with_creator', self._argmap_exec)
 
81
      aetools.enumsubst(_arguments, 'with_type', self._argmap_exec)
 
82
 
 
83
      _reply, _arguments, _attributes = self.send(_code, _subcode,
 
84
            _arguments, _attributes)
 
85
      if _arguments.has_key('errn'):
 
86
         raise aetools.Error, aetools.decodeerror(_arguments)
 
87
      # XXXX Optionally decode result
 
88
      if _arguments.has_key('----'):
 
89
         # XXXX Should do enum remapping here...
 
90
         return _arguments['----']
 
91
 
 
92
   def halt(self, _no_object=None, _attributes={}, **_arguments):
 
93
      """halt: halt any processing
 
94
      Keyword argument _attributes: AppleEvent attribute dictionary
 
95
      """
 
96
      _code = 'GPSE'
 
97
      _subcode = 'HALT'
 
98
 
 
99
      if _arguments: raise TypeError, 'No optional args expected'
 
100
      if _no_object != None: raise TypeError, 'No direct arg expected'
 
101
 
 
102
 
 
103
      _reply, _arguments, _attributes = self.send(_code, _subcode,
 
104
            _arguments, _attributes)
 
105
      if _arguments.has_key('errn'):
 
106
         raise aetools.Error, aetools.decodeerror(_arguments)
 
107
      # XXXX Optionally decode result
 
108
      if _arguments.has_key('----'):
 
109
         # XXXX Should do enum remapping here...
 
110
         return _arguments['----']
 
111
 
 
112
   def open_dialog(self, _object=None, _attributes={}, **_arguments):
 
113
      """open dialog: open a gnuplot dialog
 
114
      Required argument: the dialog to open
 
115
      Keyword argument _attributes: AppleEvent attribute dictionary
 
116
      """
 
117
      _code = 'GPLT'
 
118
      _subcode = 'DIAG'
 
119
 
 
120
      if _arguments: raise TypeError, 'No optional args expected'
 
121
      _arguments['----'] = _object
 
122
 
 
123
 
 
124
      _reply, _arguments, _attributes = self.send(_code, _subcode,
 
125
            _arguments, _attributes)
 
126
      if _arguments.has_key('errn'):
 
127
         raise aetools.Error, aetools.decodeerror(_arguments)
 
128
      # XXXX Optionally decode result
 
129
      if _arguments.has_key('----'):
 
130
         # XXXX Should do enum remapping here...
 
131
         return _arguments['----']
 
132
 
 
133
   _argmap_plot = {
 
134
      'with' : 'line',
 
135
   }
 
136
 
 
137
   def plot(self, _object=None, _attributes={}, **_arguments):
 
138
      """plot: do a 2d plot of files or data
 
139
      Required argument: the data to plot
 
140
      Keyword argument with: line style
 
141
      Keyword argument _attributes: AppleEvent attribute dictionary
 
142
      Returns: what gnuplot said
 
143
      """
 
144
      _code = 'GPLT'
 
145
      _subcode = 'plot'
 
146
 
 
147
      aetools.keysubst(_arguments, self._argmap_plot)
 
148
      _arguments['----'] = _object
 
149
 
 
150
      aetools.enumsubst(_arguments, 'line', _Enum_lyty)
 
151
 
 
152
      _reply, _arguments, _attributes = self.send(_code, _subcode,
 
153
            _arguments, _attributes)
 
154
      if _arguments.has_key('errn'):
 
155
         raise aetools.Error, aetools.decodeerror(_arguments)
 
156
      # XXXX Optionally decode result
 
157
      if _arguments.has_key('----'):
 
158
         # XXXX Should do enum remapping here...
 
159
         return _arguments['----']
 
160
 
 
161
   _argmap_splot = {
 
162
      'with' : 'line',
 
163
   }
 
164
 
 
165
   def splot(self, _object=None, _attributes={}, **_arguments):
 
166
      """splot: do a 3d plot files or data
 
167
      Required argument: the data to plot
 
168
      Keyword argument with: line style
 
169
      Keyword argument _attributes: AppleEvent attribute dictionary
 
170
      Returns: what gnuplot said
 
171
      """
 
172
      _code = 'GPLT'
 
173
      _subcode = 'splt'
 
174
 
 
175
      aetools.keysubst(_arguments, self._argmap_splot)
 
176
      _arguments['----'] = _object
 
177
 
 
178
      aetools.enumsubst(_arguments, 'line', _Enum_lyty)
 
179
 
 
180
      _reply, _arguments, _attributes = self.send(_code, _subcode,
 
181
            _arguments, _attributes)
 
182
      if _arguments.has_key('errn'):
 
183
         raise aetools.Error, aetools.decodeerror(_arguments)
 
184
      # XXXX Optionally decode result
 
185
      if _arguments.has_key('----'):
 
186
         # XXXX Should do enum remapping here...
 
187
         return _arguments['----']
 
188
 
 
189
 
 
190
#    Class 'graph' ('cGRF') -- 'graph - subclass of window'
 
191
#        property 'picture' ('PICT') 'PICT' -- 'the graph picture' [enum]
 
192
#        property 'graph number' ('NUMB') 'shor' -- 'the number of the graph' [enum]
 
193
#        property 'title' ('TITL') 'TEXT' -- 'the title of the graph' [enum]
 
194
"""Suite odds and ends: Things that should be in some standard suite, but aren't
 
195
Level 1, version 1
 
196
 
 
197
Generated from Power HD:Applications:Analysis/Plotting:gnuplot.2.0a34:gnuplot (PPC)
 
198
AETE/AEUT resource version 1/0, language 0, script 0
 
199
"""
 
200
 
 
201
_code = 'Odds'
 
202
 
 
203
class odds_and_ends:
 
204
 
 
205
   def select(self, _object=None, _attributes={}, **_arguments):
 
206
      """select: select the specified object
 
207
      Required argument: the object to select
 
208
      Keyword argument _attributes: AppleEvent attribute dictionary
 
209
      """
 
210
      _code = 'misc'
 
211
      _subcode = 'slct'
 
212
 
 
213
      if _arguments: raise TypeError, 'No optional args expected'
 
214
      _arguments['----'] = _object
 
215
 
 
216
 
 
217
      _reply, _arguments, _attributes = self.send(_code, _subcode,
 
218
            _arguments, _attributes)
 
219
      if _arguments.has_key('errn'):
 
220
         raise aetools.Error, aetools.decodeerror(_arguments)
 
221
      # XXXX Optionally decode result
 
222
      if _arguments.has_key('----'):
 
223
         # XXXX Should do enum remapping here...
 
224
         return _arguments['----']
 
225
 
 
226
"""Suite Standard Suite: Common terms for most applications
 
227
Level 1, version 1
 
228
 
 
229
Generated from Power HD:Applications:Analysis/Plotting:gnuplot.2.0a34:gnuplot (PPC)
 
230
AETE/AEUT resource version 1/0, language 0, script 0
 
231
"""
 
232
 
 
233
_code = 'CoRe'
 
234
 
 
235
class Standard_Suite:
 
236
 
 
237
   _argmap_save = {
 
238
      '_in' : 'kfil',
 
239
   }
 
240
 
 
241
   def save(self, _object, _attributes={}, **_arguments):
 
242
      """save: save an object
 
243
      Required argument: the object to save
 
244
      Keyword argument _in: the file in which to save the object
 
245
      Keyword argument _attributes: AppleEvent attribute dictionary
 
246
      """
 
247
      _code = 'core'
 
248
      _subcode = 'save'
 
249
 
 
250
      aetools.keysubst(_arguments, self._argmap_save)
 
251
      _arguments['----'] = _object
 
252
 
 
253
      aetools.enumsubst(_arguments, 'kfil', _Enum_fss )
 
254
 
 
255
      _reply, _arguments, _attributes = self.send(_code, _subcode,
 
256
            _arguments, _attributes)
 
257
      if _arguments.has_key('errn'):
 
258
         raise aetools.Error, aetools.decodeerror(_arguments)
 
259
      # XXXX Optionally decode result
 
260
      if _arguments.has_key('----'):
 
261
         # XXXX Should do enum remapping here...
 
262
         return _arguments['----']
 
263
 
 
264
   def get(self, _object, _attributes={}, **_arguments):
 
265
      """get: get the data for an object
 
266
      Required argument: the object whose data is to be returned
 
267
      Keyword argument _attributes: AppleEvent attribute dictionary
 
268
      Returns: the data from the object
 
269
      """
 
270
      _code = 'core'
 
271
      _subcode = 'getd'
 
272
 
 
273
      if _arguments: raise TypeError, 'No optional args expected'
 
274
      _arguments['----'] = _object
 
275
 
 
276
 
 
277
      _reply, _arguments, _attributes = self.send(_code, _subcode,
 
278
            _arguments, _attributes)
 
279
      if _arguments.has_key('errn'):
 
280
         raise aetools.Error, aetools.decodeerror(_arguments)
 
281
      # XXXX Optionally decode result
 
282
      if _arguments.has_key('----'):
 
283
         # XXXX Should do enum remapping here...
 
284
         return _arguments['----']
 
285
 
 
286
   _argmap_set = {
 
287
      'to' : 'data',
 
288
   }
 
289
 
 
290
   def set(self, _object, _attributes={}, **_arguments):
 
291
      """set: set an objects data
 
292
      Required argument: the object whose data is to be changed
 
293
      Keyword argument to: the new value
 
294
      Keyword argument _attributes: AppleEvent attribute dictionary
 
295
      """
 
296
      _code = 'core'
 
297
      _subcode = 'setd'
 
298
 
 
299
      aetools.keysubst(_arguments, self._argmap_set)
 
300
      _arguments['----'] = _object
 
301
 
 
302
 
 
303
      _reply, _arguments, _attributes = self.send(_code, _subcode,
 
304
            _arguments, _attributes)
 
305
      if _arguments.has_key('errn'):
 
306
         raise aetools.Error, aetools.decodeerror(_arguments)
 
307
      # XXXX Optionally decode result
 
308
      if _arguments.has_key('----'):
 
309
         # XXXX Should do enum remapping here...
 
310
         return _arguments['----']
 
311
 
 
312
 
 
313
#    Class 'application' ('capp') -- 'application properties'
 
314
#        property 'clipboard' ('clip') '****' -- "gnuplot's clipboard" [mutable]
 
315
#        property 'terminals' ('TLST') 'TEXT' -- 'list of the currently available terminals' [list]
 
316
#        property 'graph creator' ('QDCR') 'fltp' -- 'creator code for QuickDraw graphs' [mutable]
 
317
#        property 'file creator' ('CREA') 'fltp' -- 'creator code for text plots' [mutable]
 
318
#        property 'file type' ('TYPE') 'fltp' -- 'file type for text plots' [mutable]
 
319
#        property 'working folder' ('wfdr') 'alis' -- 'the path to the default folder for the command\320line plot and load commands' [mutable]
 
320
#        property 'current terminal' ('TERM') 'TEXT' -- 'the name of the current terminal' []
 
321
#        property 'text font' ('FONT') 'TEXT' -- 'the font for graphs' [mutable]
 
322
#        property 'text size' ('SIZE') 'shor' -- 'the text size for graphs' [mutable]
 
323
#        property 'graph size' ('GSIZ') 'QDpt' -- 'dimensions of the next graph' [mutable]
 
324
#        element 'cwin' as ['indx', 'name']
 
325
 
 
326
#    Class 'window' ('cwin') -- 'a window'
 
327
#        property 'bounds' ('pbnd') 'qdrt' -- 'the boundary rectangle for the window' [enum]
 
328
#        property 'closeable' ('hclb') 'bool' -- 'does the window have a close box?' [enum]
 
329
#        property 'index' ('pidx') 'shor' -- 'the number of the window' [enum]
 
330
#        property 'floating' ('isfl') 'bool' -- 'does the window float?' [enum]
 
331
#        property 'modal' ('pmod') 'bool' -- 'is the window modal?' [enum]
 
332
#        property 'resizable' ('prsz') 'bool' -- 'is the window resizable?' [enum]
 
333
#        property 'zoomable' ('iszm') 'bool' -- 'is the window zoomable?' [enum]
 
334
#        property 'zoomed' ('pzum') 'bool' -- 'is the window zoomed?' [mutable enum]
 
335
#        property 'name' ('pnam') 'TEXT' -- 'the title of the window' [enum]
 
336
#        property 'visible' ('pvis') 'bool' -- 'is the window visible?' [mutable enum]
 
337
#        property 'position' ('ppos') 'QDpt' -- 'upper left coordinates of window' [mutable enum]
 
338
 
 
339
"""Suite Miscelaneous Events: Some other events
 
340
Level 1, version 1
 
341
 
 
342
Generated from Power HD:Applications:Analysis/Plotting:gnuplot.2.0a34:gnuplot (PPC)
 
343
AETE/AEUT resource version 1/0, language 0, script 0
 
344
"""
 
345
 
 
346
_code = 'misc'
 
347
 
 
348
class Miscellaneous_Events:
 
349
 
 
350
   _argmap_DoScript = {
 
351
      'with_client' : 'CLIE',
 
352
      'with_creator' : 'CREA',
 
353
      'with_type' : 'TYPE',
 
354
   }
 
355
 
 
356
   def DoScript(self, _object=None, _attributes={}, **_arguments):
 
357
      """DoScript: execute a gnuplot script
 
358
      Required argument: a gnuplot script to execute
 
359
      Keyword argument with_client: client application
 
360
      Keyword argument with_creator: creator code for any output
 
361
      Keyword argument with_type: file type for any output
 
362
      Keyword argument _attributes: AppleEvent attribute dictionary
 
363
      Returns: what gnuplot said
 
364
      """
 
365
      _code = 'misc'
 
366
      _subcode = 'dosc'
 
367
 
 
368
      aetools.keysubst(_arguments, self._argmap_DoScript)
 
369
      _arguments['----'] = _object
 
370
 
 
371
      aetools.enumsubst(_arguments, 'with_client', self._argmap_DoScript)
 
372
      aetools.enumsubst(_arguments, 'with_creator', self._argmap_DoScript)
 
373
      aetools.enumsubst(_arguments, 'with_type', self._argmap_DoScript)
 
374
 
 
375
      _reply, _arguments, _attributes = self.send(_code, _subcode,
 
376
            _arguments, _attributes)
 
377
      if _arguments.has_key('errn'):
 
378
         raise aetools.Error, aetools.decodeerror(_arguments)
 
379
      # XXXX Optionally decode result
 
380
      if _arguments.has_key('----'):
 
381
         # XXXX Should do enum remapping here...
 
382
         return _arguments['----']
 
383