Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM debian:9
FROM debian:12

WORKDIR /root/pycam

COPY . .

RUN apt-get update && apt-get install -y python3 \
RUN apt-get update && apt-get install -y python3.12 \
python3-gi \
python3-opengl \
python3-yaml \
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,14 @@ See the [documentation](http://pycam.sourceforge.net/introduction/) for a short
* Nicholas Humfrey: documentation, recovery of old sourceforge-wiki
* Piers Titus van der Torren: documentation
* Reuben Rissler: gtk3 migration

## Steps to Run in python3.12
```
sudo apt-get install python3-gi python3-opengl gir1.2-gtk-3.0
sudo apt-get install libgirepository1.0-dev
sudo apt-get install libcairo2-dev
sudo apt-get install python3-dev
sudo apt-get install libcairo2-dev
python3 -m venv .env
pip install -r requirements.txt
```
26 changes: 26 additions & 0 deletions mySteps.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
sudo apt install python3.11-venv
sudo apt-get install python3-gi python3-opengl gir1.2-gtk-3.0
python3 -m venv .env
pip install PyOpenGL PyYAML svg.path

###
add last part to sources.list
deb http://deb.debian.org/debian/ bookworm main non-free-firmware
deb-src http://deb.debian.org/debian/ bookworm main non-free-firmware
deb [trusted=yes] file:/run/live/medium bookworm main non-free-firmware
deb http://deb.debian.org/debian/ buster main

sudo apt update
sudo apt-get install python-gtk2
sudo apt-get install libcairo2-dev
pip install numpy

### for installing pyobject need to install all 4 of them
sudo apt-get install libgirepository1.0-dev
sudo apt-get install libcairo2-dev
sudo apt-get install python3-dev
sudo apt-get install libcairo2-dev

pip install pygobject


4 changes: 3 additions & 1 deletion pycam/Plugins/OpenGLWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from pycam.Geometry.PointUtils import pcross, pmul, pnormalized
import pycam.Geometry.Matrix as Matrix
import pycam.Plugins
import numpy as np


# The length of the distance vector does not matter - it will be normalized and
Expand Down Expand Up @@ -524,7 +525,8 @@ def glsetup(self, widget=None):
GL.glPolygonOffset(1.0, 1.0)
# ambient and diffuse material lighting is defined in OpenGLViewModel
GL.glMaterial(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, (1.0, 1.0, 1.0, 1.0))
GL.glMaterial(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, (100.0))
GL.glMaterial(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, np.array([100.0], dtype='float32'))

if self.core.get("view_polygon"):
GL.glPolygonMode(GL.GL_FRONT_AND_BACK, GL.GL_FILL)
else:
Expand Down
20 changes: 17 additions & 3 deletions pycam/Plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
along with PyCAM. If not, see <http://www.gnu.org/licenses/>.
"""

import imp
import importlib
import inspect
import os
import uuid
Expand Down Expand Up @@ -242,6 +242,13 @@ def unregister_gtk_accelerator(self, groupname, action):
ui_manager.remove_action_group(actiongroup)


def find_module(mod_name, directory):
spec = importlib.machinery.PathFinder.find_spec(mod_name, [directory])
if spec is None:
raise ImportError(f"No module named {mod_name}")
return spec.loader, spec.origin, spec


class PluginManager:

def __init__(self, core):
Expand All @@ -268,12 +275,19 @@ def import_plugins(self, directory=None, ignore_names=None):
_log.info("Skipping plugin %s (marked as 'ignore')", mod_name)
continue
try:
mod_file, mod_filename, mod_desc = imp.find_module(mod_name, [directory])
# mod_file, mod_filename, mod_desc
# mod_file, mod_filename, mod_desc = find_module(mod_name, [directory])
full_mod_name = "pycam.Plugins.%s" % mod_name
mod = imp.load_module(full_mod_name, mod_file, mod_filename, mod_desc)
# mod = importlib.load_module(full_mod_name, mod_file, mod_filename, mod_desc)
spec = importlib.util.spec_from_file_location(full_mod_name, os.path.join(directory, filename))
if spec is None:
raise ImportError(f"No module named {mod_name}")
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
except ImportError as exc:
_log.info("Skipping plugin %s: %s", os.path.join(directory, filename), exc)
continue
mod_filename = spec.origin
for attr in dir(mod):
item = getattr(mod, attr)
if inspect.isclass(item) and issubclass(item, PluginBase):
Expand Down
13 changes: 10 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
PyOpenGL
PyYAML
svg.path
iniconfig==2.0.0
numpy==1.26.3
packaging==23.2
pluggy==1.4.0
pycairo==1.25.1
PyGObject==3.46.0
PyOpenGL==3.1.7
pytest==8.0.0
PyYAML==6.0.1
svg.path==6.3