printrun-src/README.md

changeset 45
c82943fb205f
parent 15
0bbb006204fc
--- a/printrun-src/README.md	Tue Jan 19 20:44:16 2021 +0100
+++ b/printrun-src/README.md	Tue Jan 19 20:45:09 2021 +0100
@@ -1,3 +1,7 @@
+# PRINTRUN 2.X
+
+The master branch holds the development of Printrun 2.x. This new version of Printrun supports Python 3 and wxPython 4. All new features and developments should be merged to it.
+
 Printrun consists of printcore, pronsole and pronterface, and a small collection of helpful scripts.
 
   * printcore.py is a library that makes writing reprap hosts easy
@@ -18,26 +22,18 @@
 
 A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/
 
+Note for OSX users: if OSX tells you the file is corrupted, you don't need to redownload it. Instead, you need to allow OSX to run unsigned apps. To do this, run 
+`sudo spctl --master-disable`
+
+
 ## Linux
 ### Ubuntu/Debian
 
-You can run Printrun directly from source. Fetch and install the dependencies using
-
-1. `sudo apt-get install python-serial python-wxgtk2.8 python-pyglet python-numpy cython python-libxml2 python-gobject python-dbus python-psutil python-cairosvg git`
-
-Clone the repository
-
-`git clone https://github.com/kliment/Printrun.git`
-
-and you can start using Printrun from the Printrun directory created by the git clone command.
-
-Users of Ubuntu Xenial Xerus or later and Debian Jessie or later won't find the package "python-wxgtk2.8" available, having been replaced by "python-wxgtk3.0". Running Printrun with "python-wxgtk3.0" instead, is possible but it is known to be affected by issue #615.
-
-A Printrun preliminary package is already available in Ubuntu Yakkety Yak and Debian Stretch/Sid repositories. Please be aware that this initial package is also known to be affected by issue #615.
+There is currently no package for Printrun 2. It must be [run from source](https://github.com/kliment/Printrun/tree/master#running-from-source).
 
 ### Chrome OS 
 
-You can use Printrun via crouton ( https://github.com/dnschneid/crouton ). Assuming you want Ubuntu Trusty, you used probably `sudo sh -e ~/Downloads/crouton -r trusty -t xfce` to install Ubuntu. Fetch and install dependencies with the line given above for Ubuntu/Debian, and obtain the source via git clone.
+You can use Printrun via crouton ( https://github.com/dnschneid/crouton ). Assuming you want Ubuntu Trusty, you used probably `sudo sh -e ~/Downloads/crouton -r trusty -t xfce` to install Ubuntu. Fetch and install printrun with the line given above for Ubuntu/Debian.
 
 By default you have no access to the serial port under Chrome OS crouton, so you cannot connect to your 3D printer. Add yourself to the serial group within the linux environment to fix this
 
@@ -49,19 +45,14 @@
 
 You can install Printrun from official packages. Install the whole package using
 
-`sudo yum install printrun`
+`sudo dnf install printrun`
 
 Or get only apps you need by
 
-`sudo yum install pronsole` or `pronterface` or `plater`
-
-Adding `--enablerepo updates-testing` option to `yum` might give you newer packages (but also not very tested).
+`sudo dnf install pronsole` or `pronterface` or `plater`
 
-You can also run Printrun directly from source, if the packages are too old for you. Fetch and install the dependencies using
+Adding `--enablerepo updates-testing` option to `dnf` might sometimes give you newer packages (but also not very tested).
 
-1. `sudo yum install pyserial wxPython python-pyglet python-cairosvg`
-
-Optional: `sudo yum install skeinforge simarrange`
 
 ### Archlinux
 
@@ -79,26 +70,45 @@
 
 To use pronterface, you need:
 
-  * python (ideally 2.6.x or 2.7.x),
-  * pyserial (or python-serial on ubuntu/debian)
-  * pyreadline (not needed on Linux) and
-  * argparse (installed by default with python >= 2.7)
-  * wxPython (some features such as Tabbed mode work better with wx 2.9)
+  * Python 3 (ideally 3.6),
+  * pyserial (or python3-serial on ubuntu/debian)
+  * pyreadline (not needed on Linux)
+  * wxPython 4
   * pyglet
+  * appdirs
   * numpy (for 3D view)
   * pycairo (to use Projector feature)
   * cairosvg (to use Projector feature)
-  * dbus (to inhibit sleep on some Linux systems)
+  * dbus (to inhibit sleep on some Linux systems) 
+
+### Use Python virtual environment
+
+Easiest way to run Printrun from source is to create and use a Python [virtual environment](https://docs.python.org/3/tutorial/venv.html).
+The following section assumes Linux. Please see specific instructions for Windows and macOS X below.
+
+**Ubuntu/Debian note:** You might need to install `python3-venv` first.
+
+**Note:** wxPython4 doesn't have Linux wheels available from the Python Package Index yet. Find a proper wheel for your distro at [extras.wxpython.org](https://extras.wxpython.org/wxPython4/extras/linux/gtk3/) and substitute the link in the bellow example. You might skip the wheel installation, but that results in compiling wxPython4 from source, which can be time and resource consuming and might fail.
 
-Please see specific instructions for Windows and Mac OS X below. Under Linux, you should use your package manager directly (see the "GETTING PRINTRUN" section), or pip:
 
-```pip install -r requirements.txt```
+```console
+$ git clone https://github.com/kliment/Printrun.git  # clone the repository
+$ cd Printrun  # change to Printrun directory
+$ python3 -m venv venv  # create an virtual environment
+$ . venv/bin/activate  # activate the virtual environment (notice the space after the dot)
+(venv) $ python -m pip install https://extras.wxpython.org/wxPython4/extras/linux/gtk3/fedora-27/wxPython-4.0.1-cp36-cp36m-linux_x86_64.whl  # replace the link with yours
+(venv) $ python -m pip install -r requirements.txt  # intall the rest of dependencies
+(venv) $ python pronterface.py  # run Pronterface
+```
 
 ### Cython-based G-Code parser
 
 Printrun default G-Code parser is quite memory hungry, but we also provide a much lighter one which just needs an extra build-time dependency (Cython), plus compiling the extension with:
 
-    python setup.py build_ext --inplace
+```console
+(venv) $ python -m pip install Cython
+(venv) $ python setup.py build_ext --inplace
+```
 
 The warning message
 
@@ -106,56 +116,49 @@
 
 means that this optimized G-Code parser hasn't been compiled. To get rid of it and benefit from the better implementation, please install Cython and run the command above.
 
+### Ubuntu/Debian
+
+The above method is the recommended way to run Printrun 2 from source. However, if you can't find a suitable wxPython4 wheel, or if it fails for other reasons, it could be run without using a python virtual environment. For users of Debian 10 Buster or later and Ubuntu 18.04 Bionic Beaver or later.
+
+Install the dependencies:
+
+```
+sudo apt install python3-serial python3-numpy cython3 python3-libxml2 python3-gi python3-dbus python3-psutil python3-cairosvg libpython3-dev python3-appdirs python3-wxgtk4.0
+```
+
+```
+sudo apt install python3-pip
+pip3 install --user pyglet
+```
+
+Install git, clone this repository:
+```
+sudo apt install git
+git clone https://github.com/kliment/Printrun.git
+cd Printrun
+```
+
 ### Windows
 
-Download the following, and install in this order:
-
-  1. http://python.org/ftp/python/2.7.2/python-2.7.2.msi
-  2. http://pypi.python.org/packages/any/p/pyserial/pyserial-2.5.win32.exe
-  3. http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.12.0-py27.exe
-  4. https://pypi.python.org/packages/any/p/pyreadline/pyreadline-1.7.1.win32.exe
-  5. http://pyglet.googlecode.com/files/pyglet-1.1.4.zip
+Download and install [Python 3.6](https://www.python.org/downloads/) and follow the **Python virtual environment** section above except use the following to create and activate the virtual environment and install dependencies:
 
-For the last one, you will need to unpack it, open a command terminal, 
-go into the the directory you unpacked it in and run
-`python setup.py install`
-
-### Mac OS X Lion
+```cmd
+> py -3 -m venv venv
+> venv\Scripts\activate
+> python -m pip install -r requirements.txt
+```
 
-  1. Ensure that the active Python is the system version. (`brew uninstall python` or other appropriate incantations)
-  2. Download an install [wxPython2.8-osx-unicode] matching to your python version (most likely 2.7 on Lion, 
-        check with: python --version) from: http://wxpython.org/download.php#stable
-  Known to work PythonWX: http://superb-sea2.dl.sourceforge.net/project/wxpython/wxPython/2.8.12.1/wxPython2.8-osx-unicode-2.8.12.1-universal-py2.7.dmg
-  3. Download and unpack pyserial from http://pypi.python.org/packages/source/p/pyserial/pyserial-2.5.tar.gz
-  4. In a terminal, change to the folder you unzipped to, then type in: `sudo python setup.py install`
-  5. Repeat 4. with http://http://pyglet.googlecode.com/files/pyglet-1.1.4.zip
 
-The tools will probably run just fine in 64bit on Lion, you don't need to mess
-with any of the 32bit settings. In case they don't, try 
-  5. export VERSIONER_PYTHON_PREFER_32_BIT=yes
-in a terminal before running Pronterface
+### macOS X
 
-### Mac OS X (pre Lion)
-
-A precompiled version is available at http://koti.kapsi.fi/~kliment/printrun/
+Install Python 3, you can use Brew:
 
-  1. Download and install http://downloads.sourceforge.net/wxpython/wxPython2.8-osx-unicode-2.8.12.0-universal-py2.6.dmg
-  2. Grab the source for pyserial from http://pypi.python.org/packages/source/p/pyserial/pyserial-2.5.tar.gz
-  3. Unzip pyserial to a folder. Then, in a terminal, change to the folder you unzipped to, then type in:
-     
-     `defaults write com.apple.versioner.python Prefer-32-Bit -bool yes`
-     
-     `sudo python setup.py install`
+```console
+$ brew install python3
+```
 
-Alternatively, you can run python in 32 bit mode by setting the following environment variable before running the setup.py command:
-
-This alternative approach is confirmed to work on Mac OS X 10.6.8. 
+And follow the above **Python virtual environment** section. You don't need to search for wxPython wheel, macOS wheels are available from the Python Package Index.
 
-`export VERSIONER_PYTHON_PREFER_32_BIT=yes`
-
-`sudo python setup.py install`
-
-Then repeat the same with http://http://pyglet.googlecode.com/files/pyglet-1.1.4.zip
 
 # USING PRINTRUN
 
@@ -167,16 +170,20 @@
 The "monitor printer" function, when enabled, checks the printer state (temperatures, SD print progress) every 3 seconds.
 The command box recognizes all pronsole commands, but has no tabcompletion.
 
-If you want to load stl files, you need to install a slicing program such as Slic3r and add its path to the settings.
-See the Slic3r readme for more details on integration.
+If you want to load stl files, you need to install a slicing program such as Slic3r or Skeinforge and add its path to the settings.
+
+#### Slic3r integration
 
+To invoke Slic3r directly from Pronterface your slicing command (_Settings_ > _Options_ > _External Commands_ > _Slice Command_) should look something like `slic3r $s -o $o`. If Slic3r is properly installed "slic3r" will suffice, otherwise, replace it with the full path to Slic3r's executable.
+
+If the Slic3r integration option (_Settings_ > _Options_ > _User interface_ > _Enable Slic3r integration_) is checked a new menu will appear after application restart which will allow you to choose among your previously saved Slic3r Print/Filament/Printer settings.
 
 ## USING PRONSOLE
 
 To use pronsole, you need:
 
-  * python (ideally 2.6.x or 2.7.x),
-  * pyserial (or python-serial on ubuntu/debian) and
+  * Python 3 (ideally 3.6),
+  * pyserial (or python3-serial on ubuntu/debian) and
   * pyreadline (not needed on Linux)
 
 Start pronsole and you will be greeted with a command prompt. Type help to view the available commands.
@@ -187,7 +194,7 @@
 
 ## USING PRINTCORE
 
-To use printcore you need python (ideally 2.6.x or 2.7.x) and pyserial (or python-serial on ubuntu/debian)
+To use printcore you need Python 3 (ideally 3.6) and pyserial (or python3-serial on ubuntu/debian)
 See pronsole for an example of a full-featured host, the bottom of printcore.py for a simple command-line
 sender, or the following code example:
 
@@ -232,10 +239,10 @@
 Here is a sample Python script querying the print status:
 
 ```python
-import xmlrpclib
+import xmlrpc.client
 
-rpc = xmlrpclib.ServerProxy('http://localhost:7978')
-print rpc.status()
+rpc = xmlrpc.client.ServerProxy('http://localhost:7978')
+print(rpc.status())
 ```
 
 ## CONFIGURATION
@@ -311,7 +318,7 @@
 Enter macro using indented lines, end with empty line
 ..> G91
 ..> G1 Z-{0}
-..> G92
+..> G90
 ..>
 ```
 
@@ -325,7 +332,7 @@
 Note that this python code invocation also works in interactive prompt:
 
 ```python
-PC> !print "Hello, printer!"
+PC> !print("Hello, printer!")
 Hello printer!
 
 PC> macro debug_on !self.p.loud = 1
@@ -346,14 +353,14 @@
 PC> macro toggle_debug_on
 Enter macro using indented lines, end with empty line
 ..> !self.p.loud = 1
-..> !print "Diagnostic information ON"
+..> !print("Diagnostic information ON")
 ..> macro toggle_debug toggle_debug_off
 ..>
 Macro 'toggle_debug_on' defined
 PC> macro toggle_debug_off
 Enter macro using indented lines, end with empty line
 ..> !self.p.loud = 0
-..> !print "Diagnostic information OFF"
+..> !print("Diagnostic information OFF")
 ..> macro toggle_debug toggle_debug_on
 ..>
 Macro 'toggle_debug_off' defined
@@ -378,10 +385,10 @@
 ```python
 !if self.p.loud:
   !self.p.loud = 0
-  !print "Diagnostic information OFF"
+  !print("Diagnostic information OFF")
 !else:
   !self.p.loud = 1
-  !print "Diagnostic information ON"
+  !print("Diagnostic information ON")
 ```
 
 Macro parameters are available in '!'-escaped python code as locally defined list variable: arg[0] arg[1] ... arg[N]
@@ -460,6 +467,8 @@
 # LICENSE
 
 ```
+Copyright (C) 2011-2020 Kliment Yanev, Guillaume Seguin
+
 Printrun is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
@@ -475,3 +484,4 @@
 ```
 
 All scripts should contain this license note, if not, feel free to ask us. Please note that files where it is difficult to state this license note (such as images) are distributed under the same terms.
+

mercurial