This commit is contained in:
Kepoor Hampond 2016-12-31 16:50:58 -08:00
parent 1cdcac80be
commit 110d02dd02
10 changed files with 0 additions and 371 deletions

View file

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TestRunnerService">
<option name="projectConfiguration" value="py.test" />
<option name="PROJECT_TEST_RUNNER" value="py.test" />
</component>
</module>

View file

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.5.2 (/usr/bin/python3.5)" project-jdk-type="Python SDK" />
</project>

View file

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/irs.iml" filepath="$PROJECT_DIR$/.idea/irs.iml" />
</modules>
</component>
</project>

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View file

@ -1,144 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="584c38f8-fe62-4de0-bab7-ab5fd4513619" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/irs/metadata.py" afterPath="$PROJECT_DIR$/irs/metadata.py" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="metadata.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/irs/metadata.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectFrameBounds">
<option name="x" value="260" />
<option name="y" value="40" />
<option name="width" value="1400" />
<option name="height" value="1000" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
<showMembers />
<showModules />
<showLibraryContents />
<hideEmptyPackages />
<abbreviatePackageNames />
<autoscrollToSource />
<autoscrollFromSource />
<sortByType />
<manualOrder />
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="ProjectPane">
<subPane>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="irs" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="irs" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
<PATH>
<PATH_ELEMENT>
<option name="myItemId" value="irs" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="irs" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="irs" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="584c38f8-fe62-4de0-bab7-ab5fd4513619" name="Default" comment="" />
<created>1482431898415</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1482431898415</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="260" y="40" width="1400" height="1000" extended-state="0" />
<editor active="false" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/irs/metadata.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</component>
</project>

View file

@ -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])))

View file

@ -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 + '<br />')
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 = '<br />%i persons in this chat:<br /><br />' % len(names)
text += '<br />'.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('<i>%s</i>: %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()

View file

@ -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()

View file

@ -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()

View file

@ -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()