Ignore:
Timestamp:
Nov 6, 2012, 6:22:25 PM (13 years ago)
Author:
Alex Taylor
Message:

Eliminate need for RINSTPRN. Try to import PPD from \cups\etc\cups\ppd if it doesn't exist in OS/2 driver. Some minor UI-related fixes.

Location:
trunk/gui/printer/cupswiz
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/printer/cupswiz/cupswiz.VRP

    r12 r17  
    11VX-REXX OS/2 V2.14 Build B3
    22VRX: cupswiz.VRX
    3 MacroPath: VRM:E:\DEVELOPMENT\VXREXX\Projects\cupswiz
     3MacroPath: VRM:G:\netlabs\svn\ecups\trunk\gui\printer\cupswiz
    44EXEPath:
    5 RunParameters: f:\cups
     5RunParameters:
    66RunDirectory:
    77VRXWindow: __VREMainWindow,1,602,2554,5770,9106
    8 VRXWindow: __VRESectionListWindow,1,662,11804,4529,3891
    9 VRXWindow: __VREToolsWindow,1,1674,9877,4995,1667
     8VRXWindow: __VRESectionListWindow,1,650,11804,4529,3891
     9VRXWindow: __VREToolsWindow,1,1674,9877,4965,1659
    1010VRXWindow: __VREWindListWindow,1,5215,11804,2650,3891
    1111UserFile: 1
  • trunk/gui/printer/cupswiz/cupswiz.VRX

    r16 r17  
    202202    queue_name    = GetQueueName( printer_title )
    203203    port_name     = GetNextPortName('CUPS')
    204     use_drv       = globals.!prdrv
    205 
    206     /* Determine the source directories/files to pass to RINSTPRN.EXE.  (Some
    207      * of this logic is repeated from ImportPPD, but we have to do it again
    208      * here because (a) we might not have gone through ImportPPD to get to this
    209      * point, and (b) even if we did, the repository information might have
    210      * changed.)
    211      */
    212     copied_driver = 0
     204
     205    /* Determine the printer driver source directories/files.  Yes, this is
     206     * repeated from ImportPPD, but we have to do it again here because
     207     * (a) we might not have gone through ImportPPD to get to this point, and
     208     * (b) even if we did, the repository information might have changed.
     209     */
    213210    driver_path = GetDriverSource( prnt_drv )
    214 
    215     IF ( pmdx <> '') & ( globals.!prdrv <> '') & ( globals.!prdesc <> '') THEN DO
    216         /* Printer driver is in the local repository, so we can just point
    217          * to that, and use the system PRDESC.LST file.
     211    IF driver_path == '' THEN
     212        /* Driver was not found in the repository.  Check for a previously-
     213         * installed copy under \OS2\DLL.
    218214         */
    219         use_desc = globals.!prdesc
    220         use_src  = globals.!repository
    221     END
    222     ELSE IF driver_path <> '' THEN DO
    223         /* Driver is not in the repository, but was found in another designated
    224          * location.  Point to that location, and create a temporary PRDESC.LST
    225          * file for it.
    226          */
    227         use_src  = VRParseFilePath( driver_path, 'DP')
    228         use_desc = use_src'\PRDESC.LST'
    229         CALL CreateDriverList driver_path, use_desc
    230     END
    231     ELSE DO
    232         /* Driver is not in the repository.  Try to grab the installed files
    233          * from under \OS2\DLL, copy them into a temporary working directory,
    234          * and create a temporary PRDESC.LST file.
    235          */
    236         driver_path = globals.!os2dir'\DLL\'prnt_drv'\'prnt_drv'.DRV'
    237 
    238         use_src  = SysTempFileName( globals.!tmpdir'\PDR_????')
    239         use_desc = use_src'\PRDESC.LST'
    240 
    241         IF VRMkDir( use_src ) == 0 THEN DO
    242             CALL LINEOUT globals.!log1, 'Failed to create working directory' use_src':' VRError()
    243             RETURN 1
    244         END
    245         IF CopyDriverToSource( driver_path, use_src ) == 0 THEN DO
    246             CALL LINEOUT globals.!log1, 'Failed to copy driver' driver_path 'to working directory' use_src'.'
    247             RETURN 1
    248         END
    249         CALL CreateDriverList driver_path, use_desc
    250         copied_driver = 1
     215        driver_path = STREAM( globals.!os2dir'\DLL\'prnt_drv'\'prnt_drv'.DRV', 'C', 'QUERY EXISTS')
     216
     217    IF driver_path == '' THEN DO
     218        /* TODO allow the user to browse for the driver on their system */
     219        CALL VRMessage VRWindow(), 'The printer driver' prnt_drv 'could not  ',
     220                                   'be located.  If you have the driver      ',
     221                                   'files, please copy them to the directory ',
     222                                   globals.!os2dir'\DLL\'prnt_drv' and then  ',
     223                                   'try again.', 'Driver Not Found', 'E'
     224        RETURN 1
    251225    END
    252226
     
    257231        RETURN 1
    258232
    259     rsp_file = globals.!tmpdir'\printer.rsp'
    260     CALL RSPCreatePrinter rsp_file, prnt_drv, printer_model,,
    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      */
     233    /* New logic to create the printer ourselves (instead of using RINSTPRN).
     234     * There are two necessary steps: make sure the driver is installed, and
     235     * then create the printer object (which causes the underlying device and
     236     * queue to be created automatically as well).
     237     */
     238
    266239    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      */
    271     result = ExecRINSTPRN( use_desc, use_drv, use_src, rsp_file )
     240    CALL LINEOUT globals.!log1, 'InstallPrintDriver(' prnt_drv',' driver_path',' printer_model ') RC =' result
     241
     242    IF result == 0 THEN
     243        result = CreatePrinterObject( prnt_drv, printer_model,,
     244                                      port_name, queue_name, printer_title )
     245    CALL LINEOUT globals.!log1, 'CreatePrinterObject(' prnt_drv',' printer_model,
     246                                ',' port_name',' queue_name',' printer_title,
     247                                ') RC =' result
     248
    272249    IF result <> 0 THEN
    273250        CALL DeletePort port_name
     
    278255                       'usable until the desktop is restarted.',,
    279256                       'Port Driver Problem', 'W'
    280     END
    281 
    282     IF copied_driver == 1 THEN DO
    283         CALL VRDeleteFile use_src'\*'
    284         CALL VRRmDir use_src
    285257    END
    286258
     
    313285        END
    314286        ELSE IF PrinterExistsInDRV( globals.!os2driver, globals.!prt_nick ) == 0 THEN DO
    315             IF globals.!prt_ppd == '' THEN
     287            cups_ppd = globals.!prt_ppd
     288            IF cups_ppd == '' THEN
     289                cups_ppd = STREAM( globals.!cupsdir'\etc\cups\ppd'globals.!prt_name'.ppd', 'C', 'QUERY EXISTS')
     290            IF cups_ppd == '' THEN
    316291                CALL PromptForPMName
    317292            ELSE DO
    318                 ok = ImportPPD(globals.!os2driver, globals.!prt_ppd )
     293                ok = ImportPPD(globals.!os2driver, cups_ppd )
    319294                IF ok <> 0 THEN DO
    320295                    CALL LINEOUT globals.!log1, 'PPD import failed:' ok
     
    618593    manufacturers.count.!printers.1.!remark2 = ''
    619594    manufacturers.0 = count
     595
     596    CALL VRSet 'DT_INFO', 'Caption', 'Select the printer manufacturer and model from the list below.'
    620597
    621598RETURN
     
    14031380                       'no similar models were found.  The generic PostScript',
    14041381                       'driver will be used for application support.',,
    1405                        'Printer Name Not Found', 'E'
     1382                       'Printer Name Not Found', 'W'
    14061383        globals.!prt_nick = 'Generic PostScript Printer'
    14071384        RETURN
     
    14481425
    14491426    CALL VRSet 'WN_MAIN', 'Pointer', 'WAIT'
    1450     CALL VRSet 'DT_INFO', 'Caption', 'Select your printer model.'
    14511427
    14521428    /* Populate the manufacturer list */
  • trunk/gui/printer/cupswiz/readme.1st

    r15 r17  
    11CUPSWIZ - CUPS printer-creation wizard
    2 Version 0.95
     2Version 0.96
     3
     4  This program is simple graphical front-end for creating CUPS-based printers
     5  under OS/2.
     6
     7  Without this program, creating a CUPS printer under OS/2 is something of a
     8  headache.  First, you need to go into the CUPS web GUI and go through its
     9  (often agonizingly slow) creation wizard.  Then you need to make sure support
     10  for your printer has been imported into the OS/2 CUPS printer driver (which
     11  may require you to manually prep and then import a PPD file yourself).  Then
     12  you have to create a new OS/2 CUPS port and point it to the CUPS queue you
     13  created earlier.  Finally, you have to create an actual OS/2 printer object
     14  for your applications to print to.  This may be fine for a few expert users,
     15  but the average person just wants to create a printer quickly and simply.
     16
     17  This program attempts to automate most of these steps.  The basic idea is
     18  that you select your printer make/model from the list of those supported
     19  (which will depend on your installed CUPS setup), or import a special CUPS
     20  PPD file which defines your printer, indicate how the printer is connected
     21  (whether via USB or one of a number of types of network connection), give
     22  it a name and description, and the program does the rest.
     23
     24  Some of the highlights:
     25   - When you create the printer, both the CUPS printer queue and a
     26     corresponding OS/2 printer object are created; the CUPS port linking
     27     the two is also created and configured automatically.  (You can also
     28     opt to only create the CUPS queue if you wish.)
     29   - You can also select an existing CUPS printer queue (locally or on a
     30     remote server), in which case a corresponding OS/2 printer object will
     31     be created for it.
     32   - The appropriate model in the OS/2 PM printer driver (ECUPS.DRV or
     33     ECUPS-HP.DRV) is automatically identified and installed in the new OS/2
     34     printer object.  If an exact match is not found (and no PPD is available
     35     - see next point) you will offered a list of similar models, or allowed
     36     to select generic support.
     37   - When installing a printer which is not currently defined in the OS/2
     38     printer driver, if a PPD exists for the new printer it will be imported
     39     automatically.  (If not, you will be prompted as above.)
     40
     41  As this program is still under development, it is not yet as smooth as it
     42  could be.  See the 'Limitations & Known Problems' section below for more.
    343
    444
     
    2464   Other required files (all included out of the box with eComStation;
    2565   other versions of OS/2 may or may not have them installed):
    26      - RINSTPRN.EXE (OS/2 printer CID installer, usually located in \OS2)
    2766     - VROBJ.DLL (VX-REXX standard runtime; must be in the LIBPATH)
    2867     - GZIP.EXE (GNU gzip; must be on the PATH)
     
    71110    to change them, you will have to do so from the CUPS administration GUI.
    72111  - This program is currently available in English only.
    73   - There is no help or documentation.
     112  - There is no help.
    74113  - There may well be undiscovered bugs; please report any you find.
    75114
  • trunk/gui/printer/cupswiz/todo

    r14 r17  
    11- Check to make sure CUPS.PDR is installed, and (offer to) install if missing.
    2 - Ditto for gzip.exe, rinstprn.exe and cupsport.exe
     2- Ditto for gzip.exe and cupsport.exe
     3- Ditto for ECUPS/ECUPS-HP/PSPRINT driver (...somehow)
    34- Offer the option to show both simplified/expert drivers.
    45- Allow setting at least some basic job options like paper/colour/quality.
    56- 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.