Changeset 14 for trunk/gui/printer/cupswiz
- Timestamp:
- Oct 8, 2012, 10:43:30 PM (13 years ago)
- Location:
- trunk/gui/printer/cupswiz
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/printer/cupswiz/cupswiz.VRX
r12 r14 101 101 */ 102 102 return 103 /*:VRX CHK_CREATEPM_Click 104 */ 105 CHK_CREATEPM_Click: PROCEDURE 106 set = VRGet( "CHK_CREATEPM", "Set" ) 107 CALL VRSet 'DT_PRESDRV', 'Enabled', set 108 CALL VRSet 'DDCB_PRESDRV', 'Enabled', set 109 RETURN 110 103 111 /*:VRX ConfirmAndCreate 104 112 */ … … 152 160 IF globals.!prt_dev <> '' THEN 153 161 cups_cmd = cups_cmd '-v "'globals.!prt_port'" -m' globals.!prt_dev 154 ELSE 155 cups_cmd = cups_cmd '-v "'globals.!prt_port'" -m "'globals.!prt_ppd'"' 156 162 ELSE IF globals.!mode == 2 THEN 163 cups_cmd = cups_cmd '-v "'globals.!prt_port'" -P "'globals.!prt_ppd'"' 164 ELSE DO 165 PARSE VAR globals.!prt_ppd (globals.!cupsdir)'\share\cups\model\' model 166 IF model == '' THEN model = globals.!prt_ppd 167 cups_cmd = cups_cmd '-v "'globals.!prt_port'" -m "'model'"' 168 END 157 169 158 170 CALL LINEOUT globals.!log1, 'Creating CUPS printer using:' … … 215 227 use_src = VRParseFilePath( driver_path, 'DP') 216 228 use_desc = use_src'\PRDESC.LST' 217 CALL CreateDriverList driver_path '\'prnt_drv'.DRV', use_desc229 CALL CreateDriverList driver_path, use_desc 218 230 END 219 231 ELSE DO … … 248 260 CALL RSPCreatePrinter rsp_file, prnt_drv, printer_model,, 249 261 port_name, queue_name, printer_title 262 263 /* Install the printer driver. (We do this manually because doing it 264 * through RINSTPRN seems not to work properly on some systems.) 265 */ 266 result = InstallPrintDriver( prnt_drv, driver_path, printer_model ) 267 IF result == 0 THEN CALL RSPInstallDriver rsp_file, prnt_drv, printer_model 268 269 /* Now call RINSTPRN to create the printer queue/device and object. 270 */ 250 271 result = ExecRINSTPRN( use_desc, use_drv, use_src, rsp_file ) 251 252 272 IF result <> 0 THEN 253 273 CALL DeletePort port_name … … 256 276 'The installed version of CUPS.PDR appears to be out of ', 257 277 'date. As a result, the desktop printer will not be ', 258 'us eable until the desktop is restarted.',,278 'usable until the desktop is restarted.',, 259 279 'Port Driver Problem', 'W' 260 280 END … … 315 335 DDCB_PROTOCOL_Change: PROCEDURE 316 336 317 which = VRGet('DDCB_PROTOCOL', 'Selected') 337 idx = VRGet('DDCB_PROTOCOL', 'Selected') 338 which = VRMethod('DDCB_PROTOCOL', 'GetItemData', idx ) 318 339 SELECT 319 340 WHEN which == 1 THEN DO /* IPP */ … … 321 342 show_user = 1 322 343 show_pass = 1 344 CALL VRSet 'DT_SERVER', 'Caption', 'Printer or server address:' 345 CALL VRSet 'DT_QUEUE', 'Caption', 'Printer queue name:' 346 CALL VRSet 'DT_USERID', 'Caption', 'User ID:' 323 347 END 324 348 WHEN which == 2 THEN DO /* SOCKET */ … … 326 350 show_user = 0 327 351 show_pass = 0 352 CALL VRSet 'DT_SERVER', 'Caption', 'Printer or server address:' 328 353 END 329 354 WHEN which == 3 THEN DO /* LPD */ … … 331 356 show_user = 1 332 357 show_pass = 0 333 /* CALL VRSet 'DT_USERID', 'Caption', 'User ID (if required):' */ 358 CALL VRSet 'DT_SERVER', 'Caption', 'Printer or server address:' 359 CALL VRSet 'DT_QUEUE', 'Caption', 'Printer queue name:' 360 CALL VRSet 'DT_USERID', 'Caption', 'User ID (if required):' 334 361 END 335 362 WHEN which == 4 THEN DO /* SMB */ … … 337 364 show_user = 1 338 365 show_pass = 1 339 /* CALL VRSet 'DT_QUEUE', 'Caption', 'Shared printer name:' */ 366 CALL VRSet 'DT_SERVER', 'Caption', 'Print server name:' 367 CALL VRSet 'DT_QUEUE', 'Caption', 'Shared printer name:' 368 CALL VRSet 'DT_USERID', 'Caption', 'User ID:' 340 369 END 341 370 OTHERWISE DO /* CUPS */ … … 343 372 show_user = 0 344 373 show_pass = 0 374 CALL VRSet 'DT_SERVER', 'Caption', 'CUPS server name:' 375 CALL VRSet 'DT_QUEUE', 'Caption', 'CUPS printer name:' 345 376 END 346 377 END … … 390 421 391 422 CALL VRSet 'DT_INFO', 'Caption', 'Looking for connected printers. Please wait...' 392 CALL VRMethod 'LB_SELECT', 'Clear'393 423 394 424 lpinfo_cmd = globals.!cupsdir'\sbin\lpinfo.exe -v |rxqueue' 425 snmp_cmd = globals.!cupsdir'\lib\cups\backend\snmp.exe |rxqueue' 395 426 396 427 _od = DIRECTORY() … … 398 429 listqueue = RXQUEUE('CREATE') 399 430 defqueue = RXQUEUE('SET', listqueue ) 431 432 /* Use the SNMP backend to find network printers. We do this in addition 433 * to lpinfo because SNMP may provide the actual printer name. We'll 434 * merge this with the output of lpinfo in the next step. 435 */ 436 ADDRESS CMD '@' snmp_cmd listqueue 437 DO QUEUED() 438 PARSE PULL line 439 PARSE VAR line _type _uri '"'_identifier'"' . 440 _uri = STRIP( _uri ) 441 _type = STRIP( _type ) 442 IF _uri == '' THEN ITERATE 443 IF _type <> 'network' THEN ITERATE 444 netnames._uri = _identifier 445 END 400 446 401 447 ADDRESS CMD '@' lpinfo_cmd listqueue … … 410 456 ELSE _protocol = TRANSLATE( _protocol ) 411 457 i = i + 1 412 IF _queue == '' THEN _desc = '('_protocol')' 413 ELSE _desc = _queue '('_protocol')' 414 devices.i = 'Detected network printer' _desc 'at' _host 458 IF _queue <> '' THEN _queue = '(queue '_queue')' 459 IF SYMBOL('netnames._name') == 'VAR' THEN 460 devices.i = 'Detected network printer ('_protocol') "'netnames._name'" at' _host _queue 461 ELSE 462 devices.i = 'Detected network printer ('_protocol') at' _host _queue 415 463 END 416 464 ELSE IF _type <> 'direct' THEN ITERATE 417 465 ELSE DO 466 IF _name == 'hp' THEN ITERATE 418 467 i = i + 1 419 468 devices.i = 'Local printer:' _name … … 443 492 CALL VRSet 'DT_INFO', 'Caption', 'Getting list of supported printers. Please wait...' 444 493 445 lpinfo_cmd = globals.!cupsdir'\sbin\lpinfo.exe --exclude-schemes drv -m |rxqueue'494 lpinfo_cmd = globals.!cupsdir'\sbin\lpinfo.exe --exclude-schemes drv -m 2>&1 |rxqueue' 446 495 447 496 _od = DIRECTORY() … … 504 553 DO i = 1 TO models.0 505 554 PARSE VAR models.i _brand _model ' - CUPS+' _type 555 IF _type == '' THEN DO 556 PARSE VAR models.i _brand _model ',' _type 557 IF WORD( _type, 1 ) == 'hpcups' THEN 558 _type = 'HPLIP' /* SUBWORD( _type, 2 ) */ 559 ELSE IF ( _type == '') & ( LEFT( ppds.i, 3 ) == 'hp/') THEN 560 _type = 'HPLIP' 561 END 506 562 man = WORDPOS( _brand, makers ) 507 563 IF man == 0 THEN ITERATE … … 518 574 * the regular driver by preference. 519 575 */ 520 IF ( manufacturers.man.!printers.count.!model == _model ) & , 521 ( manufacturers.man.!printers.count.!type == _version ) THEN 522 DO 523 IF ( WORD( _version, 1 ) == 'Gutenprint') & ( _flag == 'Simplified') THEN DO 524 manufacturers.man.!printers.count.!driver2 = manufacturers.man.!printers.count.!driver 525 manufacturers.man.!printers.count.!remark2 = manufacturers.man.!printers.count.!remark 526 manufacturers.man.!printers.count.!driver = ppds.i 527 manufacturers.man.!printers.count.!remark = 'Simplified' 576 IF ( TRANSLATE( manufacturers.man.!printers.count.!model ) == TRANSLATE( _model )) THEN DO 577 IF ( manufacturers.man.!printers.count.!type == _version ) THEN DO 578 IF ( WORD( _version, 1 ) == 'Gutenprint') & ( _flag == 'Simplified') THEN DO 579 manufacturers.man.!printers.count.!driver2 = manufacturers.man.!printers.count.!driver 580 manufacturers.man.!printers.count.!remark2 = manufacturers.man.!printers.count.!remark 581 manufacturers.man.!printers.count.!driver = ppds.i 582 manufacturers.man.!printers.count.!remark = 'Simplified' 583 END 584 ELSE DO 585 manufacturers.man.!printers.count.!driver2 = ppds.i 586 IF _flag == 'Simplified' THEN 587 manufacturers.man.!printers.count.!remark2 = 'Simplified' 588 ELSE 589 manufacturers.man.!printers.count.!remark2 = '' 590 END 591 ITERATE 528 592 END 529 ELSE DO530 manufacturers.man.!printers.count.!driver2 = ppds.i531 IF _flag == 'Simplified' THEN532 manufacturers.man.!printers.count.!remark2 = 'Simplified'533 ELSE534 manufacturers.man.!printers.count.!remark2 = ''535 END536 ITERATE537 593 END 538 594 END … … 574 630 */ 575 631 ImportPPD: PROCEDURE EXPOSE globals. 576 /* Import a new PPD file into a PostScript PrinterPakdriver.632 /* Import a new PPD file into a PostScript driver. 577 633 */ 578 634 ARG driver, ppdfile … … 777 833 END 778 834 779 IF mustcopy == 0 THEN DO 835 /*IF mustcopy == 0 THEN DO*/ 836 IF pmdx <> '' THEN DO 780 837 /* If we're working out of the repository, we need to update the 781 838 * driver table in PRDESC.LST to add the new driver(s). 782 839 */ 840 783 841 CALL LINEOUT globals.!log1, 'Updating' globals.!prdesc 'with' newprinters.0 'new entries ...' 784 842 count = 0 … … 871 929 872 930 IF \VRIsDir( globals.!cupsdir ) THEN DO 873 CALL VRMessage VRWindow(), 'Please specify the path where CUPS is installed as follows:' ||, 874 '0d0a0d0a'x || 'CUPSWIZ <cups-path>',, 875 'Unknown or Invalid CUPS Path', 'E' 876 EXIT 931 IF TRANSLATE( globals.!cupsdir ) <> '/R' THEN 932 CALL VRMessage VRWindow(),, 933 'CUPS could not be located. If you wish to use ' ||, 934 'a local installation of CUPS, please specify ' ||, 935 'the path where CUPS is installed on the command '||, 936 'line to this program (e.g "CUPSWIZ F:\CUPS").' ||, 937 '0d0a0d0a'x ||, 938 'Only remote CUPS queues will be available for ' ||, 939 'printers created in this session. (To skip ' ||, 940 'this message in the future, start this program ' ||, 941 'with the /R parameter.)',, 942 'CUPS Path Not Found or Not Valid', 'E' 943 globals.!cupsdir = '' 877 944 END 878 945 … … 953 1020 CALL VRMethod 'LB_SELECT', 'AddStringList', 'models.',, 'ppds.' 954 1021 CALL VRSet 'LB_SELECT', 'Painting', 1 1022 /* CALL VRSet 'LB_SELECT', 'Selected', 1 */ 955 1023 956 1024 RETURN … … 968 1036 IF selected == 0 THEN RETURN 969 1037 which = VRMethod('LB_SELECT', 'GetItemData', selected ) 970 IF which == '' THEN RETURN 971 man = VRMethod('LB_BRAND', 'GetItemData', brand ) 972 IF man == '' THEN RETURN 973 974 make = manufacturers.man.!name 975 model = manufacturers.man.!printers.which.!model 976 driver = manufacturers.man.!printers.which.!type 977 remark = manufacturers.man.!printers.which.!remark 978 IF remark == '' THEN 979 type = ' ('driver')' 980 ELSE 981 type = ' ('driver' - 'remark')' 982 983 CALL VRSet 'WN_MAIN', 'StatusText', make model type 1038 IF which <> '' THEN DO 1039 man = VRMethod('LB_BRAND', 'GetItemData', brand ) 1040 IF man == '' THEN RETURN 1041 make = manufacturers.man.!name 1042 model = manufacturers.man.!printers.which.!model 1043 driver = manufacturers.man.!printers.which.!type 1044 IF WORD( driver, 1 ) == 'hpcups' THEN driver = 'HPLIP' 1045 remark = manufacturers.man.!printers.which.!remark 1046 IF driver == '' THEN 1047 type = '' 1048 ELSE IF remark == '' THEN 1049 type = ' ('driver')' 1050 ELSE 1051 type = ' ('driver' - 'remark')' 1052 CALL VRSet 'WN_MAIN', 'StatusText', make model type 1053 END 984 1054 END 985 1055 … … 987 1057 END 988 1058 1059 CALL VRSet 'PB_NEXT', 'Enabled', 1 989 1060 RETURN 990 1061 … … 999 1070 /* Get CUPS paths. 1000 1071 */ 1001 globals.!cupsdir = '' 1002 cupsdrv = VRParseFilePath( me, 'D') 1003 cupsdir = cupsdrv':\cups' 1004 1005 globals.!cupsdir = cupsdir 1072 PARSE VALUE VRGetIni('eCups', 'CUPS', 'USER') WITH cupsdrv '00'x 1073 IF cupsdrv == '' THEN 1074 cupsdrv = VRParseFilePath( me, 'D') || ':' 1075 ELSE 1076 cupsdrv = STRIP( cupsdrv, 'T', '\') 1077 globals.!cupsdir = cupsdrv'\cups' 1006 1078 1007 1079 /* Get system paths. … … 1112 1184 */ 1113 1185 PB_NETOK_Click: PROCEDURE EXPOSE globals. port 1114 which = VRGet('DDCB_PROTOCOL', 'Selected') 1186 1187 idx = VRGet('DDCB_PROTOCOL', 'Selected') 1188 which = VRMethod('DDCB_PROTOCOL', 'GetItemData', idx ) 1115 1189 server = STRIP( VRGet("EF_SERVER", "Value")) 1116 1190 pqueue = STRIP( VRGet("EF_QUEUE", "Value")) … … 1193 1267 globals.!prt_dev = '' 1194 1268 globals.!prt_nick = GetNameFromPPD( ppd ) 1269 IF globals.!prt_nick == '' THEN DO 1270 CALL VRMessage VRWindow(), 'Could not read printer name '||, 1271 'from' ppd'.', 'Invalid PPD', 'E' 1272 RETURN 1273 END 1195 1274 END 1196 1275 ELSE DO … … 1216 1295 globals.!prt_ppd = TRANSLATE( globals.!cupsdir'/share/cups/model/'ppd, '\', '/') 1217 1296 globals.!prt_dev = '' 1218 globals.!prt_nick = GetNameFromPPD( ppd )1297 globals.!prt_nick = GetNameFromPPD( globals.!prt_ppd ) 1219 1298 END 1220 1299 END … … 1345 1424 SetPage1: PROCEDURE EXPOSE globals. manufacturers. 1346 1425 1426 CALL VRSet 'PB_NEXT', 'Enabled', 0 1347 1427 CALL VRSet 'LB_BRAND', 'Visible', 1 1348 1428 … … 1356 1436 CALL VRSet 'GB_INFO', 'Visible', 0 1357 1437 1358 globals.!page = 1 1438 globals.!page = 1 1439 globals.!prt_ppd = '' 1440 globals.!prt_dev = '' 1441 globals.!prt_nick = '' 1442 globals.!prt_port = '' 1443 globals.!remotecups = '' 1444 globals.!prt_name = '' 1445 globals.!prt_loc = '' 1446 globals.!prt_info = '' 1447 globals.!os2driver = '' 1448 1359 1449 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT' 1360 CALL GetCupsPrinters1361 1362 1450 CALL VRSet 'DT_INFO', 'Caption', 'Select your printer model.' 1363 1451 1364 1452 /* Populate the manufacturer list */ 1453 IF globals.!cupsdir == '' THEN DO 1454 manufacturers.1.!name = '-- Custom --' 1455 manufacturers.1.!printers.0 = 1 1456 manufacturers.1.!printers.1.!model = '-- Other printer (requires PPD) --' 1457 manufacturers.1.!printers.1.!driver = '' 1458 manufacturers.1.!printers.1.!type = '' 1459 manufacturers.1.!printers.1.!remark = '-- Other printer (requires PPD) --' 1460 manufacturers.1.!printers.1.!driver2 = '' 1461 manufacturers.1.!printers.1.!remark2 = '' 1462 manufacturers.0 = 1 1463 END 1464 ELSE 1465 CALL GetCupsPrinters 1466 1365 1467 CALL VRSet 'LB_BRAND', 'Painting', 0 1366 1468 DO i = 1 TO manufacturers.0 … … 1373 1475 CALL VRSet 'LB_BRAND', 'Painting', 1 1374 1476 1375 CALL VRMethod 'LB_SELECT', 'SetFocus' 1477 CALL VRMethod 'LB_BRAND', 'SetFocus' 1478 CALL VRSet 'LB_BRAND', 'Selected', 1 1376 1479 CALL VRSet 'WN_MAIN', 'Pointer', '<default>' 1377 1480 … … 1384 1487 globals.!page = 2 1385 1488 CALL VRSet 'LB_BRAND', 'Visible', 0 1489 CALL VRSet 'PB_NEXT', 'Enabled', 0 1386 1490 CALL VRSet 'WN_MAIN', 'StatusText', 'Selected printer: ' globals.!prt_nick 1387 1491 … … 1392 1496 CALL VRSet 'LB_SELECT', 'Width', lb_w 1393 1497 1498 CALL VRMethod 'LB_SELECT', 'Clear' 1499 1394 1500 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT' 1395 CALL GetCupsPorts 1501 IF globals.!cupsdir == '' THEN DO 1502 CALL VRMethod 'LB_SELECT', 'AddString', 'Network printer (manual configuration)',, '' 1503 CALL VRSet 'LB_SELECT', 'Selected', 1 1504 END 1505 ELSE 1506 CALL GetCupsPorts 1396 1507 CALL VRMethod 'LB_SELECT', 'SetFocus' 1397 1508 CALL VRSet 'WN_MAIN', 'Pointer', '<default>' … … 1619 1730 SW_NETWORK_Init: 1620 1731 1732 IF globals.!cupsdir == '' THEN DO 1733 protos.0 = 1 1734 protos.1 = 'Existing CUPS printer (remote server)' 1735 pnums.0 = 1 1736 pnums.1 = 5 1737 END 1738 ELSE DO 1739 protos.0 = 5 1740 protos.1 = 'Internet Printing Protocol (IPP)' 1741 protos.2 = 'AppSocket/JetDirect' 1742 protos.3 = 'Line Printer Remote daemon (LPD)' 1743 protos.4 = 'Windows/SMB network' 1744 protos.5 = 'Existing CUPS printer' 1745 pnums.0 = 5 1746 pnums.1 = 1 1747 pnums.2 = 2 1748 pnums.3 = 3 1749 pnums.4 = 4 1750 pnums.5 = 5 1751 END 1752 1753 CALL VRMethod 'DDCB_PROTOCOL', 'AddStringList', 'protos.',, 'pnums.' 1621 1754 CALL VRSet 'DDCB_PROTOCOL', 'Selected', 1 1622 1755 -
trunk/gui/printer/cupswiz/readme.1st
r12 r14 1 1 CUPSWIZ - prototype CUPS printer-creation wizard 2 Test release 3 2 Version 0.95 3 3 4 4 Make sure cupsport.exe is either in the current directory or in the PATH. … … 7 7 (e.g. "cupswiz f:\cups") 8 8 9 <path-to-cups> can be omitted if cupswiz.exe is on the same drive as CUPS. 9 <path-to-cups> can be omitted if cupswiz.exe is on the same drive as CUPS, or 10 if OS2.INI defines the CUPS path in the key "eCups" -> "CUPS". 10 11 11 12 Requirements: 12 13 - CUPS, including ECUPS.DRV and CUPS.PDR, must be installed and working. 13 14 The CUPS daemon must be running. 14 - CUPS.PDR should have a bldlevel of 1.03 (February 2011) or later. If 15 not, the created WPS printer object will not work properly until the16 WPS is restarted.15 - CUPS.PDR should have a bldlevel of 1.03 (February 2011) or later. If not, 16 the created WPS printer object will not work properly until you reboot 17 (possibly restarting the WPS will also work, but I'm not sure about that). 17 18 - GNU gzip.exe must be installed (somewhere on the PATH). 18 19 - RINSTPRN.EXE (included with OS/2 MCP/ACP & eComStation, not sure about 19 earlier ver ions) must also be somewhere on the PATH.20 earlier versions) must also be somewhere on the PATH. 20 21 - VROBJ.DLL (included in eComStation or available on Hobbes) is required. 21 22 22 23 Current limitations: 23 24 - The CUPS printer is always created with default job options. 24 - If your %TMP% directory has spaces in the pathname, the program will 25 almost certainly fail to work properly. The same applies to your 26 %LOGFILES% directory. 25 - There is no way to go 'back'; if you need to go back and change a previous 26 selection, you must cancel and start over. 27 - The program has only been tested with Gutenprint, HPLIP, and (to a limited 28 extent) foomatic-rip based printers. Other drivers packages such as SpliX 29 or foo2qpdl may work but this is not guaranteed. 30 - If your %TMP% directory has spaces in the pathname, the program will almost 31 certainly fail to work properly. The same applies to your %LOGFILES% 32 directory. 27 33 - No internationalization support (yet). 28 34 - No help or documentation. -
trunk/gui/printer/cupswiz/todo
r12 r14 1 1 - Check to make sure CUPS.PDR is installed, and (offer to) install if missing. 2 2 - Ditto for gzip.exe, rinstprn.exe and cupsport.exe 3 - Use OS2.INI eCups::CUPS ||'\cups' for cups path if found. 4 - How to support total remote CUPS (i.e. no local CUPS install)? 5 - Offer the option to show both simplified/expert drivers 3 - Offer the option to show both simplified/expert drivers. 4 - Allow setting at least some basic job options like paper/colour/quality. 5 - I18N support 6 - Is there a way to generate the PPD for driver import when using exe://? e.g. 7 get the saved PPD from the cups\etc\cups\ppd directory.
Note:
See TracChangeset
for help on using the changeset viewer.