[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 | |
---|
| 21 | class JobPriority(Attribute): |
---|
| 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 | |
---|
| 71 | def __init__(self, val): |
---|
| 72 | super(type(self), self).__init__( |
---|
| 73 | 'job-priority', |
---|
| 74 | [Value(IntegerTags.INTEGER), val]) |
---|
| 75 | |
---|
| 76 | class JobHoldUntil(Attribute): |
---|
| 77 | """4.2.2 job-hold-until (type3 keyword | name (MAX)) |
---|
| 78 | |
---|
| 79 | """ |
---|
| 80 | |
---|
| 81 | def __init__(self, val): |
---|
| 82 | raise ClientErrorAttributes, "job-hold-until" |
---|
| 83 | |
---|
| 84 | class JobSheets(Attribute): |
---|
| 85 | """4.2.3 job-sheets (type3 keyword | name(MAX)) |
---|
| 86 | |
---|
| 87 | """ |
---|
| 88 | |
---|
| 89 | def __init__(self, val): |
---|
| 90 | raise ClientErrorAttributes, "job-sheets" |
---|
| 91 | |
---|
| 92 | class MultipleDocumentHandling(Attribute): |
---|
| 93 | """4.2.4 multiple-document-handling (type2 keyword) |
---|
| 94 | |
---|
| 95 | """ |
---|
| 96 | |
---|
| 97 | def __init__(self, val): |
---|
| 98 | raise ClientErrorAttributes, "multiple-document-handling" |
---|
| 99 | |
---|
| 100 | class Copies(Attribute): |
---|
| 101 | """4.2.5 copies (integer(1:MAX)) |
---|
| 102 | |
---|
| 103 | """ |
---|
| 104 | |
---|
| 105 | def __init__(self, val): |
---|
| 106 | raise ClientErrorAttributes, "copies" |
---|
| 107 | |
---|
| 108 | class Finishings(Attribute): |
---|
| 109 | """4.2.6 finishings (1setOf type2 enum) |
---|
| 110 | |
---|
| 111 | """ |
---|
| 112 | |
---|
| 113 | def __init__(self, *vals): |
---|
| 114 | raise ClientErrorAttributes, "finishings" |
---|
| 115 | |
---|
| 116 | class PageRanges(Attribute): |
---|
| 117 | """4.2.7 page-ranges (1setOf rangeOfInteger (1:MAX)) |
---|
| 118 | |
---|
| 119 | """ |
---|
| 120 | |
---|
| 121 | def __init__(self, *vals): |
---|
| 122 | raise ClientErrorAttributes, "page-ranges" |
---|
| 123 | |
---|
| 124 | class Sides(Attribute): |
---|
| 125 | """4.2.8 sides (type2 keyword) |
---|
| 126 | |
---|
| 127 | """ |
---|
| 128 | |
---|
| 129 | def __init__(self, val): |
---|
| 130 | raise ClientErrorAttributes, "sides" |
---|
| 131 | |
---|
| 132 | class NumberUp(Attribute): |
---|
| 133 | """4.2.9 number-up (integer(1:MAX)) |
---|
| 134 | |
---|
| 135 | """ |
---|
| 136 | |
---|
| 137 | def __init__(self, val): |
---|
| 138 | raise ClientErrorAttributes, "number-up" |
---|
| 139 | |
---|
| 140 | class OrientationRequested(Attribute): |
---|
| 141 | """4.2.10 orientation-requested (type2 enum) |
---|
| 142 | |
---|
| 143 | """ |
---|
| 144 | |
---|
| 145 | def __init__(self, val): |
---|
| 146 | raise ClientErrorAttributes, "orientation-requested" |
---|
| 147 | |
---|
| 148 | class Media(Attribute): |
---|
| 149 | """4.2.11 media (type3 keyword | name(MAX)) |
---|
| 150 | |
---|
| 151 | """ |
---|
| 152 | |
---|
| 153 | def __init__(self, val): |
---|
| 154 | raise ClientErrorAttributes, "media" |
---|
| 155 | |
---|
| 156 | ### XXX: we may want to repurpose this for bitrate? |
---|
| 157 | class PrinterResolution(Attribute): |
---|
| 158 | """4.2.12 printer-resolution (resolution) |
---|
| 159 | |
---|
| 160 | """ |
---|
| 161 | |
---|
| 162 | def __init__(self, val): |
---|
| 163 | raise ClientErrorAttributes, "printer-resolution" |
---|
| 164 | |
---|
| 165 | class PrintQuality(Attribute): |
---|
| 166 | """4.2.13 print-quality (type2 enum) |
---|
| 167 | |
---|
| 168 | """ |
---|
| 169 | |
---|
| 170 | def __init__(self, val): |
---|
| 171 | raise ClientErrorAttributes, "print-quality" |
---|