Skip to content

Commit

Permalink
Add more states for multi-skilled printer
Browse files Browse the repository at this point in the history
  • Loading branch information
nielstron committed Aug 16, 2019
1 parent 394fdac commit 879dd58
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions pysyncthru/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,22 @@ class State(Enum):
READY = 4
UNKNOWN = 5
PRINTING = 6
SCANNING = 7
CALIBRATING = 8


# Translating all variations of status messages to their meaning
RAW_TO_INTERNAL = {
"EN": {
' Sleeping... ': State.SLEEPING,
' Ready to Copy ': State.READY,
' Warming Up ': State.WARMING_UP,
'Sleeping....': State.SLEEPING,
'Ready To Copy': State.READY,
'Warming up. Please wait': State.WARMING_UP,
'Printing': State.PRINTING,
'Scanning': State.SCANNING,
'Calibrating... Please Wait': State.CALIBRATING,
},
"DE": {
' Sparbetrieb... ': State.SLEEPING,
Expand All @@ -35,6 +44,38 @@ class State(Enum):
}
}

# Adds menue items that are mapped to "Ready" state
_MENUE_ITEMS = {
"EN": [
'Basic Copy',
'Auto Fit Copy',
'Custom Copy',
'ID Copy',
'N-Up Copy',
'Book Copy',
'Local PC',
'Network PC',
'FTP',
'SMB',
'Email',
'USB',
'Shared Folder',
'Memory Send',
'On Hook Dial',
'Delayed Send',
'Redial',
'Group Dial Send',
'Speed Dial Send',
'Edit Home',
'Machine Setup',
'Admin Setup',
]
}
for lang, items in _MENUE_ITEMS.items():
for raw in items:
RAW_TO_INTERNAL[lang][raw] = State.READY


ANY_LANGUAGE = {}
for mapping in RAW_TO_INTERNAL.values():
ANY_LANGUAGE.update(mapping)
Expand All @@ -47,6 +88,8 @@ class State(Enum):
State.READY: 'Ready',
State.UNKNOWN: 'Unknown',
State.PRINTING: 'Printing',
State.SCANNING: 'Scanning',
State.CALIBRATING: 'Calibrating',
},
"DE": {
State.SLEEPING: 'Sparbetrieb',
Expand All @@ -55,6 +98,8 @@ class State(Enum):
State.READY: 'Bereit',
State.UNKNOWN: 'Unbekannt',
State.PRINTING: 'Drucken',
State.SCANNING: 'Scannen',
State.CALIBRATING: 'Kalibrieren',
},
"RU": {
State.SLEEPING: 'Oжидaниe',
Expand All @@ -63,5 +108,7 @@ class State(Enum):
State.READY: 'Гoтoв',
State.UNKNOWN: 'Неизвестно',
State.PRINTING: 'Идeт пeчaть',
State.SCANNING: 'сканирование',
State.CALIBRATING: 'калибровочный',
},
}

0 comments on commit 879dd58

Please sign in to comment.