/
manifest.enaml
106 lines (76 loc) · 2.67 KB
/
manifest.enaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# -*- coding: utf-8 -*-
"""
Created on Jul 25, 2015
@author: jrm
"""
import enaml
from enaml.workbench.api import Extension
from enaml.workbench.plugin_manifest import PluginManifest
from inkcut.device.extensions import DEVICE_PROTOCOL_POINT, DeviceProtocol
def gpgl_factory(driver, declaration):
from .gpgl import GPGLProtocol
return GPGLProtocol(declaration=declaration)
def hpgl_factory(driver, declaration):
from .hpgl import HPGLProtocol
return HPGLProtocol(declaration=declaration)
def dmpl_factory(driver, declaration):
from .dmpl import DMPLProtocol, DMPLConfig
return DMPLProtocol(declaration=declaration,
config=DMPLConfig(**driver.get_protocol_config('dmpl')))
def dmpl_config_view():
with enaml.imports():
from .view import DMPLConfigView
return DMPLConfigView
def hpgl_config_view():
with enaml.imports():
from .view import HPGLConfigView
return HPGLConfigView
def cammgl1_factory(driver, declaration):
from .camm import CAMMGL1Protocol
return CAMMGL1Protocol(declaration=declaration)
def gcode_factory(driver, declaration):
from .gcode import GCodeProtocol, GCodeConfig
return GCodeProtocol(declaration=declaration, config=GCodeConfig(**driver.get_protocol_config('gcode')))
def gcode_config_view():
with enaml.imports():
from .view import GCodeConfigView
return GCodeConfigView
def mock_factory(driver, declaration):
from .debug import DebugProtocol
return DebugProtocol(declaration=declaration)
enamldef ProtocolManifest(PluginManifest):
""" Add new protocols here or within any other plugin.
All protocols should implement the IDeviceProtocol and then
register as an extension to the point 'inkcut.device.protocols'
"""
id = 'inkcut.device.protocols'
Extension:
id = 'protocols'
point = DEVICE_PROTOCOL_POINT
DeviceProtocol:
id = 'gpgl'
name = 'GPGL'
factory = gpgl_factory
DeviceProtocol:
id = 'hpgl'
name = 'HPGL'
factory = hpgl_factory
config_view = hpgl_config_view
DeviceProtocol:
id = 'dmpl'
name = 'DMPL'
factory = dmpl_factory
config_view = dmpl_config_view
DeviceProtocol:
id = 'camm-gl1'
name = 'CAMM-GL I'
factory = cammgl1_factory
DeviceProtocol:
id = 'gcode'
name = 'G-Code'
factory = gcode_factory
config_view = gcode_config_view
DeviceProtocol:
id = 'debug'
name = 'Virtual'
factory = mock_factory