Skip to content

Commit

Permalink
Functional .app bundle for OSX! yayyyy
Browse files Browse the repository at this point in the history
  • Loading branch information
lowne committed Mar 24, 2014
1 parent d5054d9 commit 597c34a
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 8 deletions.
6 changes: 6 additions & 0 deletions buildapp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
#rm -rf build

rm -rf dist
python setup.py py2app
rm -rf build
29 changes: 29 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""

from setuptools import setup

APP = ['xCodea.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True,
'plist': {
'CFBundleIdentifier': 'com.marklowne.xCodea',
'LSUIElement': True,
},
'packages': ['rumps'],
}

setup(
name='xCodea',
author = 'Mark Lowne',
version = '0.1',
url = 'http://github.com/lowne/xCodea',
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
28 changes: 20 additions & 8 deletions xCodea.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import xcodeaserver as xcs
#import xcodealog as xlog

app = rumps.App('xC')
app = rumps.App('xCodea')
prefsfile = '.xcodea.prefs'
try:
with app.open(prefsfile) as f:
Expand Down Expand Up @@ -56,7 +56,7 @@ def click_serverIpPort(sender):
'Server address updated')
win.run()
sender.title = 'Server address: '+response.text
print(response.text)
#print(response.text)

def click_projectsRoot(sender):
if set_projectsRoot(prefs['projectsRoot']):
Expand All @@ -78,7 +78,7 @@ def set_projectsRoot(folder):
folder = response.text
if response.clicked == 2:
return False
print(os.path.abspath(folder))
#print(os.path.abspath(folder))
exists = os.path.isdir(os.path.abspath(folder))
if not exists:
rumps.alert('Error','The specified folder does not exist!')
Expand Down Expand Up @@ -117,19 +117,30 @@ def scan_projects(sender):
app.menu['Project'].add(rumps.MenuItem(proj,callback=click_project))
app.menu['Project'].add(rumps.separator)
app.menu['Project'].add(rumps.MenuItem('Rescan',callback=scan_projects))
app.menu['Project'].add(rumps.MenuItem('New project...'))
app.menu['Project'].add(rumps.MenuItem('New project...',callback=new_project))

def click_project(sender):
set_project(sender.title)
if xcs.is_running:
rumps.alert('Project changed','Please restart the server')
if menu_server.state:
click_server(menu_server)

def set_project(proj):
app.menu['Project'].title = 'Project: '+(proj or '<NONE>')
prefs['project'] = proj
flush_prefs()
if xcs.is_running:
rumps.alert('Project changed','Please restart the server')
if menu_server.state:
click_server(menu_server)
def new_project(sender):
project_valid = False
while not project_valid:
win = rumps.Window('The project must already exist in Codea','New project')
win.add_button('Cancel')
response = win.run()
if response.clicked==2: return
proj = response.text
if len(proj)>0:
set_project(proj)
project_valid = True

def click_server(sender):
if not sender.state:
Expand Down Expand Up @@ -187,6 +198,7 @@ def show_log(sender):
]},
rumps.separator,
]
app.title='xC'
scan_projects(None)
app.menu['Project'].title = 'Project: '+(prefs.get('project') or '<NONE>')
menu_server = app.menu['Server']
Expand Down

0 comments on commit 597c34a

Please sign in to comment.