Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
a511f209
Commit
a511f209
authored
Jun 12, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite gcoder_line to use properties instead of hacking setattr
parent
a3b27af5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
151 additions
and
14 deletions
+151
-14
gcoder_line.pyx
printrun/gcoder_line.pyx
+151
-14
No files found.
printrun/gcoder_line.pyx
View file @
a511f209
...
...
@@ -26,7 +26,7 @@ cdef class GLine(object):
cdef public float _x, _y, _z, _e, _f, _i, _j, _s, _p
cdef public bool _is_move, _relative, _relative_e, _extruding
cdef public float _current_x, _current_y, _current_z
cdef public
int
_current_tool
cdef public
char
_current_tool
cdef public long _gcview_end_vertex
cdef char* _raw
cdef char* _command
...
...
@@ -48,18 +48,156 @@ cdef class GLine(object):
self._command = NULL
def __dealloc__(self):
if self._raw: free(self._raw)
if self._command: free(self._command)
if self._raw
!= NULL
: free(self._raw)
if self._command
!= NULL
: free(self._command)
def __getattr__(self, name):
if getattr(self, "has_" + name):
if name == "raw":
return self._raw
elif name == "command":
return self._command
return getattr(self, "_" + name)
else:
return None
property x:
def __get__(self):
if self.has_x: return self._x
else: return None
def __set__(self, value):
self._x = value
self.has_x = True
property y:
def __get__(self):
if self.has_y: return self._y
else: return None
def __set__(self, value):
self._y = value
self.has_y = True
property z:
def __get__(self):
if self.has_z: return self._z
else: return None
def __set__(self, value):
self._z = value
self.has_z = True
property e:
def __get__(self):
if self.has_e: return self._e
else: return None
def __set__(self, value):
self._e = value
self.has_e = True
property f:
def __get__(self):
if self.has_f: return self._f
else: return None
def __set__(self, value):
self._f = value
self.has_f = True
property i:
def __get__(self):
if self.has_i: return self._i
else: return None
def __set__(self, value):
self._i = value
self.has_i = True
property j:
def __get__(self):
if self.has_j: return self._j
else: return None
def __set__(self, value):
self._j = value
self.has_j = True
property s:
def __get__(self):
if self.has_s: return self._s
else: return None
def __set__(self, value):
self._s = value
self.has_s = True
property p:
def __get__(self):
if self.has_p: return self._p
else: return None
def __set__(self, value):
self._p = value
self.has_p = True
property is_move:
def __get__(self):
if self.has_is_move: return self._is_move
else: return None
def __set__(self, value):
self._is_move = value
self.has_is_move = True
property relative:
def __get__(self):
if self.has_relative: return self._relative
else: return None
def __set__(self, value):
self._relative = value
self.has_relative = True
property relative_e:
def __get__(self):
if self.has_relative_e: return self._relative_e
else: return None
def __set__(self, value):
self._relative_e = value
self.has_relative_e = True
property extruding:
def __get__(self):
if self.has_extruding: return self._extruding
else: return None
def __set__(self, value):
self._extruding = value
self.has_extruding = True
property current_x:
def __get__(self):
if self.has_current_x: return self._current_x
else: return None
def __set__(self, value):
self._current_x = value
self.has_current_x = True
property current_y:
def __get__(self):
if self.has_current_y: return self._current_y
else: return None
def __set__(self, value):
self._current_y = value
self.has_current_y = True
property current_z:
def __get__(self):
if self.has_current_z: return self._current_z
else: return None
def __set__(self, value):
self._current_z = value
self.has_current_z = True
property current_tool:
def __get__(self):
if self.has_current_tool: return self._current_tool
else: return None
def __set__(self, value):
self._current_tool = value
self.has_current_tool = True
property gcview_end_vertex:
def __get__(self):
if self.has_gcview_end_vertex: return self._gcview_end_vertex
else: return None
def __set__(self, value):
self._gcview_end_vertex = value
self.has_gcview_end_vertex = True
property split_raw:
def __get__(self):
if self.has_split_raw: return self._split_raw
else: return None
def __set__(self, value):
self._split_raw = value
self.has_split_raw = True
property raw:
def __get__(self):
if self.has_raw: return self._raw
else: return None
def __set__(self, value):
self._raw = value
self.has_raw = True
property command:
def __get__(self):
if self.has_command: return self._command
else: return None
def __set__(self, value):
self._command = value
self.has_command = True
def setstring(self, name, value):
cdef char* orig = value
...
...
@@ -74,5 +212,4 @@ cdef class GLine(object):
setattr(self, "has_" + name, True)
def set(self, name, value):
setattr(self, "_" + name, value)
setattr(self, "has_" + name, True)
setattr(self, name, value)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment