0 0 1
default
Jean-Francois Pieronne - 5 years ago 2014-10-20 18:38:33
jf.pieronne@laposte.net
Initial version of test1.py
1 file changed with 340 insertions and 0 deletions:
↑ Collapse Diff ↑
 
new file 100755
1
 
from vms.rtl.smg import _vmssmg
2
 
#import _vmssmg
3
 
import time
4
 
from vms.smgdef import (SMG_M_BORDER, SMG_M_BLOCK_BORDER, SMG_M_ERASE_MENU)
5
 

	
6
 

	
7
 

	
8
 
s, pastid = _vmssmg.create_pasteboard()
9
 
s, kid = _vmssmg.create_virtual_keyboard()
10
 

	
11
 

	
12
 
s = _vmssmg.put_status_line(pastid, "Status line")
13
 

	
14
 
s, disp = _vmssmg.create_virtual_display(10, 50, SMG_M_BLOCK_BORDER)
15
 
_vmssmg.ring_bell(disp)
16
 

	
17
 
_vmssmg.paste_virtual_display(disp, pastid, 7, 9)
18
 
_vmssmg.put_chars(disp, "bonjour a tous", 3, 5)
19
 

	
20
 
time.sleep(1)
21
 

	
22
 
#-----------------------------------------------------------------
23
 
# menu dynamique
24
 
#------------------------------------------------------------------
25
 
table = ['Saisie un fichier','Ouvrir un fichier','Aide','Quitter']
26
 
s = _vmssmg.create_menu(disp, table)
27
 
s = _vmssmg.select_from_menu(kid, disp)
28
 

	
29
 
_vmssmg.put_chars(disp, repr(s), 1, 1)
30
 
time.sleep(3)
31
 
_vmssmg.delete_menu(disp, SMG_M_ERASE_MENU)
32
 
time.sleep(3)
33
 

	
34
 
#---------------------------
35
 
# ligne de texte souligne
36
 
#----------------------------
37
 
_vmssmg.set_cursor_abs(disp, 1, 15)
38
 
_vmssmg.put_line(disp , "Operation de Saisie ")
39
 
time.sleep(3)
40
 

	
41
 
#-----------------------------------------------------------------
42
 
# copier du texte
43
 
#-----------------------------------------------------------------
44
 

	
45
 
s, disp2 = _vmssmg.create_virtual_display(10, 50, SMG_M_BLOCK_BORDER)
46
 
_vmssmg.paste_virtual_display(disp2, pastid, 13, 11)
47
 

	
48
 
_vmssmg.set_cursor_abs(disp2, 1, 15)
49
 
_vmssmg.put_line(disp2,"Copier un morceau de phrase")
50
 

	
51
 
_vmssmg.set_cursor_abs(disp2, 1, 17)
52
 
r = _vmssmg.read_from_display(disp2, 10)
53
 

	
54
 
_vmssmg.put_chars(disp2,">   ",4, 2)
55
 

	
56
 
_vmssmg.set_cursor_abs(disp2, 4, 5)
57
 
_vmssmg.put_line(disp2, repr(r))
58
 

	
59
 
time.sleep(5)
60
 

	
61
 
#--------------------------------------------------------------------
62
 
# saisie texte
63
 
#--------------------------------------------------------------------
64
 
s, disp3 = _vmssmg.create_virtual_display(15, 50, SMG_M_BLOCK_BORDER)
65
 
_vmssmg.paste_virtual_display(disp3, pastid, 13, 11)
66
 

	
67
 
_vmssmg.set_cursor_abs(disp3,1,15)
68
 
_vmssmg.put_line(disp3,"Saisir du texte")
69
 

	
70
 
_vmssmg.set_cursor_abs(disp3,3,4)
71
 
resultant = _vmssmg.read_string(kid,"Votre texte>", display_id=disp3)
72
 

	
73
 

	
74
 
_vmssmg.put_chars(disp3,"Vous avez saisie :",7, 2)
75
 
_vmssmg.put_chars(disp3,str(len(resultant[1])) + ' ' + repr(resultant), 7, 20)
76
 

	
77
 
time.sleep(5)
78
 

	
79
 

	
80
 
#--------------------------------------------------------------------
81
 
# Creer tableau
82
 
#--------------------------------------------------------------------
83
 

	
84
 
s, disp4 = _vmssmg.create_virtual_display(15, 50, SMG_M_BLOCK_BORDER)
85
 
_vmssmg.paste_virtual_display(disp4, pastid, 13, 11)
86
 

	
87
 
_vmssmg.set_cursor_abs(disp4,1,15)
88
 
_vmssmg.put_line(disp4,"Creer tableau")
89
 

	
90
 
_vmssmg.draw_line(disp4, 5, 10, 15, 10)
91
 
_vmssmg.draw_line(disp4, 5, 15, 15, 15)
92
 
_vmssmg.draw_line(disp4, 5, 20, 15, 20)
93
 
_vmssmg.draw_line(disp4, 5, 25, 15, 25)
94
 
_vmssmg.draw_line(disp4, 5, 30, 15, 30)
95
 

	
96
 
_vmssmg.draw_line(disp4, 5, 10, 5, 30)
97
 
_vmssmg.draw_line(disp4, 7, 10, 7, 30)
98
 
_vmssmg.draw_line(disp4, 9, 10, 9, 30)
99
 
_vmssmg.draw_line(disp4, 11, 10, 11, 30)
100
 
_vmssmg.draw_line(disp4, 13, 10, 13, 30)
101
 
_vmssmg.draw_line(disp4, 15, 10, 15, 30)
102
 

	
103
 
time.sleep(3)
104
 

	
105
 

	
106
 
#-------------------------------------------
107
 
# Erase_chars
108
 
#-------------------------------------------
109
 
#time.sleep(1)
110
 
#_vmssmg.erase_characters(disp2, 6, 1, 15)
111
 

	
112
 
#-------------------------------------------
113
 
# Erase_display
114
 
#-------------------------------------------
115
 
s, disp5 = _vmssmg.create_virtual_display(15, 50, SMG_M_BLOCK_BORDER)
116
 
_vmssmg.paste_virtual_display(disp5, pastid, 13, 11)
117
 

	
118
 
time.sleep(3)
119
 

	
120
 
_vmssmg.set_cursor_abs(disp5, 1, 15)
121
 
_vmssmg.put_line(disp5, "supprimer un cadre de texte")
122
 

	
123
 
_vmssmg.put_chars(disp5,"############################",4,5)
124
 
_vmssmg.put_chars(disp5,"############################",5,5)
125
 
_vmssmg.put_chars(disp5,"############################",6,5)
126
 
_vmssmg.put_chars(disp5,"############################",7,5)
127
 
_vmssmg.put_chars(disp5,"############################",8,5)
128
 
_vmssmg.put_chars(disp5,"############################",9,5)
129
 
_vmssmg.put_chars(disp5,"############################",10,5)
130
 

	
131
 
time.sleep(3)
132
 

	
133
 
_vmssmg.erase_display(disp5, 6, 7, 9, 25)
134
 

	
135
 
time.sleep(3)
136
 

	
137
 

	
138
 
#-------------------------------------------
139
 
# insert_chars
140
 
#-------------------------------------------
141
 

	
142
 
s, disp9 = _vmssmg.create_virtual_display(7, 50, SMG_M_BLOCK_BORDER)
143
 

	
144
 
_vmssmg.put_chars(disp9,"This virtual display have 7 rows and 50 columns", 2, 1)
145
 
_vmssmg.put_chars(disp9,"This is a bordered virtual display", 4, 1)
146
 
_vmssmg.put_chars(disp9,"SMG$PUT_CHARS puts data in this virtual display", 6, 1)
147
 

	
148
 
_vmssmg.paste_virtual_display(disp9, pastid, 13, 11)
149
 

	
150
 
time.sleep(5)
151
 

	
152
 
_vmssmg.insert_chars(disp9," This is a new row ", 1, 6)
153
 

	
154
 
time.sleep(5)
155
 

	
156
 
_vmssmg.insert_chars(disp9, " to this bordered display ", 6, 28)
157
 

	
158
 
time.sleep(5)
159
 

	
160
 

	
161
 
#-------------------------------------------
162
 
# Erase_display
163
 
#-------------------------------------------
164
 

	
165
 

	
166
 

	
167
 
#-----------------------------------------------------------------
168
 

	
169
 
s, disp6 = _vmssmg.create_virtual_display(15, 50, SMG_M_BLOCK_BORDER)
170
 
_vmssmg.paste_virtual_display(disp6, pastid, 13, 11)
171
 

	
172
 
_vmssmg.label_border (disp6,"Attachez vos ceintures")
173
 

	
174
 
_vmssmg.insert_line(disp6, 5, " Ca va bougerrrrr")
175
 

	
176
 
_vmssmg.move_virtual_display(disp6, pastid, 15, 20)
177
 
time.sleep(1)
178
 

	
179
 
_vmssmg.move_virtual_display(disp6, pastid, 20, 2)
180
 
time.sleep(1)
181
 

	
182
 
_vmssmg.move_virtual_display(disp6, pastid, 5, 30)
183
 
time.sleep(1)
184
 

	
185
 
_vmssmg.move_virtual_display(disp6, pastid, 13, 11)
186
 
time.sleep(1)
187
 

	
188
 
_vmssmg.move_text(disp6, 5, 10, 2, 4, disp6, 5, 7)
189
 
time.sleep(1)
190
 

	
191
 
#-----------------------------------------
192
 
# obtenir les parametres du viewport
193
 
#------------------------------------------
194
 
#page 164
195
 

	
196
 
#A=B=C=D=1
197
 

	
198
 
#_vmssmg.create_view_port(disp6,1,5,26,55)
199
 
#_vmssmg.paste_virtual_display(disp6, pastid, 8, 2)
200
 
#_vmssmg.set_physical_cursor (pastid, 16, 1)
201
 
#_vmssmg.get_viewport_char(disp6,A,B,C,D)
202
 

	
203
 
#print(A)
204
 
#print(B)
205
 
#print(C)
206
 
#print(D)
207
 

	
208
 
#-----------------------------------------
209
 
# scroll viewport
210
 
#------------------------------------------
211
 

	
212
 
s, disp7 = _vmssmg.create_virtual_display( 10, 50, SMG_M_BORDER )
213
 
_vmssmg.paste_virtual_display(disp6, pastid, 13, 11)
214
 

	
215
 
_vmssmg.create_viewport( disp7, 2, 2, 3, 10 )
216
 
time.sleep(1)
217
 
time.sleep(1)
218
 

	
219
 

	
220
 

	
221
 
_vmssmg.put_chars( disp7, "111111111111", 1, 1 )
222
 
_vmssmg.put_chars( disp7, "COUCOU 1", 2, 1 ) 
223
 
_vmssmg.put_chars( disp7, "222222222222", 3, 1 )
224
 
_vmssmg.put_chars( disp7, "COUCOU 2", 4, 1 )
225
 
_vmssmg.put_chars( disp7, "333333333333", 5, 1 )
226
 
_vmssmg.put_chars( disp7, "COUCOU 3", 6, 1 )
227
 
_vmssmg.put_chars( disp7, "444444444444", 7, 1 )
228
 
_vmssmg.put_chars( disp7, "COUCOU 4", 8, 1 )
229
 
_vmssmg.put_chars( disp7, "555555555555", 9, 1)
230
 
_vmssmg.put_chars( disp7, "COUCOU 5", 10, 1 )
231
 

	
232
 
time.sleep(1)
233
 

	
234
 
_vmssmg.paste_virtual_display(disp7, pastid, 4, 3)
235
 
time.sleep(1)
236
 

	
237
 
_vmssmg.scroll_viewport(disp7)
238
 
time.sleep(1)
239
 
_vmssmg.scroll_viewport(disp7)
240
 
time.sleep(1)
241
 
_vmssmg.scroll_viewport(disp7)
242
 
time.sleep(1)
243
 
_vmssmg.scroll_viewport(disp7)
244
 
time.sleep(1)
245
 

	
246
 

	
247
 
#-----------------------------------
248
 
# copier un virtual display
249
 
#-----------------------------------
250
 
#time.sleep(1)
251
 
#time.sleep(1)
252
 

	
253
 
#s, disp8 = _vmssmg.copy_virtual_display(disp7)
254
 

	
255
 
#time.sleep(1)
256
 
#time.sleep(1)
257
 

	
258
 
#_vmssmg.paste_virtual_display(disp8, pastid, 4, 20)
259
 

	
260
 
#-----------------------------------
261
 
# check for occlusion
262
 
#-----------------------------------
263
 

	
264
 
#time.sleep(1)
265
 
#time.sleep(1)
266
 

	
267
 

	
268
 
#s, occlusion = _vmssmg.check_for_occlusion(disp7,pastid)
269
 

	
270
 
#_vmssmg.put_chars( disp, "text not included", 1, 1 )
271
 

	
272
 
#time.sleep(1)
273
 
#time.sleep(1)
274
 

	
275
 
#_vmssmg.paste_virtual_display(disp7, pastid, 4, 20)
276
 

	
277
 

	
278
 
#-----------------------------------
279
 
# ChangeViewport
280
 
#-----------------------------------
281
 

	
282
 
#time.sleep(1)
283
 
#time.sleep(1)
284
 

	
285
 
#time.sleep(1)
286
 

	
287
 
s, disp10 = _vmssmg.create_virtual_display(9, 50, SMG_M_BLOCK_BORDER)
288
 

	
289
 
_vmssmg.put_chars(disp10, "This is a row 1 in a virtual display", 1, 1)
290
 
_vmssmg.put_chars(disp10, "This is a row 2 in a virtual display", 2, 1)
291
 
_vmssmg.put_chars(disp10, "This is a row 3 in a virtual display", 3, 1)
292
 
_vmssmg.put_chars(disp10, "This is a row 4 in a virtual display", 4, 1)
293
 
_vmssmg.put_chars(disp10, "This is a row 5 in a virtual display", 5, 1)
294
 
_vmssmg.put_chars(disp10, "This is a row 6 in a virtual display", 6, 1)
295
 
_vmssmg.put_chars(disp10, "This is a row 7 in a virtual display", 7, 1)
296
 
_vmssmg.put_chars(disp10, "This is a row 8 in a virtual display", 8, 1)
297
 
_vmssmg.put_chars(disp10, "This is a row 9 in a virtual display", 9, 1)
298
 

	
299
 
time.sleep(3)
300
 

	
301
 
s, disp11 = _vmssmg.copy_virtual_display (disp10)
302
 

	
303
 
_vmssmg.label_border (disp10, "Full Display" )
304
 

	
305
 
_vmssmg.label_border (disp11, " ViewPort " )
306
 

	
307
 
_vmssmg.paste_virtual_display (disp10, pastid, 2, 10)
308
 

	
309
 
_vmssmg.paste_virtual_display (disp11, pastid, 13, 10)
310
 

	
311
 
time.sleep(3)
312
 

	
313
 
_vmssmg.create_viewport (disp11, 2, 1, 5, 21 )
314
 

	
315
 
_vmssmg.paste_virtual_display (disp11, pastid, 13, 10)
316
 

	
317
 
time.sleep(3)
318
 

	
319
 
_vmssmg.change_viewport (disp11, 4, 8, 3, 15)
320
 

	
321
 
#---------------------------------------------------
322
 
# save_physical_screen  &  restore_physical_screen 
323
 
#---------------------------------------------------
324
 

	
325
 
s,disp = _vmssmg.save_physical_screen (pastid)
326
 
_vmssmg.restore_physical_screen (pastid, disp)
327
 

	
328
 
#-----------------------------------
329
 
# supprimer SMG pour quitter
330
 
#-----------------------------------
331
 

	
332
 
s = _vmssmg.put_status_line(pastid, "")
333
 
#_vmssmg.delete_virtual_display(disp)
334
 
#time.sleep(1)
335
 
#_vmssmg.delete_virtual_display(disp2)
336
 
#time.sleep(1)
337
 
_vmssmg.delete_virtual_keyboard(kid)
338
 
time.sleep(1)
339
 
_vmssmg.delete_pasteboard(pastid)
340
 
time.sleep(1)
0 comments (0 inline, 0 general)