Skip to content

Commit

Permalink
[Gears] Allow for both Python 3.11 and above as...
Browse files Browse the repository at this point in the history
well as 3.10 and below as they are all currently supported by FreeCAD core.
  • Loading branch information
Syres916 authored and looooo committed Dec 26, 2023
1 parent 6d04fb1 commit 48f3f4a
Showing 1 changed file with 27 additions and 10 deletions.
37 changes: 27 additions & 10 deletions freecad/gears/features.py
Expand Up @@ -18,6 +18,7 @@

from __future__ import division
import os
import sys

import numpy as np
import math
Expand Down Expand Up @@ -94,13 +95,22 @@ def getIcon(self):
self._check_attr()
return self.icon_fn

def dumps(self):
self._check_attr()
return {"icon_fn": self.icon_fn}
if sys.version_info[0] == 3 and sys.version_info[1] >= 11:
def dumps(self):
self._check_attr()
return {"icon_fn": self.icon_fn}

def loads(self, state):
if state and "icon_fn" in state:
self.icon_fn = state["icon_fn"]
else:
def __getstate__(self):
self._check_attr()
return {"icon_fn": self.icon_fn}

def loads(self, state):
if state and "icon_fn" in state:
self.icon_fn = state["icon_fn"]
def __setstate__(self, state):
if state and "icon_fn" in state:
self.icon_fn = state["icon_fn"]


class BaseGear(object):
Expand Down Expand Up @@ -147,11 +157,18 @@ def generate_gear_shape(self, fp):
"""
raise NotImplementedError("generate_gear_shape not implemented")

def loads(self, state):
pass
if sys.version_info[0] == 3 and sys.version_info[1] >= 11:
def loads(self, state):
pass

def dumps(self):
pass
def dumps(self):
pass
else:
def __setstate__(self, state):
pass

def __getstate__(self):
pass


class InvoluteGear(BaseGear):
Expand Down

0 comments on commit 48f3f4a

Please sign in to comment.