forked from jsoftware/ide_qt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pacman.ijs
361 lines (359 loc) · 7.29 KB
/
pacman.ijs
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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
require 'pacman'
coclass 'jpacman'
Status=: cutopen 0 : 0
All
Upgrades
Not installed
Installed
)
create=: 3 : 0
log=: loggui
window=: 0
written=: matched=: 0
DATAMASK=: 0
DATAX=: _1
IFSECTION=: 0
ISGUI=: 1
LASTMSG=: ''
LOGTXT=: ''
MSGX=: 0
SECTION=: ,<'All'
SELNDX=: 0 0
if. -. pmview_init'' do. destroy'' end.
)
destroy=: 3 : 0
codestroy''
)
toDEL=: [: ; (DEL&, @ (,&DEL)) each
info=: 3 : 0
wd 'mb info "',SYSNAME,'" *',y
)
runpacman=: 3 : 0
if. (<'jpacman') e. {.2}.|:(<;._2);._2 wd'qpx' do. EMPTY return. end.
empty '' conew 'jpacman'
)
pm_apply_button=: 3 : 0
dat=. pmview_selected''
if. 0 = #dat do.
info 'No packages selected for installation.' return.
end.
if. -.HASADDONSDIR*.HASFILEACCESS do.
info 'File permission' return.
end.
if. -. ONLINE do.
if. -. getonline 'Install Packages';CHECKONLINE do. return. end.
end.
install dat
pmview_show''
)
pm_bclear_button=: 3 : 0
setshowall 0
pmview_show''
)
pm_bnotins_button=: 3 : 0
setshownew 1
pmview_show''
)
pm_bsection_button=: 3 : 0
IFSECTION=: '1'={.bsection
pmview_show''
)
pm_bselall_button=: 3 : 0
setshowall 1
pmview_show''
)
pm_bupdate_button=: 3 : 0
setshowups 1
pmview_show''
)
pm_close=: pm_exit_button=: 3 : 0
wd 'pclose'
destroy''
)
pm_remove_button=: 3 : 0
if. -. HASADDONSDIR*.HASFILEACCESS do.
info 'File permission' return.
end.
dat=. pmview_selected''
if. 0 = #dat do.
info 'No packages selected for removal.' return.
end.
remove_console 1{"1 pmview_selected''
pmview_show''
)
pm_msg=: 3 : 0
MSGX=: y
pmview_showlog''
)
pm_pac_change=: 3 : 0
val=. 0 ". pac
DATAX=: {.0 ". pac_cell
row=. DATAX{(I.DATAMASK),_1
if. row<0 do. return. end.
PKGDATA=: (<val) (<row;0)} PKGDATA
)
pm_pac_mark=: 3 : 0
DATAX=: {. 0 ". pac
pmview_showlog''
)
pm_prebuild_button=: 3 : 0
if. -. HASADDONSDIR*.HASFILEACCESS do.
info 'File permission' return.
end.
if. -. ONLINE do.
getonline 'Read Catalog from Server';CHECKASK
end.
if. ONLINE do.
log 'Updating server catalog...'
refreshjal''
end.
log 'Rebuilding local file list...'
refreshaddins''
readlocal''
log 'Done.'
pacman_init''
pmview_show''
)
pm_pupcat_button=: 3 : 0
if. -. HASADDONSDIR*.HASFILEACCESS do.
info 'File permission' return.
end.
if. -. ONLINE do.
if. 0 = getonline 'Read Catalog from Server';CHECKASK do. return. end.
end.
log 'Updating server catalog...'
if. refreshweb'' do.
log 'Done.'
end.
pacman_init''
pmview_show''
)
pm_sel_select=: 3 : 0
SELNDX=: (0 ". sel_select) IFSECTION } SELNDX
pmview_show''
)
pm_bsummary_button=: pm_msg bind 0
pm_bhistory_button=: pm_msg bind 1
pm_bmanifest_button=: pm_msg bind 2
pm_blog_button=: pm_msg bind 3
pm_binfo_button=: addon_info
pm_bstatus_button=: pm_bsection_button
pmview_applycounts=: 3 : 0
dat=. y
if. 0=#dat do. 0 0 return. end.
'lib dat'=. splitlib dat
cnt=. 0 < #lib
siz=. cnt * 2 pick LIB
ind=. ({."1 ZIPS) i. 1 {"1 dat
(cnt + #ind),siz + +/>(<ind;4){ZIPS
)
pmview_getmask=: 3 : 0
ndx=. IFSECTION { SELNDX
if. IFSECTION do.
sel=. ndx pick SECTION
select. sel
case. 'All' do.
DATAMASK=: (#PKGDATA) $ 1
case. BASELIB do.
DATAMASK=: (1 {"1 PKGDATA) = <BASELIB
case. do.
DATAMASK=: (<sel,'/') = (1+#sel) {.each 1 {"1 PKGDATA
end.
else.
select. ndx pick Status
case. 'All' do.
DATAMASK=: (#PKGDATA) $ 1
case. 'Not installed' do.
DATAMASK=: pkgnew''
case. 'Upgrades' do.
DATAMASK=: pkgups''
case. 'Installed' do.
DATAMASK=: -. pkgnew''
end.
end.
DATAX=: DATAX <. <: +/DATAMASK
)
pmview_init=: 3 : 0
HASFILEACCESS=: checkaccess''
HASADDONSDIR=: checkaddonsdir''
setfiles ''
readlocal''
ONLINE=: checkonline''
pacman_init 1
pmview_open''
pmview_show''
1
)
pmview_selected=: 3 : 'PKGDATA #~ > {."1 PKGDATA'
pmview_show=: 3 : 0
wd 'psel pm'
pmview_getmask ''
sel=. IFSECTION pick Status;<SECTION
wd 'set sel items ',toDEL sel
wd 'set sel select ',":IFSECTION { SELNDX
wd 'set apply enable ',":ONLINE
pmview_showdata DATAMASK # PKGDATA
)
pmview_showdata=: 3 : 0
VIEWDATA=: y
dat=. ": each 5 {."1 VIEWDATA
wd 'set pac shape ',":$dat
wd 'set pac type 100 0 0 0 0'
wd 'set pac data *',toDEL dat
)
pmview_showlog=: 3 : 0
if. window=0 do. return. end.
if. MSGX=3 do.
t=. ; LOGTXT
else.
ndx=. DATAX{(I.DATAMASK),_1
if. ndx<0 do.
t=. ''
else.
p=. '~addons/',(<ndx;1){:: PKGDATA
select. MSGX
case. 0 do.
t=. ndx pick 5{"1 PKGDATA
case. 1 do.
t=. fread jpath p,'/history.txt'
case. 2 do.
t=. fread jpath p,'/manifest.ijs'
end.
end.
end.
if. 2 ~: 3!:0 t do. t=. '' end.
wd 'set edlog text *',t
if. MSGX=3 do. wd 'set edlog scroll max' end.
)
addon_info=: 3 : 0
if. 0=#PKGDATA do. return.end.
row=. DATAX{(I.DATAMASK),_1
if. row<0 do. return. end.
a=. (<row;1){:: PKGDATA
if. 'base library'-:a do. a=. 'JAL' else. a=. 'Addons/',a end.
browse_j_ 'http://code.jsoftware.com/wiki/',a
)
loggui=: 3 : 0
LOGTXT=: LOGTXT,<;.2 y,LF -. {: y
if. window=0 do. return. end.
wd 'set blog value 1'
MSGX=: 3
pmview_showlog''
wd 'msgs'
)
pkglater=: 3 : 0
if. 0=#PKGDATA do. $0 return. end.
loc=. fixvers > 2 {"1 PKGDATA
srv=. fixvers > 3 {"1 PKGDATA
{."1 /:"2 srv ,:"1 loc
)
pkgnew=: 3 : 0
0 = # &> 2 {"1 PKGDATA
)
PMVIEW=: 0 : 0
pc pm;
menupop "&File";
menu exit "&Quit" "Ctrl+Q";
menupopz;
menupop "&Tools";
menu pupcat "&Update Catalog from Server";
menusep;
menu prebuild "&Rebuild all Repository Catalogs";
menusep;
menu remove "Re&move Selected Packages";
menupopz;
splith 0 1 100 100;
cc sel listbox;
bin p5h;
cc bstatus radiobutton;cn "Status";
cc bsection radiobutton group;cn "Category";
bin zp5;
groupbox Selections;
cc bclear button;cn "Clear All";
cc bupdate button;cn "Updates";
cc bnotins button;cn "Not Installed";
cc bselall button;cn "Select All";
bin p5;
cc apply button;cn "Install";
groupboxend;
splitsep;
splitv 1 0 100 150;
cc pac table selectrows;
splitsep;
cc edlog editm readonly;
bin p5h;
cc bsummary radiobutton;cn "Summary";
cc bhistory radiobutton group;cn "History";
cc bmanifest radiobutton group;cn "Manifest";
cc blog radiobutton group;cn "Log";
bin s1;
cc binfo button;cn "Wiki";
splitend;
splitend;
)
PMVIEW_S=: 0 : 0
pc pm;
menupop "&File";
menu exit "&Quit" "Ctrl+Q";
menupopz;
menupop "&Tools";
menu pupcat "&Update Catalog from Server";
menusep;
menu prebuild "&Rebuild all Repository Catalogs";
menusep;
menu remove "Re&move Selected Packages";
menupopz;
bin v;
cc sel combolist;
bin h;
cc bstatus radiobutton;cn "Status";
cc bsection radiobutton group;cn "Category";
bin s;
cc binfo button;cn "Wiki";
bin z;
bin vh;
cc apply button;cn "Install";
bin s;
cc selection static;cn "Selections";
cc bselall button;cn "Select All";
bin zh;
cc bclear button flush;cn "Clear All";
cc bupdate button;cn "Updates";
cc bnotins button;cn "Not Installed";
bin szz;
cc pac table selectrows;
cc edlog editm readonly;
bin h;
cc bsummary radiobutton flush;cn "Summary";
cc bhistory radiobutton group;cn "History";
cc bmanifest radiobutton group;cn "Manifest";
cc blog radiobutton group;cn "Log";
bin sz;
bin z;
)
pmview_edlog=: 3 : 0
MSGX=: '1' i.~ bsummary,bhistory,bmanifest,blog
pmview_showlog''
)
pmview_postinit=: 3 : 0
pmview_setmenu''
pmview_show''
logstatus''
)
pmview_read=: 3 : 0
IFSECTION=: 0 ". bsection
SELNDX=: (0 ". sel_select) IFSECTION } SELNDX
)
pmview_open=: 3 : 0
wh=. 900 700 <. 200 20 -~ 2 3 { 0 ". wd 'qscreen'
wd PMVIEW
wd 'set bsummary value 1'
wd 'set bstatus value 1'
wd 'pn *',SYSNAME
wd 'set pac shape 0 5'
wd 'set pac type 100 0 0 0 0'
wd 'set pac hdr " " Package Installed Latest Caption'
wd 'pmove 100 10 ',":wh
wd 'pshow'
window=: 1
)