[aded2d1] | 1 | __all__ = [ |
---|
| 2 | 'JobPriority', |
---|
| 3 | 'JobHoldUntil', |
---|
| 4 | 'JobSheets', |
---|
| 5 | 'MultipleDocumentHandling', |
---|
| 6 | 'Copies', |
---|
| 7 | 'Finishings', |
---|
| 8 | 'PageRanges', |
---|
| 9 | 'Sides', |
---|
| 10 | 'NumberUp', |
---|
| 11 | 'OrientationRequested', |
---|
| 12 | 'Media', |
---|
| 13 | 'PrinterResolution', |
---|
| 14 | 'PrintQuality', |
---|
| 15 | ] |
---|
| 16 | |
---|
| 17 | from ..attribute import Attribute |
---|
| 18 | from ..value import Value |
---|
| 19 | from ..exceptions import ClientErrorAttributes |
---|
| 20 | |
---|
[b828a96] | 21 | def JobPriority(val): |
---|
[aded2d1] | 22 | """4.2.1 job-priority (integer(1:100)) |
---|
| 23 | |
---|
| 24 | This attribute specifies a priority for scheduling the Job. A |
---|
| 25 | higher value specifies a higher priority. The value 1 indicates |
---|
| 26 | the lowest possible priority. The value 100 indicates the highest |
---|
| 27 | possible priority. Among those jobs that are ready to print, a |
---|
| 28 | Printer MUST print all jobs with a priority value of n before |
---|
| 29 | printing those with a priority value of n-1 for all n. |
---|
| 30 | |
---|
| 31 | If the Printer object supports this attribute, it MUST always |
---|
| 32 | support the full range from 1 to 100. No administrative |
---|
| 33 | restrictions are permitted. This way an end-user can always make |
---|
| 34 | full use of the entire range with any Printer object. If |
---|
| 35 | privileged jobs are implemented outside IPP/1.1, they MUST have |
---|
| 36 | priorities higher than 100, rather than restricting the range |
---|
| 37 | available to end-users. |
---|
| 38 | |
---|
| 39 | If the client does not supply this attribute and this attribute is |
---|
| 40 | supported by the Printer object, the Printer object MUST use the |
---|
| 41 | value of the Printer object's 'job-priority-default' at job |
---|
| 42 | submission time (unlike most Job Template attributes that are used |
---|
| 43 | if necessary at job processing time). |
---|
| 44 | |
---|
| 45 | The syntax for the 'job-priority-supported' is also |
---|
| 46 | integer(1:100). This single integer value indicates the number of |
---|
| 47 | priority levels supported. The Printer object MUST take the value |
---|
| 48 | supplied by the client and map it to the closest integer in a |
---|
| 49 | sequence of n integers values that are evenly distributed over the |
---|
| 50 | range from 1 to 100 using the formula: |
---|
| 51 | |
---|
| 52 | roundToNearestInt((100x+50)/n) |
---|
| 53 | |
---|
| 54 | where n is the value of 'job-priority-supported' and x ranges from |
---|
| 55 | 0 through n-1. |
---|
| 56 | |
---|
| 57 | For example, if n=1 the sequence of values is 50; if n=2, the |
---|
| 58 | sequence of values is: 25 and 75; if n = 3, the sequence of values |
---|
| 59 | is: 17, 50 and 83; if n = 10, the sequence of values is: 5, 15, |
---|
| 60 | 25, 35, 45, 55, 65, 75, 85, and 95; if n = 100, the sequence of |
---|
| 61 | values is: 1, 2, 3, ... 100. |
---|
| 62 | |
---|
| 63 | If the value of the Printer object's 'job-priority-supported' is |
---|
| 64 | 10 and the client supplies values in the range 1 to 10, the |
---|
| 65 | Printer object maps them to 5, in the range 11 to 20, the Printer |
---|
| 66 | object maps them to 15, etc. |
---|
| 67 | |
---|
| 68 | """ |
---|
| 69 | |
---|
| 70 | |
---|
[b828a96] | 71 | return Attribute( |
---|
| 72 | 'job-priority', |
---|
| 73 | [Value(IntegerTags.INTEGER), val]) |
---|
[aded2d1] | 74 | |
---|
[b828a96] | 75 | def JobHoldUntil(val): |
---|
[aded2d1] | 76 | """4.2.2 job-hold-until (type3 keyword | name (MAX)) |
---|
| 77 | |
---|
| 78 | """ |
---|
| 79 | |
---|
[b828a96] | 80 | raise ClientErrorAttributes, "job-hold-until" |
---|
| 81 | |
---|
| 82 | def JobSheets(val): |
---|
[aded2d1] | 83 | """4.2.3 job-sheets (type3 keyword | name(MAX)) |
---|
| 84 | |
---|
| 85 | """ |
---|
[b828a96] | 86 | |
---|
| 87 | raise ClientErrorAttributes, "job-sheets" |
---|
[aded2d1] | 88 | |
---|
[b828a96] | 89 | def MultipleDocumentHandling(val): |
---|
[aded2d1] | 90 | """4.2.4 multiple-document-handling (type2 keyword) |
---|
| 91 | |
---|
| 92 | """ |
---|
| 93 | |
---|
[b828a96] | 94 | raise ClientErrorAttributes, "multiple-document-handling" |
---|
[aded2d1] | 95 | |
---|
[b828a96] | 96 | def Copies(val): |
---|
[aded2d1] | 97 | """4.2.5 copies (integer(1:MAX)) |
---|
| 98 | |
---|
| 99 | """ |
---|
[b828a96] | 100 | |
---|
| 101 | raise ClientErrorAttributes, "copies" |
---|
[aded2d1] | 102 | |
---|
[b828a96] | 103 | def Finishings(*vals): |
---|
[aded2d1] | 104 | """4.2.6 finishings (1setOf type2 enum) |
---|
| 105 | |
---|
| 106 | """ |
---|
| 107 | |
---|
[b828a96] | 108 | raise ClientErrorAttributes, "finishings" |
---|
[aded2d1] | 109 | |
---|
[b828a96] | 110 | def PageRanges(*vals): |
---|
[aded2d1] | 111 | """4.2.7 page-ranges (1setOf rangeOfInteger (1:MAX)) |
---|
| 112 | |
---|
| 113 | """ |
---|
| 114 | |
---|
[b828a96] | 115 | raise ClientErrorAttributes, "page-ranges" |
---|
[aded2d1] | 116 | |
---|
[b828a96] | 117 | def Sides(val): |
---|
[aded2d1] | 118 | """4.2.8 sides (type2 keyword) |
---|
| 119 | |
---|
| 120 | """ |
---|
| 121 | |
---|
[b828a96] | 122 | raise ClientErrorAttributes, "sides" |
---|
[aded2d1] | 123 | |
---|
[b828a96] | 124 | def NumberUp(val): |
---|
[aded2d1] | 125 | """4.2.9 number-up (integer(1:MAX)) |
---|
| 126 | |
---|
| 127 | """ |
---|
| 128 | |
---|
[b828a96] | 129 | raise ClientErrorAttributes, "number-up" |
---|
[aded2d1] | 130 | |
---|
[b828a96] | 131 | def OrientationRequested(val): |
---|
[aded2d1] | 132 | """4.2.10 orientation-requested (type2 enum) |
---|
| 133 | |
---|
| 134 | """ |
---|
| 135 | |
---|
[b828a96] | 136 | raise ClientErrorAttributes, "orientation-requested" |
---|
[aded2d1] | 137 | |
---|
[b828a96] | 138 | def Media(val): |
---|
[aded2d1] | 139 | """4.2.11 media (type3 keyword | name(MAX)) |
---|
| 140 | |
---|
| 141 | """ |
---|
| 142 | |
---|
[b828a96] | 143 | raise ClientErrorAttributes, "media" |
---|
[aded2d1] | 144 | |
---|
| 145 | ### XXX: we may want to repurpose this for bitrate? |
---|
[b828a96] | 146 | def PrinterResolution(val): |
---|
[aded2d1] | 147 | """4.2.12 printer-resolution (resolution) |
---|
| 148 | |
---|
| 149 | """ |
---|
| 150 | |
---|
[b828a96] | 151 | raise ClientErrorAttributes, "printer-resolution" |
---|
[aded2d1] | 152 | |
---|
[b828a96] | 153 | def PrintQuality(val): |
---|
[aded2d1] | 154 | """4.2.13 print-quality (type2 enum) |
---|
| 155 | |
---|
| 156 | """ |
---|
| 157 | |
---|
[b828a96] | 158 | raise ClientErrorAttributes, "print-quality" |
---|