From 74209a97209e2b8405360d73ac17eaa785a066c1 Mon Sep 17 00:00:00 2001
From: Olivier Belanger <belangeo@gmail.com>
Date: Fri, 22 Feb 2019 21:02:59 -0500
Subject: [PATCH] Fixed imports for the new structure of pyo.
---
Resources/CommandFrame.py | 2 +-
Resources/ControlPanel.py | 18 +++++++++---------
Resources/DrawingSurface.py | 2 +-
Resources/FxBall.py | 4 ++--
Resources/MainFrame.py | 2 +-
Resources/MidiSettings.py | 5 ++---
Resources/Modules.py | 2 +-
Resources/Trajectory.py | 2 +-
Resources/widgets.py | 2 +-
TODO.md | 27 ---------------------------
10 files changed, 19 insertions(+), 47 deletions(-)
delete mode 100644 TODO.md
diff --git a/Resources/CommandFrame.py b/Resources/CommandFrame.py
index 2c754a2..2c30de8 100644
--- a/Resources/CommandFrame.py
+++ b/Resources/CommandFrame.py
@@ -20,7 +20,7 @@
import wx, os, markdown, webbrowser
import wx.html as html
from Resources.constants import DOCUMENTATION_PATH
-from pyolib._wxwidgets import BACKGROUND_COLOUR
+from pyo.lib._wxwidgets import BACKGROUND_COLOUR
class MyHtmlWindow(html.HtmlWindow):
def __init__(self, parent):
diff --git a/Resources/ControlPanel.py b/Resources/ControlPanel.py
index b851a42..faf8e77 100644
--- a/Resources/ControlPanel.py
+++ b/Resources/ControlPanel.py
@@ -21,7 +21,7 @@
from Resources.constants import *
from Resources.audio import soundInfo
from Resources.widgets import ControlKnob
-from pyolib._wxwidgets import ControlSlider, VuMeter, BACKGROUND_COLOUR
+from pyo.lib._wxwidgets import ControlSlider, VuMeter, BACKGROUND_COLOUR
class ControlPanel(scrolled.ScrolledPanel):
def __init__(self, parent, surface):
@@ -54,10 +54,11 @@ def __init__(self, parent, surface):
# TODO: Check the size of this button on Windows and OSX
self.closedToggle = wx.ToggleButton(self, -1, 'Closed', size=self.trajType.GetSize())
+ # If this is no more needed, remove the next three lines...
font = self.closedToggle.GetFont()
- if PLATFORM.startswith('linux') or PLATFORM == 'win32':
+ if PLATFORM == 'win32':
font = wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
- self.closedToggle.SetFont(font)
+ self.closedToggle.SetFont(font) # ... and all related calls in this method.
typeBox.Add(self.closedToggle, wx.CENTER|wx.RIGHT, 5 )
box.Add(typeBox, 0, wx.CENTER|wx.ALL, 5)
@@ -137,7 +138,7 @@ def __init__(self, parent, surface):
srBox = wx.BoxSizer(wx.VERTICAL)
srText = wx.StaticText(self, -1, "Rate")
srBox.Add(srText, 0, wx.CENTER | wx.LEFT | wx.RIGHT, 5)
- self.pop_sr = wx.Choice(self, -1, choices = ['44100', '48000', '96000'], size=(80,-1))
+ self.pop_sr = wx.Choice(self, -1, choices = ['44100', '48000', '96000'], size=(90,-1))
self.pop_sr.SetSelection(0)
self.pop_sr.Bind(wx.EVT_CHOICE, self.handleSamplingRate)
srBox.Add(self.pop_sr, 0, wx.LEFT | wx.RIGHT, 5)
@@ -195,7 +196,7 @@ def __init__(self, parent, surface):
self.tx_output = wx.TextCtrl( self, -1, "snd", size=(120, -1))
rec2Box.Add(self.tx_output, 0, wx.LEFT | wx.RIGHT, 10)
- self.tog_record = wx.ToggleButton(self, -1, "Start Rec", size=(65,-1))
+ self.tog_record = wx.ToggleButton(self, -1, "Start", size=(65,-1))
self.tog_record.SetFont(font)
rec2Box.Add(self.tog_record, 1, wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.RIGHT, 10)
@@ -290,7 +291,6 @@ def checkEnableWidgets(self):
self.drawing.sl_period.Disable()
self.drawing.sl_scaling.Disable()
- # TODO: replace all these handle, get, set, with single event
def handleType(self, event):
self.processType(event.GetInt())
@@ -668,7 +668,7 @@ def handleAudio(self, event):
self.tog_audio.SetValue(0)
self.parent.menu.Check(7, False)
self.tog_record.SetValue(0)
- self.tog_record.SetLabel('Start Rec')
+ self.tog_record.SetLabel('Start')
self.parent.sg_audio.stop()
def handleOutput(self, event):
@@ -693,9 +693,9 @@ def handleRecord(self, event):
else:
filename = os.path.join(os.path.expanduser('~'), "Desktop", self.tx_output.GetValue())
self.parent.sg_audio.recStart(filename, self.fileformat, self.sampletype)
- self.tog_record.SetLabel('Stop Rec')
+ self.tog_record.SetLabel('Stop')
else:
- self.tog_record.SetLabel('Start Rec')
+ self.tog_record.SetLabel('Start')
self.parent.sg_audio.recStop()
def chooseRecFolder(self, evt):
diff --git a/Resources/DrawingSurface.py b/Resources/DrawingSurface.py
index de5cb2e..90f9565 100644
--- a/Resources/DrawingSurface.py
+++ b/Resources/DrawingSurface.py
@@ -20,7 +20,7 @@
from Resources.constants import *
from Resources.FxBall import FxBall
from Resources.Trajectory import Trajectory
-from pyolib._wxwidgets import BACKGROUND_COLOUR
+from pyo.lib._wxwidgets import BACKGROUND_COLOUR
class MyFileDropTarget(wx.FileDropTarget):
def __init__(self, window):
diff --git a/Resources/FxBall.py b/Resources/FxBall.py
index f353a6a..e5c80cd 100644
--- a/Resources/FxBall.py
+++ b/Resources/FxBall.py
@@ -18,7 +18,7 @@
"""
import wx, math
from .constants import *
-from pyolib._wxwidgets import ControlSlider
+from pyo.lib._wxwidgets import ControlSlider
class FxBallControls(wx.Frame):
def __init__(self, parent, fxball, sg_audio, size=(270, 200)):
@@ -275,4 +275,4 @@ def openControls(self, pos):
self.controls.Show()
def hideControls(self):
- self.controls.Hide()
\ No newline at end of file
+ self.controls.Hide()
diff --git a/Resources/MainFrame.py b/Resources/MainFrame.py
index 115a017..aac88da 100644
--- a/Resources/MainFrame.py
+++ b/Resources/MainFrame.py
@@ -21,7 +21,7 @@
from Resources.constants import *
from Resources.audio import *
from Resources.Modules import *
-from pyolib._wxwidgets import Grapher, BACKGROUND_COLOUR
+from pyo.lib._wxwidgets import Grapher, BACKGROUND_COLOUR
from Resources.Trajectory import Trajectory
from Resources.MidiSettings import MidiSettings
from Resources.CommandFrame import CommandFrame
diff --git a/Resources/MidiSettings.py b/Resources/MidiSettings.py
index 48ced6f..359bc29 100644
--- a/Resources/MidiSettings.py
+++ b/Resources/MidiSettings.py
@@ -19,7 +19,7 @@
"""
import wx, sys
-from pyolib._wxwidgets import ControlSlider
+from pyo.lib._wxwidgets import ControlSlider
from .constants import BACKGROUND_COLOUR, ensureNFD
from Resources.audio import checkForMidiDrivers
@@ -100,7 +100,7 @@ def __init__(self, parent, surface, sg_audio, miDriver):
self.panel.SetSizerAndFit(box)
- size = self.GetBestSize() #(230, 500)
+ size = self.GetBestSize()
size = (size[0], size[1]+30)
self.SetMinSize(size)
self.SetMaxSize(size)
@@ -125,7 +125,6 @@ def changeInterface(self, evt):
self.selectedInterface = self.interfaceIndexes[self.interfaceList.index(selectedInterface)]
self.sg_audio.setMidiListener(self.selectedInterface)
- # TODO: replace handle, set and get method with events
def handleMethod(self, evt):
self.sg_audio.setMidiMethod(self.popupMethod.GetSelection())
diff --git a/Resources/Modules.py b/Resources/Modules.py
index d06006c..d030840 100644
--- a/Resources/Modules.py
+++ b/Resources/Modules.py
@@ -19,7 +19,7 @@
import wx
from pyo import rescale
-from pyolib._wxwidgets import ControlSlider
+from pyo.lib._wxwidgets import ControlSlider
from .constants import BACKGROUND_COLOUR, PLATFORM
class SGControlSlider(ControlSlider):
diff --git a/Resources/Trajectory.py b/Resources/Trajectory.py
index 17d3291..075d204 100644
--- a/Resources/Trajectory.py
+++ b/Resources/Trajectory.py
@@ -131,7 +131,7 @@ def setAttributes(self, dict, xfac=1.0, yfac=1.0):
self.filterCut = dict['filterCut']
self.setPoints(dict['points'], xfac=xfac, yfac=yfac)
self.type = dict['type']
- if self.getType() in ['circle', 'oscil']:
+ if self.getType() in ['circle', 'oscil'] and type(dict['center']) in [list, tuple]:
self.center = [dict['center'][0]*xfac, dict['center'][1]*yfac]
self.setRadius(self.center[0] - self.getFirstPoint()[0])
else:
diff --git a/Resources/widgets.py b/Resources/widgets.py
index 29dbf02..3380f66 100644
--- a/Resources/widgets.py
+++ b/Resources/widgets.py
@@ -1,6 +1,6 @@
import math, wx
from wx.lib.embeddedimage import PyEmbeddedImage
-from pyolib._wxwidgets import BACKGROUND_COLOUR
+from pyo.lib._wxwidgets import BACKGROUND_COLOUR
from Resources.constants import *
KNOB = PyEmbeddedImage(
diff --git a/TODO.md b/TODO.md
deleted file mode 100644
index 93af560..0000000
--- a/TODO.md
+++ /dev/null
@@ -1,27 +0,0 @@
-Soundgrain todo
-===============
-
-- Particle2 **done**
-
-- Remember last save path directories. **done**
-
-- Granulator Controls -> Y axis -> 3-point range for each row: **done**
-
- [ ] Bottom: xxx Middle: xxx Top: xxx
-
-- 2009-2017 in license text. **done**
-
-- Add global 4 bands EQ and Compressor. **done**
-
-- Review fx balls. **done**
-
-- Review MIDI features. **done**
-
-- slider's midi control. **done**
-
-- Documentation for the 4 bands EQ and the compressor. **done**
-
-- FxBall control window to small.
- - ok on linux
-
-- Can't put an FxBall if the audio is off. **done**
\ No newline at end of file