Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build and visualization for Python 3.8 #1

Open
wants to merge 2 commits into
base: python3
Choose a base branch
from
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
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ def apply_folder_join(item):
return os.path.join(BIN_FOLDER, item)


if os.name is 'nt':
if os.name == 'nt':
bin_scripts = ['symoro-bin.py']
else:
bin_scripts = ['symoro-bin']
bin_scripts = map(apply_folder_join, bin_scripts)

bin_scripts = [apply_folder_join(x) for x in bin_scripts]

setup(
name='symoro',
Expand All @@ -34,9 +33,9 @@ def apply_folder_join(item):
scripts=bin_scripts,
packages=find_packages(exclude=['*.tests', '*.tests.*', 'tests.*', 'tests']),
install_requires=[
'sympy==0.7.3',
'sympy>=0.7.3',
'numpy>=1.6.1',
'wxPython>=2.8.11',
'wxPython==4.0.7',
'PyOpenGL>=3.0.1b2'
],
dependency_links=[
Expand Down
4 changes: 2 additions & 2 deletions symoroui/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ def params_in_grid(self, szr_grd, elements, rows, cols, width=70):
place = elements[key].place
handler = getattr(self, elements[key].handler)
field_id = int(elements[key].id)
if control is 'cmb':
if control == 'cmb':
ctrl = wx.ComboBox(
parent=self.panel, style=wx.CB_READONLY,
size=(width, -1), name=name
)
ctrl.Bind(wx.EVT_COMBOBOX, handler)
elif control is 'lbl':
elif control == 'lbl':
ctrl = wx.StaticText(
parent=self.panel, size=(width, -1), name=name
)
Expand Down
2 changes: 1 addition & 1 deletion symoroutils/configfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def get_prog_config_path():
A string specifying the path to store SYMORO settings.
"""
prog_name = 'symoro'
if os.name is 'nt':
if os.name == 'nt':
return os.path.join(os.environ['APPDATA'], prog_name)
else:
return os.path.join(os.environ['HOME'], '.config', prog_name)
Expand Down
15 changes: 9 additions & 6 deletions symoroviz/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import wx
import wx.lib.agw.floatspin as FS
from wx.glcanvas import GLCanvas
from wx.glcanvas import GLCanvas, GLContext

import OpenGL.GL as gl
import OpenGL.GLU as glu
Expand All @@ -34,6 +34,7 @@
#TODO: Random button

class VizGlCanvas(GLCanvas):

def __init__(self, parent, robo, params, size=(600, 600)):
super(VizGlCanvas, self).__init__(parent, size=size)
self.Bind(wx.EVT_PAINT, self.OnPaintAll)
Expand All @@ -59,6 +60,8 @@ def __init__(self, parent, robo, params, size=(600, 600)):
self.construct_hierarchy()
self.dgms = {}
self.l_solver = None
self._glContext = GLContext(self)


def OnEraseBackground(self, event):
# Do nothing, to avoid flashing on MSW.
Expand Down Expand Up @@ -140,8 +143,8 @@ def construct_hierarchy(self):

def OnSize(self, event):
size = self.size = self.GetClientSize()
if self.GetContext():
self.SetCurrent()
if self._glContext:
self._glContext.SetCurrent(self)
gl.glViewport(0, 0, size.width, size.height)
#gl.glMatrixMode(gl.GL_PROJECTION)
#gl.glLoadIdentity()
Expand Down Expand Up @@ -244,7 +247,7 @@ def centralize_to_frame(self, index):
self.Refresh(False)

def OnPaintAll(self, event):
self.SetCurrent()
self._glContext.SetCurrent(self)
if not self.init:
self.InitGL()
self.init = 1
Expand Down Expand Up @@ -469,7 +472,7 @@ def init_ui(self):
choices.append("Frame " + str(jnt.index))
self.drag_pos = None
self.clb_frames = wx.CheckListBox(self.p, choices=choices)
self.clb_frames.SetChecked(range(len(choices)))
self.clb_frames.SetCheckedItems(range(len(choices)))
self.clb_frames.Bind(wx.EVT_CHECKLISTBOX, self.CheckFrames)
self.clb_frames.Bind(wx.EVT_LISTBOX, self.SelectFrames)
grd_szr_control.Add(
Expand Down Expand Up @@ -573,7 +576,7 @@ def OnShowAllFrames(self, _):
else:
indices = []
self.canvas.show_frames(indices)
self.clb_frames.SetChecked(indices)
self.clb_frames.SetCheckedItems(indices)

def update_spin_controls(self):
for ctrl in self.spin_ctrls.values():
Expand Down
3 changes: 2 additions & 1 deletion symoroviz/primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from numpy import sin, cos, pi

import ctypes

def create_cyl_array(radius, length, n_segments, centered=True):
vertices, indices, normals = [], [], []
Expand Down Expand Up @@ -51,7 +52,7 @@ def create_sphere_array(radius, n_lat, n_long):
normals += xn, yn, zn
vertices += (x, y, z)
# top and bottom indices
for i, start in enumerate([2, len(vertices)/3 - n_long]):
for i, start in enumerate([2, int(len(vertices)/3) - n_long]):
for j in range(n_long):
indices += (i, j + start, (j + 1) % n_long + start)
# in-between
Expand Down