Skip to content

Commit ff43e53

Browse files
committed
Update unecessary __init__ file and fix version file/entry function
1 parent 77ec25a commit ff43e53

File tree

4 files changed

+8
-142
lines changed

4 files changed

+8
-142
lines changed

FoxDot/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ def is_proc_running(name):
107107

108108
def main():
109109
""" Function for starting the GUI when importing the library """
110-
FoxDot = Workspace.Editor.workspace(FoxDotCode).run()
110+
from .lib.Workspace.Editor import workspace
111+
FoxDot = workspace(FoxDotCode).run()
111112

112113
def Go():
113114
""" Function to be called at the end of Python files with FoxDot code in to keep

FoxDot/lib/.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.8.4
1+
0.8.7

FoxDot/lib/__init__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import os.path
44
with open((os.path.join(os.path.dirname(__file__), ".version")), "r") as f:
5-
__version__ = f.read()
5+
__version__ = f.readline().strip()
66

77
import logging
88
from .Code import *
@@ -29,7 +29,7 @@
2929
from random import choice as choose
3030

3131
# Define any custom functions
32-
32+
3333
@PatternMethod
3434
def __getitem__(self, key):
3535
""" Overrides the Pattern.__getitem__ to allow indexing
@@ -47,7 +47,7 @@ def __getitem__(self, key):
4747
return self.getitem(key)
4848

4949
def player_method(f):
50-
""" Decorator for assigning functions as Player methods.
50+
""" Decorator for assigning functions as Player methods.
5151
5252
>>> @player_method
5353
... def test(self):
@@ -101,7 +101,7 @@ def futureBar(n=0):
101101
return _futureBarDecorator(n, Clock.bar_length())
102102

103103
def update_foxdot_clock(clock):
104-
""" Tells the TimeVar, Player, and MidiIn classes to use
104+
""" Tells the TimeVar, Player, and MidiIn classes to use
105105
a new instance of TempoClock. """
106106

107107
assert isinstance(clock, TempoClock)
@@ -233,4 +233,4 @@ def reassign_clock(self):
233233

234234
# Start
235235

236-
Clock.start()
236+
Clock.start()

__init__.py

Lines changed: 0 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +0,0 @@
1-
#!/usr/bin/python
2-
3-
"""
4-
5-
FoxDot is a Python library and programming environment that provides a fast and
6-
user-friendly abstraction to the powerful audio-engine, SuperCollider. It comes
7-
with its own IDE, which means it can be used straight out of the box; all you need
8-
is Python and SuperCollider and you're ready to go!
9-
10-
For more information on installation, check out [the guide](http://foxdot.org/installation),
11-
or if you're already set up, you can also find a useful starter guide that introduces the
12-
key components of FoxDot on [the website](http://foxdot.org/).
13-
14-
Please see the [documentation](http://docs.foxdot.org/) for more detailed information on
15-
the FoxDot classes and how to implement them.
16-
17-
Copyright Ryan Kirkbride 2015
18-
"""
19-
20-
from __future__ import absolute_import, division, print_function
21-
22-
try:
23-
import time
24-
except:
25-
print("Couldn't import time")
26-
27-
try:
28-
import platform
29-
except:
30-
print("Couldn't import platform library")
31-
32-
import os
33-
34-
import subprocess
35-
36-
try:
37-
import psutil
38-
except:
39-
os.system("pip install psutil")
40-
41-
try:
42-
import getpass
43-
except:
44-
print("Couldn't import getpass library")
45-
46-
47-
sclangpath = "" #find path to sclang
48-
49-
thispath = "" #find this path
50-
51-
"""
52-
53-
Sclang path and supercollider path are the same but need to go to the actual file for sclang
54-
55-
For CWR (current working directory) need to go to the folder that contains sclang (also contains supercollider (scide.exe))
56-
57-
"""
58-
59-
thisdir = os.getcwd()
60-
61-
OS = platform.system()
62-
63-
username = getpass.getuser()
64-
65-
if(OS == "Windows"):
66-
67-
print("OS: Windows")
68-
69-
sclangloc = os.popen('where /R "C:\Program Files" sclang.exe').read()
70-
71-
thiscwd = str(sclangloc)
72-
73-
ourcwd = thiscwd.replace('\\sclang.exe\n', '')
74-
75-
def is_proc_running(name):
76-
for p in psutil.process_iter(attrs=["name", "exe", "cmdline"]):
77-
#print(p);
78-
procname = p.info['name'] or \
79-
p.info['exe'] and os.path.basename(p.info['exe']) == name or \
80-
p.info['cmdline'] and p.info['cmdline'][0] == name
81-
if(procname.startswith(name)):
82-
return True
83-
return False
84-
85-
86-
running = (is_proc_running("sclang"))
87-
88-
if(running == False):
89-
startup = thisdir+"/FoxDot/startup.scd"
90-
#os.system("sclang"+startup+" &")
91-
subprocess.Popen([sclangloc, startup], cwd=ourcwd, shell=True)
92-
93-
elif(OS == "Linux"):
94-
95-
print("OS: Linux")
96-
97-
def is_proc_running(name):
98-
for p in psutil.process_iter(attrs=["name","cmdline"]):
99-
#print(p);
100-
procname = p.info['name'] or \
101-
p.info['cmdline'] and p.info['cmdline'][0] == name
102-
if(procname.startswith(name)):
103-
return True
104-
return False
105-
106-
107-
running = (is_proc_running("sclang"))
108-
109-
if(running == False):
110-
startup = thisdir+"/FoxDot/startup.scd"
111-
#os.system('sclang "/home/foxdot/Desktop/FoxDot-Cross-Platform/FoxDot/startup.scd" &') #fuctional
112-
os.system("sclang "+startup+" &")
113-
114-
115-
else:
116-
print("Operating system unrecognised")
117-
#Potentially get the user to choose their OS from a list?
118-
#Then run the corresponding functions
119-
120-
from .lib import *
121-
122-
123-
def main():
124-
""" Function for starting the GUI when importing the library """
125-
FoxDot = Workspace.workspace(FoxDotCode).run()
126-
127-
def Go():
128-
""" Function to be called at the end of Python files with FoxDot code in to keep
129-
the TempoClock thread alive. """
130-
try:
131-
import time
132-
while 1:
133-
time.sleep(100)
134-
except KeyboardInterrupt:
135-
return

0 commit comments

Comments
 (0)