Skip to content

Commit

Permalink
Update unecessary __init__ file and fix version file/entry function
Browse files Browse the repository at this point in the history
  • Loading branch information
Qirky committed Apr 12, 2020
1 parent 77ec25a commit ff43e53
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 142 deletions.
3 changes: 2 additions & 1 deletion FoxDot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ def is_proc_running(name):

def main():
""" Function for starting the GUI when importing the library """
FoxDot = Workspace.Editor.workspace(FoxDotCode).run()
from .lib.Workspace.Editor import workspace
FoxDot = workspace(FoxDotCode).run()

def Go():
""" Function to be called at the end of Python files with FoxDot code in to keep
Expand Down
2 changes: 1 addition & 1 deletion FoxDot/lib/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.8.4
0.8.7
10 changes: 5 additions & 5 deletions FoxDot/lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import os.path
with open((os.path.join(os.path.dirname(__file__), ".version")), "r") as f:
__version__ = f.read()
__version__ = f.readline().strip()

import logging
from .Code import *
Expand All @@ -29,7 +29,7 @@
from random import choice as choose

# Define any custom functions

@PatternMethod
def __getitem__(self, key):
""" Overrides the Pattern.__getitem__ to allow indexing
Expand All @@ -47,7 +47,7 @@ def __getitem__(self, key):
return self.getitem(key)

def player_method(f):
""" Decorator for assigning functions as Player methods.
""" Decorator for assigning functions as Player methods.
>>> @player_method
... def test(self):
Expand Down Expand Up @@ -101,7 +101,7 @@ def futureBar(n=0):
return _futureBarDecorator(n, Clock.bar_length())

def update_foxdot_clock(clock):
""" Tells the TimeVar, Player, and MidiIn classes to use
""" Tells the TimeVar, Player, and MidiIn classes to use
a new instance of TempoClock. """

assert isinstance(clock, TempoClock)
Expand Down Expand Up @@ -233,4 +233,4 @@ def reassign_clock(self):

# Start

Clock.start()
Clock.start()
135 changes: 0 additions & 135 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -1,135 +0,0 @@
#!/usr/bin/python

"""
FoxDot is a Python library and programming environment that provides a fast and
user-friendly abstraction to the powerful audio-engine, SuperCollider. It comes
with its own IDE, which means it can be used straight out of the box; all you need
is Python and SuperCollider and you're ready to go!
For more information on installation, check out [the guide](http://foxdot.org/installation),
or if you're already set up, you can also find a useful starter guide that introduces the
key components of FoxDot on [the website](http://foxdot.org/).
Please see the [documentation](http://docs.foxdot.org/) for more detailed information on
the FoxDot classes and how to implement them.
Copyright Ryan Kirkbride 2015
"""

from __future__ import absolute_import, division, print_function

try:
import time
except:
print("Couldn't import time")

try:
import platform
except:
print("Couldn't import platform library")

import os

import subprocess

try:
import psutil
except:
os.system("pip install psutil")

try:
import getpass
except:
print("Couldn't import getpass library")


sclangpath = "" #find path to sclang

thispath = "" #find this path

"""
Sclang path and supercollider path are the same but need to go to the actual file for sclang
For CWR (current working directory) need to go to the folder that contains sclang (also contains supercollider (scide.exe))
"""

thisdir = os.getcwd()

OS = platform.system()

username = getpass.getuser()

if(OS == "Windows"):

print("OS: Windows")

sclangloc = os.popen('where /R "C:\Program Files" sclang.exe').read()

thiscwd = str(sclangloc)

ourcwd = thiscwd.replace('\\sclang.exe\n', '')

def is_proc_running(name):
for p in psutil.process_iter(attrs=["name", "exe", "cmdline"]):
#print(p);
procname = p.info['name'] or \
p.info['exe'] and os.path.basename(p.info['exe']) == name or \
p.info['cmdline'] and p.info['cmdline'][0] == name
if(procname.startswith(name)):
return True
return False


running = (is_proc_running("sclang"))

if(running == False):
startup = thisdir+"/FoxDot/startup.scd"
#os.system("sclang"+startup+" &")
subprocess.Popen([sclangloc, startup], cwd=ourcwd, shell=True)

elif(OS == "Linux"):

print("OS: Linux")

def is_proc_running(name):
for p in psutil.process_iter(attrs=["name","cmdline"]):
#print(p);
procname = p.info['name'] or \
p.info['cmdline'] and p.info['cmdline'][0] == name
if(procname.startswith(name)):
return True
return False


running = (is_proc_running("sclang"))

if(running == False):
startup = thisdir+"/FoxDot/startup.scd"
#os.system('sclang "/home/foxdot/Desktop/FoxDot-Cross-Platform/FoxDot/startup.scd" &') #fuctional
os.system("sclang "+startup+" &")


else:
print("Operating system unrecognised")
#Potentially get the user to choose their OS from a list?
#Then run the corresponding functions

from .lib import *


def main():
""" Function for starting the GUI when importing the library """
FoxDot = Workspace.workspace(FoxDotCode).run()

def Go():
""" Function to be called at the end of Python files with FoxDot code in to keep
the TempoClock thread alive. """
try:
import time
while 1:
time.sleep(100)
except KeyboardInterrupt:
return

0 comments on commit ff43e53

Please sign in to comment.