Skip to content

Instantly share code, notes, and snippets.

@maddievision
Last active December 14, 2015 13:28
Show Gist options
  • Save maddievision/5093159 to your computer and use it in GitHub Desktop.
Save maddievision/5093159 to your computer and use it in GitHub Desktop.
idealised conceptual iOS python app. again (not complete)
import pyios
import helpers
from boxcore import Session, Playlist
class BoxListView(pyios.TableView):
def __init__(self,session):
super(BoxListView,self).__init__(self)
self.session = session
self.title = "Box Play"
self.show_edit_button = True
self.left_buttons = [pyios.Navigation.SystemButton("add",handler=self.plus_button)]
def plus_button(self,sender):
title = pyios.InputBox("New Box",placeholder="Title",ok="Save")
if title:
playlist = self.session.add_playlist(title)
self.insert_row(-1,animation="slide_bottom")
self.show_playlist(playlist,new=True)
@pyios.TableView.CellClass("playlist_cell")
def playlist_cell(self):
return pyios.TableViewCell(pyios.TableViewCell.StyleDetail)
def get_cell(self,section,index):
playlist = self.session.playlists[index]
cell = self.deque_cell("playlist_cell")
cell.text_label.text = playlist.title
cell.detail_text_label.text = helpers.pluralize("song",len(playlist.entries))
return cell
class BoxPlayApp(pyios.App):
def on_app_start(self,url,file_open):
self.session = Session.load_session()
self.window = pyios.MainWindow()
self.window.add_subview(BoxListView(session))
self.window.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment