Changeset 9 for trunk/gui/printer/cupswiz
- Timestamp:
- Oct 31, 2011, 5:06:48 AM (14 years ago)
- Location:
- trunk/gui/printer/cupswiz
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gui/printer/cupswiz/cupswiz.VRX
r8 r9 150 150 IF globals.!prt_loc <> '' THEN 151 151 cups_cmd = cups_cmd '-L "'globals.!prt_loc'"' 152 cups_cmd = cups_cmd '-v "'globals.!prt_port'" -P "'globals.!prt_ppd'"' 152 IF globals.!prt_dev <> '' THEN 153 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 153 157 154 158 CALL LINEOUT globals.!log1, 'Creating CUPS printer using:' … … 195 199 */ 196 200 copied_driver = 0 197 driver_path = GetDriverSource( driver)201 driver_path = GetDriverSource( prnt_drv ) 198 202 199 203 IF ( pmdx <> '') & ( globals.!prdrv <> '') & ( globals.!prdesc <> '') THEN DO … … 249 253 CALL DeletePort port_name 250 254 ELSE IF port_ok == 1 THEN DO 251 CALL VRMessage VRWindow(), 255 CALL VRMessage VRWindow(), 252 256 'The installed version of CUPS.PDR appears to be out of ', 253 257 'date. As a result, the desktop printer will not be ', 254 'useable until the desktop is restarted.',, 258 'useable until the desktop is restarted.',, 255 259 'Port Driver Problem', 'W' 256 260 END … … 289 293 END 290 294 ELSE IF PrinterExistsInDRV('ECUPS', globals.!prt_nick ) == 0 THEN DO 291 ok = ImportPPD('ECUPS', globals.!prt_ppd ) 292 IF ok <> 0 THEN DO 293 CALL LINEOUT globals.!log1, 'PPD import failed:' ok 294 RETURN 1 /** RC=1 PPD import failed **/ 295 IF globals.!prt_ppd == '' THEN 296 CALL PromptForPMName 297 ELSE DO 298 ok = ImportPPD('ECUPS', globals.!prt_ppd ) 299 IF ok <> 0 THEN DO 300 CALL LINEOUT globals.!log1, 'PPD import failed:' ok 301 RETURN 1 /** RC=1 PPD import failed **/ 302 END 295 303 END 296 304 END … … 351 359 352 360 od = DIRECTORY() 353 CALL DIRECTORY src 361 CALL DIRECTORY src 354 362 rinstprn_cmd = 'rinstprn /DSC:'dsc '/DRV:'drv' /S:'src , 355 363 '/T:'globals.!bootdrv '/L1:'globals.!logdir'\rinstprn.log' , … … 394 402 PARSE PULL line 395 403 PARSE VAR line _type _name 396 IF _type <> 'direct' THEN ITERATE397 404 IF _name == '' THEN ITERATE 398 i = i + 1 399 devices.i = 'Local printer:' _name 400 ports.i = _name 405 IF _type == 'network' & POS('://', _name ) > 0 THEN DO 406 PARSE VAR _name _protocol '://' _host '/' _queue 407 IF _protocol == 'socket' THEN _protocol = 'AppSocket' 408 ELSE _protocol = TRANSLATE( _protocol ) 409 i = i + 1 410 IF _queue == '' THEN _desc = '('_protocol')' 411 ELSE _desc = _queue '('_protocol')' 412 devices.i = 'Detected network printer' _desc 'at' _host 413 END 414 ELSE IF _type <> 'direct' THEN ITERATE 415 ELSE DO 416 i = i + 1 417 devices.i = 'Local printer:' _name 418 END 419 ports.i = _name 401 420 END 402 421 devices.0 = i … … 408 427 CALL VRSet 'LB_SELECT', 'Painting', 0 409 428 CALL VRMethod 'LB_SELECT', 'AddStringList', 'devices.',, 'ports.' 410 CALL VRMethod 'LB_SELECT', 'AddString', 'Network printer ',, ''429 CALL VRMethod 'LB_SELECT', 'AddString', 'Network printer (manual configuration)',, '' 411 430 CALL VRSet 'LB_SELECT', 'Selected', 1 412 431 CALL VRSet 'LB_SELECT', 'Painting', 1 … … 439 458 PARSE VAR line _ppd '.ppd ' _name 440 459 _ppd = _ppd'.ppd' 460 END 461 IF _name == '' THEN DO 462 PARSE VAR line _ppd _name 441 463 END 442 464 IF _name <> '' THEN DO … … 904 926 RETURN 905 927 928 /*:VRX PB_MODELCANCEL_Click 929 */ 930 PB_MODELCANCEL_Click: 931 CALL SW_MODEL_Close 932 globals.!prt_nick = 'Generic PostScript Printer' 933 RETURN 934 935 /*:VRX PB_MODELOK_Click 936 */ 937 PB_MODELOK_Click: 938 globals.!prt_nick = VRGet( "LB_OS2MODELS", "SelectedString" ) 939 CALL SW_MODEL_Close 940 RETURN 941 906 942 /*:VRX PB_NETCANCEL_Click 907 943 */ … … 986 1022 globals.!mode = 2 /* Mode 2: user-selected PPD file */ 987 1023 ppd = VRFileDialog( VRWindow(), 'Select PPD', 'O', '*.ppd') 1024 IF ppd == '' THEN RETURN 1025 globals.!prt_ppd = ppd 1026 globals.!prt_dev = '' 1027 globals.!prt_nick = GetNameFromPPD( ppd ) 988 1028 END 989 1029 ELSE DO 990 1030 globals.!mode = 1 /* Mode 1: CUPS-included model */ 991 ppd = TRANSLATE( globals.!cupsdir'/share/cups/model/'ppd, '\', '/') 1031 IF POS('exe://', ppd ) > 0 THEN DO 1032 globals.!prt_ppd = '' 1033 globals.!prt_dev = ppd 1034 sel_name = VRMethod('LB_SELECT', 'GetString', selected ) 1035 PARSE VAR sel_name _nick ' - CUPS' . 1036 IF _nick == '' THEN 1037 globals.!prt_nick = STRIP( sel_name ) 1038 ELSE 1039 globals.!prt_nick = STRIP( _nick ) 1040 END 1041 ELSE DO 1042 globals.!prt_ppd = TRANSLATE( globals.!cupsdir'/share/cups/model/'ppd, '\', '/') 1043 globals.!prt_dev = '' 1044 globals.!prt_nick = GetNameFromPPD( ppd ) 1045 END 992 1046 END 993 IF ppd == '' THEN RETURN994 globals.!prt_ppd = ppd995 globals.!prt_nick = GetNameFromPPD( ppd )996 1047 globals.!remotecups = '' 997 1048 … … 1001 1052 ELSE 1002 1053 CALL LINEOUT globals.!log1, 'Starting printer install for built-in model:' 1003 CALL LINEOUT globals.!log1, ' - PPD file: ' globals.!prt_ppd 1004 CALL LINEOUT globals.!log1, ' - Model name:' globals.!prt_nick 1054 IF globals.!prt_dev <> '' THEN 1055 CALL LINEOUT globals.!log1, ' - Device name:' globals.!prt_dev 1056 ELSE 1057 CALL LINEOUT globals.!log1, ' - PPD file: ' globals.!prt_ppd 1058 CALL LINEOUT globals.!log1, ' - Model name: ' globals.!prt_nick 1005 1059 CALL LINEOUT globals.!log1, '' 1006 1060 … … 1051 1105 END 1052 1106 1107 /* TODO support other drivers 1108 */ 1109 globals.!os2driver = 'ECUPS' 1110 1053 1111 CALL ConfirmAndCreate 1054 1112 END 1055 1113 1056 1114 WHEN globals.!page == 4 THEN DO 1057 CALL VRSet 'PB_NEXT', 'Caption', 'Next >' 1115 CALL VRSet 'PB_NEXT', 'Caption', 'Next >' 1116 CALL VRSet 'EF_NAME', 'Value', '' 1117 CALL VRSet 'EF_LOCATION', 'Value', '' 1118 CALL VRSet 'EF_DESC', 'Value', '' 1058 1119 CALL SetPage1 1059 1120 END … … 1061 1122 OTHERWISE NOP 1062 1123 END 1124 1125 RETURN 1126 1127 /*:VRX PromptForPMName 1128 */ 1129 PromptForPMName: PROCEDURE EXPOSE globals. models. best 1130 best = MatchPrinterModel( globals.!os2driver, globals.!prt_nick ) 1131 1132 IF models.0 == 0 THEN DO 1133 /* No similar models were found in the list of supported printers. 1134 * Just use the generic PS driver. 1135 */ 1136 CALL VRMessage VRWindow(),, 1137 'The printer "'globals.!prt_nick'" does not appear to' , 1138 'be supported by the' globals.!os2driver 'driver, and' , 1139 'no similar models were found. The generic PostScript', 1140 'driver will be used for application support.',, 1141 'Printer Name Not Found', 'E' 1142 globals.!prt_nick = 'Generic PostScript Printer' 1143 RETURN 1144 END 1145 1146 CALL VRLoadSecondary 'SW_MODEL', 'W' 1063 1147 1064 1148 RETURN … … 1162 1246 1163 1247 IF globals.!remotecups <> '' THEN DO 1164 /* An existing CUPS printer was indicated. This means we're not 1248 /* An existing CUPS printer was indicated. This means we're not 1165 1249 * creating a CUPS printer, but only a PM printer object (and port) 1166 * that points to it. 1250 * that points to it. 1167 1251 */ 1168 1252 CALL VRSet 'DT_CREATE', 'Caption', 'Ready to create printer object with the following parameters.' … … 1194 1278 RETURN 1195 1279 1196 /*:VRX SW_NETWORK_Close 1197 */ 1198 SW_NETWORK_Close: 1199 call SW_NETWORK_Fini 1200 return 1201 1202 /*:VRX SW_NETWORK_Create 1203 */ 1204 SW_NETWORK_Create: 1205 call SW_NETWORK_Init 1206 return 1207 1208 /*:VRX SW_NETWORK_Fini 1209 */ 1210 SW_NETWORK_Fini: 1280 /*:VRX SW_MODEL_Close 1281 */ 1282 SW_MODEL_Close: 1283 call SW_MODEL_Fini 1284 return 1285 1286 /*:VRX SW_MODEL_Create 1287 */ 1288 SW_MODEL_Create: 1289 call SW_MODEL_Init 1290 return 1291 1292 /*:VRX SW_MODEL_Fini 1293 */ 1294 SW_MODEL_Fini: 1295 1296 CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT' 1297 1211 1298 window = VRInfo( "Window" ) 1212 1299 call VRDestroy window 1213 1300 drop window 1214 1301 return 1215 /*:VRX SW_NETWORK_Init 1216 */ 1217 SW_NETWORK_Init: 1218 1219 CALL VRSet 'DDCB_PROTOCOL', 'Selected', 1 1302 /*:VRX SW_MODEL_Init 1303 */ 1304 SW_MODEL_Init: 1305 1306 /* We should have a list of suggested printer models whose names at least 1307 * partially match the requested model, sorted in order with the closest 1308 * match at the top. 1309 */ 1310 ok = VRMethod( "LB_OS2MODELS", "AddStringList", "models.", ) 1311 IF best > 0 THEN 1312 CALL VRSet 'LP_OS2MODELS', 'Selected', best 1313 1314 CALL VRSet 'DT_MODEL1', 'Caption',, 1315 'The printer "'globals.!prt_nick'" could not be found in the' , 1316 globals.!os2driver'.DRV driver under that name. Please choose', 1317 'the model of printer which will be reported to applications.' 1318 1319 CALL VRSet 'WN_MAIN', 'Pointer', '<default>' 1220 1320 1221 1321 window = VRInfo( "Object" ) … … 1226 1326 end 1227 1327 drop window 1328 1329 RETURN 1330 1331 /*:VRX SW_NETWORK_Close 1332 */ 1333 SW_NETWORK_Close: 1334 call SW_NETWORK_Fini 1335 return 1336 1337 /*:VRX SW_NETWORK_Create 1338 */ 1339 SW_NETWORK_Create: 1340 call SW_NETWORK_Init 1341 return 1342 1343 /*:VRX SW_NETWORK_Fini 1344 */ 1345 SW_NETWORK_Fini: 1346 window = VRInfo( "Window" ) 1347 call VRDestroy window 1348 drop window 1349 return 1350 /*:VRX SW_NETWORK_Init 1351 */ 1352 SW_NETWORK_Init: 1353 1354 CALL VRSet 'DDCB_PROTOCOL', 'Selected', 1 1355 1356 window = VRInfo( "Object" ) 1357 if( \VRIsChildOf( window, "Notebook" ) ) then do 1358 call VRMethod window, "CenterWindow" 1359 call VRSet window, "Visible", 1 1360 call VRMethod window, "Activate" 1361 end 1362 drop window 1228 1363 return 1229 1364 -
trunk/gui/printer/cupswiz/readme.1st
r8 r9 1 1 CUPSWIZ - prototype CUPS printer-creation wizard 2 Test release 12 Test release 2 3 3 4 4 Make sure cupsport.exe is either in the current directory or in the PATH. … … 21 21 22 22 Current limitations: 23 - CUPS _must_ be installed locally. You can create a printer on a remote24 CUPS system, but this requires the use of CUPS tools which need to be25 present on the system the wizard runs on.26 23 - The CUPS printer is always created with default job options. 27 24 - Currently only ECUPS.DRV is supported (not ECUPS-HP.DRV). -
trunk/gui/printer/cupswiz/todo
r8 r9 1 1 - Check to make sure CUPS.PDR is installed, and (offer to) install if missing. 2 - Ditto for gzip , rinstprnand cupsport.exe2 - Ditto for gzip.exe, rinstprn.exe and cupsport.exe 3 3 - Split first-page printer list into manufacturer-model lists. 4 4 - Check if (mode 1) printer is HP-LIP and use ECUPS-HP instead.
Note:
See TracChangeset
for help on using the changeset viewer.