mmcp42
July 14, 2020, 8:31am
1
I wanted the virtual printer to process M118 gcode commands just like a real printer
it only took two lines of code!
I modified ~/oprint/lib/python2.7/site-packages/octoprint/plugins/virtual_printer/virtual.py
to add this fragment
def _gcode_M118(self, data):
# type: (str) -> None
# strip off leading M118
# and any whitespace at either end
self._send(data[4:].strip())
at around line 486 in the code
it slots in between M109 and M140
how can I get this integrated into mainstream code?
Read the contributing guide: OctoPrint/CONTRIBUTING.md
Basically boils down to the below, but make sure you follow the guide above:
Fork the OctoPrint repository at https://github.com/OctoPrint/OctoPrint
Make your changes on your fork, commit and test.
Create a pull request against the maintenance
branch
mmcp42
July 14, 2020, 9:57am
3
@Charlie_Powell
cheers
v useful links
1 Like
mmcp42
July 14, 2020, 1:05pm
4
ok
I have (I think)
installed a development environment
fork from github
made my changes
now trying to test
worked through the instructions
got as far as
run the test suite from the checked out source folder via nosetests --with-doctest
nosetest not found
I've had a look around and I can't find it either
any clues?
cheers
mmcp42
July 14, 2020, 3:08pm
5
found that I had to install Sphinx to be able to run nosetests
didn't spot that anywhere!
now I get a shed-load of errors depending on which folder I cd to before running nosetests
where SHOULD I be ruuning it?
cheers
Have just run it here from the checked out folder ('Repository root') with no issues. This is the folder that contains src
, tests
, docs
, setup.py
etc.
Nose should have been installed with OctoPrint in the development environment using pip install .[develop]
. You may need to activate the virtual environment to use it.If not install with pip install nose
Also note that OctoPrint is currently in release candidate phase so you may or may not get a response to any pull request quickly.
mmcp42
July 14, 2020, 5:53pm
8
@Charlie_Powell
thanks for that
I'll try again (more slowly and carefully!
and no rush from my side
1 Like
Also keep in mind, that OctoPrint is moving over to Python 3
mmcp42
July 14, 2020, 6:41pm
10
@Ewald_Ikemann
yup noticed that too
luckily my code is version agnostic
1 Like
foosel
July 14, 2020, 9:01pm
11
Where did you find to run nosetests
? Because that means there's somewhere some documentation I forgot to update. OctoPrint switched to pytest
.
This should work inside a checkout with activated virtualenv:
pip install -e .[develop]
pytest
mmcp42
July 15, 2020, 6:40am
12
@foosel
I started with this link
OctoPrint/CONTRIBUTING.md
which took me to this page
setting up development environment
that mentions nosetests
I'll try pytest
now
thanks!
1 Like
foosel
July 15, 2020, 9:44am
13
2 Likes