Ignore:
Timestamp:
Dec 1, 2017, 3:44:52 AM (8 years ago)
Author:
Alex Taylor
Message:

CUPSWIZ version 1.13, various fixes for changes in backend (esp installing drv:// type models).

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

Legend:

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

    r55 r59  
    33MacroPath: VRM:G:\netlabs\svn\ecups\trunk\gui\printer\cupswiz
    44EXEPath:
    5 RunParameters:
     5RunParameters: /debug
    66RunDirectory:
    77VRXWindow: __VREMainWindow,1,578,2746,5770,9106
    8 VRXWindow: __VRESectionListWindow,1,650,11900,4529,3891
    9 VRXWindow: __VREToolsWindow,1,1650,9973,5471,1667
     8VRXWindow: __VRESectionListWindow,1,675,11900,4529,3891
     9VRXWindow: __VREToolsWindow,1,1650,9973,5477,1667
    1010VRXWindow: __VREWindListWindow,1,5191,11900,2650,3891
    1111UserFile: 1
    1212UserWindow: WN_MAIN,1
    13 UserWindow: SW_NETWORK,1
    1413UserWindow: SW_CREATE,1
    1514UserWindow: SW_MODEL,1
  • trunk/gui/printer/cupswiz/cupswiz.VRX

    r55 r59  
    254254        cups_cmd = cups_cmd '-v "'globals.!prt_port'" -P "'globals.!prt_ppd'"'
    255255    ELSE DO
     256        /*
    256257        PARSE VAR globals.!prt_ppd (globals.!cupsdir)'\share\cups\model\' model
    257         IF model == '' THEN model = globals.!prt_ppd
     258        IF model == '' THEN
     259        */
     260        model = TRANSLATE( globals.!prt_ppd, '/', '\')
    258261        cups_cmd = cups_cmd '-v "'globals.!prt_port'" -m "'model'"'
    259262    END
     
    393396    /* Create the CUPS printer */
    394397    IF globals.!remotecups == '' THEN DO
    395         CALL LINEOUT globals.!log1, 'No local printer, creating remote CUPS printer'
     398        CALL LINEOUT globals.!log1, 'Local CUPS queue does not exist, creating.'
    396399        ok = CreateCupsPrinter()
    397400        IF ok <> 0 THEN
     
    429432        END
    430433        ELSE DO
     434            cups_ppd = globals.!prt_ppd
     435            IF cups_ppd == '' THEN DO
     436                /* If we didn't have a PPD before, use the CUPS-generated one now
     437                 * to get the exact model name.
     438                 */
     439                cups_ppd = STREAM( cups_etc'\cups\ppd\'globals.!prt_name'.ppd', 'C', 'QUERY EXISTS')
     440                globals.!prt_nick = GetNameFromPPD( cups_ppd )
     441            END
    431442            drv_model = PrinterExistsInDRV( globals.!os2driver, globals.!prt_nick )
    432443            CALL LINEOUT globals.!log1, 'PrinterExistsInDRV(' globals.!os2driver',' globals.!prt_nick '):' drv_model
    433444            IF drv_model == '' THEN DO
    434                 cups_ppd = globals.!prt_ppd
    435                 IF cups_ppd == '' THEN
    436                     cups_ppd = STREAM( cups_etc'\cups\ppd\'globals.!prt_name'.ppd', 'C', 'QUERY EXISTS')
    437445                IF cups_ppd == '' THEN DO
     446                    /* CUPS didn't give us a PPD?  Hmm, better ask the user for
     447                     * an existing printer model to use.
     448                     */
    438449                    CALL LINEOUT globals.!log1, 'CUPS PPD for this printer ('cups_etc'\cups\ppd\'globals.!prt_name'.ppd) does not exist.'
    439450                    CALL LINEOUT globals.!log1, 'Cannot import PPD.  Prompting user for preferred printer model.'
     
    441452                END
    442453                ELSE DO
    443                     ok = ImportPPD(globals.!os2driver, cups_ppd )
     454                    ok = ImportPPD( globals.!os2driver, cups_ppd )
    444455                    IF ok <> 0 THEN DO
    445456                        CALL LINEOUT globals.!log1, 'PPD import failed:' ok
     
    720731        PARSE VAR models.i _brand _model ' - CUPS+' _type
    721732        IF _type == '' THEN DO
    722             PARSE VAR models.i _brand _model ',' _type
    723             IF WORD( _type, 1 ) == 'hpcups' THEN
    724                 _type = 'HPLIP' /* SUBWORD( _type, 2 ) */
     733            IF POS('hpcups', _model ) > 0 THEN
     734                _type = 'HPLIP'
     735            ELSE IF POS('hpijs', _model ) > 0 THEN
     736                _type = 'HPLIP'
    725737            ELSE IF ( _type == '') & ( LEFT( ppds.i, 3 ) == 'hp/') THEN
    726738                _type = 'HPLIP'
     739            lc = LASTPOS(',', _model )
     740            IF ( _type == 'HPLIP') & ( lc > 1 ) THEN DO
     741                _type = _type || SUBSTR( _model, lc )
     742                _model = LEFT( _model, lc - 1 )
     743            END
    727744        END
    728745        man = WORDPOS( _brand, makers )
     
    10641081        /* Next, create a new list for the updated driver and merge that in */
    10651082        newlist = workdir'\'driver'.LST'
    1066         CALL CreateDriverList driver, newlist
     1083        CALL CreateDriverList drv_out, newlist
    10671084        DO WHILE LINES( newlist )
    10681085            _line = LINEIN( newlist )
     
    13061323    IF cupsdrv == '' THEN DO
    13071324        cupsd_exe = SysSearchPath('PATH', 'cupsd.exe')
    1308         IF cupsd_exe <> '' THEN 
     1325        IF cupsd_exe <> '' THEN
    13091326            cupsdrv = FILESPEC('DRIVE', cupsd_exe )
    13101327    END
     
    15481565                ppd = manufacturers.man.!printers.which.!driver
    15491566                globals.!mode = 1   /* Mode 1: CUPS-included model */
    1550                 IF POS('://', ppd ) > 0 THEN DO
    1551                     globals.!prt_ppd  = ''
    1552                     globals.!prt_dev  = ppd
     1567
     1568                /* We're dealing with a device which lpadmin reported as supported
     1569                 * by the current CUPS installation. In this mode, we will set
     1570                 * both !prt_ppd and !prt_dev if a path to a PPD file was returned, or
     1571                 * only !prt_dev if it was reported as a URI (e.g. drv:///whatever) to
     1572                 * a dynamic PPD.
     1573                 */
     1574                IF POS('://', ppd ) > 0 THEN DO     /* lpadmin returned URI for dynamic PPD */
     1575                    globals.!prt_ppd = ''
     1576                    globals.!prt_dev = ppd
    15531577                    sel_brand = VRGet('LB_BRAND', 'SelectedString')
    15541578                    sel_name = sel_brand VRMethod('LB_SELECT', 'GetString', selected )
     
    15591583                        globals.!prt_nick = STRIP( _nick )
    15601584                END
    1561                 ELSE DO
    1562                     globals.!prt_ppd  = TRANSLATE( globals.!cupsdir'/share/cups/model/'ppd, '\', '/')
    1563                     globals.!prt_dev  = ''
     1585                ELSE DO                             /* lpadmin returned path to an actual PPD */
     1586                    globals.!prt_dev  = ppd             /* <-- or is relative_ppd needed for this? */
     1587                    IF LEFT( ppd, 10 ) == 'lsb/local/' THEN DO
     1588                        path_to_ppd = globals.!cupsroot'/usr/local/share'
     1589                        relative_ppd = SUBSTR( ppd, 11 )
     1590                    END
     1591                    ELSE IF LEFT( ppd, 8 ) == 'lsb/usr/' THEN DO
     1592                        path_to_ppd = globals.!cupsroot'/usr/share'
     1593                        relative_ppd = SUBSTR( ppd, 9 )
     1594                    END
     1595                    ELSE DO
     1596                        path_to_ppd = globals.!cupsdir'/share/cups'
     1597                        relative_ppd = ppd
     1598                    END
     1599                    globals.!prt_ppd  = TRANSLATE( path_to_ppd'/ppd/' || relative_ppd, '\', '/')
     1600                    /* TODO check for '/@unixroot' and replace with globals.!cupsroot if present */
    15641601                    globals.!prt_nick = GetNameFromPPD( globals.!prt_ppd )
     1602                    IF globals.!prt_nick = '' THEN DO
     1603                        globals.!prt_ppd  = TRANSLATE( path_to_ppd'/model/' || relative_ppd, '\', '/')
     1604                        globals.!prt_nick = GetNameFromPPD( globals.!prt_ppd )
     1605                    END
     1606                    IF globals.!prt_nick = '' THEN DO
     1607                        CALL VRMessage VRWindow(), NLSGetMessage( 76, globals.!prt_ppd ),,      /* 76: Could not read printer name from %1. */
     1608                                                   NLSGetMessage( 77 ), 'E'                     /* 77: Invalid PPD */
     1609                        RETURN
     1610                    END
    15651611                END
    15661612            END
     
    15711617                CALL LINEOUT globals.!log1, 'Starting printer install with user-provided PPD:'
    15721618            ELSE
    1573                 CALL LINEOUT globals.!log1, 'Starting printer install for built-in model:'
    1574             IF globals.!prt_dev <> '' THEN
     1619                CALL LINEOUT globals.!log1, 'Starting printer install for built-in model:' ppd
     1620            IF globals.!prt_ppd <> '' THEN
     1621                CALL LINEOUT globals.!log1, ' - PPD file:   ' globals.!prt_ppd
     1622            ELSE
    15751623                CALL LINEOUT globals.!log1, ' - Device name:' globals.!prt_dev
    1576             ELSE
    1577                 CALL LINEOUT globals.!log1, ' - PPD file:   ' globals.!prt_ppd
    15781624            CALL LINEOUT globals.!log1, ' - Model name: ' globals.!prt_nick
    15791625            CALL LINEOUT globals.!log1, ''
     
    19552001    CALL NLSSetText 'SW_ABOUT',  'Caption', 10                                          /* 10: Product Information */
    19562002    CALL NLSSetText 'DT_ABOUT1', 'Caption', 11                                          /* 11: eCups Printer Install Utility */
    1957     CALL NLSSetText 'DT_ABOUT2', 'Caption', 12, '1.11'                                  /* 12: Version %1 */
    1958     CALL NLSSetText 'DT_ABOUT3', 'Caption', 13, '2010-2016'                             /* 13: (C) %1 Alex Taylor */
     2003    CALL NLSSetText 'DT_ABOUT2', 'Caption', 12, '1.13'                                  /* 12: Version %1 */
     2004    CALL NLSSetText 'DT_ABOUT3', 'Caption', 13, '2010-2017'                             /* 13: (C) %1 Alex Taylor */
    19592005    CALL NLSSetText 'PB_ABOUT',  'Caption', 2                                           /* 10: Product Information */
    19602006
  • trunk/gui/printer/cupswiz/readme.1st

    r53 r59  
    110110  - The CUPS printer is always created with default job options.  If you want
    111111    to change them, you will have to do so from the CUPS administration GUI.
     112  - Password-protected local CUPS queues are not supported.  (Network printers
     113    connected with LPD, IPP or SMB should work, however.)
    112114  - There may well be undiscovered bugs; please report any you find.
    113115
Note: See TracChangeset for help on using the changeset viewer.