From 110d02dd02f273b394296466c07bcacc75d75556 Mon Sep 17 00:00:00 2001 From: Kepoor Hampond Date: Sat, 31 Dec 2016 16:50:58 -0800 Subject: [PATCH] Updated --- .idea/irs.iml | 12 ---- .idea/misc.xml | 4 -- .idea/modules.xml | 8 --- .idea/vcs.xml | 6 -- .idea/workspace.xml | 144 ------------------------------------------- flexx-app/center.py | 9 --- flexx-app/chat.py | 87 -------------------------- flexx-app/circles.py | 51 --------------- flexx-app/form.py | 28 --------- flexx-app/irs-app.py | 22 ------- 10 files changed, 371 deletions(-) delete mode 100644 .idea/irs.iml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/workspace.xml delete mode 100644 flexx-app/center.py delete mode 100644 flexx-app/chat.py delete mode 100644 flexx-app/circles.py delete mode 100644 flexx-app/form.py delete mode 100644 flexx-app/irs-app.py diff --git a/.idea/irs.iml b/.idea/irs.iml deleted file mode 100644 index e98082a..0000000 --- a/.idea/irs.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 5bbe586..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 0dc461c..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 53bb332..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1482431898415 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/flexx-app/center.py b/flexx-app/center.py deleted file mode 100644 index 5d17a4b..0000000 --- a/flexx-app/center.py +++ /dev/null @@ -1,9 +0,0 @@ -def center(lst): - length = len(lst) - center = -1 - for num in range(0, length): - if not (num % 2): - center += 1 - return lst[center] - -print (center(center([1, 2, [1, 2, 3], 4, 5]))) \ No newline at end of file diff --git a/flexx-app/chat.py b/flexx-app/chat.py deleted file mode 100644 index 0f260c0..0000000 --- a/flexx-app/chat.py +++ /dev/null @@ -1,87 +0,0 @@ -""" -Simple chat web app in less than 80 lines. - -This app might be running at the demo server: http://flexx1.zoof.io -""" - -from flexx import app, ui, event - - -class Relay(event.HasEvents): - """ Global object to relay messages to all participants. - """ - @event.emitter - def new_message(self, msg): - return dict(msg=msg + '
') - - -class MessageBox(ui.Label): - CSS = """ - .flx-MessageBox { - overflow-y:scroll; - background: #e8e8e8; - border: 1px solid #444; - margin: 3px; - } - """ - - -class ChatRoom(ui.Widget): - """ Despite the name, this represents one connection to the chat room.""" - - def init(self): - with ui.HBox(): - ui.Widget(flex=1) - with ui.VBox(): - self.name = ui.LineEdit(placeholder_text='your name') - self.people = ui.Label(flex=1, base_size=(250, 0)) - with ui.VBox(): - self.messages = MessageBox(flex=1) - with ui.HBox(): - self.message = ui.LineEdit(flex=1, placeholder_text='enter message') - self.ok = ui.Button(text='Send') - ui.Widget(flex=1) - - # Pipe messages send by the relay into this app - relay.connect(self._push_info, 'new_message:' + self.id) - - self._update_participants() - - def _push_info(self, *events): - if self.session.status: - for ev in events: - self.emit('new_message', ev) - - def _update_participants(self): - if not self.session.status: - relay.disconnect('new_message:' + self.id) - return # and dont't invoke a new call - proxies = app.manager.get_connections(self.__class__.__name__) - names = [p.app.name.text for p in proxies] - del proxies - text = '
%i persons in this chat:

' % len(names) - text += '
'.join([name or 'anonymous' for name in sorted(names)]) - self.people.text = text - app.call_later(3, self._update_participants) - - @event.connect('ok.mouse_down', 'message.submit') - def _send_message(self, *events): - text = self.message.text - if text: - name = self.name.text or 'anonymous' - relay.new_message('%s: %s' % (name, text)) - self.message.text = '' - - class JS: - - @event.connect('new_message') - def _update_total_text(self, *events): - self.messages.text += ''.join([ev.msg for ev in events]) - - -# Create global relay -relay = Relay() - -if __name__ == '__main__': - m = app.launch(ChatRoom) # for use during development - app.run() diff --git a/flexx-app/circles.py b/flexx-app/circles.py deleted file mode 100644 index 2a3daef..0000000 --- a/flexx-app/circles.py +++ /dev/null @@ -1,51 +0,0 @@ -""" -Example that shows animated circles. The animation is run from Python. -Doing that in JS would be more efficient, but we have not implemented timers -yet. -""" - -import math - -from flexx import app, ui - - -class Circle(ui.Label): - CSS = """ - .flx-Circle { - background: #f00; - border-radius: 10px; - width: 10px; - height: 10px; - } - """ - -class Circles(ui.Widget): - - def init(self): - self._circles = [] - - with ui.PinboardLayout(): - for i in range(32): - x = math.sin(i*0.2)*0.3 + 0.5 - y = math.cos(i*0.2)*0.3 + 0.5 - w = Circle(pos=(x, y)) - self._circles.append(w) - - self.tick() - # todo: animate in JS! - - def tick(self): - if not self.session.status: - return - import time - t = time.time() - for i, circle in enumerate(self._circles): - x = math.sin(i*0.2 + t)*0.3 + 0.5 - y = math.cos(i*0.2 + t)*0.3 + 0.5 - circle.pos = x, y - app.call_later(0.03, self.tick) - - -if __name__ == '__main__': - m = app.launch(Circles) - app.run() diff --git a/flexx-app/form.py b/flexx-app/form.py deleted file mode 100644 index bfb3dc7..0000000 --- a/flexx-app/form.py +++ /dev/null @@ -1,28 +0,0 @@ -""" -Simple example that shows two forms, one which is stretched, and one -in which we use a dummy Widget to fill up space so that the form is -more compact. -""" - -from flexx import app, ui - - -class Form(ui.Widget): - - def init(self): - - with ui.BoxPanel(): - with ui.FormLayout() as self.form: - self.b1 = ui.Button(title='Name:', text='Hola') - self.b2 = ui.Button(title='Age:', text='Hello world') - self.b3 = ui.Button(title='Favorite color:', text='Foo bar') - with ui.FormLayout() as self.form: - self.b4 = ui.Button(title='Name:', text='Hola') - self.b5 = ui.Button(title='Age:', text='Hello world') - self.b6 = ui.Button(title='Favorite color:', text='Foo bar') - ui.Widget(flex=1) # Add a flexer - - -if __name__ == '__main__': - m = app.launch(Form) - app.run() diff --git a/flexx-app/irs-app.py b/flexx-app/irs-app.py deleted file mode 100644 index 4c5285a..0000000 --- a/flexx-app/irs-app.py +++ /dev/null @@ -1,22 +0,0 @@ -from flexx import app, ui, event -import os - -class IRS(ui.Widget): - - def init(self): - - with ui.FormLayout() as self.form: - self.song = ui.LineEdit(placeholder_text="Song Name") - self.artist = ui.LineEdit(placeholder_text="Artist Name") - self.submit = ui.Button(text="Submit") - self.output = ui.Label(text="") - ui.Widget(flex=2) - - """@event.connect("submit.mouse_click", "artist.submit") - def _button_clicked(self, *events): - self.output.text = os.system('irs -a "%s" -s "%s"' % (self.artist.text, self.song.text)) -""" - -if __name__ == '__main__': - m = app.launch(IRS) - app.run()