diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 4fc325f..0000000 --- a/.gitignore +++ /dev/null @@ -1,56 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.cache -nosetests.xml -coverage.xml - -# Translations -*.mo -*.pot - -# Django stuff: -*.log - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -*/debug.txt diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..5c457d7 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +docs \ No newline at end of file diff --git a/.idea/docs.iml b/.idea/docs.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/docs.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..d821048 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..6049cfe --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..6564d52 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..e2d72c3 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,269 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $PROJECT_DIR$ + true + + BDD + + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1418345986368 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Client-module.html b/Client-module.html new file mode 100644 index 0000000..885e68a --- /dev/null +++ b/Client-module.html @@ -0,0 +1,164 @@ + + + + + Client + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Package Client

source code

+ + + + + + + +
+ + + + + +
Submodules[hide private]
+
+
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client-pysrc.html b/Client-pysrc.html new file mode 100644 index 0000000..4a02b60 --- /dev/null +++ b/Client-pysrc.html @@ -0,0 +1,105 @@ + + + + + Client + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Package Client

+
+1  # Exists solely for documentation-generating purposes 
+2   
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes-module.html b/Client.Classes-module.html new file mode 100644 index 0000000..0c976d5 --- /dev/null +++ b/Client.Classes-module.html @@ -0,0 +1,150 @@ + + + + + Client.Classes + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Package Classes

source code

+ + + + + + + +
+ + + + + +
Submodules[hide private]
+
+
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes-pysrc.html b/Client.Classes-pysrc.html new file mode 100644 index 0000000..c251c0d --- /dev/null +++ b/Client.Classes-pysrc.html @@ -0,0 +1,107 @@ + + + + + Client.Classes + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Package Client.Classes

+
+1  # This file is needed to allow us to move classes into this folder 
+2  # and call them using Classes.____ 
+3   
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes.ConfigParser-module.html b/Client.Classes.ConfigParser-module.html new file mode 100644 index 0000000..49d14c1 --- /dev/null +++ b/Client.Classes.ConfigParser-module.html @@ -0,0 +1,150 @@ + + + + + Client.Classes.ConfigParser + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes :: + Module ConfigParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module ConfigParser

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ConfigParser
+ Configuration Parser Class +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes.ConfigParser-pysrc.html b/Client.Classes.ConfigParser-pysrc.html new file mode 100644 index 0000000..0ec6310 --- /dev/null +++ b/Client.Classes.ConfigParser-pysrc.html @@ -0,0 +1,146 @@ + + + + + Client.Classes.ConfigParser + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes :: + Module ConfigParser + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Client.Classes.ConfigParser

+
+
1 -class ConfigParser: +
2 """ + 3 Configuration Parser Class + 4 @copyright: Northeastern University Crew 2014 + 5 """ + 6 + 7 @staticmethod +
8 - def readConfig(): +
9 """ +10 Reads the contents of PIE.conf +11 @return: User-specified Configuration +12 @rtype: Dict +13 """ +14 config = open("Configs/PIE.conf", "r") +15 configContents = config.read() +16 configDict = {} +17 for line in configContents.splitlines(): +18 if not (line.startswith("[") or line == ""): +19 pair = ConfigParser.getPair(line) +20 configDict[pair[0]] = pair[1] +21 return configDict +
22 +23 @staticmethod +
24 - def getPair(line): +
25 """ +26 Parses the given configuration file +27 line into a tuple. +28 @param line: The line to parse +29 @type line: String +30 @return: Tuple of the form (key, value) +31 @rtype: Tuple +32 """ +33 split = line.replace(" ", "").split("=") +34 if len(split) != 2: +35 raise Exception("Bad config file...") +36 return split[0], split[1] +
37 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes.ConfigParser.ConfigParser-class.html b/Client.Classes.ConfigParser.ConfigParser-class.html new file mode 100644 index 0000000..69f39e2 --- /dev/null +++ b/Client.Classes.ConfigParser.ConfigParser-class.html @@ -0,0 +1,225 @@ + + + + + Client.Classes.ConfigParser.ConfigParser + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes :: + Module ConfigParser :: + Class ConfigParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ConfigParser

source code

+

Configuration Parser Class

+ +
+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+ Dict + + + + + + +
readConfig()
+ Reads the contents of PIE.conf
+ source code + +
+ +
+ Tuple + + + + + + +
getPair(line)
+ Parses the given configuration file line into a tuple.
+ source code + +
+ +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

readConfig() +
Static Method +

+
source code  +
+ +

Reads the contents of PIE.conf

+
+
Returns: Dict
+
User-specified Configuration
+
+
+
+ +
+ +
+ + +
+

getPair(line) +
Static Method +

+
source code  +
+ +

Parses the given configuration file line into a tuple.

+
+
Parameters:
+
    +
  • line (String) - The line to parse
  • +
+
Returns: Tuple
+
Tuple of the form (key, value)
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes.message-module.html b/Client.Classes.message-module.html new file mode 100644 index 0000000..2b26fce --- /dev/null +++ b/Client.Classes.message-module.html @@ -0,0 +1,157 @@ + + + + + Client.Classes.message + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes :: + Module message + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module message

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + Message
+ " A message object to be passed between threads via Queue + Sample Usage: Making a new message that will send terminate + from main to display: newMessage = Message("Main", + "Display", "Terminate", \{\}) Making a + slide that will update Display with a new slide: newMessage = + Message("Main", "Display", "Update", + \{\}) newMessage.add_content("slide1", + "http://google.com") +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'Client.Classes' +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes.message-pysrc.html b/Client.Classes.message-pysrc.html new file mode 100644 index 0000000..c3c0b40 --- /dev/null +++ b/Client.Classes.message-pysrc.html @@ -0,0 +1,230 @@ + + + + + Client.Classes.message + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes :: + Module message + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Client.Classes.message

+
+  1  import json 
+
2 + 3 + 4 # TODO: See doctring below + 5 -class Message: +
6 """" + 7 A message object to be passed between threads via Queue + 8 I{Sample Usage}: + 9 Making a new message that will send terminate from main to display: + 10 C{newMessage = Message("Main", "Display", "Terminate", \{\})} + 11 Making a slide that will update Display with a new slide: + 12 C{newMessage = Message("Main", "Display", "Update", \{\})} + 13 C{newMessage.add_content("slide1", "http://google.com")} + 14 + 15 @attention: It is good practice to use dict accessors as opposed to object attributes + 16 @todo: Un-expose attributes + 17 @ivar src: Name of the thread who sent the message + 18 @type src: String + 19 @ivar dest: Intended message destination + 20 @type dest: String + 21 @ivar pluginDest: Client-side plugin to receive the message + 22 @type pluginDest: String + 23 @ivar action: Action for the client-side plugin to perform + 24 @type action: String + 25 @ivar content: Message payload (destination plugin should be able to interpret content) + 26 @type content: Dictionary + 27 @ivar datetime: Message timestamp + 28 @type datetime: String + 29 @copyright: Northeastern University Crew 2014 + 30 """ + 31 +
32 - def __init__(self, src, dest, pluginDest, action, content, datetime=None): +
33 """ + 34 Message Constructor + 35 @param src: Name of the thread who sent the message + 36 @type src: String + 37 @param dest: Intended message destination + 38 @type dest: String + 39 @param pluginDest: Client-side plugin to receive the message + 40 @type pluginDest: String + 41 @param action: Action for the client-side plugin to perform + 42 @type action: String + 43 @param content: Message payload (destination plugin should be able to interpret content) + 44 @type content: Dictionary + 45 @param datetime: Message timestamp + 46 @type datetime: String + 47 @return: Message with the given parameters + 48 @rtype: Message + 49 """ + 50 self.src = src + 51 self.dest = dest + 52 self.pluginDest = pluginDest + 53 self.action = action + 54 self.content = content + 55 self.datetime = datetime +
56 +
57 - def add_content(self, key, val): +
58 """ + 59 Sets the given key-value pair to the message's content + 60 @param key: Key to write to in message content + 61 @param val: Value to write in message content + 62 @return: None + 63 """ + 64 self.content[key] = val +
65 +
66 - def toJSON(self): +
67 """ + 68 Returns the message in JSON format + 69 @return: JSON representation of Message + 70 @rtype: String + 71 """ + 72 text = json.dumps(self.__dict__) + 73 return text +
74 + 75 # TODO: (See docstring) +
76 - def __str__(self): +
77 """ + 78 @return: String Representation of Message + 79 @rtype: String + 80 @todo: This looks horrendous. We should pretty it up. + 81 """ + 82 return "Src = " + self.src + " dest = " + self.dest + " pluginDest = " + self.pluginDest + \ + 83 " action = " + self.action + " content = " + self.content + " datetime = " + self.datetime +
84 + 85 @staticmethod +
86 - def fromJSON(jsonObj): +
87 """ + 88 Creates a message from JSON input + 89 @param jsonObj: A Parsed JSON Input + 90 @type jsonObj: Dictionary + 91 @return: Message represented by the given JSON + 92 @rtype: Message + 93 """ + 94 src = jsonObj['src'] + 95 dest = jsonObj['dest'] + 96 pluginDest = jsonObj['pluginDest'] + 97 action = jsonObj['action'] + 98 content = jsonObj['content'] + 99 datetime = None +100 if "datetime" in jsonObj: +101 datetime = jsonObj["datetime"] +102 return Message(src, dest, pluginDest, action, content, datetime) +
103 +
104 - def __getitem__(self, item): +
105 """ +106 Implements dict-like behavior for Messages +107 @param item: Message value to fetch +108 @return: The attribute associated with the given key +109 """ +110 if item == "src": +111 return self.src +112 elif item == "dest": +113 return self.dest +114 elif item == "pluginDest": +115 return self.pluginDest +116 elif item == "action": +117 return self.action +118 elif item == "content": +119 return self.content +120 elif item == "datetime": +121 return self.datetime +122 raise Exception("Message does not have an attribute \"" + item + "\"") +
123 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes.message.Message-class.html b/Client.Classes.message.Message-class.html new file mode 100644 index 0000000..e21dff9 --- /dev/null +++ b/Client.Classes.message.Message-class.html @@ -0,0 +1,519 @@ + + + + + Client.Classes.message.Message + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes :: + Module message :: + Class Message + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Message

source code

+

" A message object to be passed between threads via Queue + Sample Usage: Making a new message that will send terminate from + main to display: newMessage = Message("Main", + "Display", "Terminate", \{\}) Making a slide + that will update Display with a new slide: newMessage = + Message("Main", "Display", "Update", + \{\}) newMessage.add_content("slide1", + "http://google.com")

+ +
+

Attention: + It is good practice to use dict accessors as opposed to object + attributes +

+

To Do: + Un-expose attributes +

+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ Message + + + + + + +
__init__(self, + src, + dest, + pluginDest, + action, + content, + datetime=None)
+ Message Constructor
+ source code + +
+ +
+   + + + + + + +
add_content(self, + key, + val)
+ Sets the given key-value pair to the message's content
+ source code + +
+ +
+ String + + + + + + +
toJSON(self)
+ Returns the message in JSON format
+ source code + +
+ +
+ String + + + + + + +
__str__(self)
+ Returns: + String Representation of Message
+ source code + +
+ +
+   + + + + + + +
__getitem__(self, + item)
+ Implements dict-like behavior for Messages
+ source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+ Message + + + + + + +
fromJSON(jsonObj)
+ Creates a message from JSON input
+ source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Variables[hide private]
+
+ String + + action
+ Action for the client-side plugin to perform +
+ Dictionary + + content
+ Message payload (destination plugin should be able to interpret + content) +
+ String + + datetime
+ Message timestamp +
+ String + + dest
+ Intended message destination +
+ String + + pluginDest
+ Client-side plugin to receive the message +
+ String + + src
+ Name of the thread who sent the message +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + src, + dest, + pluginDest, + action, + content, + datetime=None) +
(Constructor) +

+
source code  +
+ +

Message Constructor

+
+
Parameters:
+
    +
  • src (String) - Name of the thread who sent the message
  • +
  • dest (String) - Intended message destination
  • +
  • pluginDest (String) - Client-side plugin to receive the message
  • +
  • action (String) - Action for the client-side plugin to perform
  • +
  • content (Dictionary) - Message payload (destination plugin should be able to interpret + content)
  • +
  • datetime (String) - Message timestamp
  • +
+
Returns: Message
+
Message with the given parameters
+
+
+
+ +
+ +
+ + +
+

add_content(self, + key, + val) +

+
source code  +
+ +

Sets the given key-value pair to the message's content

+
+
Parameters:
+
    +
  • key - Key to write to in message content
  • +
  • val - Value to write in message content
  • +
+
Returns:
+
None
+
+
+
+ +
+ +
+ + +
+

toJSON(self) +

+
source code  +
+ +

Returns the message in JSON format

+
+
Returns: String
+
JSON representation of Message
+
+
+
+ +
+ +
+ + +
+

__str__(self) +
(Informal representation operator) +

+
source code  +
+ + +
+
Returns: String
+
String Representation of Message
+
+

To Do: + This looks horrendous. We should pretty it up. +

+
+
+ +
+ +
+ + +
+

fromJSON(jsonObj) +
Static Method +

+
source code  +
+ +

Creates a message from JSON input

+
+
Parameters:
+
    +
  • jsonObj (Dictionary) - A Parsed JSON Input
  • +
+
Returns: Message
+
Message represented by the given JSON
+
+
+
+ +
+ +
+ + +
+

__getitem__(self, + item) +
(Indexing operator) +

+
source code  +
+ +

Implements dict-like behavior for Messages

+
+
Parameters:
+
    +
  • item - Message value to fetch
  • +
+
Returns:
+
The attribute associated with the given key
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes.slide-module.html b/Client.Classes.slide-module.html new file mode 100644 index 0000000..f73ebc4 --- /dev/null +++ b/Client.Classes.slide-module.html @@ -0,0 +1,150 @@ + + + + + Client.Classes.slide + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes :: + Module slide + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module slide

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + Slide
+ Class for Slide Show Slide Objects +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'Client.Classes' +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes.slide-pysrc.html b/Client.Classes.slide-pysrc.html new file mode 100644 index 0000000..9c52118 --- /dev/null +++ b/Client.Classes.slide-pysrc.html @@ -0,0 +1,187 @@ + + + + + Client.Classes.slide + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes :: + Module slide + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Client.Classes.slide

+
+ 1  import json 
+
2 + 3 + 4 # TODO: Make symlinks between the Server and Client slide, message, and ConfigParser classes + 5 -class Slide(): +
6 """ + 7 Class for Slide Show Slide Objects + 8 @ivar url: The Slide's URL + 9 @type url: String +10 @ivar duration: The Duration to show the slide (in seconds) +11 @type duration: Integer +12 @ivar id: The Slide's ID +13 @type id: Integer +14 @ivar meta: The Slide's meta content +15 @type meta: Dictionary +16 @copyright: Northeastern University Crew 2014 +17 """ +18 +19 @staticmethod +
20 - def makeSlide(url, duration, id, meta): +
21 """ +22 Slide Constructor based on the given input (instead of a dictionary) +23 @param url: The Slide's URL +24 @type url: String +25 @param duration: The Duration to show the slide (in seconds) +26 @type duration: Integer +27 @param id: The Slide's ID +28 @type id: Integer +29 @param meta: The Slide's meta content +30 @type meta: Dictionary +31 @return: The constructed Slide +32 @rtype: Slide +33 """ +34 return Slide({"permalink": url, "duration": duration, "ID": id, "meta": meta}) +
35 +
36 - def __init__(self, infoDict): +
37 """ +38 Slide Constructor +39 @param infoDict: The relevant information for the slide +40 @type infoDict: Dictionary +41 @return: The constructed Slide +42 @rtype: Slide +43 """ +44 self.__type__ = "slide" +45 print "Got meta:", infoDict["meta"] +46 self.url = infoDict["permalink"] +47 if (not (isinstance(infoDict["meta"], str)) and +48 (infoDict["meta"]["dds_external_url"][0] != "")): +49 self.url = infoDict["meta"]["dds_external_url"][0] +50 +51 self.duration = infoDict["duration"] +52 self.id = infoDict["ID"] +53 self.meta = infoDict["meta"] +
54 +
55 - def toJSON(self): +
56 """ +57 @return: A JSON Representation of the slide +58 @rtype: String +59 """ +60 text = json.dumps(self.__dict__) +61 return text +
62 +
63 - def sameID(self, id): +
64 """ +65 Predicate method which checks if the given id is equal to the slide's +66 @param id: The id to check +67 @type id: Integer +68 @return: Whether the id matches the slide's +69 @rtype: Boolean +70 @todo: Do we I{really} need a method for this? +71 """ +72 return self.id == id +
73 +
74 - def __str__(self): +
75 return "Slide[url=" + str(self.url) + ", duration=" + str(self.duration) + ", id=" + str( +76 self.id) + ", meta=" + str(self.meta) + "]" +
77 +
78 - def __repr__(self): +
79 # Simplified output (Shown when Arrays of Slides are Printed) +80 return "Slide(" + str(self.url) + "," + str(self.duration) + ")" +
81 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes.slide.Slide-class.html b/Client.Classes.slide.Slide-class.html new file mode 100644 index 0000000..370e8d3 --- /dev/null +++ b/Client.Classes.slide.Slide-class.html @@ -0,0 +1,428 @@ + + + + + Client.Classes.slide.Slide + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes :: + Module slide :: + Class Slide + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Slide

source code

+

Class for Slide Show Slide Objects

+ +
+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ Slide + + + + + + +
__init__(self, + infoDict)
+ Slide Constructor
+ source code + +
+ +
+ String + + + + + + +
toJSON(self)
+ Returns: + A JSON Representation of the slide
+ source code + +
+ +
+ Boolean + + + + + + +
sameID(self, + id)
+ Predicate method which checks if the given id is equal to the slide's
+ source code + +
+ +
+   + + + + + + +
__str__(self) + source code + +
+ +
+   + + + + + + +
__repr__(self) + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+ Slide + + + + + + +
makeSlide(url, + duration, + id, + meta)
+ Slide Constructor based on the given input (instead of a dictionary)
+ source code + +
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Variables[hide private]
+
+ Integer + + duration
+ The Duration to show the slide (in seconds) +
+ Integer + + id
+ The Slide's ID +
+ Dictionary + + meta
+ The Slide's meta content +
+ String + + url
+ The Slide's URL +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

makeSlide(url, + duration, + id, + meta) +
Static Method +

+
source code  +
+ +

Slide Constructor based on the given input (instead of a + dictionary)

+
+
Parameters:
+
    +
  • url (String) - The Slide's URL
  • +
  • duration (Integer) - The Duration to show the slide (in seconds)
  • +
  • id (Integer) - The Slide's ID
  • +
  • meta (Dictionary) - The Slide's meta content
  • +
+
Returns: Slide
+
The constructed Slide
+
+
+
+ +
+ +
+ + +
+

__init__(self, + infoDict) +
(Constructor) +

+
source code  +
+ +

Slide Constructor

+
+
Parameters:
+
    +
  • infoDict (Dictionary) - The relevant information for the slide
  • +
+
Returns: Slide
+
The constructed Slide
+
+
+
+ +
+ +
+ + +
+

toJSON(self) +

+
source code  +
+ + +
+
Returns: String
+
A JSON Representation of the slide
+
+
+
+ +
+ +
+ + +
+

sameID(self, + id) +

+
source code  +
+ +

Predicate method which checks if the given id is equal to the + slide's

+
+
Parameters:
+
    +
  • id (Integer) - The id to check
  • +
+
Returns: Boolean
+
Whether the id matches the slide's
+
+

To Do: + Do we really need a method for this? +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes.sockClass-module.html b/Client.Classes.sockClass-module.html new file mode 100644 index 0000000..a503677 --- /dev/null +++ b/Client.Classes.sockClass-module.html @@ -0,0 +1,150 @@ + + + + + Client.Classes.sockClass + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes :: + Module sockClass + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module sockClass

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + sockClass
+ Client Socket class +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'Client.Classes' +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes.sockClass-pysrc.html b/Client.Classes.sockClass-pysrc.html new file mode 100644 index 0000000..c20dae9 --- /dev/null +++ b/Client.Classes.sockClass-pysrc.html @@ -0,0 +1,180 @@ + + + + + Client.Classes.sockClass + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes :: + Module sockClass + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Client.Classes.sockClass

+
+ 1  import socket 
+ 2  import time 
+ 3   
+ 4  from message import Message 
+ 5   
+ 6   
+
7 -class sockClass: +
8 """ + 9 Client Socket class +10 @ivar sock: The Socket's I/O socket +11 @type sock: Socket +12 @ivar hostIP: The Server's IP Address +13 @type hostIP: String +14 @ivar hostPort: The Server's Port +15 @type hostPort: Integer +16 @copyright: Northeastern University Crew 2014 +17 """ +18 +
19 - def __init__(self, runtimeVars): +
20 """ +21 Client Socket Constructor +22 @param runtimeVars: User-defined configuration +23 @return: The Constructed Client Socket +24 @rtype: sockClass +25 """ +26 self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +27 self.hostIP = runtimeVars["server"] +28 self.hostPort = int(runtimeVars["port"]) +29 self.connect(runtimeVars) +
30 +
31 - def send(self, msg): +
32 """ +33 Sends the given message to the server +34 @param msg: The message to send +35 @type msg: String +36 @return: None +37 @rtype: NoneType +38 """ +39 self.sock.send(msg) +
40 +
41 - def connect(self, runtimeVars): +
42 """ +43 Connects the Client to the Server +44 (Server configuration inside of Configs/PIE.conf) +45 @param runtimeVars: User-defined configuration +46 @return: None +47 @rtype: NoneType +48 """ +49 print "I'm connected: " + runtimeVars["name"] +50 while True: +51 try: +52 self.sock.connect((self.hostIP, self.hostPort)) +53 print "Connected" +54 break +55 except: +56 print 'Unable to connect' +57 time.sleep(2) +58 +59 # Pass along PIE name to Grandma +60 # TODO: Abstract to allow config setting of these parameters +61 identify = Message(runtimeVars["name"], "Grandma", "socketServer", "connect", {}) +62 identify.add_content("name", runtimeVars["name"]) +63 self.sock.send(identify.toJSON()) +
64 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Classes.sockClass.sockClass-class.html b/Client.Classes.sockClass.sockClass-class.html new file mode 100644 index 0000000..bde3e40 --- /dev/null +++ b/Client.Classes.sockClass.sockClass-class.html @@ -0,0 +1,320 @@ + + + + + Client.Classes.sockClass.sockClass + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Classes :: + Module sockClass :: + Class sockClass + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class sockClass

source code

+

Client Socket class

+ +
+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ sockClass + + + + + + +
__init__(self, + runtimeVars)
+ Client Socket Constructor
+ source code + +
+ +
+ NoneType + + + + + + +
send(self, + msg)
+ Sends the given message to the server
+ source code + +
+ +
+ NoneType + + + + + + +
connect(self, + runtimeVars)
+ Connects the Client to the Server (Server configuration inside of + Configs/PIE.conf)
+ source code + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Variables[hide private]
+
+ String + + hostIP
+ The Server's IP Address +
+ Integer + + hostPort
+ The Server's Port +
+ Socket + + sock
+ The Socket's I/O socket +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + runtimeVars) +
(Constructor) +

+
source code  +
+ +

Client Socket Constructor

+
+
Parameters:
+
    +
  • runtimeVars - User-defined configuration
  • +
+
Returns: sockClass
+
The Constructed Client Socket
+
+
+
+ +
+ +
+ + +
+

send(self, + msg) +

+
source code  +
+ +

Sends the given message to the server

+
+
Parameters:
+
    +
  • msg (String) - The message to send
  • +
+
Returns: NoneType
+
None
+
+
+
+ +
+ +
+ + +
+

connect(self, + runtimeVars) +

+
source code  +
+ +

Connects the Client to the Server (Server configuration inside of + Configs/PIE.conf)

+
+
Parameters:
+
    +
  • runtimeVars - User-defined configuration
  • +
+
Returns: NoneType
+
None
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Plugins-module.html b/Client.Plugins-module.html new file mode 100644 index 0000000..fcb182b --- /dev/null +++ b/Client.Plugins-module.html @@ -0,0 +1,148 @@ + + + + + Client.Plugins + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Plugins + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Package Plugins

source code

+ + + + + + + +
+ + + + + +
Submodules[hide private]
+
+
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Plugins-pysrc.html b/Client.Plugins-pysrc.html new file mode 100644 index 0000000..c079af3 --- /dev/null +++ b/Client.Plugins-pysrc.html @@ -0,0 +1,106 @@ + + + + + Client.Plugins + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Plugins + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Package Client.Plugins

+
+1   
+2   
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Plugins.ExamplePlugin-module.html b/Client.Plugins.ExamplePlugin-module.html new file mode 100644 index 0000000..9606f34 --- /dev/null +++ b/Client.Plugins.ExamplePlugin-module.html @@ -0,0 +1,181 @@ + + + + + Client.Plugins.ExamplePlugin + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Plugins :: + Module ExamplePlugin + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module ExamplePlugin

source code

+

This is an example of a plugin that the user could add themselves. + There are several rules to create a plugin and have it run, in order to + ensure programmatic safety as well as usability. they are as follows:

+
    +
  1. + The file for the plugin must be placed in the Plugins directory +
  2. +
  3. + The file must only define one class, nothing more, nothing less +
  4. +
  5. + The class must have the EXACT same name as the file its in +
  6. +
  7. + the class must extend Plugin +
  8. +
  9. + add the class to the config file in the plugins field. The syntax for + this field is identical to the python list syntax +
  10. +
  11. + The plugin must implement the method getName which returns a string. + No other implementations are necessary. +
  12. +
+ +
+

Note: + your plugin will raise an exception if another plugin tries to pass + it a message and the addMessage method is not + implemented +

+
+ + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ExamplePlugin +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'Client.Plugins' +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Plugins.ExamplePlugin-pysrc.html b/Client.Plugins.ExamplePlugin-pysrc.html new file mode 100644 index 0000000..f35d3a3 --- /dev/null +++ b/Client.Plugins.ExamplePlugin-pysrc.html @@ -0,0 +1,128 @@ + + + + + Client.Plugins.ExamplePlugin + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Plugins :: + Module ExamplePlugin + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Client.Plugins.ExamplePlugin

+
+ 1  """ 
+ 2  This is an example of a plugin that the user could add themselves. 
+ 3  There are several rules to create a plugin and have it run, in order to ensure 
+ 4  programmatic safety as well as usability. they are as follows: 
+ 5      1. The file for the plugin must be placed in the Plugins directory 
+ 6      2. The file must only define one class, nothing more, nothing less 
+ 7      3. The class must have the EXACT same name as the file its in 
+ 8      4. the class must extend Plugin 
+ 9      5. add the class to the config file in the plugins field. The syntax for this field 
+10      is identical to the python list syntax 
+11      6. The plugin must implement the method getName which returns a string. No other implementations are necessary. 
+12  @note: your plugin will raise an exception if another plugin tries to pass it a message and the C{addMessage} method is 
+13  not implemented 
+14  """ 
+15  from plugin import Plugin 
+16   
+17   
+
18 -class ExamplePlugin(Plugin): +
19 - def getName(self): +
20 return "ExamplePlugin" +
21 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Plugins.ExamplePlugin.ExamplePlugin-class.html b/Client.Plugins.ExamplePlugin.ExamplePlugin-class.html new file mode 100644 index 0000000..e26818d --- /dev/null +++ b/Client.Plugins.ExamplePlugin.ExamplePlugin-class.html @@ -0,0 +1,198 @@ + + + + + Client.Plugins.ExamplePlugin.ExamplePlugin + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Plugins :: + Module ExamplePlugin :: + Class ExamplePlugin + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ExamplePlugin

source code

+
+plugin.Plugin --+
+                |
+               ExamplePlugin
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ String + + + + + + +
getName(self)
+ Returns: + The Plugin's name
+ source code + +
+ +
+

Inherited from plugin.Plugin: + __str__, + addMessage, + needsThread, + run, + setup +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

getName(self) +

+
source code  +
+ + +
+
Returns: String
+
The Plugin's name
+
Overrides: + plugin.Plugin.getName +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Plugins.plugin-module.html b/Client.Plugins.plugin-module.html new file mode 100644 index 0000000..73b9c8c --- /dev/null +++ b/Client.Plugins.plugin-module.html @@ -0,0 +1,150 @@ + + + + + Client.Plugins.plugin + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Plugins :: + Module plugin + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module plugin

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + Plugin
+ Plugin Base Class +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Plugins.plugin-pysrc.html b/Client.Plugins.plugin-pysrc.html new file mode 100644 index 0000000..317432c --- /dev/null +++ b/Client.Plugins.plugin-pysrc.html @@ -0,0 +1,161 @@ + + + + + Client.Plugins.plugin + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Plugins :: + Module plugin + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Client.Plugins.plugin

+
+
1 -class Plugin: +
2 """ + 3 Plugin Base Class + 4 """ + 5 +
6 - def needsThread(self): +
7 """ + 8 Predicate method which asks whether the plugin's + 9 run() function requires threading +10 @return: Whether the plugin needs a thread +11 @rtype: Boolean +12 """ +13 return False +
14 +
15 - def run(self, runtimeVars): +
16 """ +17 The main function of the plugin. This is called +18 after setup() by the main client function +19 @param runtimeVars: Configuration provided in Configs/PIE.conf +20 @return: None +21 @rtype: NoneType +22 """ +23 pass +
24 +
25 - def setup(self, messageDict, runtimeVars): +
26 """ +27 Called during the client's initialization process +28 @param messageDict: All of the Client's Plugins' Message Receivers +29 @type messageDict: Dictionary +30 @param runtimeVars: Configuration provided in Configs/PIE.conf +31 @type runtimeVars: Dictionary +32 """ +33 pass +
34 +
35 - def getName(self): +
36 """ +37 @return: The Plugin's name +38 @rtype: String +39 """ +40 raise Exception("Abstract Plugin does not have a name") +
41 +
42 - def addMessage(self, message): +
43 """ +44 Handler for incoming messages +45 @param message: Received message +46 @type message: String +47 """ +48 raise Exception("Not implemented for Plugin") +
49 +
50 - def __str__(self): +
51 return self.getName() +
52 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.Plugins.plugin.Plugin-class.html b/Client.Plugins.plugin.Plugin-class.html new file mode 100644 index 0000000..007fd8b --- /dev/null +++ b/Client.Plugins.plugin.Plugin-class.html @@ -0,0 +1,373 @@ + + + + + Client.Plugins.plugin.Plugin + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Package Plugins :: + Module plugin :: + Class Plugin + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Plugin

source code

+
Known Subclasses:
+
+ +
+ +
+

Plugin Base Class

+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__str__(self) + source code + +
+ +
+   + + + + + + +
addMessage(self, + message)
+ Handler for incoming messages
+ source code + +
+ +
+ String + + + + + + +
getName(self)
+ Returns: + The Plugin's name
+ source code + +
+ +
+ Boolean + + + + + + +
needsThread(self)
+ Predicate method which asks whether the plugin's run() function + requires threading
+ source code + +
+ +
+ NoneType + + + + + + +
run(self, + runtimeVars)
+ The main function of the plugin.
+ source code + +
+ +
+   + + + + + + +
setup(self, + messageDict, + runtimeVars)
+ Called during the client's initialization process
+ source code + +
+ +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

addMessage(self, + message) +

+
source code  +
+ +

Handler for incoming messages

+
+
Parameters:
+
    +
  • message (String) - Received message
  • +
+
+
+
+ +
+ +
+ + +
+

getName(self) +

+
source code  +
+ + +
+
Returns: String
+
The Plugin's name
+
+
+
+ +
+ +
+ + +
+

needsThread(self) +

+
source code  +
+ +

Predicate method which asks whether the plugin's run() function + requires threading

+
+
Returns: Boolean
+
Whether the plugin needs a thread
+
+
+
+ +
+ +
+ + +
+

run(self, + runtimeVars) +

+
source code  +
+ +

The main function of the plugin. This is called after setup() by the + main client function

+
+
Parameters:
+
    +
  • runtimeVars - Configuration provided in Configs/PIE.conf
  • +
+
Returns: NoneType
+
None
+
+
+
+ +
+ +
+ + +
+

setup(self, + messageDict, + runtimeVars) +

+
source code  +
+ +

Called during the client's initialization process

+
+
Parameters:
+
    +
  • messageDict (Dictionary) - All of the Client's Plugins' Message Receivers
  • +
  • runtimeVars (Dictionary) - Configuration provided in Configs/PIE.conf
  • +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.gtkDisplay-module.html b/Client.gtkDisplay-module.html new file mode 100644 index 0000000..52b609e --- /dev/null +++ b/Client.gtkDisplay-module.html @@ -0,0 +1,214 @@ + + + + + Client.gtkDisplay + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module gtkDisplay + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module gtkDisplay

source code

+ + + + + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + WebBrowser
+ Web Page Display Window Class Represents a full screen GTK Web + Browser (no UI) displaying a given URL. +
+   + + GTKPlugin
+ GTK Web Display Plugin Class +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+   + + + + + + +
getUpdateHandle(runtimeVars)
+ Initializes the browser and returns the function used to update its + page
+ source code + +
+ +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

getUpdateHandle(runtimeVars) +

+
source code  +
+ +

Initializes the browser and returns the function used to update its + page

+
+
Parameters:
+
    +
  • runtimeVars (Dictionary) - User-defined Configuration
  • +
+
Returns:
+
Function
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.gtkDisplay-pysrc.html b/Client.gtkDisplay-pysrc.html new file mode 100644 index 0000000..9fb2a03 --- /dev/null +++ b/Client.gtkDisplay-pysrc.html @@ -0,0 +1,237 @@ + + + + + Client.gtkDisplay + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module gtkDisplay + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Client.gtkDisplay

+
+  1  #!/usr/bin/env python 
+  2   
+  3  import threading 
+  4  import time 
+  5   
+  6  import gobject 
+  7  import gtk 
+  8  import webkit 
+  9  from Plugins.plugin import Plugin 
+ 10   
+ 11   
+
12 -class WebBrowser(gtk.Window): +
13 """ + 14 Web Page Display Window Class + 15 Represents a full screen GTK Web Browser (no UI) + 16 displaying a given URL. + 17 @note: URL must begin with a prefix (e.g. "https://") + 18 @note: Extension of the python-gtk-webkit presentation program, + 19 Copyright (C) 2009 by Akkana Peck + 20 @license: GNU Public License, version 2 + 21 @copyright: Northeastern University Crew 2014 + 22 """ + 23 +
24 - def __init__(self, url, width, height): +
25 """ + 26 GTK Window Constructor + 27 @param url: The initial URL to show + 28 @type url: String + 29 @param width: The Screen's Width + 30 @type width: Integer + 31 @param height: The Screen's Height + 32 @type height: Integer + 33 @return: The Constructed WebBrowser + 34 @rtype: WebBrowser + 35 """ + 36 gtk.Window.__init__(self) + 37 self.fullscreen() + 38 + 39 self._browser = webkit.WebView() + 40 settings = webkit.WebSettings() + 41 settings.set_property('enable-page-cache', True) + 42 settings.set_property('enable-accelerated-compositing', True) + 43 + 44 self._browser.set_settings(settings) + 45 self.connect('destroy', gtk.main_quit) + 46 self.add(self._browser) + 47 + 48 self._browser.load_uri(url) + 49 self._browser.set_size_request(int(width), int(height)) + 50 self.show_all() + 51 + 52 gobject.threads_init() +
53 +
54 - def updatePage(self, url): +
55 """ + 56 Updates the browser to show the given URL + 57 @param url: The new URL to show + 58 @type url: String + 59 @return: None + 60 @rtype: NoneType + 61 """ + 62 print "Update page running in : " + threading.currentThread().getName() + 63 print "updatePage" + 64 self._browser.load_uri(url) + 65 try: + 66 self.fullscreen() + 67 except: + 68 pass + 69 print "showing" + 70 self.show_all() +
71 + 72 +
73 -def getUpdateHandle(runtimeVars): +
74 """ + 75 Initializes the browser and returns the + 76 function used to update its page + 77 @param runtimeVars: User-defined Configuration + 78 @type runtimeVars: Dictionary + 79 @return: Function + 80 """ + 81 browser = WebBrowser("", runtimeVars["width"], runtimeVars["height"]) + 82 + 83 # GTK Thread-Safe Wrapper for updatePage() method + 84 def updatePage(url): + 85 gobject.timeout_add(100, browser.updatePage, url) +
86 + 87 return updatePage + 88 + 89 +
90 -class GTKPlugin(Plugin): +
91 """ + 92 GTK Web Display Plugin Class + 93 @see: Plugins/plugin.py for more information + 94 @copyright: Northeastern University Crew 2014 + 95 """ + 96 +
97 - def needsThread(self): +
98 return True +
99 +
100 - def run(self, runtimeVars): +
101 gtk.main() +102 while True: +103 print "Main loop" +104 time.sleep(5) +
105 +
106 - def getName(self): +
107 return "Gtk Plugin" +
108 +
109 - def addMessage(self, message): +
110 raise Exception("GTKPlugin does not take any messages") +
111 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.gtkDisplay.GTKPlugin-class.html b/Client.gtkDisplay.GTKPlugin-class.html new file mode 100644 index 0000000..be59b34 --- /dev/null +++ b/Client.gtkDisplay.GTKPlugin-class.html @@ -0,0 +1,342 @@ + + + + + Client.gtkDisplay.GTKPlugin + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module gtkDisplay :: + Class GTKPlugin + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class GTKPlugin

source code

+
+Plugins.plugin.Plugin --+
+                        |
+                       GTKPlugin
+
+ +
+

GTK Web Display Plugin Class

+ +
+

See Also: + Plugins/plugin.py for more information +

+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ Boolean + + + + + + +
needsThread(self)
+ Predicate method which asks whether the plugin's run() function + requires threading
+ source code + +
+ +
+ NoneType + + + + + + +
run(self, + runtimeVars)
+ The main function of the plugin.
+ source code + +
+ +
+ String + + + + + + +
getName(self)
+ Returns: + The Plugin's name
+ source code + +
+ +
+   + + + + + + +
addMessage(self, + message)
+ Handler for incoming messages
+ source code + +
+ +
+

Inherited from Plugins.plugin.Plugin: + __str__, + setup +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

needsThread(self) +

+
source code  +
+ +

Predicate method which asks whether the plugin's run() function + requires threading

+
+
Returns: Boolean
+
Whether the plugin needs a thread
+
Overrides: + Plugins.plugin.Plugin.needsThread +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

run(self, + runtimeVars) +

+
source code  +
+ +

The main function of the plugin. This is called after setup() by the + main client function

+
+
Parameters:
+
    +
  • runtimeVars - Configuration provided in Configs/PIE.conf
  • +
+
Returns: NoneType
+
None
+
Overrides: + Plugins.plugin.Plugin.run +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

getName(self) +

+
source code  +
+ + +
+
Returns: String
+
The Plugin's name
+
Overrides: + Plugins.plugin.Plugin.getName +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

addMessage(self, + message) +

+
source code  +
+ +

Handler for incoming messages

+
+
Parameters:
+
    +
  • message - Received message
  • +
+
Overrides: + Plugins.plugin.Plugin.addMessage +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.gtkDisplay.WebBrowser-class.html b/Client.gtkDisplay.WebBrowser-class.html new file mode 100644 index 0000000..555bed0 --- /dev/null +++ b/Client.gtkDisplay.WebBrowser-class.html @@ -0,0 +1,258 @@ + + + + + Client.gtkDisplay.WebBrowser + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module gtkDisplay :: + Class WebBrowser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class WebBrowser

source code

+
+gtk.Window --+
+             |
+            WebBrowser
+
+ +
+

Web Page Display Window Class Represents a full screen GTK Web Browser + (no UI) displaying a given URL.

+ +
+
Notes: + +

License: + GNU Public License, version 2 +

+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ WebBrowser + + + + + + +
__init__(self, + url, + width, + height)
+ GTK Window Constructor
+ source code + +
+ +
+ NoneType + + + + + + +
updatePage(self, + url)
+ Updates the browser to show the given URL
+ source code + +
+ +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + url, + width, + height) +
(Constructor) +

+
source code  +
+ +

GTK Window Constructor

+
+
Parameters:
+
    +
  • url (String) - The initial URL to show
  • +
  • width (Integer) - The Screen's Width
  • +
  • height (Integer) - The Screen's Height
  • +
+
Returns: WebBrowser
+
The Constructed WebBrowser
+
+
+
+ +
+ +
+ + +
+

updatePage(self, + url) +

+
source code  +
+ +

Updates the browser to show the given URL

+
+
Parameters:
+
    +
  • url (String) - The new URL to show
  • +
+
Returns: NoneType
+
None
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.logging-module.html b/Client.logging-module.html new file mode 100644 index 0000000..15d2774 --- /dev/null +++ b/Client.logging-module.html @@ -0,0 +1,156 @@ + + + + + Client.logging + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module logging + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module logging

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + Logger
+ A Thread-Safe Logging Class +
+ + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + instance = Logger(15) +
+   + + __package__ = 'Client' +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.logging-pysrc.html b/Client.logging-pysrc.html new file mode 100644 index 0000000..47f9c9c --- /dev/null +++ b/Client.logging-pysrc.html @@ -0,0 +1,176 @@ + + + + + Client.logging + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module logging + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Client.logging

+
+ 1  import threading 
+
2 + 3 + 4 -class Logger: +
5 """ + 6 A Thread-Safe Logging Class + 7 @todo: Modify to use syslog instead of these log files + 8 @copyright: Northeastern University Crew 2014 + 9 """ +10 +
11 - def __init__(self, threshold): +
12 """ +13 Logger Constructor +14 @param threshold: The amount of messages to store in a buffer +15 before writing to a logfile +16 @type threshold: Integer +17 @return: The Constructed Logger +18 @rtype: Logger +19 """ +20 self.__debug = [] +21 self.__debugLock = threading.Lock() +22 self.__warning = [] +23 self.__warningLock = threading.Lock() +24 self.__error = [] +25 self.__errorLock = threading.Lock() +26 self.__threshold = threshold +
27 +
28 - def __addDebugMsg(self, msg): +
29 self.__debug.append(msg) +30 if len(self.__debug) > self.__threshold: +31 self.__writeAllAndClear(self.__debug, open("./debug.txt", "a+"), self.__debugLock) +
32 +
33 - def __addWarningMessage(self, msg): +
34 self.__warning.append(msg) +35 if len(self.__warning) > self.__threshold: +36 self.__writeAllAndClear(self.__warning, open("./warning.txt", "a+"), self.__warningLock) +
37 +
38 - def __addErrorMessage(self, msg): +
39 self.__error.append(msg) +40 if len(self.__error) > self.__threshold: +41 self.__writeAllAndClear(self.__error, open("./error.txt", "a+"), self.__errorLock) +
42 +
43 - def __writeAllAndClear(self, list, file, lock): +
44 lock.acquire(True) +45 for msg in list: +46 file.write(msg + "\n") +47 file.close() +48 lock.release() +49 del list[:] +
50 +51 @staticmethod +
52 - def log(level, msg): +
53 """ +54 Logs the given message with the given Log Level +55 @param level: The given Log Level. ( "DEBUG" | "WARNING" | "ERROR" ) +56 @type level: String +57 @param msg: The message to log +58 @type msg: String +59 @return: +60 """ +61 if instance is None: +62 raise Exception("Logging instance was never created") +63 if level == "DEBUG": +64 instance.__addDebugMsg(msg) +65 elif level == "WARNING": +66 instance.__addWarningMessage(msg) +67 elif level == "ERROR": +68 instance.__addErrorMessage(msg) +
69 +70 # Initialize the Logger +71 instance = Logger(15) +72 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.logging.Logger-class.html b/Client.logging.Logger-class.html new file mode 100644 index 0000000..9815062 --- /dev/null +++ b/Client.logging.Logger-class.html @@ -0,0 +1,324 @@ + + + + + Client.logging.Logger + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module logging :: + Class Logger + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Logger

source code

+

A Thread-Safe Logging Class

+ +
+

To Do: + Modify to use syslog instead of these log files +

+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ Logger + + + + + + +
__init__(self, + threshold)
+ Logger Constructor
+ source code + +
+ +
+   + + + + + + +
__addDebugMsg(self, + msg) + source code + +
+ +
+   + + + + + + +
__addWarningMessage(self, + msg) + source code + +
+ +
+   + + + + + + +
__addErrorMessage(self, + msg) + source code + +
+ +
+   + + + + + + +
__writeAllAndClear(self, + list, + file, + lock) + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+   + + + + + + +
log(level, + msg)
+ Logs the given message with the given Log Level
+ source code + +
+ +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + threshold) +
(Constructor) +

+
source code  +
+ +

Logger Constructor

+
+
Parameters:
+
    +
  • threshold (Integer) - The amount of messages to store in a buffer before writing to a + logfile
  • +
+
Returns: Logger
+
The Constructed Logger
+
+
+
+ +
+ +
+ + +
+

log(level, + msg) +
Static Method +

+
source code  +
+ +

Logs the given message with the given Log Level

+
+
Parameters:
+
    +
  • level (String) - The given Log Level. ( "DEBUG" | "WARNING" | + "ERROR" )
  • +
  • msg (String) - The message to log
  • +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.main-module.html b/Client.main-module.html new file mode 100644 index 0000000..f881b71 --- /dev/null +++ b/Client.main-module.html @@ -0,0 +1,217 @@ + + + + + Client.main + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module main + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module main

source code

+ + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+ Array + + + + + + +
getAdditionalPlugins(runtimeVars)
+ Gets any User-Defined Plugins specified in the Configuration from + ./Plugins
+ source code + +
+ +
+ None + + + + + + +
main()
+ The main function of the client
+ source code + +
+ +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

getAdditionalPlugins(runtimeVars) +

+
source code  +
+ +

Gets any User-Defined Plugins specified in the Configuration from + ./Plugins

+
+
Parameters:
+
    +
  • runtimeVars (Dictionary) - User-Defined Configuration
  • +
+
Returns: Array
+
User-Define Plugins
+
+
+
+ +
+ +
+ + +
+

main() +

+
source code  +
+ +

The main function of the client

+
+
Returns: None
+
None
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.main-pysrc.html b/Client.main-pysrc.html new file mode 100644 index 0000000..09d29ea --- /dev/null +++ b/Client.main-pysrc.html @@ -0,0 +1,237 @@ + + + + + Client.main + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module main + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Client.main

+
+ 1  #!/usr/bin/python 
+ 2  # General Imports 
+ 3  import thread 
+ 4   
+ 5  from Classes.ConfigParser import ConfigParser 
+ 6   
+ 7  # Import functions 
+ 8   
+ 9  # In the future we should house these in a file of there own 
+10  # We can dynamically load plugins from the directory 
+11  # we wouldn't need to import and add everything by hand. 
+12  from Plugins.plugin import Plugin 
+13  from slideShow import SlideShowPlugin 
+14  from socketClient import IOPlugin 
+15  from gtkDisplay import GTKPlugin 
+16   
+17   
+
18 -def getAdditionalPlugins(runtimeVars): +
19 """ +20 Gets any User-Defined Plugins specified in the Configuration +21 from ./Plugins +22 @param runtimeVars: User-Defined Configuration +23 @type runtimeVars: Dictionary +24 @return: User-Define Plugins +25 @rtype: Array +26 """ +27 plugins = [] +28 for plugin in runtimeVars["plugins"]: +29 try: +30 exec "from Plugins." + plugin + " import " + plugin +31 instance = eval(plugin + "()") +32 if isinstance(instance, Plugin): +33 print instance +34 plugins.append(instance) +35 else: +36 print "Huh? what did i get? : " + str(instance) +37 except Exception, e: +38 print "Couldn't create an instance of a plugin in the config" +39 print str(e) +40 return plugins +
41 +42 +
43 -def main(): +
44 """ +45 The main function of the client +46 @return: None +47 @rtype: None +48 """ +49 runtimeVars = ConfigParser.readConfig() +50 plugins = [SlideShowPlugin(), IOPlugin()] + getAdditionalPlugins(runtimeVars) +51 runtimeVars["plugins"] += ["SlideShowPlugin", "IOPlugin"] +52 +53 def addPluginToDict(dict, p): +54 dict[p.getName()] = p.addMessage +55 return dict +
56 +57 # messageDict = Message-handling functions for each plugin +58 messageDict = reduce(addPluginToDict, plugins, {}) +59 +60 for plugin in plugins: +61 plugin.setup(messageDict, runtimeVars) +62 for plugin in plugins: +63 print "Starting " + plugin.getName() +64 if plugin.needsThread(): +65 thread.start_new_thread(plugin.run, (runtimeVars,)) +66 # Instead of having main() be in a busy wait doing nothing, +67 # we denote GTKPlugin() to be the "main" plugin, so its +68 # behavior drives any looping done on the main thread +69 GTKPlugin().run(runtimeVars) +70 +71 +72 # TODO: Replace with argparse library +73 if __name__ == "__main__": +74 main() +75 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.slideShow-module.html b/Client.slideShow-module.html new file mode 100644 index 0000000..f48243b --- /dev/null +++ b/Client.slideShow-module.html @@ -0,0 +1,212 @@ + + + + + Client.slideShow + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module slideShow + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module slideShow

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + SlideShowPlugin
+ Slide Show Plugin Class +
+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+ None + + + + + + +
runShow(inputQueue, + runtimeVars, + setPage, + writeOut)
+ Runs the slide show (manages GTK and incoming messages)
+ source code + +
+ +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

runShow(inputQueue, + runtimeVars, + setPage, + writeOut) +

+
source code  +
+ +

Runs the slide show (manages GTK and incoming messages)

+
+
Parameters:
+
    +
  • inputQueue (Queue.Queue) - The Slide Show Plugin's input queue
  • +
  • runtimeVars (Dictionary) - User-defined Configuration
  • +
  • setPage (Function) - The function which sets the GTK Display's webpage
  • +
  • writeOut (Function) - The socket outgoing message queue
  • +
+
Returns: None
+
None
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.slideShow-pysrc.html b/Client.slideShow-pysrc.html new file mode 100644 index 0000000..e2ecc0b --- /dev/null +++ b/Client.slideShow-pysrc.html @@ -0,0 +1,291 @@ + + + + + Client.slideShow + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module slideShow + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Client.slideShow

+
+  1  import Queue 
+  2  import json 
+  3  import datetime 
+  4  import time 
+  5  import sys 
+  6   
+  7  from Classes.message import Message 
+  8  from Classes.slide import Slide 
+  9  from logging import Logger 
+ 10  from Plugins.plugin import Plugin 
+ 11  import gtkDisplay 
+ 12   
+ 13   
+
14 -class SlideShowPlugin(Plugin): +
15 """ + 16 Slide Show Plugin Class + 17 @see: Plugins/plugin.py for more information + 18 @copyright: Northeastern University Crew 2014 + 19 """ + 20 +
21 - def __init__(self): +
22 self.updateHandle = None + 23 self.inQ = Queue.Queue(100) + 24 self.outHandle = None +
25 +
26 - def needsThread(self): +
27 return True +
28 +
29 - def run(self, runtimeVars): +
30 if self.updateHandle is None or self.outHandle is None: + 31 raise Exception("Something went wrong...") + 32 runShow(self.inQ, runtimeVars, self.updateHandle, self.outHandle) +
33 +
34 - def setup(self, messageDict, runtimeVars): +
35 self.updateHandle = gtkDisplay.getUpdateHandle(runtimeVars) + 36 self.outHandle = messageDict["IOPlugin"] +
37 +
38 - def getName(self): +
39 return "slideShow" +
40 +
41 - def addMessage(self, message): +
42 print "Adding : " + str(message) + 43 self.inQ.put(message, True) +
44 + 45 +
46 -def runShow(inputQueue, runtimeVars, setPage, writeOut): +
47 """ + 48 Runs the slide show (manages GTK and incoming messages) + 49 @param inputQueue: The Slide Show Plugin's input queue + 50 @type inputQueue: Queue.Queue + 51 @param runtimeVars: User-defined Configuration + 52 @type runtimeVars: Dictionary + 53 @param setPage: The function which sets the GTK Display's webpage + 54 @type setPage: Function + 55 @param writeOut: The socket outgoing message queue + 56 @type writeOut: Function + 57 @return: None + 58 @rtype: None + 59 """ + 60 # TODO get DT + 61 slideRequest = Message(runtimeVars["name"], "Grandma", 'WPHandler', "querySlides", "Maor slidez") + 62 print "slideReuqest " + slideRequest.toJSON() + 63 writeOut(slideRequest) + 64 + 65 slides = [] + 66 # Replace with loading slide + 67 slides.append( + 68 Slide.makeSlide("file:///home/pi/dds-client/Client/resources/loading_screen/index.html", 5, -1, "")) + 69 + 70 # Temp Weather slide for testing purposes. Uncomment as needed. + 71 # slides.append(Slide("http://104.131.73.58", 10)) + 72 + 73 # Helper to get the slide out of the slide list with the given ID, also insures uniqueness if ID's + 74 def getSlideById(slideList, id): + 75 print "getSlideById called. currentMessage(" + str(type(currentMessage)) + "):", currentMessage + 76 matches = filter(lambda x: x.sameID(id), slideList) + 77 if len(matches) > 1: + 78 raise Exception("Why are there two slides with the same ID?") + 79 return None if len(matches) == 0 else matches[0] +
80 + 81 def deleteSlide(slideList, id): + 82 print "Deleting slide..." + 83 temp = getSlideById(slides, id) + 84 Logger.log("DEBUG", "Removing slide: " + str(temp)) + 85 if temp: + 86 slideList.remove(temp) + 87 + 88 def editSlide(slideList, id, newSlide): + 89 print "Editing slide..." + 90 old = getSlideById(slides, id) + 91 Logger.log("DEBUG", "Changing slide :" + str(old) + " to " + str(newSlide)) + 92 if old: + 93 slideList.remove(old) + 94 slideList.append(newSlide) + 95 + 96 def addSlide(slideList, slide): + 97 print "Adding slide..." + 98 Logger.log("DEBUG", "Adding slide :" + str(slide)) + 99 slideList.append(slide) +100 +101 x = 0 +102 Run = True +103 while Run: +104 print str(slides) +105 # +106 if len(slides) > 1 and getSlideById(slides, -1) is not None: +107 print "Slides have loaded removing loading slide..." +108 # Following line needed for situations in which +109 # a client only has one slide to show +110 x = 0 +111 slides.remove(getSlideById(slides, -1)) +112 if len(slides) == 0: +113 print "I Have no slides, stopping slide show..." +114 Logger.log("ERROR", "Ran out of slides...") +115 sys.exit(0) +116 # TODO: Handle this situation better. +117 # (Currently, the slide show will +118 # simply freeze on its last received +119 # slide at this point) +120 currentSlide = slides[x] +121 target_time = datetime.datetime.now() + datetime.timedelta(seconds=currentSlide.duration) +122 setPage(currentSlide.url) +123 print "Just set page : " + currentSlide.url +124 while datetime.datetime.now() < target_time: +125 if not inputQueue.empty(): +126 currentMessage = inputQueue.get() +127 infoForAddition = json.loads(currentMessage["content"]) +128 if currentMessage["action"] == "load-slides": +129 for slideJSON in infoForAddition["actions"]: +130 # TODO fields in dds-api call need to be changed to standard, +131 # they also need ID and meta added @Eddie +132 addSlide(slides, +133 Slide.makeSlide(slideJSON["location"], slideJSON["duration"], slideJSON["ID"], +134 "")) +135 elif currentMessage["action"] == "add-slide": +136 addSlide(slides, Slide(infoForAddition)) +137 elif currentMessage["action"] == "delete-slide": +138 deleteSlide(slides, infoForAddition["ID"]) +139 elif currentMessage["action"] == "edit-slide": +140 editSlide(slides, infoForAddition["ID"], Slide(infoForAddition)) +141 elif currentMessage["action"] == "Terminate": +142 Run = False +143 break +144 time.sleep(1) +145 # Move on +146 if len(slides): +147 x = (x + 1) % len(slides) +148 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.slideShow.SlideShowPlugin-class.html b/Client.slideShow.SlideShowPlugin-class.html new file mode 100644 index 0000000..083d044 --- /dev/null +++ b/Client.slideShow.SlideShowPlugin-class.html @@ -0,0 +1,406 @@ + + + + + Client.slideShow.SlideShowPlugin + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module slideShow :: + Class SlideShowPlugin + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class SlideShowPlugin

source code

+
+Plugins.plugin.Plugin --+
+                        |
+                       SlideShowPlugin
+
+ +
+

Slide Show Plugin Class

+ +
+

See Also: + Plugins/plugin.py for more information +

+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self) + source code + +
+ +
+ Boolean + + + + + + +
needsThread(self)
+ Predicate method which asks whether the plugin's run() function + requires threading
+ source code + +
+ +
+ NoneType + + + + + + +
run(self, + runtimeVars)
+ The main function of the plugin.
+ source code + +
+ +
+   + + + + + + +
setup(self, + messageDict, + runtimeVars)
+ Called during the client's initialization process
+ source code + +
+ +
+ String + + + + + + +
getName(self)
+ Returns: + The Plugin's name
+ source code + +
+ +
+   + + + + + + +
addMessage(self, + message)
+ Handler for incoming messages
+ source code + +
+ +
+

Inherited from Plugins.plugin.Plugin: + __str__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

needsThread(self) +

+
source code  +
+ +

Predicate method which asks whether the plugin's run() function + requires threading

+
+
Returns: Boolean
+
Whether the plugin needs a thread
+
Overrides: + Plugins.plugin.Plugin.needsThread +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

run(self, + runtimeVars) +

+
source code  +
+ +

The main function of the plugin. This is called after setup() by the + main client function

+
+
Parameters:
+
    +
  • runtimeVars - Configuration provided in Configs/PIE.conf
  • +
+
Returns: NoneType
+
None
+
Overrides: + Plugins.plugin.Plugin.run +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

setup(self, + messageDict, + runtimeVars) +

+
source code  +
+ +

Called during the client's initialization process

+
+
Parameters:
+
    +
  • messageDict - All of the Client's Plugins' Message Receivers
  • +
  • runtimeVars - Configuration provided in Configs/PIE.conf
  • +
+
Overrides: + Plugins.plugin.Plugin.setup +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

getName(self) +

+
source code  +
+ + +
+
Returns: String
+
The Plugin's name
+
Overrides: + Plugins.plugin.Plugin.getName +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

addMessage(self, + message) +

+
source code  +
+ +

Handler for incoming messages

+
+
Parameters:
+
    +
  • message - Received message
  • +
+
Overrides: + Plugins.plugin.Plugin.addMessage +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.socketClient-module.html b/Client.socketClient-module.html new file mode 100644 index 0000000..9d2df36 --- /dev/null +++ b/Client.socketClient-module.html @@ -0,0 +1,279 @@ + + + + + Client.socketClient + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module socketClient + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module socketClient

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + IOPlugin
+ Socket I/O Plugin Class +
+ + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+ NoneType + + + + + + +
socket_out(currentMessage, + socket)
+ Writes the given Message to the given socket
+ source code + +
+ +
+ NoneType + + + + + + +
socket_in(s, + runtimeVars, + route)
+ Reads and redirects messages received by the client
+ source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'Client' +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

socket_out(currentMessage, + socket) +

+
source code  +
+ +

Writes the given Message to the given socket

+
+
Parameters:
+
    +
  • currentMessage (Message) - The Message to write
  • +
  • socket (Socket) - The socket to write to
  • +
+
Returns: NoneType
+
None
+
+
+
+ +
+ +
+ + +
+

socket_in(s, + runtimeVars, + route) +

+
source code  +
+ +

Reads and redirects messages received by the client

+
+
Parameters:
+
    +
  • s (sockClass) - The Client Socket
  • +
  • runtimeVars (Dictionary) - User-defined Configuration
  • +
  • route (Dictionary) - The message handlers for the client plugins
  • +
+
Returns: NoneType
+
None
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.socketClient-pysrc.html b/Client.socketClient-pysrc.html new file mode 100644 index 0000000..017d557 --- /dev/null +++ b/Client.socketClient-pysrc.html @@ -0,0 +1,261 @@ + + + + + Client.socketClient + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module socketClient + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Client.socketClient

+
+  1  #!/usr/bin/python 
+  2  import select 
+  3  import sys 
+  4  import time 
+  5  import json 
+  6  import Queue 
+  7   
+  8  from Classes.message import Message 
+  9  from Classes.sockClass import sockClass 
+ 10  from logging import Logger 
+ 11  from Plugins.plugin import Plugin 
+ 12   
+ 13   
+
14 -def socket_out(currentMessage, socket): +
15 """ + 16 Writes the given Message to the given socket + 17 @param currentMessage: The Message to write + 18 @type currentMessage: Message + 19 @param socket: The socket to write to + 20 @type socket: Socket + 21 @return: None + 22 @rtype: NoneType + 23 """ + 24 Logger.log("DEBUG", "Outbound Message: " + currentMessage.toJSON()) + 25 if currentMessage.dest == "Grandma": + 26 try: + 27 socket.send(currentMessage.toJSON()) + 28 except Exception, e: + 29 print str(e) + 30 Logger.log("ERROR", "Socket raised exception on send - exception : " + str(e)) + 31 raise Exception("Can't send message. Socket = " + str(socket)) + 32 else: + 33 Logger.log("WARNING", "Message not addressed to grandma") + 34 print "Socket Message Sent!" +
35 + 36 +
37 -def socket_in(s, runtimeVars, route): +
38 """ + 39 Reads and redirects messages received by the client + 40 @param s: The Client Socket + 41 @type s: sockClass + 42 @param runtimeVars: User-defined Configuration + 43 @type runtimeVars: Dictionary + 44 @param route: The message handlers for the client plugins + 45 @type route: Dictionary + 46 @return: None + 47 @rtype: NoneType + 48 """ + 49 run = True + 50 while run: + 51 socket_list = [s.sock, ] + 52 # Get the list of sockets which are readable + 53 read_sockets, write_sockets, error_sockets = select.select(socket_list, [], []) + 54 for sock in read_sockets: + 55 if sock == s.sock: + 56 data = sock.recv(4096) + 57 if not data: + 58 s.connect(runtimeVars) + 59 else: + 60 messages = filter(lambda s: s != "", + 61 data.split('\v')) + 62 for currentMessage in messages: + 63 currentMessage = json.loads(currentMessage) + 64 if currentMessage["pluginDest"] == "Main": + 65 sys.exit(0) + 66 print "Got message : " + str(currentMessage) + 67 messageDestination = currentMessage["pluginDest"] + 68 print "Received message sending it too : " + str(messageDestination) + 69 route[messageDestination](Message.fromJSON(currentMessage)) + 70 else: + 71 print "Something Goofed" + 72 # We all program updates will be in multiples of 1 sec, + 73 # as this is the slide time accuracy + 74 time.sleep(1) +
75 + 76 +
77 -class IOPlugin(Plugin): +
78 """ + 79 Socket I/O Plugin Class + 80 @see: Plugins/plugin.py for more information + 81 @copyright: Northeastern University Crew 2014 + 82 """ + 83 +
84 - def __init__(self): +
85 self.queue = Queue.Queue(100) + 86 self.msgRoute = None + 87 self.socket = None +
88 +
89 - def needsThread(self): +
90 return True +
91 +
92 - def setup(self, messageDict, runtimeVars): +
93 self.msgRoute = messageDict + 94 self.socket = sockClass(runtimeVars) +
95 +
96 - def run(self, runtimeVars): +
97 if self.msgRoute is None: + 98 raise Exception("Can't distribute info; message route is None") + 99 socket_in(self.socket, runtimeVars, self.msgRoute) +
100 +
101 - def getName(self): +
102 return "IOPlugin" +
103 +
104 - def addMessage(self, message): +
105 print "Attempting to send Message" +106 if self.socket is None: +107 Logger.log("WARNING", "No socket connection, trying again...") +108 time.sleep(.5) +109 self.addMessage(message) +110 else: +111 socket_out(message, self.socket) +
112 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client.socketClient.IOPlugin-class.html b/Client.socketClient.IOPlugin-class.html new file mode 100644 index 0000000..b5845d7 --- /dev/null +++ b/Client.socketClient.IOPlugin-class.html @@ -0,0 +1,406 @@ + + + + + Client.socketClient.IOPlugin + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Client :: + Module socketClient :: + Class IOPlugin + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class IOPlugin

source code

+
+Plugins.plugin.Plugin --+
+                        |
+                       IOPlugin
+
+ +
+

Socket I/O Plugin Class

+ +
+

See Also: + Plugins/plugin.py for more information +

+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self) + source code + +
+ +
+ Boolean + + + + + + +
needsThread(self)
+ Predicate method which asks whether the plugin's run() function + requires threading
+ source code + +
+ +
+   + + + + + + +
setup(self, + messageDict, + runtimeVars)
+ Called during the client's initialization process
+ source code + +
+ +
+ NoneType + + + + + + +
run(self, + runtimeVars)
+ The main function of the plugin.
+ source code + +
+ +
+ String + + + + + + +
getName(self)
+ Returns: + The Plugin's name
+ source code + +
+ +
+   + + + + + + +
addMessage(self, + message)
+ Handler for incoming messages
+ source code + +
+ +
+

Inherited from Plugins.plugin.Plugin: + __str__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

needsThread(self) +

+
source code  +
+ +

Predicate method which asks whether the plugin's run() function + requires threading

+
+
Returns: Boolean
+
Whether the plugin needs a thread
+
Overrides: + Plugins.plugin.Plugin.needsThread +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

setup(self, + messageDict, + runtimeVars) +

+
source code  +
+ +

Called during the client's initialization process

+
+
Parameters:
+
    +
  • messageDict - All of the Client's Plugins' Message Receivers
  • +
  • runtimeVars - Configuration provided in Configs/PIE.conf
  • +
+
Overrides: + Plugins.plugin.Plugin.setup +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

run(self, + runtimeVars) +

+
source code  +
+ +

The main function of the plugin. This is called after setup() by the + main client function

+
+
Parameters:
+
    +
  • runtimeVars - Configuration provided in Configs/PIE.conf
  • +
+
Returns: NoneType
+
None
+
Overrides: + Plugins.plugin.Plugin.run +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

getName(self) +

+
source code  +
+ + +
+
Returns: String
+
The Plugin's name
+
Overrides: + Plugins.plugin.Plugin.getName +
(inherited documentation)
+ +
+
+
+ +
+ +
+ + +
+

addMessage(self, + message) +

+
source code  +
+ +

Handler for incoming messages

+
+
Parameters:
+
    +
  • message - Received message
  • +
+
Overrides: + Plugins.plugin.Plugin.addMessage +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Client/Classes/ConfigParser.py b/Client/Classes/ConfigParser.py deleted file mode 100644 index a99c5c5..0000000 --- a/Client/Classes/ConfigParser.py +++ /dev/null @@ -1,45 +0,0 @@ -class ConfigParser: - """ - Configuration Parser Class - @copyright: Northeastern University Crew 2014 - """ - - @staticmethod - def readConfig(): - """ - Reads the contents of PIE.conf - @return: User-specified Configuration - @rtype: Dict - """ - config = open("Configs/PIE.conf", "r") - configContents = config.read() - configDict = {} - for line in configContents.splitlines(): - if not (line.startswith("[") or line == ""): - pair = ConfigParser.getPair(line) - configDict[pair[0]] = pair[1] - return configDict - - @staticmethod - def getPair(line): - """ - Parses the given configuration file - line into a tuple. - @param line: The line to parse - @type line: String - @return: Tuple of the form (key, value) - @rtype: Tuple - """ - split = line.replace(" ", "").split("=") - if len(split) != 2: - raise Exception("Bad config file...") - if split[1].find("[") != -1: - if split[1] != "[]": - temp = [] - for string in split[1][1:-1].split(","): - temp.append(string) - split[1] = temp - else: - split[1] = [] - return split[0], split[1] - diff --git a/Client/Classes/QueueDict.py b/Client/Classes/QueueDict.py deleted file mode 100644 index 051e9b6..0000000 --- a/Client/Classes/QueueDict.py +++ /dev/null @@ -1,47 +0,0 @@ -import Queue - - -class QueueDict: - """ - A wrapper around the Queue Object, which is - simply a dictionary of Queues that can be - passed into a plugin, thereby allowing all - plugins to communicate with other plugins. - (i.e. A String to Queue dictionary) - @ivar Queues: Dictionary of queues - @type Queues: Dictionary - @ivar queueSize : Queue size in _Queues - @type queueSize: Integer - @copyright: Northeastern University Crew 2014 - """ - - def __init__(self, queueSize=100): - """ - Queue Dictionary Constructor - @param queueSize: (Optional) Specifies size of contained queues (Default 100) - @return: The Constructed Queue Dictionary - @rtype: QueueDict - """ - self.Queues = {} - self.queueSize = queueSize - - def __getitem__(self, name): - """ - Retrieves the desired queue using dictionary syntax - (e.g. C{queues[name]}) - @param name: The name of the desired queue - @type name: String - @return: The queue corresponding to the given name - @rtype: Queue.Queue - """ - return self.Queues[name] - - def addQueue(self, name): - """ - Adds a queue with the given name to the QueueDict object. - @param name: The name of the queue to add - @type name: String - @return: None - @rtype: NoneType - """ - self.Queues[name] = Queue.Queue(self.queueSize) \ No newline at end of file diff --git a/Client/Classes/ThreadDict.py b/Client/Classes/ThreadDict.py deleted file mode 100644 index 38f4f7f..0000000 --- a/Client/Classes/ThreadDict.py +++ /dev/null @@ -1,33 +0,0 @@ -class ThreadDict: - """ - Wrapper around thread object, allows us to - start all the persistent Threads in a consistent - and simple fashion. See plugins.py for more details. - - @ivar Threads: The threads contained in the object. - @type Threads: Dictionary - @copyright: Northeastern University Crew 2014 - """ - - def __init__(self): - """ - ThreadDict Constructor - @return: An empty ThreadDict - @rtype: ThreadDict - """ - self.Threads = {} - - def addThread(self, name, function, queueDict): - """ - Adds a thread with the given parameters to the ThreadDict - @param name: The name of the thread - @type name: String - @param function: The function associated with the thread to add - @type function: Function - @param queueDict: The QueueDict to add the thread's message queue to - @type queueDict: QueueDict - @return: None - @rtype: NoneType - """ - queueDict.addQueue(name) - self.Threads[name] = function \ No newline at end of file diff --git a/Client/Classes/__init__.py b/Client/Classes/__init__.py deleted file mode 100644 index 9c71683..0000000 --- a/Client/Classes/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -# This file is needed to allow us to move classes into this folder -# and call them using Classes.____ diff --git a/Client/Classes/log.py b/Client/Classes/log.py deleted file mode 100644 index 64b9ecb..0000000 --- a/Client/Classes/log.py +++ /dev/null @@ -1,5 +0,0 @@ -# TODO: Figure out if this is even being used... -class logging(object): - def __init__(self, arg): - super(logging, self).__init__() - self.arg = arg diff --git a/Client/Classes/message.py b/Client/Classes/message.py deleted file mode 100644 index fab75a3..0000000 --- a/Client/Classes/message.py +++ /dev/null @@ -1,122 +0,0 @@ -import json - - -# TODO: See doctring below -class Message: - """" - A message object to be passed between threads via Queue - I{Sample Usage}: - Making a new message that will send terminate from main to display: - C{newMessage = Message("Main", "Display", "Terminate", \{\})} - Making a slide that will update Display with a new slide: - C{newMessage = Message("Main", "Display", "Update", \{\})} - C{newMessage.add_content("slide1", "http://google.com")} - - @attention: It is good practice to use dict accessors as opposed to object attributes - @todo: Un-expose attributes - @ivar src: Name of the thread who sent the message - @type src: String - @ivar dest: Intended message destination - @type dest: String - @ivar pluginDest: Client-side plugin to receive the message - @type pluginDest: String - @ivar action: Action for the client-side plugin to perform - @type action: String - @ivar content: Message payload (destination plugin should be able to interpret content) - @type content: Dictionary - @ivar datetime: Message timestamp - @type datetime: String - @copyright: Northeastern University Crew 2014 - """ - - def __init__(self, src, dest, pluginDest, action, content, datetime=None): - """ - Message Constructor - @param src: Name of the thread who sent the message - @type src: String - @param dest: Intended message destination - @type dest: String - @param pluginDest: Client-side plugin to receive the message - @type pluginDest: String - @param action: Action for the client-side plugin to perform - @type action: String - @param content: Message payload (destination plugin should be able to interpret content) - @type content: Dictionary - @param datetime: Message timestamp - @type datetime: String - @return: Message with the given parameters - @rtype: Message - """ - self.src = src - self.dest = dest - self.pluginDest = pluginDest - self.action = action - self.content = content - self.datetime = datetime - - def add_content(self, key, val): - """ - Sets the given key-value pair to the message's content - @param key: Key to write to in message content - @param val: Value to write in message content - @return: None - """ - self.content[key] = val - - def toJSON(self): - """ - Returns the message in JSON format - @return: JSON representation of Message - @rtype: String - """ - text = json.dumps(self.__dict__) - return text - - # TODO: (See docstring) - def __str__(self): - """ - @return: String Representation of Message - @rtype: String - @todo: This looks horrendous. We should pretty it up. - """ - return "Src = " + self.src + " dest = " + self.dest + " pluginDest = " + self.pluginDest + \ - " action = " + self.action + " content = " + self.content - - @staticmethod - def fromJSON(jsonObj): - """ - Creates a message from JSON input - @param jsonObj: A Parsed JSON Input - @type jsonObj: Dictionary - @return: Message represented by the given JSON - @rtype: Message - """ - src = jsonObj['src'] - dest = jsonObj['dest'] - pluginDest = jsonObj['pluginDest'] - action = jsonObj['action'] - content = jsonObj['content'] - datetime = None - if "datetime" in jsonObj: - datetime = jsonObj["datetime"] - return Message(src, dest, pluginDest, action, content, datetime) - - def __getitem__(self, item): - """ - Implements dict-like behavior for Messages - @param item: Message value to fetch - @return: The attribute associated with the given key - """ - if item == "src": - return self.src - elif item == "dest": - return self.dest - elif item == "pluginDest": - return self.pluginDest - elif item == "action": - return self.action - elif item == "content": - return self.content - elif item == "datetime": - return self.datetime - raise Exception("Message does not have an attribute \"" + item + "\"") diff --git a/Client/Classes/slide.py b/Client/Classes/slide.py deleted file mode 100644 index 71290ff..0000000 --- a/Client/Classes/slide.py +++ /dev/null @@ -1,80 +0,0 @@ -import json - - -# TODO: Make symlinks between the Server and Client slide, message, and ConfigParser classes -class Slide(): - """ - Class for Slide Show Slide Objects - @ivar url: The Slide's URL - @type url: String - @ivar duration: The Duration to show the slide (in seconds) - @type duration: Integer - @ivar id: The Slide's ID - @type id: Integer - @ivar meta: The Slide's meta content - @type meta: Dictionary - @copyright: Northeastern University Crew 2014 - """ - - @staticmethod - def makeSlide(url, duration, id, meta): - """ - Slide Constructor based on the given input (instead of a dictionary) - @param url: The Slide's URL - @type url: String - @param duration: The Duration to show the slide (in seconds) - @type duration: Integer - @param id: The Slide's ID - @type id: Integer - @param meta: The Slide's meta content - @type meta: Dictionary - @return: The constructed Slide - @rtype: Slide - """ - return Slide({"permalink": url, "duration": duration, "ID": id, "meta": meta}) - - def __init__(self, infoDict): - """ - Slide Constructor - @param infoDict: The relevant information for the slide - @type infoDict: Dictionary - @return: The constructed Slide - @rtype: Slide - """ - self.__type__ = "slide" - print "Got meta:", infoDict["meta"] - self.url = infoDict["permalink"] - if (not (isinstance(infoDict["meta"], str)) and - (infoDict["meta"]["dds_external_url"][0] != "")): - self.url = infoDict["meta"]["dds_external_url"][0] - - self.duration = infoDict["duration"] - self.id = infoDict["ID"] - self.meta = infoDict["meta"] - - def toJSON(self): - """ - @return: A JSON Representation of the slide - @rtype: String - """ - text = json.dumps(self.__dict__) - return text - - def sameID(self, id): - """ - Predicate method which checks if the given id is equal to the slide's - @param id: The id to check - @type id: Integer - @return: Whether the id matches the slide's - @rtype: Boolean - @todo: Do we I{really} need a method for this? - """ - return self.id == id - - def __str__(self): - return "Slide[url=" + str(self.url) + ", duration=" + str(self.duration) + ", id=" + str( - self.id) + ", meta=" + str(self.meta) + "]" - - def __repr__(self): - # Simplified output (Shown when Arrays of Slides are Printed) - return "Slide(" + str(self.url) + "," + str(self.duration) + ")" diff --git a/Client/Classes/sockClass.py b/Client/Classes/sockClass.py deleted file mode 100644 index 617c723..0000000 --- a/Client/Classes/sockClass.py +++ /dev/null @@ -1,36 +0,0 @@ -import socket, time -from message import Message - -class sockClass: - """ Client Socket class. Lets us split off socket functionality into - multiple threads such that we can send and recive sockets comunications - without any troubles.""" - def __init__(self, runtimeVars): - self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.hostIP = runtimeVars["server"] - self.hostPort = int(runtimeVars["port"]) - self.connect(runtimeVars) - - def send(self, msg): - self.sock.send(msg) - - def connect(self, runtimeVars): - print "Im conected: "+runtimeVars["name"] - while True: - # connect to remote host - #s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - #s.settimeout(2) - try : - self.sock.connect((self.hostIP, self.hostPort)) - print "Connected" - break - except : - print 'Unable to connect' - time.sleep(2) - - # Passes along PIE name to Grandma - # Needs to be abstracted to allow config setting of these parameters - identify = Message(runtimeVars["name"], "Grandma","socketServer" , "connect",{}) - identify.add_content("name",runtimeVars["name"]) - identify.add_content("item2","bob") - self.sock.send(identify.toJSON() + '\v') diff --git a/Client/Classes/socketlist.py b/Client/Classes/socketlist.py deleted file mode 100644 index ca4e191..0000000 --- a/Client/Classes/socketlist.py +++ /dev/null @@ -1,131 +0,0 @@ -class socketList: - """ - Object responsible for keeping track of all socket connections - - @ivar pieMap: A dictionary mapping each connected Raspberry Pi to its socket - @type pieMap: Dictionary - @ivar sockList: List of live Socket Connections - @type sockList: Array - @ivar serverSocket: Represents the Server's Listening Socket - @type serverSocket: Socket - @see: Python C{socket} Documentation for socket info - @warning: If you're writing a plugin, you I{probably} don't need - to mess with this. - @copyright: Northeastern University Crew 2014 - """ - - def __init__(self, serverSocket): - """ - socketList Constructor - @param serverSocket: The socket to use as the server socket - @type serverSocket: Socket - @return: A new empty SocketList with the given server socket - @rtype: socketList - """ - self.pieMap = {} - self.sockList = [] - self.serverSocket = serverSocket - - def addSocket(self, sock): - """ - Adds the given socket to the socketList - @param sock: The socket to add - @type sock: Socket - @return: None - @rtype: NoneType - """ - self.sockList.append(sock) - - def mapPie(self, sock, pieName): - """ - Maps the given Raspberry Pi to the given socket - @param sock: The socket to map the Raspberry Pi to - @type sock: Socket - @param pieName: The name of the Raspberry Pi - @type pieName: String - @return: None - @rtype: NoneType - """ - print "mapping" + pieName - self.pieMap[pieName] = sock - - def removeSocket(self, sock): - """ - Removes the given socket to the socketList - @param sock: The socket to remove - @type sock: Socket - @return: None - @rtype: NoneType - """ - print "\nGood bye, " + str(self.getPie(sock)) + "!\n" - sock.close() - self.sockList.remove(sock) - self.pieMap.pop(self.getPie(sock)) - - def broadcast(self, msg, sock=None): - """ - Broadcasts the given message to every socket - except the serverSocket and the socket provided - @param msg: The message to broadcast - @type msg: String - @param sock: (Optional) The socket to exclude (e.g. - the socket from which the broadcast - originated) - @type sock: Socket - @return: None - @rtype: NoneType - """ - for socket in self.sockList: - print(self.getPie(socket)) - if socket != self.serverSocket and socket != sock: - self.sendMessage(socket, msg) - - def sendMessage(self, sock, msg): - """ - Sends the given message to the given socket - @param sock: The socket to receive the message - @type sock: Socket - @param msg: The message to send - @type msg: String - @return: None - @rtype: NoneType - """ - print "Sending" - print "Message " + str(msg) - try: - sock.sendall(msg) - print "Message sent!" - except Exception as e: - # Is caught if something goes wrong. - # Print the exception and do - # any needed cleanups for the socket - print str(e) - if sock: - self.removeSocket(sock) - - def getSock(self, pie): - """ - Returns the socket associated with the given - Raspberry Pi name - @param pie: The name of the Raspberry Pi whose socket to retrieve - @type pie: String - @return: The socket for the given Raspberry Pi - @rtype: Socket - """ - try: - return self.pieMap[pie] - except: - print "Missing Pie:", pie - - def getPie(self, sock): - """ - Returns the Raspberry Pi associated with the given socket - @param sock: The socket whose Raspberry Pi to retrieve - @type sock: Socket - @return: The Raspberry Pi associated with the socket - @rtype: String - """ - print(len(self.pieMap)) - for pie, socket in self.pieMap.iteritems(): - if sock == socket: - return pie \ No newline at end of file diff --git a/Client/Configs/PIE.conf b/Client/Configs/PIE.conf deleted file mode 100644 index 392dd95..0000000 --- a/Client/Configs/PIE.conf +++ /dev/null @@ -1,9 +0,0 @@ -[SlideRequests] -server = 10.0.10.132 -name = keylime -port = 5000 -[Display] -width = 1280 -height = 1024 -[Plugins] -plugins=[] diff --git a/Client/Plugins/ExamplePlugin.py b/Client/Plugins/ExamplePlugin.py deleted file mode 100644 index 8255613..0000000 --- a/Client/Plugins/ExamplePlugin.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -This is an example of a plugin that the user could add themselves. -There are several rules to create a plugin and have it run, in order to ensure -programmatic safety as well as usability. they are as follows: - 1. The file for the plugin must be placed in the Plugins directory - 2. The file must only define one class, nothing more, nothing less - 3. The class must have the EXACT same name as the file its in - 4. the class must extend Plugin - 5. add the class to the config file in the plugins field. The syntax for this field - is identical to the python list syntax - 6. The plugin must implement the method getName which returns a string. No other implementations are necessary. -@note: your plugin will raise an exception if another plugin tries to pass it a message and the C{addMessage} method is -not implemented -""" -from plugin import Plugin - - -class ExamplePlugin(Plugin): - def getName(self): - return "ExamplePlugin" \ No newline at end of file diff --git a/Client/Plugins/__init__.py b/Client/Plugins/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/Client/Plugins/plugin.py b/Client/Plugins/plugin.py deleted file mode 100644 index 4a6d65a..0000000 --- a/Client/Plugins/plugin.py +++ /dev/null @@ -1,53 +0,0 @@ -class Plugin: - """ - Plugin Base Class - """ - - def needsThread(self): - """ - Predicate method which asks whether the plugin's - run() function requires threading - @return: Whether the plugin needs a thread - @rtype: Boolean - """ - return False - - def run(self, runtimeVars): - """ - The main function of the plugin. This is called - after setup() by the main client function - @param runtimeVars: Configuration provided in Configs/PIE.conf - @return: None - @rtype: NoneType - """ - pass - - def setup(self, messageDict, runtimeVars): - """ - Called during the client's initialization process - @param messageDict: All of the Client's Plugins' Message Receivers - @type messageDict: Dictionary - @param runtimeVars: Configuration provided in Configs/PIE.conf - @type runtimeVars: Dictionary - """ - pass - - def getName(self): - """ - @return: The Plugin's name - @rtype: String - """ - raise Exception("Abstract Plugin does not have a name") - - def addMessage(self, message): - """ - Handler for incoming messages - @param message: Received message - @type message: String - """ - raise Exception("Not implemented for Plugin") - - def __str__(self): - return self.getName() - - diff --git a/Client/README.md b/Client/README.md deleted file mode 100644 index fc0a53b..0000000 --- a/Client/README.md +++ /dev/null @@ -1,12 +0,0 @@ -Client Functionality: -=================== - -Client will be a multi-threaded program that will will take inputs from the server program as well as eventual hardware interactions. It will output to the display (A web browser), to the server, as well as possibly hardware. - -The "main" thread essentially is a thread manager that ensures all of the proper children threads are running as well as pass along any information that they can't act upon. - -The "display" thread manages "slide show" running on the browser front end as well as waits for any commands to upload the slides in the slide show, remove any slides from the slide show, immediately display on the screen anything it may have to. - -The "logging" thread waits input from any threads running and logs it to the syslog. - -The "socket" thread handles the transfer of information between the server and the client. It will accomplish this through the use of sockets where PIEs will connect to a socket server running on the server and send a general identifier message. Then messages will pass freely between the server and client. diff --git a/Client/Resources/loading_screen/index.html b/Client/Resources/loading_screen/index.html deleted file mode 100644 index 7e6bf00..0000000 --- a/Client/Resources/loading_screen/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -
-
-

Now Loading

- \ No newline at end of file diff --git a/Client/Resources/loading_screen/main.css b/Client/Resources/loading_screen/main.css deleted file mode 100644 index af3edda..0000000 --- a/Client/Resources/loading_screen/main.css +++ /dev/null @@ -1,22 +0,0 @@ -#imgwrap { - margin-left: auto; - margin-right: auto; - width: 100%; - height: 70%; -} -#logo { - display:block; - margin-left: auto; - margin-right: auto; - max-height: 100%; - max-width: 100%;} -#mainText { - text-align:center; - font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; - font-weight: 300; - font-size: 72px; - color:#594B48;} - -body { - background-color: #E6D4C0; -} \ No newline at end of file diff --git a/Client/Resources/loading_screen/nu_n.png b/Client/Resources/loading_screen/nu_n.png deleted file mode 100644 index bf2e4de..0000000 Binary files a/Client/Resources/loading_screen/nu_n.png and /dev/null differ diff --git a/Client/__init__.py b/Client/__init__.py deleted file mode 100644 index 14082ec..0000000 --- a/Client/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Exists solely for documentation-generating purposes \ No newline at end of file diff --git a/Client/gtkDisplay.py b/Client/gtkDisplay.py deleted file mode 100755 index 60912ac..0000000 --- a/Client/gtkDisplay.py +++ /dev/null @@ -1,110 +0,0 @@ -#!/usr/bin/env python - -import threading -import time - -import gobject -import gtk -import webkit -from Plugins.plugin import Plugin - - -class WebBrowser(gtk.Window): - """ - Web Page Display Window Class - Represents a full screen GTK Web Browser (no UI) - displaying a given URL. - @note: URL must begin with a prefix (e.g. "https://") - @note: Extension of the python-gtk-webkit presentation program, - Copyright (C) 2009 by Akkana Peck - @license: GNU Public License, version 2 - @copyright: Northeastern University Crew 2014 - """ - - def __init__(self, url, width, height): - """ - GTK Window Constructor - @param url: The initial URL to show - @type url: String - @param width: The Screen's Width - @type width: Integer - @param height: The Screen's Height - @type height: Integer - @return: The Constructed WebBrowser - @rtype: WebBrowser - """ - gtk.Window.__init__(self) - self.fullscreen() - - self._browser = webkit.WebView() - settings = webkit.WebSettings() - settings.set_property('enable-page-cache', True) - settings.set_property('enable-accelerated-compositing', True) - - self._browser.set_settings(settings) - self.connect('destroy', gtk.main_quit) - self.add(self._browser) - - self._browser.load_uri(url) - self._browser.set_size_request(int(width), int(height)) - self.show_all() - - gobject.threads_init() - - def updatePage(self, url): - """ - Updates the browser to show the given URL - @param url: The new URL to show - @type url: String - @return: None - @rtype: NoneType - """ - print "Update page running in : " + threading.currentThread().getName() - print "updatePage" - self._browser.load_uri(url) - try: - self.fullscreen() - except: - pass - print "showing" - self.show_all() - - -def getUpdateHandle(runtimeVars): - """ - Initializes the browser and returns the - function used to update its page - @param runtimeVars: User-defined Configuration - @type runtimeVars: Dictionary - @return: Function - """ - browser = WebBrowser("", runtimeVars["width"], runtimeVars["height"]) - - # GTK Thread-Safe Wrapper for updatePage() method - def updatePage(url): - gobject.timeout_add(100, browser.updatePage, url) - - return updatePage - - -class GTKPlugin(Plugin): - """ - GTK Web Display Plugin Class - @see: Plugins/plugin.py for more information - @copyright: Northeastern University Crew 2014 - """ - - def needsThread(self): - return True - - def run(self, runtimeVars): - gtk.main() - while True: - print "Main loop" - time.sleep(5) - - def getName(self): - return "Gtk Plugin" - - def addMessage(self, message): - raise Exception("GTKPlugin does not take any messages") \ No newline at end of file diff --git a/Client/logging.py b/Client/logging.py deleted file mode 100644 index ea485b9..0000000 --- a/Client/logging.py +++ /dev/null @@ -1,71 +0,0 @@ -import threading - - -class Logger: - """ - A Thread-Safe Logging Class - @todo: Modify to use syslog instead of these log files - @copyright: Northeastern University Crew 2014 - """ - - def __init__(self, threshold): - """ - Logger Constructor - @param threshold: The amount of messages to store in a buffer - before writing to a logfile - @type threshold: Integer - @return: The Constructed Logger - @rtype: Logger - """ - self.__debug = [] - self.__debugLock = threading.Lock() - self.__warning = [] - self.__warningLock = threading.Lock() - self.__error = [] - self.__errorLock = threading.Lock() - self.__threshold = threshold - - def __addDebugMsg(self, msg): - self.__debug.append(msg) - if len(self.__debug) > self.__threshold: - self.__writeAllAndClear(self.__debug, open("./debug.txt", "a+"), self.__debugLock) - - def __addWarningMessage(self, msg): - self.__warning.append(msg) - if len(self.__warning) > self.__threshold: - self.__writeAllAndClear(self.__warning, open("./warning.txt", "a+"), self.__warningLock) - - def __addErrorMessage(self, msg): - self.__error.append(msg) - if len(self.__error) > self.__threshold: - self.__writeAllAndClear(self.__error, open("./error.txt", "a+"), self.__errorLock) - - def __writeAllAndClear(self, list, file, lock): - lock.acquire(True) - for msg in list: - file.write(msg + "\n") - file.close() - lock.release() - del list[:] - - @staticmethod - def log(level, msg): - """ - Logs the given message with the given Log Level - @param level: The given Log Level. ( "DEBUG" | "WARNING" | "ERROR" ) - @type level: String - @param msg: The message to log - @type msg: String - @return: - """ - if instance is None: - raise Exception("Logging instance was never created") - if level == "DEBUG": - instance.__addDebugMsg(msg) - elif level == "WARNING": - instance.__addWarningMessage(msg) - elif level == "ERROR": - instance.__addErrorMessage(msg) - -# Initialize the Logger -instance = Logger(15) \ No newline at end of file diff --git a/Client/main.py b/Client/main.py deleted file mode 100755 index 9e3493e..0000000 --- a/Client/main.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/python -# General Imports -import thread - -from Classes.ConfigParser import ConfigParser - -# Import functions - -# In the future we should house these in a file of there own -# We can dynamically load plugins from the directory -# we wouldn't need to import and add everything by hand. -from Plugins.plugin import Plugin -from slideShow import SlideShowPlugin -from socketClient import IOPlugin -from gtkDisplay import GTKPlugin - - -def getAdditionalPlugins(runtimeVars): - """ - Gets any User-Defined Plugins specified in the Configuration - from ./Plugins - @param runtimeVars: User-Defined Configuration - @type runtimeVars: Dictionary - @return: User-Define Plugins - @rtype: Array - """ - plugins = [] - for plugin in runtimeVars["plugins"]: - try: - exec "from Plugins." + plugin + " import " + plugin - instance = eval(plugin + "()") - if isinstance(instance, Plugin): - print instance - plugins.append(instance) - else: - print "Huh? what did i get? : " + str(instance) - except Exception, e: - print "Couldn't create an instance of a plugin in the config" - print str(e) - return plugins - - -def main(): - """ - The main function of the client - @return: None - @rtype: None - """ - runtimeVars = ConfigParser.readConfig() - plugins = [SlideShowPlugin(), IOPlugin()] + getAdditionalPlugins(runtimeVars) - runtimeVars["plugins"] += ["SlideShowPlugin", "IOPlugin"] - - def addPluginToDict(dict, p): - dict[p.getName()] = p.addMessage - return dict - - # messageDict = Message-handling functions for each plugin - messageDict = reduce(addPluginToDict, plugins, {}) - - for plugin in plugins: - plugin.setup(messageDict, runtimeVars) - for plugin in plugins: - print "Starting " + plugin.getName() - if plugin.needsThread(): - thread.start_new_thread(plugin.run, (runtimeVars,)) - # Instead of having main() be in a busy wait doing nothing, - # we denote GTKPlugin() to be the "main" plugin, so its - # behavior drives any looping done on the main thread - GTKPlugin().run(runtimeVars) - - -# TODO: Replace with argparse library -if __name__ == "__main__": - main() - diff --git a/Client/resources/loading_screen/index.html b/Client/resources/loading_screen/index.html deleted file mode 100644 index 087ffc9..0000000 --- a/Client/resources/loading_screen/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - -
-
- -

Now Loading

- \ No newline at end of file diff --git a/Client/resources/loading_screen/main.css b/Client/resources/loading_screen/main.css deleted file mode 100644 index 77c5c1b..0000000 --- a/Client/resources/loading_screen/main.css +++ /dev/null @@ -1,26 +0,0 @@ -#imgwrap { - margin-left: auto; - margin-right: auto; - width: 100%; - height: 70%; -} - -#logo { - display: block; - margin-left: auto; - margin-right: auto; - max-height: 100%; - max-width: 100%; -} - -#mainText { - text-align: center; - font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif; - font-weight: 300; - font-size: 72px; - color: #594B48; -} - -body { - background-color: #E6D4C0; -} \ No newline at end of file diff --git a/Client/resources/loading_screen/nu_n.png b/Client/resources/loading_screen/nu_n.png deleted file mode 100644 index bf2e4de..0000000 Binary files a/Client/resources/loading_screen/nu_n.png and /dev/null differ diff --git a/Client/slideShow.py b/Client/slideShow.py deleted file mode 100644 index 473d604..0000000 --- a/Client/slideShow.py +++ /dev/null @@ -1,147 +0,0 @@ -import Queue -import json -import datetime -import time -import sys - -from Classes.message import Message -from Classes.slide import Slide -from logging import Logger -from Plugins.plugin import Plugin -import gtkDisplay - - -class SlideShowPlugin(Plugin): - """ - Slide Show Plugin Class - @see: Plugins/plugin.py for more information - @copyright: Northeastern University Crew 2014 - """ - - def __init__(self): - self.updateHandle = None - self.inQ = Queue.Queue(100) - self.outHandle = None - - def needsThread(self): - return True - - def run(self, runtimeVars): - if self.updateHandle is None or self.outHandle is None: - raise Exception("Something went wrong...") - runShow(self.inQ, runtimeVars, self.updateHandle, self.outHandle) - - def setup(self, messageDict, runtimeVars): - self.updateHandle = gtkDisplay.getUpdateHandle(runtimeVars) - self.outHandle = messageDict["IOPlugin"] - - def getName(self): - return "slideShow" - - def addMessage(self, message): - print "Adding : " + str(message) - self.inQ.put(message, True) - - -def runShow(inputQueue, runtimeVars, setPage, writeOut): - """ - Runs the slide show (manages GTK and incoming messages) - @param inputQueue: The Slide Show Plugin's input queue - @type inputQueue: Queue.Queue - @param runtimeVars: User-defined Configuration - @type runtimeVars: Dictionary - @param setPage: The function which sets the GTK Display's webpage - @type setPage: Function - @param writeOut: The socket outgoing message queue - @type writeOut: Function - @return: None - @rtype: None - """ - # TODO get DT - slideRequest = Message(runtimeVars["name"], "Grandma", 'WPHandler', "load-slides", "Maor slidez") - print "slideReuqest " + slideRequest.toJSON() - writeOut(slideRequest) - - slides = [] - # Replace with loading slide - slides.append( - Slide.makeSlide("file:///home/pi/dds-client/Client/resources/loading_screen/index.html", 5, -1, "")) - - # Temp Weather slide for testing purposes. Uncomment as needed. - # slides.append(Slide("http://104.131.73.58", 10)) - - # Helper to get the slide out of the slide list with the given ID, also insures uniqueness if ID's - def getSlideById(slideList, id): - print "getSlideById called. currentMessage(" + str(type(currentMessage)) + "):", currentMessage - matches = filter(lambda x: x.sameID(id), slideList) - if len(matches) > 1: - raise Exception("Why are there two slides with the same ID?") - return None if len(matches) == 0 else matches[0] - - def deleteSlide(slideList, id): - print "Deleting slide..." - temp = getSlideById(slides, id) - Logger.log("DEBUG", "Removing slide: " + str(temp)) - if temp: - slideList.remove(temp) - - def editSlide(slideList, id, newSlide): - print "Editing slide..." - old = getSlideById(slides, id) - Logger.log("DEBUG", "Changing slide :" + str(old) + " to " + str(newSlide)) - if old: - slideList.remove(old) - slideList.append(newSlide) - - def addSlide(slideList, slide): - print "Adding slide..." - Logger.log("DEBUG", "Adding slide :" + str(slide)) - slideList.append(slide) - - x = 0 - Run = True - while Run: - print str(slides) - # - if len(slides) > 1 and getSlideById(slides, -1) is not None: - print "Slides have loaded removing loading slide..." - # Following line needed for situations in which - # a client only has one slide to show - x = 0 - slides.remove(getSlideById(slides, -1)) - if len(slides) == 0: - print "I Have no slides, stopping slide show..." - Logger.log("ERROR", "Ran out of slides...") - sys.exit(0) - # TODO: Handle this situation better. - # (Currently, the slide show will - # simply freeze on its last received - # slide at this point) - currentSlide = slides[x] - target_time = datetime.datetime.now() + datetime.timedelta(seconds=currentSlide.duration) - setPage(currentSlide.url) - print "Just set page : " + currentSlide.url - while datetime.datetime.now() < target_time: - if not inputQueue.empty(): - currentMessage = inputQueue.get() - infoForAddition = json.loads(currentMessage["content"]) - if currentMessage["action"] == "load-slides": - for slideJSON in infoForAddition["actions"]: - # TODO fields in dds-api call need to be changed to standard, - # they also need ID and meta added @Eddie - addSlide(slides, - Slide.makeSlide(slideJSON["location"], slideJSON["duration"], slideJSON["ID"], - "")) - elif currentMessage["action"] == "add-slide": - addSlide(slides, Slide(infoForAddition)) - elif currentMessage["action"] == "delete-slide": - deleteSlide(slides, infoForAddition["ID"]) - elif currentMessage["action"] == "edit-slide": - editSlide(slides, infoForAddition["ID"], Slide(infoForAddition)) - elif currentMessage["action"] == "Terminate": - Run = False - break - time.sleep(1) - # Move on - if len(slides): - x = (x + 1) % len(slides) diff --git a/Client/socketClient.py b/Client/socketClient.py deleted file mode 100755 index 326c6f6..0000000 --- a/Client/socketClient.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/python -import select -import sys -import time -import json -import Queue - -from Classes.message import Message -from Classes.sockClass import sockClass -from logging import Logger -from Plugins.plugin import Plugin - - -def socket_out(currentMessage, socket): - """ - Writes the given Message to the given socket - @param currentMessage: The Message to write - @type currentMessage: Message - @param socket: The socket to write to - @type socket: Socket - @return: None - @rtype: NoneType - """ - Logger.log("DEBUG", "Outbound Message: " + currentMessage.toJSON()) - if currentMessage.dest == "Grandma": - try: - socket.send(currentMessage.toJSON() + '\v') - except Exception, e: - print str(e) - Logger.log("ERROR", "Socket raised exception on send - exception : " + str(e)) - raise Exception("Can't send message. Socket = " + str(socket)) - else: - Logger.log("WARNING", "Message not addressed to grandma") - print "Socket Message Sent!" - - -def socket_in(s, runtimeVars, route): - """ - Reads and redirects messages received by the client - @param s: The Client Socket - @type s: sockClass - @param runtimeVars: User-defined Configuration - @type runtimeVars: Dictionary - @param route: The message handlers for the client plugins - @type route: Dictionary - @return: None - @rtype: NoneType - """ - run = True - while run: - socket_list = [s.sock, ] - # Get the list of sockets which are readable - read_sockets, write_sockets, error_sockets = select.select(socket_list, [], []) - for sock in read_sockets: - if sock == s.sock: - data = sock.recv(4096) - if not data: - s.connect(runtimeVars) - else: - messages = filter(lambda s: s != "", - data.split('\v')) - for currentMessage in messages: - currentMessage = json.loads(currentMessage) - if currentMessage["pluginDest"] == "Main": - sys.exit(0) - print "Got message : " + str(currentMessage) - messageDestination = currentMessage["pluginDest"] - print "Received message sending it too : " + str(messageDestination) - route[messageDestination](Message.fromJSON(currentMessage)) - else: - print "Something Goofed" - # We all program updates will be in multiples of 1 sec, - # as this is the slide time accuracy - time.sleep(1) - - -class IOPlugin(Plugin): - """ - Socket I/O Plugin Class - @see: Plugins/plugin.py for more information - @copyright: Northeastern University Crew 2014 - """ - - def __init__(self): - self.queue = Queue.Queue(100) - self.msgRoute = None - self.socket = None - - def needsThread(self): - return True - - def setup(self, messageDict, runtimeVars): - self.msgRoute = messageDict - self.socket = sockClass(runtimeVars) - - def run(self, runtimeVars): - if self.msgRoute is None: - raise Exception("Can't distribute info; message route is None") - socket_in(self.socket, runtimeVars, self.msgRoute) - - def getName(self): - return "IOPlugin" - - def addMessage(self, message): - print "Attempting to send Message" - if self.socket is None: - Logger.log("WARNING", "No socket connection, trying again...") - time.sleep(.5) - self.addMessage(message) - else: - socket_out(message, self.socket) diff --git a/LICENSE b/LICENSE deleted file mode 100644 index f3fd563..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Northeastern University College of Computer and Information Science's Experimental Systems Group - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 131a003..0000000 --- a/README.md +++ /dev/null @@ -1,29 +0,0 @@ -DDS-Client -- Project Bakesale -================================ -Todo: -Note: This is a working todo list. Will add things as they come up - -Mostly little things. If you have some time, just look for the `todo` tags sprinkled throughout the codebase - -DDS is a NU Crew project. -The MIT License (MIT) - -Copyright (c) 2014 Northeastern University College of Computer and Information Science's Experimental Systems Group - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/Sample JSON.txt b/Sample JSON.txt deleted file mode 100644 index 806a5a8..0000000 --- a/Sample JSON.txt +++ /dev/null @@ -1,41 +0,0 @@ -See: https://dds-wp.ccs.neu.edu/wp-admin/admin-ajax.php?action=dds_api&pie_name=chocolate -{ - "actions":[ - { - "type":"slide", - "location":"https:\/\/round-lake.dustinice.workers.dev:443\/http\/m.weather.com\/weather\/tenday\/USMA0046", - "duration":1 - }, - { - "type":"slide", - "location":"https:\/\/round-lake.dustinice.workers.dev:443\/http\/www.northeastern.edu\/news\/", - "duration":20 - }, - { - "type":"slide", - "location":"https:\/\/round-lake.dustinice.workers.dev:443\/http\/dds-wp.ccs.neu.edu\/?slide=cisters-welcome-dinner&pie_name=chocolate", - "duration":1 - }, - { - "type":"slide", - "location":"https:\/\/round-lake.dustinice.workers.dev:443\/http\/dds-wp.ccs.neu.edu\/?slide=fall-masters-student-social&pie_name=chocolate", - "duration":3 - }, - { - "type":"slide", - "location":"https:\/\/round-lake.dustinice.workers.dev:443\/http\/dds-wp.ccs.neu.edu\/?slide=test-ccis-tutoring&pie_name=chocolate", - "duration":1 - }, - { - "type":"slide", - "location":"https:\/\/round-lake.dustinice.workers.dev:443\/http\/dds-wp.ccs.neu.edu\/?slide=cisters&pie_name=chocolate", - "duration":3 - }, - { - "type":"slide", - "location":"https:\/\/round-lake.dustinice.workers.dev:443\/http\/dds-wp.ccs.neu.edu\/?slide=welcome-to-the-ccis-main-office&pie_name=chocolate", - "duration":5 - } - ] -} - diff --git a/Server-module.html b/Server-module.html new file mode 100644 index 0000000..daac426 --- /dev/null +++ b/Server-module.html @@ -0,0 +1,162 @@ + + + + + Server + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Package Server

source code

+ + + + + + + +
+ + + + + +
Submodules[hide private]
+
+
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server-pysrc.html b/Server-pysrc.html new file mode 100644 index 0000000..2dcc583 --- /dev/null +++ b/Server-pysrc.html @@ -0,0 +1,105 @@ + + + + + Server + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Package Server

+
+1  # Exists solely for documentation-generating purposes 
+2   
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes-module.html b/Server.Classes-module.html new file mode 100644 index 0000000..4aed2b5 --- /dev/null +++ b/Server.Classes-module.html @@ -0,0 +1,153 @@ + + + + + Server.Classes + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Package Classes

source code

+ + + + + + + +
+ + + + + +
Submodules[hide private]
+
+
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes-pysrc.html b/Server.Classes-pysrc.html new file mode 100644 index 0000000..a1f7b5e --- /dev/null +++ b/Server.Classes-pysrc.html @@ -0,0 +1,107 @@ + + + + + Server.Classes + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Package Server.Classes

+
+1  # This file is needed to allow us to move classes into this folder 
+2  # and call them using Classes.____ 
+3   
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.ConfigParser-module.html b/Server.Classes.ConfigParser-module.html new file mode 100644 index 0000000..ec48047 --- /dev/null +++ b/Server.Classes.ConfigParser-module.html @@ -0,0 +1,150 @@ + + + + + Server.Classes.ConfigParser + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module ConfigParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module ConfigParser

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ConfigParser
+ Configuration Parser Class +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.ConfigParser-pysrc.html b/Server.Classes.ConfigParser-pysrc.html new file mode 100644 index 0000000..f91b786 --- /dev/null +++ b/Server.Classes.ConfigParser-pysrc.html @@ -0,0 +1,146 @@ + + + + + Server.Classes.ConfigParser + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module ConfigParser + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.Classes.ConfigParser

+
+
1 -class ConfigParser: +
2 """ + 3 Configuration Parser Class + 4 @copyright: Northeastern University Crew 2014 + 5 """ + 6 + 7 @staticmethod +
8 - def readConfig(): +
9 """ +10 Reads the contents of PIE.conf +11 @return: User-specified Configuration +12 @rtype: Dict +13 """ +14 config = open("Configs/PIE.conf", "r") +15 configContents = config.read() +16 configDict = {} +17 for line in configContents.splitlines(): +18 if not (line.startswith("[") or line == ""): +19 pair = ConfigParser.getPair(line) +20 configDict[pair[0]] = pair[1] +21 return configDict +
22 +23 @staticmethod +
24 - def getPair(line): +
25 """ +26 Parses the given configuration file +27 line into a tuple. +28 @param line: The line to parse +29 @type line: String +30 @return: Tuple of the form (key, value) +31 @rtype: Tuple +32 """ +33 split = line.replace(" ", "").split("=") +34 if len(split) != 2: +35 raise Exception("Bad config file...") +36 return split[0], split[1] +
37 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.ConfigParser.ConfigParser-class.html b/Server.Classes.ConfigParser.ConfigParser-class.html new file mode 100644 index 0000000..eabd0ff --- /dev/null +++ b/Server.Classes.ConfigParser.ConfigParser-class.html @@ -0,0 +1,225 @@ + + + + + Server.Classes.ConfigParser.ConfigParser + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module ConfigParser :: + Class ConfigParser + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ConfigParser

source code

+

Configuration Parser Class

+ +
+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+ Dict + + + + + + +
readConfig()
+ Reads the contents of PIE.conf
+ source code + +
+ +
+ Tuple + + + + + + +
getPair(line)
+ Parses the given configuration file line into a tuple.
+ source code + +
+ +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

readConfig() +
Static Method +

+
source code  +
+ +

Reads the contents of PIE.conf

+
+
Returns: Dict
+
User-specified Configuration
+
+
+
+ +
+ +
+ + +
+

getPair(line) +
Static Method +

+
source code  +
+ +

Parses the given configuration file line into a tuple.

+
+
Parameters:
+
    +
  • line (String) - The line to parse
  • +
+
Returns: Tuple
+
Tuple of the form (key, value)
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.QueueDict-module.html b/Server.Classes.QueueDict-module.html new file mode 100644 index 0000000..835c087 --- /dev/null +++ b/Server.Classes.QueueDict-module.html @@ -0,0 +1,152 @@ + + + + + Server.Classes.QueueDict + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module QueueDict + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module QueueDict

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + QueueDict
+ A wrapper around the Queue Object, which is simply a dictionary of + Queues that can be passed into a plugin, thereby allowing all + plugins to communicate with other plugins. +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'Server.Classes' +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.QueueDict-pysrc.html b/Server.Classes.QueueDict-pysrc.html new file mode 100644 index 0000000..4ce2c84 --- /dev/null +++ b/Server.Classes.QueueDict-pysrc.html @@ -0,0 +1,153 @@ + + + + + Server.Classes.QueueDict + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module QueueDict + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.Classes.QueueDict

+
+ 1  import Queue 
+ 2   
+ 3   
+
4 -class QueueDict: +
5 """ + 6 A wrapper around the Queue Object, which is + 7 simply a dictionary of Queues that can be + 8 passed into a plugin, thereby allowing all + 9 plugins to communicate with other plugins. +10 (i.e. A String to Queue dictionary) +11 @ivar Queues: Dictionary of queues +12 @type Queues: Dictionary +13 @ivar queueSize : Queue size in _Queues +14 @type queueSize: Integer +15 @copyright: Northeastern University Crew 2014 +16 """ +17 +
18 - def __init__(self, queueSize=100): +
19 """ +20 Queue Dictionary Constructor +21 @param queueSize: (Optional) Specifies size of contained queues (Default 100) +22 @return: The Constructed Queue Dictionary +23 @rtype: QueueDict +24 """ +25 self.Queues = {} +26 self.queueSize = queueSize +
27 +
28 - def __getitem__(self, name): +
29 """ +30 Retrieves the desired queue using dictionary syntax +31 (e.g. C{queues[name]}) +32 @param name: The name of the desired queue +33 @type name: String +34 @return: The queue corresponding to the given name +35 @rtype: Queue.Queue +36 """ +37 return self.Queues[name] +
38 +
39 - def addQueue(self, name): +
40 """ +41 Adds a queue with the given name to the QueueDict object. +42 @param name: The name of the queue to add +43 @type name: String +44 @return: None +45 @rtype: NoneType +46 """ +47 self.Queues[name] = Queue.Queue(self.queueSize) +
48 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.QueueDict.QueueDict-class.html b/Server.Classes.QueueDict.QueueDict-class.html new file mode 100644 index 0000000..0bea21b --- /dev/null +++ b/Server.Classes.QueueDict.QueueDict-class.html @@ -0,0 +1,314 @@ + + + + + Server.Classes.QueueDict.QueueDict + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module QueueDict :: + Class QueueDict + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class QueueDict

source code

+

A wrapper around the Queue Object, which is simply a dictionary of + Queues that can be passed into a plugin, thereby allowing all plugins to + communicate with other plugins. (i.e. A String to Queue dictionary)

+ +
+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ QueueDict + + + + + + +
__init__(self, + queueSize=100)
+ Queue Dictionary Constructor
+ source code + +
+ +
+ Queue.Queue + + + + + + +
__getitem__(self, + name)
+ Retrieves the desired queue using dictionary syntax (e.g.
+ source code + +
+ +
+ NoneType + + + + + + +
addQueue(self, + name)
+ Adds a queue with the given name to the QueueDict object.
+ source code + +
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Variables[hide private]
+
+ Dictionary + + Queues
+ Dictionary of queues +
+ Integer + + queueSize
+ Queue size in _Queues +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + queueSize=100) +
(Constructor) +

+
source code  +
+ +

Queue Dictionary Constructor

+
+
Parameters:
+
    +
  • queueSize - (Optional) Specifies size of contained queues (Default 100)
  • +
+
Returns: QueueDict
+
The Constructed Queue Dictionary
+
+
+
+ +
+ +
+ + +
+

__getitem__(self, + name) +
(Indexing operator) +

+
source code  +
+ +

Retrieves the desired queue using dictionary syntax (e.g. + queues[name])

+
+
Parameters:
+
    +
  • name (String) - The name of the desired queue
  • +
+
Returns: Queue.Queue
+
The queue corresponding to the given name
+
+
+
+ +
+ +
+ + +
+

addQueue(self, + name) +

+
source code  +
+ +

Adds a queue with the given name to the QueueDict object.

+
+
Parameters:
+
    +
  • name (String) - The name of the queue to add
  • +
+
Returns: NoneType
+
None
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.ThreadDict-module.html b/Server.Classes.ThreadDict-module.html new file mode 100644 index 0000000..bad0f46 --- /dev/null +++ b/Server.Classes.ThreadDict-module.html @@ -0,0 +1,151 @@ + + + + + Server.Classes.ThreadDict + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module ThreadDict + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module ThreadDict

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + ThreadDict
+ Wrapper around thread object, allows us to start all the persistent + Threads in a consistent and simple fashion. +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.ThreadDict-pysrc.html b/Server.Classes.ThreadDict-pysrc.html new file mode 100644 index 0000000..2078faf --- /dev/null +++ b/Server.Classes.ThreadDict-pysrc.html @@ -0,0 +1,139 @@ + + + + + Server.Classes.ThreadDict + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module ThreadDict + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.Classes.ThreadDict

+
+
1 -class ThreadDict: +
2 """ + 3 Wrapper around thread object, allows us to + 4 start all the persistent Threads in a consistent + 5 and simple fashion. See plugins.py for more details. + 6 + 7 @ivar Threads: The threads contained in the object. + 8 @type Threads: Dictionary + 9 @copyright: Northeastern University Crew 2014 +10 """ +11 +
12 - def __init__(self): +
13 """ +14 ThreadDict Constructor +15 @return: An empty ThreadDict +16 @rtype: ThreadDict +17 """ +18 self.Threads = {} +
19 +
20 - def addThread(self, name, function, queueDict): +
21 """ +22 Adds a thread with the given parameters to the ThreadDict +23 @param name: The name of the thread +24 @type name: String +25 @param function: The function associated with the thread to add +26 @type function: Function +27 @param queueDict: The QueueDict to add the thread's message queue to +28 @type queueDict: QueueDict +29 @return: None +30 @rtype: NoneType +31 """ +32 queueDict.addQueue(name) +33 self.Threads[name] = function +
34 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.ThreadDict.ThreadDict-class.html b/Server.Classes.ThreadDict.ThreadDict-class.html new file mode 100644 index 0000000..6d7f8b0 --- /dev/null +++ b/Server.Classes.ThreadDict.ThreadDict-class.html @@ -0,0 +1,260 @@ + + + + + Server.Classes.ThreadDict.ThreadDict + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module ThreadDict :: + Class ThreadDict + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class ThreadDict

source code

+

Wrapper around thread object, allows us to start all the persistent + Threads in a consistent and simple fashion. See plugins.py for more + details.

+ +
+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ ThreadDict + + + + + + +
__init__(self)
+ ThreadDict Constructor
+ source code + +
+ +
+ NoneType + + + + + + +
addThread(self, + name, + function, + queueDict)
+ Adds a thread with the given parameters to the ThreadDict
+ source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Instance Variables[hide private]
+
+ Dictionary + + Threads
+ The threads contained in the object. +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self) +
(Constructor) +

+
source code  +
+ +

ThreadDict Constructor

+
+
Returns: ThreadDict
+
An empty ThreadDict
+
+
+
+ +
+ +
+ + +
+

addThread(self, + name, + function, + queueDict) +

+
source code  +
+ +

Adds a thread with the given parameters to the ThreadDict

+
+
Parameters:
+
    +
  • name (String) - The name of the thread
  • +
  • function (Function) - The function associated with the thread to add
  • +
  • queueDict (QueueDict) - The QueueDict to add the thread's message queue to
  • +
+
Returns: NoneType
+
None
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.log-module.html b/Server.Classes.log-module.html new file mode 100644 index 0000000..5da5860 --- /dev/null +++ b/Server.Classes.log-module.html @@ -0,0 +1,149 @@ + + + + + Server.Classes.log + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module log + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module log

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + logging +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.log-pysrc.html b/Server.Classes.log-pysrc.html new file mode 100644 index 0000000..6d06b42 --- /dev/null +++ b/Server.Classes.log-pysrc.html @@ -0,0 +1,125 @@ + + + + + Server.Classes.log + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module log + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.Classes.log

+
+1  # TODO: Figure out if this is even being used... 
+
2 -class logging(object): +
3 - def __init__(self, arg): +
4 super(logging, self).__init__() +5 self.arg = arg +
6 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.log.logging-class.html b/Server.Classes.log.logging-class.html new file mode 100644 index 0000000..797141f --- /dev/null +++ b/Server.Classes.log.logging-class.html @@ -0,0 +1,230 @@ + + + + + Server.Classes.log.logging + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module log :: + Class logging + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class logging

source code

+
+object --+
+         |
+        logging
+
+ +
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + arg)
+ x.__init__(...) initializes x; see help(type(x)) for signature
+ source code + +
+ +
+

Inherited from object: + __delattr__, + __format__, + __getattribute__, + __hash__, + __new__, + __reduce__, + __reduce_ex__, + __repr__, + __setattr__, + __sizeof__, + __str__, + __subclasshook__ +

+
+ + + + + + + + + +
+ + + + + +
Properties[hide private]
+
+

Inherited from object: + __class__ +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + arg) +
(Constructor) +

+
source code  +
+ +

x.__init__(...) initializes x; see help(type(x)) for signature

+
+
Overrides: + object.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.message-module.html b/Server.Classes.message-module.html new file mode 100644 index 0000000..a3fc18d --- /dev/null +++ b/Server.Classes.message-module.html @@ -0,0 +1,157 @@ + + + + + Server.Classes.message + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module message + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module message

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + Message
+ " A message object to be passed between threads via Queue + Sample Usage: Making a new message that will send terminate + from main to display: newMessage = Message("Main", + "Display", "Terminate", \{\}) Making a + slide that will update Display with a new slide: newMessage = + Message("Main", "Display", "Update", + \{\}) newMessage.add_content("slide1", + "http://google.com") +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'Server.Classes' +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.message-pysrc.html b/Server.Classes.message-pysrc.html new file mode 100644 index 0000000..1bd602b --- /dev/null +++ b/Server.Classes.message-pysrc.html @@ -0,0 +1,230 @@ + + + + + Server.Classes.message + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module message + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.Classes.message

+
+  1  import json 
+
2 + 3 + 4 # TODO: See doctring below + 5 -class Message: +
6 """" + 7 A message object to be passed between threads via Queue + 8 I{Sample Usage}: + 9 Making a new message that will send terminate from main to display: + 10 C{newMessage = Message("Main", "Display", "Terminate", \{\})} + 11 Making a slide that will update Display with a new slide: + 12 C{newMessage = Message("Main", "Display", "Update", \{\})} + 13 C{newMessage.add_content("slide1", "http://google.com")} + 14 + 15 @attention: It is good practice to use dict accessors as opposed to object attributes + 16 @todo: Un-expose attributes + 17 @ivar src: Name of the thread who sent the message + 18 @type src: String + 19 @ivar dest: Intended message destination + 20 @type dest: String + 21 @ivar pluginDest: Client-side plugin to receive the message + 22 @type pluginDest: String + 23 @ivar action: Action for the client-side plugin to perform + 24 @type action: String + 25 @ivar content: Message payload (destination plugin should be able to interpret content) + 26 @type content: Dictionary + 27 @ivar datetime: Message timestamp + 28 @type datetime: String + 29 @copyright: Northeastern University Crew 2014 + 30 """ + 31 +
32 - def __init__(self, src, dest, pluginDest, action, content, datetime=None): +
33 """ + 34 Message Constructor + 35 @param src: Name of the thread who sent the message + 36 @type src: String + 37 @param dest: Intended message destination + 38 @type dest: String + 39 @param pluginDest: Client-side plugin to receive the message + 40 @type pluginDest: String + 41 @param action: Action for the client-side plugin to perform + 42 @type action: String + 43 @param content: Message payload (destination plugin should be able to interpret content) + 44 @type content: Dictionary + 45 @param datetime: Message timestamp + 46 @type datetime: String + 47 @return: Message with the given parameters + 48 @rtype: Message + 49 """ + 50 self.src = src + 51 self.dest = dest + 52 self.pluginDest = pluginDest + 53 self.action = action + 54 self.content = content + 55 self.datetime = datetime +
56 +
57 - def add_content(self, key, val): +
58 """ + 59 Sets the given key-value pair to the message's content + 60 @param key: Key to write to in message content + 61 @param val: Value to write in message content + 62 @return: None + 63 """ + 64 self.content[key] = val +
65 +
66 - def toJSON(self): +
67 """ + 68 Returns the message in JSON format + 69 @return: JSON representation of Message + 70 @rtype: String + 71 """ + 72 text = json.dumps(self.__dict__) + 73 return text +
74 + 75 # TODO: (See docstring) +
76 - def __str__(self): +
77 """ + 78 @return: String Representation of Message + 79 @rtype: String + 80 @todo: This looks horrendous. We should pretty it up. + 81 """ + 82 return "Src = " + self.src + " dest = " + self.dest + " pluginDest = " + self.pluginDest + \ + 83 " action = " + self.action + " content = " + self.content + " datetime = " + self.datetime +
84 + 85 @staticmethod +
86 - def fromJSON(jsonObj): +
87 """ + 88 Creates a message from JSON input + 89 @param jsonObj: A Parsed JSON Input + 90 @type jsonObj: Dictionary + 91 @return: Message represented by the given JSON + 92 @rtype: Message + 93 """ + 94 src = jsonObj['src'] + 95 dest = jsonObj['dest'] + 96 pluginDest = jsonObj['pluginDest'] + 97 action = jsonObj['action'] + 98 content = jsonObj['content'] + 99 datetime = None +100 if "datetime" in jsonObj: +101 datetime = jsonObj["datetime"] +102 return Message(src, dest, pluginDest, action, content, datetime) +
103 +
104 - def __getitem__(self, item): +
105 """ +106 Implements dict-like behavior for Messages +107 @param item: Message value to fetch +108 @return: The attribute associated with the given key +109 """ +110 if item == "src": +111 return self.src +112 elif item == "dest": +113 return self.dest +114 elif item == "pluginDest": +115 return self.pluginDest +116 elif item == "action": +117 return self.action +118 elif item == "content": +119 return self.content +120 elif item == "datetime": +121 return self.datetime +122 raise Exception("Message does not have an attribute \"" + item + "\"") +
123 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.message.Message-class.html b/Server.Classes.message.Message-class.html new file mode 100644 index 0000000..48d794f --- /dev/null +++ b/Server.Classes.message.Message-class.html @@ -0,0 +1,519 @@ + + + + + Server.Classes.message.Message + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module message :: + Class Message + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Message

source code

+

" A message object to be passed between threads via Queue + Sample Usage: Making a new message that will send terminate from + main to display: newMessage = Message("Main", + "Display", "Terminate", \{\}) Making a slide + that will update Display with a new slide: newMessage = + Message("Main", "Display", "Update", + \{\}) newMessage.add_content("slide1", + "http://google.com")

+ +
+

Attention: + It is good practice to use dict accessors as opposed to object + attributes +

+

To Do: + Un-expose attributes +

+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ Message + + + + + + +
__init__(self, + src, + dest, + pluginDest, + action, + content, + datetime=None)
+ Message Constructor
+ source code + +
+ +
+   + + + + + + +
add_content(self, + key, + val)
+ Sets the given key-value pair to the message's content
+ source code + +
+ +
+ String + + + + + + +
toJSON(self)
+ Returns the message in JSON format
+ source code + +
+ +
+ String + + + + + + +
__str__(self)
+ Returns: + String Representation of Message
+ source code + +
+ +
+   + + + + + + +
__getitem__(self, + item)
+ Implements dict-like behavior for Messages
+ source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+ Message + + + + + + +
fromJSON(jsonObj)
+ Creates a message from JSON input
+ source code + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Variables[hide private]
+
+ String + + action
+ Action for the client-side plugin to perform +
+ Dictionary + + content
+ Message payload (destination plugin should be able to interpret + content) +
+ String + + datetime
+ Message timestamp +
+ String + + dest
+ Intended message destination +
+ String + + pluginDest
+ Client-side plugin to receive the message +
+ String + + src
+ Name of the thread who sent the message +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + src, + dest, + pluginDest, + action, + content, + datetime=None) +
(Constructor) +

+
source code  +
+ +

Message Constructor

+
+
Parameters:
+
    +
  • src (String) - Name of the thread who sent the message
  • +
  • dest (String) - Intended message destination
  • +
  • pluginDest (String) - Client-side plugin to receive the message
  • +
  • action (String) - Action for the client-side plugin to perform
  • +
  • content (Dictionary) - Message payload (destination plugin should be able to interpret + content)
  • +
  • datetime (String) - Message timestamp
  • +
+
Returns: Message
+
Message with the given parameters
+
+
+
+ +
+ +
+ + +
+

add_content(self, + key, + val) +

+
source code  +
+ +

Sets the given key-value pair to the message's content

+
+
Parameters:
+
    +
  • key - Key to write to in message content
  • +
  • val - Value to write in message content
  • +
+
Returns:
+
None
+
+
+
+ +
+ +
+ + +
+

toJSON(self) +

+
source code  +
+ +

Returns the message in JSON format

+
+
Returns: String
+
JSON representation of Message
+
+
+
+ +
+ +
+ + +
+

__str__(self) +
(Informal representation operator) +

+
source code  +
+ + +
+
Returns: String
+
String Representation of Message
+
+

To Do: + This looks horrendous. We should pretty it up. +

+
+
+ +
+ +
+ + +
+

fromJSON(jsonObj) +
Static Method +

+
source code  +
+ +

Creates a message from JSON input

+
+
Parameters:
+
    +
  • jsonObj (Dictionary) - A Parsed JSON Input
  • +
+
Returns: Message
+
Message represented by the given JSON
+
+
+
+ +
+ +
+ + +
+

__getitem__(self, + item) +
(Indexing operator) +

+
source code  +
+ +

Implements dict-like behavior for Messages

+
+
Parameters:
+
    +
  • item - Message value to fetch
  • +
+
Returns:
+
The attribute associated with the given key
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.slide-module.html b/Server.Classes.slide-module.html new file mode 100644 index 0000000..4590d31 --- /dev/null +++ b/Server.Classes.slide-module.html @@ -0,0 +1,150 @@ + + + + + Server.Classes.slide + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module slide + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module slide

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + Slide
+ Class for Slide Show Slide Objects +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'Server.Classes' +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.slide-pysrc.html b/Server.Classes.slide-pysrc.html new file mode 100644 index 0000000..1d2e991 --- /dev/null +++ b/Server.Classes.slide-pysrc.html @@ -0,0 +1,186 @@ + + + + + Server.Classes.slide + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module slide + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.Classes.slide

+
+ 1  import json 
+
2 + 3 + 4 -class Slide(): +
5 """ + 6 Class for Slide Show Slide Objects + 7 @ivar url: The Slide's URL + 8 @type url: String + 9 @ivar duration: The Duration to show the slide (in seconds) +10 @type duration: Integer +11 @ivar id: The Slide's ID +12 @type id: Integer +13 @ivar meta: The Slide's meta content +14 @type meta: Dictionary +15 @copyright: Northeastern University Crew 2014 +16 """ +17 +18 @staticmethod +
19 - def makeSlide(url, duration, id, meta): +
20 """ +21 Slide Constructor based on the given input (instead of a dictionary) +22 @param url: The Slide's URL +23 @type url: String +24 @param duration: The Duration to show the slide (in seconds) +25 @type duration: Integer +26 @param id: The Slide's ID +27 @type id: Integer +28 @param meta: The Slide's meta content +29 @type meta: Dictionary +30 @return: The constructed Slide +31 @rtype: Slide +32 """ +33 return Slide({"permalink": url, "duration": duration, "ID": id, "meta": meta}) +
34 +
35 - def __init__(self, infoDict): +
36 """ +37 Slide Constructor +38 @param infoDict: The relevant information for the slide +39 @type infoDict: Dictionary +40 @return: The constructed Slide +41 @rtype: Slide +42 """ +43 self.__type__ = "slide" +44 print "Got meta:", infoDict["meta"] +45 self.url = infoDict["permalink"] +46 if (not (isinstance(infoDict["meta"], str)) and +47 (infoDict["meta"]["dds_external_url"][0] != "")): +48 self.url = infoDict["meta"]["dds_external_url"][0] +49 +50 self.duration = infoDict["duration"] +51 self.id = infoDict["ID"] +52 self.meta = infoDict["meta"] +
53 +
54 - def toJSON(self): +
55 """ +56 @return: A JSON Representation of the slide +57 @rtype: String +58 """ +59 text = json.dumps(self.__dict__) +60 return text +
61 +
62 - def sameID(self, id): +
63 """ +64 Predicate method which checks if the given id is equal to the slide's +65 @param id: The id to check +66 @type id: Integer +67 @return: Whether the id matches the slide's +68 @rtype: Boolean +69 @todo: Do we I{really} need a method for this? +70 """ +71 return self.id == id +
72 +
73 - def __str__(self): +
74 return "Slide[url=" + str(self.url) + ", duration=" + str(self.duration) + ", id=" + str( +75 self.id) + ", meta=" + str(self.meta) + "]" +
76 +
77 - def __repr__(self): +
78 # Simplified output (Shown when Arrays of Slides are Printed) +79 return "Slide(" + str(self.url) + "," + str(self.duration) + ")" +
80 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.slide.Slide-class.html b/Server.Classes.slide.Slide-class.html new file mode 100644 index 0000000..e183712 --- /dev/null +++ b/Server.Classes.slide.Slide-class.html @@ -0,0 +1,428 @@ + + + + + Server.Classes.slide.Slide + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module slide :: + Class Slide + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Slide

source code

+

Class for Slide Show Slide Objects

+ +
+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ Slide + + + + + + +
__init__(self, + infoDict)
+ Slide Constructor
+ source code + +
+ +
+ String + + + + + + +
toJSON(self)
+ Returns: + A JSON Representation of the slide
+ source code + +
+ +
+ Boolean + + + + + + +
sameID(self, + id)
+ Predicate method which checks if the given id is equal to the slide's
+ source code + +
+ +
+   + + + + + + +
__str__(self) + source code + +
+ +
+   + + + + + + +
__repr__(self) + source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Static Methods[hide private]
+
+ Slide + + + + + + +
makeSlide(url, + duration, + id, + meta)
+ Slide Constructor based on the given input (instead of a dictionary)
+ source code + +
+ +
+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Variables[hide private]
+
+ Integer + + duration
+ The Duration to show the slide (in seconds) +
+ Integer + + id
+ The Slide's ID +
+ Dictionary + + meta
+ The Slide's meta content +
+ String + + url
+ The Slide's URL +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

makeSlide(url, + duration, + id, + meta) +
Static Method +

+
source code  +
+ +

Slide Constructor based on the given input (instead of a + dictionary)

+
+
Parameters:
+
    +
  • url (String) - The Slide's URL
  • +
  • duration (Integer) - The Duration to show the slide (in seconds)
  • +
  • id (Integer) - The Slide's ID
  • +
  • meta (Dictionary) - The Slide's meta content
  • +
+
Returns: Slide
+
The constructed Slide
+
+
+
+ +
+ +
+ + +
+

__init__(self, + infoDict) +
(Constructor) +

+
source code  +
+ +

Slide Constructor

+
+
Parameters:
+
    +
  • infoDict (Dictionary) - The relevant information for the slide
  • +
+
Returns: Slide
+
The constructed Slide
+
+
+
+ +
+ +
+ + +
+

toJSON(self) +

+
source code  +
+ + +
+
Returns: String
+
A JSON Representation of the slide
+
+
+
+ +
+ +
+ + +
+

sameID(self, + id) +

+
source code  +
+ +

Predicate method which checks if the given id is equal to the + slide's

+
+
Parameters:
+
    +
  • id (Integer) - The id to check
  • +
+
Returns: Boolean
+
Whether the id matches the slide's
+
+

To Do: + Do we really need a method for this? +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.socketlist-module.html b/Server.Classes.socketlist-module.html new file mode 100644 index 0000000..bada647 --- /dev/null +++ b/Server.Classes.socketlist-module.html @@ -0,0 +1,150 @@ + + + + + Server.Classes.socketlist + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module socketlist + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module socketlist

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + socketList
+ Object responsible for keeping track of all socket connections +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = None +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.socketlist-pysrc.html b/Server.Classes.socketlist-pysrc.html new file mode 100644 index 0000000..09ea15c --- /dev/null +++ b/Server.Classes.socketlist-pysrc.html @@ -0,0 +1,237 @@ + + + + + Server.Classes.socketlist + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module socketlist + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.Classes.socketlist

+
+
1 -class socketList: +
2 """ + 3 Object responsible for keeping track of all socket connections + 4 + 5 @ivar pieMap: A dictionary mapping each connected Raspberry Pi to its socket + 6 @type pieMap: Dictionary + 7 @ivar sockList: List of live Socket Connections + 8 @type sockList: Array + 9 @ivar serverSocket: Represents the Server's Listening Socket + 10 @type serverSocket: Socket + 11 @see: Python C{socket} Documentation for socket info + 12 @warning: If you're writing a plugin, you I{probably} don't need + 13 to mess with this. + 14 @copyright: Northeastern University Crew 2014 + 15 """ + 16 +
17 - def __init__(self, serverSocket): +
18 """ + 19 socketList Constructor + 20 @param serverSocket: The socket to use as the server socket + 21 @type serverSocket: Socket + 22 @return: A new empty SocketList with the given server socket + 23 @rtype: socketList + 24 """ + 25 self.pieMap = {} + 26 self.sockList = [] + 27 self.serverSocket = serverSocket +
28 +
29 - def addSocket(self, sock): +
30 """ + 31 Adds the given socket to the socketList + 32 @param sock: The socket to add + 33 @type sock: Socket + 34 @return: None + 35 @rtype: NoneType + 36 """ + 37 self.sockList.append(sock) +
38 +
39 - def mapPie(self, sock, pieName): +
40 """ + 41 Maps the given Raspberry Pi to the given socket + 42 @param sock: The socket to map the Raspberry Pi to + 43 @type sock: Socket + 44 @param pieName: The name of the Raspberry Pi + 45 @type pieName: String + 46 @return: None + 47 @rtype: NoneType + 48 """ + 49 print "mapping" + pieName + 50 self.pieMap[pieName] = sock +
51 +
52 - def removeSocket(self, sock): +
53 """ + 54 Removes the given socket to the socketList + 55 @param sock: The socket to remove + 56 @type sock: Socket + 57 @return: None + 58 @rtype: NoneType + 59 """ + 60 print "\nGood bye, " + str(self.getPie(sock)) + "!\n" + 61 sock.close() + 62 self.sockList.remove(sock) + 63 self.pieMap.pop(self.getPie(sock)) +
64 +
65 - def broadcast(self, msg, sock=None): +
66 """ + 67 Broadcasts the given message to every socket + 68 except the serverSocket and the socket provided + 69 @param msg: The message to broadcast + 70 @type msg: String + 71 @param sock: (Optional) The socket to exclude (e.g. + 72 the socket from which the broadcast + 73 originated) + 74 @type sock: Socket + 75 @return: None + 76 @rtype: NoneType + 77 """ + 78 for socket in self.sockList: + 79 print(self.getPie(socket)) + 80 if socket != self.serverSocket and socket != sock: + 81 self.sendMessage(socket, msg) +
82 +
83 - def sendMessage(self, sock, msg): +
84 """ + 85 Sends the given message to the given socket + 86 @param sock: The socket to receive the message + 87 @type sock: Socket + 88 @param msg: The message to send + 89 @type msg: String + 90 @return: None + 91 @rtype: NoneType + 92 """ + 93 print "Sending" + 94 print "Message " + str(msg) + 95 try: + 96 sock.sendall(msg) + 97 print "Message sent!" + 98 except Exception as e: + 99 # Is caught if something goes wrong. +100 # Print the exception and do +101 # any needed cleanups for the socket +102 print str(e) +103 if sock: +104 self.removeSocket(sock) +
105 +
106 - def getSock(self, pie): +
107 """ +108 Returns the socket associated with the given +109 Raspberry Pi name +110 @param pie: The name of the Raspberry Pi whose socket to retrieve +111 @type pie: String +112 @return: The socket for the given Raspberry Pi +113 @rtype: Socket +114 """ +115 try: +116 return self.pieMap[pie] +117 except: +118 print "Missing Pie:", pie +
119 +
120 - def getPie(self, sock): +
121 """ +122 Returns the Raspberry Pi associated with the given socket +123 @param sock: The socket whose Raspberry Pi to retrieve +124 @type sock: Socket +125 @return: The Raspberry Pi associated with the socket +126 @rtype: String +127 """ +128 print(len(self.pieMap)) +129 for pie, socket in self.pieMap.iteritems(): +130 if sock == socket: +131 return pie +
132 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.Classes.socketlist.socketList-class.html b/Server.Classes.socketlist.socketList-class.html new file mode 100644 index 0000000..e58049b --- /dev/null +++ b/Server.Classes.socketlist.socketList-class.html @@ -0,0 +1,557 @@ + + + + + Server.Classes.socketlist.socketList + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Package Classes :: + Module socketlist :: + Class socketList + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class socketList

source code

+

Object responsible for keeping track of all socket connections

+ +
+

See Also: + Python socket Documentation for socket info +

+

Warning: + If you're writing a plugin, you probably don't need to mess + with this. +

+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ socketList + + + + + + +
__init__(self, + serverSocket)
+ socketList Constructor
+ source code + +
+ +
+ NoneType + + + + + + +
addSocket(self, + sock)
+ Adds the given socket to the socketList
+ source code + +
+ +
+ NoneType + + + + + + +
mapPie(self, + sock, + pieName)
+ Maps the given Raspberry Pi to the given socket
+ source code + +
+ +
+ NoneType + + + + + + +
removeSocket(self, + sock)
+ Removes the given socket to the socketList
+ source code + +
+ +
+ NoneType + + + + + + +
broadcast(self, + msg, + sock=None)
+ Broadcasts the given message to every socket except the serverSocket + and the socket provided
+ source code + +
+ +
+ NoneType + + + + + + +
sendMessage(self, + sock, + msg)
+ Sends the given message to the given socket
+ source code + +
+ +
+ Socket + + + + + + +
getSock(self, + pie)
+ Returns the socket associated with the given Raspberry Pi name
+ source code + +
+ +
+ String + + + + + + +
getPie(self, + sock)
+ Returns the Raspberry Pi associated with the given socket
+ source code + +
+ +
+ + + + + + + + + + + + + + + +
+ + + + + +
Instance Variables[hide private]
+
+ Dictionary + + pieMap
+ A dictionary mapping each connected Raspberry Pi to its socket +
+ Socket + + serverSocket
+ Represents the Server's Listening Socket +
+ Array + + sockList
+ List of live Socket Connections +
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + serverSocket) +
(Constructor) +

+
source code  +
+ +

socketList Constructor

+
+
Parameters:
+
    +
  • serverSocket (Socket) - The socket to use as the server socket
  • +
+
Returns: socketList
+
A new empty SocketList with the given server socket
+
+
+
+ +
+ +
+ + +
+

addSocket(self, + sock) +

+
source code  +
+ +

Adds the given socket to the socketList

+
+
Parameters:
+
    +
  • sock (Socket) - The socket to add
  • +
+
Returns: NoneType
+
None
+
+
+
+ +
+ +
+ + +
+

mapPie(self, + sock, + pieName) +

+
source code  +
+ +

Maps the given Raspberry Pi to the given socket

+
+
Parameters:
+
    +
  • sock (Socket) - The socket to map the Raspberry Pi to
  • +
  • pieName (String) - The name of the Raspberry Pi
  • +
+
Returns: NoneType
+
None
+
+
+
+ +
+ +
+ + +
+

removeSocket(self, + sock) +

+
source code  +
+ +

Removes the given socket to the socketList

+
+
Parameters:
+
    +
  • sock (Socket) - The socket to remove
  • +
+
Returns: NoneType
+
None
+
+
+
+ +
+ +
+ + +
+

broadcast(self, + msg, + sock=None) +

+
source code  +
+ +

Broadcasts the given message to every socket except the serverSocket + and the socket provided

+
+
Parameters:
+
    +
  • msg (String) - The message to broadcast
  • +
  • sock (Socket) - (Optional) The socket to exclude (e.g. the socket from which the + broadcast originated)
  • +
+
Returns: NoneType
+
None
+
+
+
+ +
+ +
+ + +
+

sendMessage(self, + sock, + msg) +

+
source code  +
+ +

Sends the given message to the given socket

+
+
Parameters:
+
    +
  • sock (Socket) - The socket to receive the message
  • +
  • msg (String) - The message to send
  • +
+
Returns: NoneType
+
None
+
+
+
+ +
+ +
+ + +
+

getSock(self, + pie) +

+
source code  +
+ +

Returns the socket associated with the given Raspberry Pi name

+
+
Parameters:
+
    +
  • pie (String) - The name of the Raspberry Pi whose socket to retrieve
  • +
+
Returns: Socket
+
The socket for the given Raspberry Pi
+
+
+
+ +
+ +
+ + +
+

getPie(self, + sock) +

+
source code  +
+ +

Returns the Raspberry Pi associated with the given socket

+
+
Parameters:
+
    +
  • sock (Socket) - The socket whose Raspberry Pi to retrieve
  • +
+
Returns: String
+
The Raspberry Pi associated with the socket
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.WPHandler-module.html b/Server.WPHandler-module.html new file mode 100644 index 0000000..d7f1b13 --- /dev/null +++ b/Server.WPHandler-module.html @@ -0,0 +1,350 @@ + + + + + Server.WPHandler + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module WPHandler + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module WPHandler

source code

+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+ NoneType + + + + + + +
main_WPHandler_thread(inputQueue, + queues, + runtimeVars)
+ The main thread for the WordPress Handler Plugin
+ source code + +
+ +
+ NoneType + + + + + + +
handle(message, + outputQueue, + runtime)
+ WPHandler Thread Message Handler
+ source code + +
+ +
+ NoneType + + + + + + +
wpListenerStart(outboundMessageQueue)
+ Sets the given queue as the receiver for any processed POST Requests + sent out from the WordPress Server
+ source code + +
+ +
+ String + + + + + + +
querySlidesFor(pieName, + url)
+ Retrieves a JSON string containing the slides for the given Raspberry + Pi
+ source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'Server' +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

main_WPHandler_thread(inputQueue, + queues, + runtimeVars) +

+
source code  +
+ +

The main thread for the WordPress Handler Plugin

+
+
Parameters:
+
    +
  • inputQueue (Queue.Queue) - The Queue Responsible for receiving WPHandler messages
  • +
  • queues (QueueDict) - The Global Queue Dictionary
  • +
  • runtimeVars (Dictionary) - User-Specified Configuration
  • +
+
Returns: NoneType
+
None
+
+

Copyright: + Northeastern University Crew 2014 +

+
+
+ +
+ +
+ + +
+

handle(message, + outputQueue, + runtime) +

+
source code  +
+ +

WPHandler Thread Message Handler

+
+
Parameters:
+
    +
  • message (Message) - The received message
  • +
  • outputQueue (Queue.Queue) - The queue to output any response to
  • +
  • runtime (Dictionary) - User-Specified Configuration
  • +
+
Returns: NoneType
+
None
+
+
+
+ +
+ +
+ + +
+

wpListenerStart(outboundMessageQueue) +

+
source code  +
+ +

Sets the given queue as the receiver for any processed POST Requests + sent out from the WordPress Server

+
+
Parameters:
+
    +
  • outboundMessageQueue (Queue.Queue) - The queue to receive WordPress Messages
  • +
+
Returns: NoneType
+
None
+
+
+
+ +
+ +
+ + +
+

querySlidesFor(pieName, + url) +

+
source code  +
+ +

Retrieves a JSON string containing the slides for the given Raspberry + Pi

+
+
Parameters:
+
    +
  • pieName (String) - The name of the Raspberry Pi whose slides to retrieve
  • +
  • url (String) - The Base URL of the WordPress Site
  • +
+
Returns: String
+
A JSON Representation of the given Raspberry Pi's slides
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.WPHandler-pysrc.html b/Server.WPHandler-pysrc.html new file mode 100644 index 0000000..40fe3f9 --- /dev/null +++ b/Server.WPHandler-pysrc.html @@ -0,0 +1,191 @@ + + + + + Server.WPHandler + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module WPHandler + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.WPHandler

+
+ 1  import urllib2 
+ 2   
+ 3  from Classes.message import Message 
+ 4  import wpPush 
+ 5   
+ 6   
+
7 -def main_WPHandler_thread(inputQueue, queues, runtimeVars): +
8 """ + 9 The main thread for the WordPress Handler Plugin +10 @param inputQueue: The Queue Responsible for receiving WPHandler messages +11 @type inputQueue: Queue.Queue +12 @param queues: The Global Queue Dictionary +13 @type queues: QueueDict +14 @param runtimeVars: User-Specified Configuration +15 @type runtimeVars: Dictionary +16 @return: None +17 @rtype: NoneType +18 @copyright: Northeastern University Crew 2014 +19 """ +20 while True: +21 if not inputQueue.empty(): +22 print "WPListener received a message" +23 message = inputQueue.get() +24 handle(message, queues["socketServer"], runtimeVars) +
25 +26 +
27 -def handle(message, outputQueue, runtime): +
28 """ +29 WPHandler Thread Message Handler +30 @param message: The received message +31 @type message: Message +32 @param outputQueue: The queue to output any response to +33 @type outputQueue: Queue.Queue +34 @param runtime: User-Specified Configuration +35 @type runtime: Dictionary +36 @return: None +37 @rtype: NoneType +38 """ +39 if message["action"] == "querySlides": +40 pieName = message["src"] +41 jsonToSend = querySlidesFor(pieName, runtime["server"]) +42 message = Message("WPHandler", pieName, "slideShow", "load-slides", jsonToSend) +43 print "Wp sending message" +44 outputQueue.put(message) +
45 +46 +
47 -def wpListenerStart(outboundMessageQueue): +
48 """ +49 Sets the given queue as the receiver for any processed POST +50 Requests sent out from the WordPress Server +51 @param outboundMessageQueue: The queue to receive WordPress Messages +52 @type outboundMessageQueue: Queue.Queue +53 @return: None +54 @rtype: NoneType +55 """ +56 print "Starting http POST server for wp updates" +57 wpPush.writeOut = outboundMessageQueue +
58 +59 +
60 -def querySlidesFor(pieName, url): +
61 """ +62 Retrieves a JSON string containing the slides for the +63 given Raspberry Pi +64 @param pieName: The name of the Raspberry Pi whose slides to retrieve +65 @type pieName: String +66 @param url: The Base URL of the WordPress Site +67 @type url: String +68 @return: A JSON Representation of the given Raspberry Pi's slides +69 @rtype: String +70 """ +71 url = "https://" + url + "/wp-admin/admin-ajax.php?action=dds_api&pie_name=" + pieName +72 jsonString = str(urllib2.urlopen(url).read().decode("utf-8")) +73 print "Slides for " + pieName + ": " + jsonString +74 return jsonString +
75 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.logging-module.html b/Server.logging-module.html new file mode 100644 index 0000000..91b414d --- /dev/null +++ b/Server.logging-module.html @@ -0,0 +1,228 @@ + + + + + Server.logging + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module logging + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module logging

source code

+ + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+ None + + + + + + +
logging_thread(input_queue, + runtimeVars)
+ Logs the given Queue to the syslog
+ source code + +
+ +
+ None + + + + + + +
log(queue, + mes)
+ Logs the given message in the given log
+ source code + +
+ +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

logging_thread(input_queue, + runtimeVars) +

+
source code  +
+ +

Logs the given Queue to the syslog

+
+
Parameters:
+
    +
  • input_queue (QueueDict) - Queue from which to read
  • +
  • runtimeVars (Dictionary) - User-Defined Configuration File Contents
  • +
+
Returns: None
+
None
+
+

Copyright: + Northeastern University Crew 2014 +

+
+
+ +
+ +
+ + +
+

log(queue, + mes) +

+
source code  +
+ +

Logs the given message in the given log

+
+
Parameters:
+
    +
  • queue (Queue.Queue) - Logging queue to pass message to
  • +
  • mes - Message to pass
  • +
+
Returns: None
+
None
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.logging-pysrc.html b/Server.logging-pysrc.html new file mode 100644 index 0000000..609db01 --- /dev/null +++ b/Server.logging-pysrc.html @@ -0,0 +1,148 @@ + + + + + Server.logging + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module logging + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.logging

+
+ 1  from Classes.message import Message 
+ 2   
+ 3  import syslog 
+ 4   
+ 5   
+
6 -def logging_thread(input_queue, runtimeVars): +
7 """ + 8 Logs the given Queue to the syslog + 9 @param input_queue: Queue from which to read +10 @type input_queue: QueueDict +11 @param runtimeVars: User-Defined Configuration File Contents +12 @type runtimeVars: Dictionary +13 @return: None +14 @rtype: None +15 @copyright: Northeastern University Crew 2014 +16 """ +17 while True: +18 if not input_queue.empty(): +19 currentMessage = input_queue.get() +20 for key in currentMessage.content: +21 msg = "PIE: " + currentMessage.src + ": " + currentMessage.content[key] +22 syslog.syslog(syslog.LOG_ERR, msg) +
23 +24 +
25 -def log(queue, mes): +
26 """ +27 Logs the given message in the given log +28 @param queue: Logging queue to pass message to +29 @type queue: Queue.Queue +30 @param mes: Message to pass +31 @return: None +32 @rtype: None +33 """ +34 newLog = Message("Main", "Logging", "Logger", "log", {}) +35 newLog.add_content("1", mes) +36 queue.put(newLog) +
37 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.main-module.html b/Server.main-module.html new file mode 100644 index 0000000..8540e2f --- /dev/null +++ b/Server.main-module.html @@ -0,0 +1,227 @@ + + + + + Server.main + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module main + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module main

source code

+ + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+ NoneType + + + + + + +
main()
+ Main server function (manages threads, queues, etc.)
+ source code + +
+ +
+ NoneType + + + + + + +
terminate(queues)
+ Sends a terminate message to the threads listening to the given + queues
+ source code + +
+ +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

main() +

+
source code  +
+ +

Main server function (manages threads, queues, etc.)

+
+
Returns: NoneType
+
None
+
+

Copyright: + Northeastern University Crew 2014 +

+
+
+ +
+ +
+ + +
+

terminate(queues) +

+
source code  +
+ +

Sends a terminate message to the threads listening to the given + queues

+
+
Parameters:
+
    +
  • queues (Dictionary) - The list of queues to terminate
  • +
+
Returns: NoneType
+
None
+
+

Note: + I added this 'queues' parameter since, as it was written, + Queues.Queues was out of scope for this function. I *believe* the + way I added its call above replicates the desired behavior. If not, + please fix. If so, please remove this message. -<Philip (11 Dec + 2014)> +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.main-pysrc.html b/Server.main-pysrc.html new file mode 100644 index 0000000..3559841 --- /dev/null +++ b/Server.main-pysrc.html @@ -0,0 +1,241 @@ + + + + + Server.main + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module main + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.main

+
+ 1  #!/usr/bin/python 
+ 2  # General Imports 
+ 3  import Queue 
+ 4  import thread 
+ 5   
+ 6  # Import Classes 
+ 7  from Classes.message import Message 
+ 8  from Classes.QueueDict import QueueDict 
+ 9  from Classes.ThreadDict import ThreadDict 
+10  from Classes.ConfigParser import ConfigParser 
+11   
+12  # Import functions 
+13  from plugin import plugin 
+14  from logging import log 
+15   
+16  # Import children 
+17  from logging import logging_thread 
+18   
+19   
+
20 -def main(): +
21 """ +22 Main server function (manages threads, queues, etc.) +23 @return: None +24 @rtype: NoneType +25 @copyright: Northeastern University Crew 2014 +26 """ +27 # Will be generated from config files +28 runtimeVars = ConfigParser.readConfig() +29 +30 # Set up individual queues +31 Queues = QueueDict() +32 Threads = ThreadDict() +33 plugin(Threads, Queues) +34 Queues.Queues["Logging"] = Queue.Queue(100) +35 Queues.Queues["Main"] = Queue.Queue(100) +36 +37 # Order of Queues passed to functions: +38 # Queue passing data into function, +39 # Queue passing data from function to Main, +40 # Queue for logging function +41 thread.start_new_thread(logging_thread, (Queues.Queues["Logging"], runtimeVars)) +42 for Thread in Threads.Threads: +43 log(Queues.Queues["Logging"], "Starting thread" + Thread) +44 thread.start_new_thread(Threads.Threads[Thread], (Queues.Queues[Thread], Queues, runtimeVars)) +45 +46 Run = True +47 # Forwards messages to appropriate queues and runs appropriate functions +48 while Run: +49 log(Queues.Queues["Logging"], "Empty Log") +50 while not Queues.Queues["Main"].empty(): +51 log(Queues.Queues["Logging"], "Entries in Log") +52 currentMessage = Queues.Queues["Main"].get() +53 if "Terminate" in currentMessage.content: +54 log(Queues.Queues["Logging"], "Terminating") +55 # Terminate all children threads +56 terminate(Queues.Queues) +57 Run = False +58 break +
59 +60 +
61 -def terminate(queues): +
62 """ +63 Sends a terminate message to the threads +64 listening to the given queues +65 @param queues: The list of queues to terminate +66 @type queues: Dictionary +67 @return: None +68 @rtype: NoneType +69 @note: I added this 'queues' parameter since, as it was written, +70 Queues.Queues was out of scope for this function. I *believe* +71 the way I added its call above replicates the desired +72 behavior. If not, please fix. If so, please remove this +73 message. -<Philip (11 Dec 2014)> +74 """ +75 terminateMes = Message("Main", "All", "All", "Terminate", {}) +76 terminateMes.add_content("Terminate", True) +77 for queue in queues: +78 queue.put(terminateMes) +
79 +80 # TODO: Replace with argparse library +81 if __name__ == "__main__": +82 main() +83 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.plugin-module.html b/Server.plugin-module.html new file mode 100644 index 0000000..559b8d7 --- /dev/null +++ b/Server.plugin-module.html @@ -0,0 +1,214 @@ + + + + + Server.plugin + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module plugin + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module plugin

source code

+ + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+ NoneType + + + + + + +
plugin(Threads, + Queues)
+ Adds plugin threads to the given ThreadDict and adds their message + Queues to the given QueueDict
+ source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'Server' +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

plugin(Threads, + Queues) +

+
source code  +
+ +

Adds plugin threads to the given ThreadDict and adds their message + Queues to the given QueueDict

+
+
Parameters:
+
    +
  • Threads (ThreadDict) - The ThreadDict to contain the plugins' threads
  • +
  • Queues (QueueDict) - The QueueDict to contain the plugins' message queues
  • +
+
Returns: NoneType
+
None
+
+

To Do: + Abstract this out so that the plugin names aren't hardcoded (At least + on the Server end. We'll see what the Pis can handle) +

+

Copyright: + Northeastern University Crew 2014 +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.plugin-pysrc.html b/Server.plugin-pysrc.html new file mode 100644 index 0000000..b0054fb --- /dev/null +++ b/Server.plugin-pysrc.html @@ -0,0 +1,128 @@ + + + + + Server.plugin + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module plugin + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.plugin

+
+ 1  # Import the threads for the plugins 
+ 2  from socketServer import main_socketServer_thread 
+ 3  from WPHandler import main_WPHandler_thread 
+ 4   
+ 5   
+ 6  # TODO: (See docstring) 
+
7 -def plugin(Threads, Queues): +
8 """ + 9 Adds plugin threads to the given ThreadDict and +10 adds their message Queues to the given QueueDict +11 @param Threads: The ThreadDict to contain the plugins' threads +12 @type Threads: ThreadDict +13 @param Queues: The QueueDict to contain the plugins' message queues +14 @type Queues: QueueDict +15 @return: None +16 @rtype: NoneType +17 @todo: Abstract this out so that the plugin names aren't hardcoded +18 (At least on the Server end. We'll see what the Pis can handle) +19 @copyright: Northeastern University Crew 2014 +20 """ +21 Threads.addThread("socketServer", main_socketServer_thread, Queues) +22 Threads.addThread("WPHandler", main_WPHandler_thread, Queues) +
23 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.socketServer-module.html b/Server.socketServer-module.html new file mode 100644 index 0000000..4dbd318 --- /dev/null +++ b/Server.socketServer-module.html @@ -0,0 +1,350 @@ + + + + + Server.socketServer + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module socketServer + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module socketServer

source code

+ + + + + + + + + + + + + + + + + + +
+ + + + + +
Functions[hide private]
+
+ Dictionary + + + + + + +
connect(**kwargs)
+ Handles any new connections
+ source code + +
+ +
+ NoneType + + + + + + +
main_socketServer_thread(inputQueue, + Queues, + runtimeVars)
+ Socket Server Primary Thread Function
+ source code + +
+ +
+ NoneType + + + + + + +
socketServer(connection, + Queues, + server_socket, + RECV_BUFFER)
+ The socket server implementation
+ source code + +
+ +
+ None + + + + + + +
log(queue, + mes)
+ Logs the given message
+ source code + +
+ +
+ + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + __package__ = 'Server' +
+ + + + + + +
+ + + + + +
Function Details[hide private]
+
+ +
+ +
+ + +
+

connect(**kwargs) +

+
source code  +
+ +

Handles any new connections

+
+
Parameters:
+
    +
  • kwargs (Dictionary) - Needed information for the connection
  • +
+
Returns: Dictionary
+
The updated parameters of the parameters used to call it
+
+
+
+ +
+ +
+ + +
+

main_socketServer_thread(inputQueue, + Queues, + runtimeVars) +

+
source code  +
+ +

Socket Server Primary Thread Function

+
+
Parameters:
+
    +
  • inputQueue (Queue.Queue) - Socket server's message queue (Unused, included to conform to + plugin thread API)
  • +
  • Queues (QueueDict) - Global queue list
  • +
  • runtimeVars (Dictionary) - User-defined configurations
  • +
+
Returns: NoneType
+
None
+
+

Copyright: + Northeastern University Crew 2014 +

+
+
+ +
+ +
+ + +
+

socketServer(connection, + Queues, + server_socket, + RECV_BUFFER) +

+
source code  +
+ +

The socket server implementation

+
+
Parameters:
+
    +
  • connection (socketList) - The socketServer's socket connection
  • +
  • Queues (QueueDict) - The global list of queues
  • +
  • server_socket (Socket) - The server's local socket
  • +
  • RECV_BUFFER (Integer) - The socket read buffer size
  • +
+
Returns: NoneType
+
None
+
+
+
+ +
+ +
+ + +
+

log(queue, + mes) +

+
source code  +
+ +

Logs the given message

+
+
Parameters:
+
    +
  • queue (Queue.Queue) - The Logger's message queue
  • +
  • mes - The message to log
  • +
+
Returns: None
+
None
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.socketServer-pysrc.html b/Server.socketServer-pysrc.html new file mode 100644 index 0000000..757f967 --- /dev/null +++ b/Server.socketServer-pysrc.html @@ -0,0 +1,252 @@ + + + + + Server.socketServer + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module socketServer + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.socketServer

+
+  1  #!/usr/bin/python 
+  2   
+  3  import socket 
+  4  import select 
+  5  import json 
+  6  import thread 
+  7   
+  8  from Classes.socketlist import socketList 
+  9  from Classes.message import Message 
+ 10  from WPHandler import wpListenerStart 
+ 11   
+ 12   
+
13 -def connect(**kwargs): +
14 """ + 15 Handles any new connections + 16 @param kwargs: Needed information for the connection + 17 @type kwargs: Dictionary + 18 @return: The updated parameters of the parameters used to call it + 19 @rtype: Dictionary + 20 """ + 21 pie = kwargs["currentMessage"]["src"] + 22 kwargs["connection"].mapPie(kwargs["sock"], pie) + 23 return kwargs +
24 + 25 +
26 -def main_socketServer_thread(inputQueue, Queues, runtimeVars): +
27 """ + 28 Socket Server Primary Thread Function + 29 @param inputQueue: Socket server's message queue (Unused, included to conform to plugin thread API) + 30 @type inputQueue: Queue.Queue + 31 @param Queues: Global queue list + 32 @type Queues: QueueDict + 33 @param runtimeVars: User-defined configurations + 34 @type runtimeVars: Dictionary + 35 @return: None + 36 @rtype: NoneType + 37 @copyright: Northeastern University Crew 2014 + 38 """ + 39 # List to keep track of socket descriptors + 40 RECV_BUFFER = 4096 # Advisable to keep it as a power of 2 + 41 PORT = int(runtimeVars["port"]) + 42 + 43 server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + 44 server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) + 45 server_socket.bind(("0.0.0.0", PORT)) + 46 server_socket.listen(10) + 47 + 48 # Add server socket to the list of readable connections + 49 connection = socketList(server_socket) + 50 connection.addSocket(server_socket) + 51 wpListenerStart(Queues["socketServer"]) + 52 + 53 log(Queues["Logging"], "Socket server started on port " + str(PORT)) + 54 thread.start_new_thread(socketServer, (connection, Queues, server_socket, RECV_BUFFER)) + 55 + 56 while True: + 57 if not Queues["socketServer"].empty(): + 58 log(Queues["Logging"], "Message in Queue") + 59 currentMessage = Queues["socketServer"].get() + 60 connection.sendMessage(connection.getSock(currentMessage.dest), currentMessage.toJSON() + "\v") +
61 + 62 +
63 -def socketServer(connection, Queues, server_socket, RECV_BUFFER): +
64 """ + 65 The socket server implementation + 66 @param connection: The socketServer's socket connection + 67 @type connection: socketList + 68 @param Queues: The global list of queues + 69 @type Queues: QueueDict + 70 @param server_socket: The server's local socket + 71 @type server_socket: Socket + 72 @param RECV_BUFFER: The socket read buffer size + 73 @type RECV_BUFFER: Integer + 74 @return: None + 75 @rtype: NoneType + 76 """ + 77 # Wrapper to log to Logging Queue + 78 write_log = lambda s: log(Queues["Logging"], str(s) + '\n') + 79 + 80 while True: + 81 write_log("pieMap: " + str(connection.pieMap)) + 82 write_log("sockList: " + str(connection.sockList)) + 83 read_sockets, write_sockets, error_sockets = select.select(connection.sockList, [], []) + 84 for sock in read_sockets: + 85 write_log(read_sockets) + 86 if sock == server_socket: + 87 # Handle the case in which there is a new connections + 88 # received through server_socket + 89 sockfd, addr = server_socket.accept() + 90 connection.addSocket(sockfd) + 91 write_log("Client Connected " + str(addr)) + 92 else: + 93 data = sock.recv(RECV_BUFFER) + 94 write_log(data) + 95 if data == "": + 96 write_log("No Data Received on Socket %s. Removing." % str(sock)) + 97 connection.removeSocket(sock) + 98 else: + 99 currentMessage = json.loads(data) +100 if not currentMessage["pluginDest"] == "socketServer": +101 write_log("Placing message in destination: " + currentMessage["pluginDest"]) +102 Queues[currentMessage["pluginDest"]].put(Message.fromJSON(currentMessage)) +103 else: +104 write_log("Connecting") +105 connect(connection=connection, currentMessage=currentMessage, pieMap=connection.pieMap, +106 sock=sock) +107 write_log("Finished connection...") +
108 +109 +110 # TODO: Deal with the fact that we have multiple log() definitions across our codebase... +
111 -def log(queue, mes): +
112 """ +113 Logs the given message +114 @param queue: The Logger's message queue +115 @type queue: Queue.Queue +116 @param mes: The message to log +117 @return: None +118 @rtype: None +119 """ +120 newLog = Message("Socket", "Logging", "Logger", "log", {}) +121 newLog.add_content("1", mes) +122 queue.put(newLog) +
123 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.wpPush-module.html b/Server.wpPush-module.html new file mode 100644 index 0000000..a10f5f3 --- /dev/null +++ b/Server.wpPush-module.html @@ -0,0 +1,177 @@ + + + + + Server.wpPush + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module wpPush + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Module wpPush

source code

+ + + + + + + + + +
+ + + + + +
Classes[hide private]
+
+   + + RequestHandler
+ Handler Class for any requests received from WordPress +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Variables[hide private]
+
+   + + ADDR = '0.0.0.0' +
+   + + PORT = 12345 +
+   + + writeOut = None +
+   + + httpd = HTTPServer((ADDR, PORT), RequestHandler) +
+   + + __package__ = 'Server' +
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.wpPush-pysrc.html b/Server.wpPush-pysrc.html new file mode 100644 index 0000000..0f63b70 --- /dev/null +++ b/Server.wpPush-pysrc.html @@ -0,0 +1,197 @@ + + + + + Server.wpPush + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module wpPush + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module Server.wpPush

+
+ 1  from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer 
+ 2  import json 
+ 3  import thread 
+ 4   
+ 5  from Classes.message import Message 
+ 6   
+ 7   
+ 8  # Defaults 
+ 9  ADDR = "0.0.0.0" 
+10  PORT = 12345 
+11  writeOut = None 
+12   
+13   
+14  #Expecting to receive something of the form 
+15  #{ 
+16  #    "datetime" : "2014-11-30T22:04:15+00:00", # ISO 8601, Timestamp of this push 
+17  #    "action" : "add-slide", 
+18  #    "pies" : [ 
+19  #        { "name" : "shepard" }, 
+20  #        { "name" : "blueberry" }, # allows adding of new fields later on down the road 
+21  #    ], 
+22  #    "content"  : { # should definitely be an object for flex and forward compatibility 
+23  #        "ID" : 14, # WordPress Post ID 
+24  #        "Permalink" : "http://dds-wp..." # The URL to the Post; does not append 
+25  #                                         # ?pie=name or anything fancy, just the permalink 
+26  #        # ... All other WordPress Post Fields... basically json_encode( get_post( $post_id ) ) 
+27  # 
+28  #        # ... and then the post meta for plugins and other cool add-ons 
+29  #        "meta" : { 
+30  #            "key1" : [ "value" ], 
+31  #            "key2" : [ 
+32  #                "value1", 
+33  #                "value2", 
+34  #                3, 
+35  #                { 
+36  #                    "meta can be weird" : "remember that" 
+37  #                } 
+38  #            ] 
+39  #        } 
+40  #    } 
+41  #} 
+42   
+43   
+44   
+
45 -class RequestHandler(BaseHTTPRequestHandler): +
46 """ +47 Handler Class for any requests received from WordPress +48 @copyright: Northeastern University Crew 2014 +49 """ +50 +
51 - def do_POST(self): +
52 """ +53 Handles received POST requests +54 @return: None +55 @rtype: NoneType +56 """ +57 # writeOut is set externally to be the +58 # socketServer Message Queue +59 global writeOut +60 if writeOut == None: +61 # Receiving Queue has not been set +62 print "(RequestHandler): writeOut is none. Returning." +63 return +64 if 'content-length' not in self.headers: +65 # Malformed Header; content-length needed to know how many bytes to read +66 print 'ERROR(RequestHandler): No content-length in post request, exiting' +67 return +68 +69 # Read in the request +70 data = self.rfile.read(int(self.headers.getheader('content-length'))) +71 +72 # Log the request +73 print "Http received POST: " + str(data) +74 +75 # Parse the request into JSON +76 info = json.loads(data) +77 +78 for pie in info["pies"]: +79 writeOut.put( +80 Message("wpPush", pie["name"], "slideShow", info["action"], json.dumps(info["content"]), +81 info["datetime"])) +
82 +83 # Start the HTTP Server to receive any POST requests +84 # (Note: Python Server's Address set within WordPress Configuration) +85 httpd = HTTPServer((ADDR, PORT), RequestHandler) +86 thread.start_new_thread(httpd.serve_forever, ()) +87 +
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server.wpPush.RequestHandler-class.html b/Server.wpPush.RequestHandler-class.html new file mode 100644 index 0000000..2442c5e --- /dev/null +++ b/Server.wpPush.RequestHandler-class.html @@ -0,0 +1,282 @@ + + + + + Server.wpPush.RequestHandler + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package Server :: + Module wpPush :: + Class RequestHandler + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class RequestHandler

source code

+
+SocketServer.BaseRequestHandler --+        
+                                  |        
+  SocketServer.StreamRequestHandler --+    
+                                      |    
+  BaseHTTPServer.BaseHTTPRequestHandler --+
+                                          |
+                                         RequestHandler
+
+ +
+

Handler Class for any requests received from WordPress

+ +
+

Copyright: + Northeastern University Crew 2014 +

+
+ + + + + + + + +
+ + + + + +
Nested Classes[hide private]
+
+

Inherited from BaseHTTPServer.BaseHTTPRequestHandler: + MessageClass +

+
+ + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+ NoneType + + + + + + +
do_POST(self)
+ Handles received POST requests
+ source code + +
+ +
+

Inherited from BaseHTTPServer.BaseHTTPRequestHandler: + address_string, + date_time_string, + end_headers, + handle, + handle_one_request, + log_date_time_string, + log_error, + log_message, + log_request, + parse_request, + send_error, + send_header, + send_response, + version_string +

+

Inherited from SocketServer.StreamRequestHandler: + finish, + setup +

+

Inherited from SocketServer.BaseRequestHandler: + __init__ +

+
+ + + + + + + + + +
+ + + + + +
Class Variables[hide private]
+
+

Inherited from BaseHTTPServer.BaseHTTPRequestHandler: + default_request_version, + error_content_type, + error_message_format, + monthname, + protocol_version, + responses, + server_version, + sys_version, + weekdayname +

+

Inherited from SocketServer.StreamRequestHandler: + disable_nagle_algorithm, + rbufsize, + timeout, + wbufsize +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

do_POST(self) +

+
source code  +
+ +

Handles received POST requests

+
+
Returns: NoneType
+
None
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Server/Classes b/Server/Classes deleted file mode 120000 index e2330e5..0000000 --- a/Server/Classes +++ /dev/null @@ -1 +0,0 @@ -../Client/Classes/ \ No newline at end of file diff --git a/Server/Configs/PIE.conf b/Server/Configs/PIE.conf deleted file mode 100644 index 69dc73d..0000000 --- a/Server/Configs/PIE.conf +++ /dev/null @@ -1,7 +0,0 @@ -[SlideRequests] -server = 127.0.0.1/ -name = default -port = 5000 -[Display] -width = 1280 -height = 720 diff --git a/Server/README.md b/Server/README.md deleted file mode 100644 index 79f05cb..0000000 --- a/Server/README.md +++ /dev/null @@ -1,8 +0,0 @@ -Server Functionality -===================== - -Server will be a multi threaded program that will take inputs from the WP server as well as messages from the Clients. It will pass the appropriate data from the WP server to the appropriate Client as well as pass requests from the clients to the WP server - -The "Socket Server" thread listens for messages from the client as well as send messages to the appropriate client when receiving a post from the WP server - -The "WPHandler" thread listens for posts from the WP server and pass it to the socket server to send to the pies \ No newline at end of file diff --git a/Server/WPHandler.py b/Server/WPHandler.py deleted file mode 100644 index 36b979a..0000000 --- a/Server/WPHandler.py +++ /dev/null @@ -1,74 +0,0 @@ -import urllib2 - -from Classes.message import Message -import wpPush - - -def main_WPHandler_thread(inputQueue, queues, runtimeVars): - """ - The main thread for the WordPress Handler Plugin - @param inputQueue: The Queue Responsible for receiving WPHandler messages - @type inputQueue: Queue.Queue - @param queues: The Global Queue Dictionary - @type queues: QueueDict - @param runtimeVars: User-Specified Configuration - @type runtimeVars: Dictionary - @return: None - @rtype: NoneType - @copyright: Northeastern University Crew 2014 - """ - while True: - if not inputQueue.empty(): - print "WPListener received a message" - message = inputQueue.get() - handle(message, queues["socketServer"], runtimeVars) - - -def handle(message, outputQueue, runtime): - """ - WPHandler Thread Message Handler - @param message: The received message - @type message: Message - @param outputQueue: The queue to output any response to - @type outputQueue: Queue.Queue - @param runtime: User-Specified Configuration - @type runtime: Dictionary - @return: None - @rtype: NoneType - """ - if message["action"] == "load-slides": - pieName = message["src"] - jsonToSend = querySlidesFor(pieName, runtime["server"]) - message = Message("WPHandler", pieName, "slideShow", "load-slides", jsonToSend) - print "Wp sending message" - outputQueue.put(message) - - -def wpListenerStart(outboundMessageQueue): - """ - Sets the given queue as the receiver for any processed POST - Requests sent out from the WordPress Server - @param outboundMessageQueue: The queue to receive WordPress Messages - @type outboundMessageQueue: Queue.Queue - @return: None - @rtype: NoneType - """ - print "Starting http POST server for wp updates" - wpPush.writeOut = outboundMessageQueue - - -def querySlidesFor(pieName, url): - """ - Retrieves a JSON string containing the slides for the - given Raspberry Pi - @param pieName: The name of the Raspberry Pi whose slides to retrieve - @type pieName: String - @param url: The Base URL of the WordPress Site - @type url: String - @return: A JSON Representation of the given Raspberry Pi's slides - @rtype: String - """ - url = "https://" + url + "/wp-admin/admin-ajax.php?action=dds_api&pie_name=" + pieName - jsonString = str(urllib2.urlopen(url).read().decode("utf-8")) - print "Slides for " + pieName + ": " + jsonString - return jsonString diff --git a/Server/__init__.py b/Server/__init__.py deleted file mode 100644 index 14082ec..0000000 --- a/Server/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# Exists solely for documentation-generating purposes \ No newline at end of file diff --git a/Server/logging.py b/Server/logging.py deleted file mode 100644 index 3d63507..0000000 --- a/Server/logging.py +++ /dev/null @@ -1,36 +0,0 @@ -from Classes.message import Message - -import syslog - - -def logging_thread(input_queue, runtimeVars): - """ - Logs the given Queue to the syslog - @param input_queue: Queue from which to read - @type input_queue: QueueDict - @param runtimeVars: User-Defined Configuration File Contents - @type runtimeVars: Dictionary - @return: None - @rtype: None - @copyright: Northeastern University Crew 2014 - """ - while True: - if not input_queue.empty(): - currentMessage = input_queue.get() - for key in currentMessage.content: - msg = "PIE: " + currentMessage.src + ": " + currentMessage.content[key] - syslog.syslog(syslog.LOG_ERR, msg) - - -def log(queue, mes): - """ - Logs the given message in the given log - @param queue: Logging queue to pass message to - @type queue: Queue.Queue - @param mes: Message to pass - @return: None - @rtype: None - """ - newLog = Message("Main", "Logging", "Logger", "log", {}) - newLog.add_content("1", mes) - queue.put(newLog) \ No newline at end of file diff --git a/Server/main.py b/Server/main.py deleted file mode 100755 index ea9cc88..0000000 --- a/Server/main.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/python -# General Imports -import Queue -import thread - -# Import Classes -from Classes.message import Message -from Classes.QueueDict import QueueDict -from Classes.ThreadDict import ThreadDict -from Classes.ConfigParser import ConfigParser - -# Import functions -from plugin import plugin -from logging import log - -# Import children -from logging import logging_thread - - -def main(): - """ - Main server function (manages threads, queues, etc.) - @return: None - @rtype: NoneType - @copyright: Northeastern University Crew 2014 - """ - # Will be generated from config files - runtimeVars = ConfigParser.readConfig() - - # Set up individual queues - Queues = QueueDict() - Threads = ThreadDict() - plugin(Threads, Queues) - Queues.Queues["Logging"] = Queue.Queue(100) - Queues.Queues["Main"] = Queue.Queue(100) - - # Order of Queues passed to functions: - # Queue passing data into function, - # Queue passing data from function to Main, - # Queue for logging function - thread.start_new_thread(logging_thread, (Queues.Queues["Logging"], runtimeVars)) - for Thread in Threads.Threads: - log(Queues.Queues["Logging"], "Starting thread" + Thread) - thread.start_new_thread(Threads.Threads[Thread], (Queues.Queues[Thread], Queues, runtimeVars)) - - Run = True - # Forwards messages to appropriate queues and runs appropriate functions - while Run: - log(Queues.Queues["Logging"], "Empty Log") - while not Queues.Queues["Main"].empty(): - log(Queues.Queues["Logging"], "Entries in Log") - currentMessage = Queues.Queues["Main"].get() - if "Terminate" in currentMessage.content: - log(Queues.Queues["Logging"], "Terminating") - # Terminate all children threads - terminate(Queues.Queues) - Run = False - break - - -def terminate(queues): - """ - Sends a terminate message to the threads - listening to the given queues - @param queues: The list of queues to terminate - @type queues: Dictionary - @return: None - @rtype: NoneType - @note: I added this 'queues' parameter since, as it was written, - Queues.Queues was out of scope for this function. I *believe* - the way I added its call above replicates the desired - behavior. If not, please fix. If so, please remove this - message. - - """ - terminateMes = Message("Main", "All", "All", "Terminate", {}) - terminateMes.add_content("Terminate", True) - for queue in queues: - queue.put(terminateMes) - -# TODO: Replace with argparse library -if __name__ == "__main__": - main() diff --git a/Server/plugin.py b/Server/plugin.py deleted file mode 100644 index fb099d8..0000000 --- a/Server/plugin.py +++ /dev/null @@ -1,22 +0,0 @@ -# Import the threads for the plugins -from socketServer import main_socketServer_thread -from WPHandler import main_WPHandler_thread - - -# TODO: (See docstring) -def plugin(Threads, Queues): - """ - Adds plugin threads to the given ThreadDict and - adds their message Queues to the given QueueDict - @param Threads: The ThreadDict to contain the plugins' threads - @type Threads: ThreadDict - @param Queues: The QueueDict to contain the plugins' message queues - @type Queues: QueueDict - @return: None - @rtype: NoneType - @todo: Abstract this out so that the plugin names aren't hardcoded - (At least on the Server end. We'll see what the Pis can handle) - @copyright: Northeastern University Crew 2014 - """ - Threads.addThread("socketServer", main_socketServer_thread, Queues) - Threads.addThread("WPHandler", main_WPHandler_thread, Queues) diff --git a/Server/socketServer.py b/Server/socketServer.py deleted file mode 100755 index c7dfc69..0000000 --- a/Server/socketServer.py +++ /dev/null @@ -1,126 +0,0 @@ -#!/usr/bin/python - -import socket -import select -import json -import thread - -from Classes.socketlist import socketList -from Classes.message import Message -from WPHandler import wpListenerStart - - -def connect(**kwargs): - """ - Handles any new connections - @param kwargs: Needed information for the connection - @type kwargs: Dictionary - @return: The updated parameters of the parameters used to call it - @rtype: Dictionary - """ - pie = kwargs["currentMessage"]["src"] - kwargs["connection"].mapPie(kwargs["sock"], pie) - return kwargs - - -def main_socketServer_thread(inputQueue, Queues, runtimeVars): - """ - Socket Server Primary Thread Function - @param inputQueue: Socket server's message queue (Unused, included to conform to plugin thread API) - @type inputQueue: Queue.Queue - @param Queues: Global queue list - @type Queues: QueueDict - @param runtimeVars: User-defined configurations - @type runtimeVars: Dictionary - @return: None - @rtype: NoneType - @copyright: Northeastern University Crew 2014 - """ - # List to keep track of socket descriptors - RECV_BUFFER = 4096 # Advisable to keep it as a power of 2 - PORT = int(runtimeVars["port"]) - - server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - server_socket.bind(("0.0.0.0", PORT)) - server_socket.listen(10) - - # Add server socket to the list of readable connections - connection = socketList(server_socket) - connection.addSocket(server_socket) - wpListenerStart(Queues["socketServer"]) - - log(Queues["Logging"], "Socket server started on port " + str(PORT)) - thread.start_new_thread(socketServer, (connection, Queues, server_socket, RECV_BUFFER)) - - while True: - if not Queues["socketServer"].empty(): - log(Queues["Logging"], "Message in Queue") - currentMessage = Queues["socketServer"].get() - connection.sendMessage(connection.getSock(currentMessage.dest), currentMessage.toJSON() + "\v") - - -def socketServer(connection, Queues, server_socket, RECV_BUFFER): - """ - The socket server implementation - @param connection: The socketServer's socket connection - @type connection: socketList - @param Queues: The global list of queues - @type Queues: QueueDict - @param server_socket: The server's local socket - @type server_socket: Socket - @param RECV_BUFFER: The socket read buffer size - @type RECV_BUFFER: Integer - @return: None - @rtype: NoneType - """ - # Wrapper to log to Logging Queue - write_log = lambda s: log(Queues["Logging"], str(s) + '\n') - - while True: - write_log("pieMap: " + str(connection.pieMap)) - write_log("sockList: " + str(connection.sockList)) - read_sockets, write_sockets, error_sockets = select.select(connection.sockList, [], []) - for sock in read_sockets: - write_log(read_sockets) - if sock == server_socket: - # Handle the case in which there is a new connections - # received through server_socket - sockfd, addr = server_socket.accept() - connection.addSocket(sockfd) - write_log("Client Connected " + str(addr)) - else: - data = sock.recv(RECV_BUFFER) - write_log(data) - if data == "": - write_log("No Data Received on Socket %s. Removing." % str(sock)) - connection.removeSocket(sock) - else: - messages = filter(lambda s: s != "", - data.split('\v')) - for rawMessage in messages: - print rawMessage - currentMessage = json.loads(rawMessage) - if not currentMessage["pluginDest"] == "socketServer": - write_log("Placing message in destination: " + currentMessage["pluginDest"]) - Queues[currentMessage["pluginDest"]].put(Message.fromJSON(currentMessage)) - else: - write_log("Connecting") - connect(connection=connection, currentMessage=currentMessage, pieMap=connection.pieMap, - sock=sock) - write_log("Finished connection...") - - -# TODO: Deal with the fact that we have multiple log() definitions across our codebase... -def log(queue, mes): - """ - Logs the given message - @param queue: The Logger's message queue - @type queue: Queue.Queue - @param mes: The message to log - @return: None - @rtype: None - """ - newLog = Message("Socket", "Logging", "Logger", "log", {}) - newLog.add_content("1", mes) - queue.put(newLog) diff --git a/Server/wpPush.py b/Server/wpPush.py deleted file mode 100644 index 45beb5a..0000000 --- a/Server/wpPush.py +++ /dev/null @@ -1,87 +0,0 @@ -from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer -import json -import thread - -from Classes.message import Message - - -# Defaults -ADDR = "0.0.0.0" -PORT = 12345 -writeOut = None - - -#Expecting to receive something of the form -#{ -# "datetime" : "2014-11-30T22:04:15+00:00", # ISO 8601, Timestamp of this push -# "action" : "add-slide", -# "pies" : [ -# { "name" : "shepard" }, -# { "name" : "blueberry" }, # allows adding of new fields later on down the road -# ], -# "content" : { # should definitely be an object for flex and forward compatibility -# "ID" : 14, # WordPress Post ID -# "Permalink" : "http://dds-wp..." # The URL to the Post; does not append -# # ?pie=name or anything fancy, just the permalink -# # ... All other WordPress Post Fields... basically json_encode( get_post( $post_id ) ) -# -# # ... and then the post meta for plugins and other cool add-ons -# "meta" : { -# "key1" : [ "value" ], -# "key2" : [ -# "value1", -# "value2", -# 3, -# { -# "meta can be weird" : "remember that" -# } -# ] -# } -# } -#} - - - -class RequestHandler(BaseHTTPRequestHandler): - """ - Handler Class for any requests received from WordPress - @copyright: Northeastern University Crew 2014 - """ - - def do_POST(self): - """ - Handles received POST requests - @return: None - @rtype: NoneType - """ - # writeOut is set externally to be the - # socketServer Message Queue - global writeOut - if writeOut == None: - # Receiving Queue has not been set - print "(RequestHandler): writeOut is none. Returning." - return - if 'content-length' not in self.headers: - # Malformed Header; content-length needed to know how many bytes to read - print 'ERROR(RequestHandler): No content-length in post request, exiting' - return - - # Read in the request - data = self.rfile.read(int(self.headers.getheader('content-length'))) - - # Log the request - print "Http received POST: " + str(data) - - # Parse the request into JSON - info = json.loads(data) - - for pie in info["pies"]: - writeOut.put( - Message("wpPush", pie["name"], "slideShow", info["action"], json.dumps(info["content"]), - info["datetime"])) - -# Start the HTTP Server to receive any POST requests -# (Note: Python Server's Address set within WordPress Configuration) -httpd = HTTPServer((ADDR, PORT), RequestHandler) -thread.start_new_thread(httpd.serve_forever, ()) - diff --git a/api-objects.txt b/api-objects.txt new file mode 100644 index 0000000..a81eaf8 --- /dev/null +++ b/api-objects.txt @@ -0,0 +1,226 @@ +Client Client-module.html +Client.__package__ Client-module.html#__package__ +Client.Classes Client.Classes-module.html +Client.Classes.__package__ Client.Classes-module.html#__package__ +Client.Classes.ConfigParser Client.Classes.ConfigParser-module.html +Client.Classes.ConfigParser.__package__ Client.Classes.ConfigParser-module.html#__package__ +Client.Classes.message Client.Classes.message-module.html +Client.Classes.message.__package__ Client.Classes.message-module.html#__package__ +Client.Classes.slide Client.Classes.slide-module.html +Client.Classes.slide.__package__ Client.Classes.slide-module.html#__package__ +Client.Classes.sockClass Client.Classes.sockClass-module.html +Client.Classes.sockClass.__package__ Client.Classes.sockClass-module.html#__package__ +Client.Plugins Client.Plugins-module.html +Client.Plugins.__package__ Client.Plugins-module.html#__package__ +Client.Plugins.ExamplePlugin Client.Plugins.ExamplePlugin-module.html +Client.Plugins.ExamplePlugin.__package__ Client.Plugins.ExamplePlugin-module.html#__package__ +Client.Plugins.plugin Client.Plugins.plugin-module.html +Client.Plugins.plugin.__package__ Client.Plugins.plugin-module.html#__package__ +Client.gtkDisplay Client.gtkDisplay-module.html +Client.gtkDisplay.getUpdateHandle Client.gtkDisplay-module.html#getUpdateHandle +Client.logging Client.logging-module.html +Client.logging.instance Client.logging-module.html#instance +Client.logging.__package__ Client.logging-module.html#__package__ +Client.main Client.main-module.html +Client.main.getAdditionalPlugins Client.main-module.html#getAdditionalPlugins +Client.main.main Client.main-module.html#main +Client.slideShow Client.slideShow-module.html +Client.slideShow.runShow Client.slideShow-module.html#runShow +Client.socketClient Client.socketClient-module.html +Client.socketClient.socket_in Client.socketClient-module.html#socket_in +Client.socketClient.socket_out Client.socketClient-module.html#socket_out +Client.socketClient.__package__ Client.socketClient-module.html#__package__ +Server Server-module.html +Server.__package__ Server-module.html#__package__ +Server.Classes Server.Classes-module.html +Server.Classes.__package__ Server.Classes-module.html#__package__ +Server.Classes.ConfigParser Server.Classes.ConfigParser-module.html +Server.Classes.ConfigParser.__package__ Server.Classes.ConfigParser-module.html#__package__ +Server.Classes.QueueDict Server.Classes.QueueDict-module.html +Server.Classes.QueueDict.__package__ Server.Classes.QueueDict-module.html#__package__ +Server.Classes.ThreadDict Server.Classes.ThreadDict-module.html +Server.Classes.ThreadDict.__package__ Server.Classes.ThreadDict-module.html#__package__ +Server.Classes.log Server.Classes.log-module.html +Server.Classes.log.__package__ Server.Classes.log-module.html#__package__ +Server.Classes.message Server.Classes.message-module.html +Server.Classes.message.__package__ Server.Classes.message-module.html#__package__ +Server.Classes.slide Server.Classes.slide-module.html +Server.Classes.slide.__package__ Server.Classes.slide-module.html#__package__ +Server.Classes.socketlist Server.Classes.socketlist-module.html +Server.Classes.socketlist.__package__ Server.Classes.socketlist-module.html#__package__ +Server.WPHandler Server.WPHandler-module.html +Server.WPHandler.handle Server.WPHandler-module.html#handle +Server.WPHandler.__package__ Server.WPHandler-module.html#__package__ +Server.WPHandler.main_WPHandler_thread Server.WPHandler-module.html#main_WPHandler_thread +Server.WPHandler.wpListenerStart Server.WPHandler-module.html#wpListenerStart +Server.WPHandler.querySlidesFor Server.WPHandler-module.html#querySlidesFor +Server.logging Server.logging-module.html +Server.logging.logging_thread Server.logging-module.html#logging_thread +Server.logging.log Server.logging-module.html#log +Server.main Server.main-module.html +Server.main.terminate Server.main-module.html#terminate +Server.main.main Server.main-module.html#main +Server.plugin Server.plugin-module.html +Server.plugin.main_socketServer_thread Server.socketServer-module.html#main_socketServer_thread +Server.plugin.main_WPHandler_thread Server.WPHandler-module.html#main_WPHandler_thread +Server.plugin.plugin Server.plugin-module.html#plugin +Server.plugin.__package__ Server.plugin-module.html#__package__ +Server.socketServer Server.socketServer-module.html +Server.socketServer.log Server.socketServer-module.html#log +Server.socketServer.socketServer Server.socketServer-module.html#socketServer +Server.socketServer.main_socketServer_thread Server.socketServer-module.html#main_socketServer_thread +Server.socketServer.__package__ Server.socketServer-module.html#__package__ +Server.socketServer.connect Server.socketServer-module.html#connect +Server.socketServer.wpListenerStart Server.WPHandler-module.html#wpListenerStart +Server.wpPush Server.wpPush-module.html +Server.wpPush.httpd Server.wpPush-module.html#httpd +Server.wpPush.ADDR Server.wpPush-module.html#ADDR +Server.wpPush.writeOut Server.wpPush-module.html#writeOut +Server.wpPush.__package__ Server.wpPush-module.html#__package__ +Server.wpPush.PORT Server.wpPush-module.html#PORT +Client.Classes.ConfigParser.ConfigParser Client.Classes.ConfigParser.ConfigParser-class.html +Client.Classes.ConfigParser.ConfigParser.readConfig Client.Classes.ConfigParser.ConfigParser-class.html#readConfig +Client.Classes.ConfigParser.ConfigParser.getPair Client.Classes.ConfigParser.ConfigParser-class.html#getPair +Client.Classes.message.Message Client.Classes.message.Message-class.html +Client.Classes.message.Message.src Client.Classes.message.Message-class.html#src +Client.Classes.message.Message.__getitem__ Client.Classes.message.Message-class.html#__getitem__ +Client.Classes.message.Message.dest Client.Classes.message.Message-class.html#dest +Client.Classes.message.Message.__str__ Client.Classes.message.Message-class.html#__str__ +Client.Classes.message.Message.datetime Client.Classes.message.Message-class.html#datetime +Client.Classes.message.Message.add_content Client.Classes.message.Message-class.html#add_content +Client.Classes.message.Message.content Client.Classes.message.Message-class.html#content +Client.Classes.message.Message.fromJSON Client.Classes.message.Message-class.html#fromJSON +Client.Classes.message.Message.pluginDest Client.Classes.message.Message-class.html#pluginDest +Client.Classes.message.Message.action Client.Classes.message.Message-class.html#action +Client.Classes.message.Message.toJSON Client.Classes.message.Message-class.html#toJSON +Client.Classes.message.Message.__init__ Client.Classes.message.Message-class.html#__init__ +Client.Classes.slide.Slide Client.Classes.slide.Slide-class.html +Client.Classes.slide.Slide.sameID Client.Classes.slide.Slide-class.html#sameID +Client.Classes.slide.Slide.url Client.Classes.slide.Slide-class.html#url +Client.Classes.slide.Slide.__str__ Client.Classes.slide.Slide-class.html#__str__ +Client.Classes.slide.Slide.meta Client.Classes.slide.Slide-class.html#meta +Client.Classes.slide.Slide.__repr__ Client.Classes.slide.Slide-class.html#__repr__ +Client.Classes.slide.Slide.duration Client.Classes.slide.Slide-class.html#duration +Client.Classes.slide.Slide.toJSON Client.Classes.slide.Slide-class.html#toJSON +Client.Classes.slide.Slide.makeSlide Client.Classes.slide.Slide-class.html#makeSlide +Client.Classes.slide.Slide.id Client.Classes.slide.Slide-class.html#id +Client.Classes.slide.Slide.__init__ Client.Classes.slide.Slide-class.html#__init__ +Client.Classes.sockClass.sockClass Client.Classes.sockClass.sockClass-class.html +Client.Classes.sockClass.sockClass.hostIP Client.Classes.sockClass.sockClass-class.html#hostIP +Client.Classes.sockClass.sockClass.sock Client.Classes.sockClass.sockClass-class.html#sock +Client.Classes.sockClass.sockClass.send Client.Classes.sockClass.sockClass-class.html#send +Client.Classes.sockClass.sockClass.connect Client.Classes.sockClass.sockClass-class.html#connect +Client.Classes.sockClass.sockClass.hostPort Client.Classes.sockClass.sockClass-class.html#hostPort +Client.Classes.sockClass.sockClass.__init__ Client.Classes.sockClass.sockClass-class.html#__init__ +Client.Plugins.ExamplePlugin.ExamplePlugin Client.Plugins.ExamplePlugin.ExamplePlugin-class.html +Client.Plugins.plugin.Plugin.run Client.Plugins.plugin.Plugin-class.html#run +Client.Plugins.ExamplePlugin.ExamplePlugin.getName Client.Plugins.ExamplePlugin.ExamplePlugin-class.html#getName +Client.Plugins.plugin.Plugin.needsThread Client.Plugins.plugin.Plugin-class.html#needsThread +Client.Plugins.plugin.Plugin.__str__ Client.Plugins.plugin.Plugin-class.html#__str__ +Client.Plugins.plugin.Plugin.addMessage Client.Plugins.plugin.Plugin-class.html#addMessage +Client.Plugins.plugin.Plugin.setup Client.Plugins.plugin.Plugin-class.html#setup +Client.Plugins.plugin.Plugin Client.Plugins.plugin.Plugin-class.html +Client.Plugins.plugin.Plugin.addMessage Client.Plugins.plugin.Plugin-class.html#addMessage +Client.Plugins.plugin.Plugin.setup Client.Plugins.plugin.Plugin-class.html#setup +Client.Plugins.plugin.Plugin.needsThread Client.Plugins.plugin.Plugin-class.html#needsThread +Client.Plugins.plugin.Plugin.getName Client.Plugins.plugin.Plugin-class.html#getName +Client.Plugins.plugin.Plugin.run Client.Plugins.plugin.Plugin-class.html#run +Client.Plugins.plugin.Plugin.__str__ Client.Plugins.plugin.Plugin-class.html#__str__ +Client.gtkDisplay.GTKPlugin Client.gtkDisplay.GTKPlugin-class.html +Client.gtkDisplay.GTKPlugin.addMessage Client.gtkDisplay.GTKPlugin-class.html#addMessage +Client.gtkDisplay.GTKPlugin.getName Client.gtkDisplay.GTKPlugin-class.html#getName +Client.gtkDisplay.GTKPlugin.needsThread Client.gtkDisplay.GTKPlugin-class.html#needsThread +Client.Plugins.plugin.Plugin.__str__ Client.Plugins.plugin.Plugin-class.html#__str__ +Client.gtkDisplay.GTKPlugin.run Client.gtkDisplay.GTKPlugin-class.html#run +Client.Plugins.plugin.Plugin.setup Client.Plugins.plugin.Plugin-class.html#setup +Client.gtkDisplay.WebBrowser Client.gtkDisplay.WebBrowser-class.html +Client.gtkDisplay.WebBrowser.updatePage Client.gtkDisplay.WebBrowser-class.html#updatePage +Client.gtkDisplay.WebBrowser.__init__ Client.gtkDisplay.WebBrowser-class.html#__init__ +Client.logging.Logger Client.logging.Logger-class.html +Client.logging.Logger.__writeAllAndClear Client.logging.Logger-class.html#__writeAllAndClear +Client.logging.Logger.log Client.logging.Logger-class.html#log +Client.logging.Logger.__addDebugMsg Client.logging.Logger-class.html#__addDebugMsg +Client.logging.Logger.__addErrorMessage Client.logging.Logger-class.html#__addErrorMessage +Client.logging.Logger.__addWarningMessage Client.logging.Logger-class.html#__addWarningMessage +Client.logging.Logger.__init__ Client.logging.Logger-class.html#__init__ +Client.slideShow.SlideShowPlugin Client.slideShow.SlideShowPlugin-class.html +Client.slideShow.SlideShowPlugin.addMessage Client.slideShow.SlideShowPlugin-class.html#addMessage +Client.slideShow.SlideShowPlugin.setup Client.slideShow.SlideShowPlugin-class.html#setup +Client.slideShow.SlideShowPlugin.needsThread Client.slideShow.SlideShowPlugin-class.html#needsThread +Client.Plugins.plugin.Plugin.__str__ Client.Plugins.plugin.Plugin-class.html#__str__ +Client.slideShow.SlideShowPlugin.run Client.slideShow.SlideShowPlugin-class.html#run +Client.slideShow.SlideShowPlugin.getName Client.slideShow.SlideShowPlugin-class.html#getName +Client.slideShow.SlideShowPlugin.__init__ Client.slideShow.SlideShowPlugin-class.html#__init__ +Client.socketClient.IOPlugin Client.socketClient.IOPlugin-class.html +Client.socketClient.IOPlugin.addMessage Client.socketClient.IOPlugin-class.html#addMessage +Client.socketClient.IOPlugin.setup Client.socketClient.IOPlugin-class.html#setup +Client.socketClient.IOPlugin.needsThread Client.socketClient.IOPlugin-class.html#needsThread +Client.Plugins.plugin.Plugin.__str__ Client.Plugins.plugin.Plugin-class.html#__str__ +Client.socketClient.IOPlugin.run Client.socketClient.IOPlugin-class.html#run +Client.socketClient.IOPlugin.getName Client.socketClient.IOPlugin-class.html#getName +Client.socketClient.IOPlugin.__init__ Client.socketClient.IOPlugin-class.html#__init__ +Server.Classes.ConfigParser.ConfigParser Server.Classes.ConfigParser.ConfigParser-class.html +Server.Classes.ConfigParser.ConfigParser.readConfig Server.Classes.ConfigParser.ConfigParser-class.html#readConfig +Server.Classes.ConfigParser.ConfigParser.getPair Server.Classes.ConfigParser.ConfigParser-class.html#getPair +Server.Classes.QueueDict.QueueDict Server.Classes.QueueDict.QueueDict-class.html +Server.Classes.QueueDict.QueueDict.Queues Server.Classes.QueueDict.QueueDict-class.html#Queues +Server.Classes.QueueDict.QueueDict.__init__ Server.Classes.QueueDict.QueueDict-class.html#__init__ +Server.Classes.QueueDict.QueueDict.queueSize Server.Classes.QueueDict.QueueDict-class.html#queueSize +Server.Classes.QueueDict.QueueDict.__getitem__ Server.Classes.QueueDict.QueueDict-class.html#__getitem__ +Server.Classes.QueueDict.QueueDict.addQueue Server.Classes.QueueDict.QueueDict-class.html#addQueue +Server.Classes.ThreadDict.ThreadDict Server.Classes.ThreadDict.ThreadDict-class.html +Server.Classes.ThreadDict.ThreadDict.addThread Server.Classes.ThreadDict.ThreadDict-class.html#addThread +Server.Classes.ThreadDict.ThreadDict.Threads Server.Classes.ThreadDict.ThreadDict-class.html#Threads +Server.Classes.ThreadDict.ThreadDict.__init__ Server.Classes.ThreadDict.ThreadDict-class.html#__init__ +Server.Classes.log.logging Server.Classes.log.logging-class.html +Server.Classes.log.logging.__init__ Server.Classes.log.logging-class.html#__init__ +Server.Classes.message.Message Server.Classes.message.Message-class.html +Server.Classes.message.Message.src Server.Classes.message.Message-class.html#src +Server.Classes.message.Message.__getitem__ Server.Classes.message.Message-class.html#__getitem__ +Server.Classes.message.Message.dest Server.Classes.message.Message-class.html#dest +Server.Classes.message.Message.__str__ Server.Classes.message.Message-class.html#__str__ +Server.Classes.message.Message.datetime Server.Classes.message.Message-class.html#datetime +Server.Classes.message.Message.add_content Server.Classes.message.Message-class.html#add_content +Server.Classes.message.Message.content Server.Classes.message.Message-class.html#content +Server.Classes.message.Message.fromJSON Server.Classes.message.Message-class.html#fromJSON +Server.Classes.message.Message.pluginDest Server.Classes.message.Message-class.html#pluginDest +Server.Classes.message.Message.action Server.Classes.message.Message-class.html#action +Server.Classes.message.Message.toJSON Server.Classes.message.Message-class.html#toJSON +Server.Classes.message.Message.__init__ Server.Classes.message.Message-class.html#__init__ +Server.Classes.slide.Slide Server.Classes.slide.Slide-class.html +Server.Classes.slide.Slide.sameID Server.Classes.slide.Slide-class.html#sameID +Server.Classes.slide.Slide.url Server.Classes.slide.Slide-class.html#url +Server.Classes.slide.Slide.__str__ Server.Classes.slide.Slide-class.html#__str__ +Server.Classes.slide.Slide.meta Server.Classes.slide.Slide-class.html#meta +Server.Classes.slide.Slide.__repr__ Server.Classes.slide.Slide-class.html#__repr__ +Server.Classes.slide.Slide.duration Server.Classes.slide.Slide-class.html#duration +Server.Classes.slide.Slide.toJSON Server.Classes.slide.Slide-class.html#toJSON +Server.Classes.slide.Slide.makeSlide Server.Classes.slide.Slide-class.html#makeSlide +Server.Classes.slide.Slide.id Server.Classes.slide.Slide-class.html#id +Server.Classes.slide.Slide.__init__ Server.Classes.slide.Slide-class.html#__init__ +Server.Classes.socketlist.socketList Server.Classes.socketlist.socketList-class.html +Server.Classes.socketlist.socketList.mapPie Server.Classes.socketlist.socketList-class.html#mapPie +Server.Classes.socketlist.socketList.removeSocket Server.Classes.socketlist.socketList-class.html#removeSocket +Server.Classes.socketlist.socketList.pieMap Server.Classes.socketlist.socketList-class.html#pieMap +Server.Classes.socketlist.socketList.addSocket Server.Classes.socketlist.socketList-class.html#addSocket +Server.Classes.socketlist.socketList.broadcast Server.Classes.socketlist.socketList-class.html#broadcast +Server.Classes.socketlist.socketList.serverSocket Server.Classes.socketlist.socketList-class.html#serverSocket +Server.Classes.socketlist.socketList.getSock Server.Classes.socketlist.socketList-class.html#getSock +Server.Classes.socketlist.socketList.sendMessage Server.Classes.socketlist.socketList-class.html#sendMessage +Server.Classes.socketlist.socketList.sockList Server.Classes.socketlist.socketList-class.html#sockList +Server.Classes.socketlist.socketList.getPie Server.Classes.socketlist.socketList-class.html#getPie +Server.Classes.socketlist.socketList.__init__ Server.Classes.socketlist.socketList-class.html#__init__ +Server.wpPush.RequestHandler Server.wpPush.RequestHandler-class.html +BaseHTTPServer.BaseHTTPRequestHandler.MessageClass mimetools.Message-class.html +Server.wpPush.RequestHandler.do_POST Server.wpPush.RequestHandler-class.html#do_POST +mimetools.Message mimetools.Message-class.html +mimetools.Message.getmaintype mimetools.Message-class.html#getmaintype +mimetools.Message.getsubtype mimetools.Message-class.html#getsubtype +mimetools.Message.parseplist mimetools.Message-class.html#parseplist +mimetools.Message.__init__ mimetools.Message-class.html#__init__ +mimetools.Message.getparamnames mimetools.Message-class.html#getparamnames +mimetools.Message.getencoding mimetools.Message-class.html#getencoding +mimetools.Message.getparam mimetools.Message-class.html#getparam +mimetools.Message.parsetype mimetools.Message-class.html#parsetype +mimetools.Message.getplist mimetools.Message-class.html#getplist +mimetools.Message.gettype mimetools.Message-class.html#gettype diff --git a/class-tree.html b/class-tree.html new file mode 100644 index 0000000..a6a15ee --- /dev/null +++ b/class-tree.html @@ -0,0 +1,194 @@ + + + + + Class Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
+ [ Module Hierarchy + | Class Hierarchy ] +

+

Class Hierarchy

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/crarr.png b/crarr.png new file mode 100644 index 0000000..26b43c5 Binary files /dev/null and b/crarr.png differ diff --git a/epydoc.css b/epydoc.css new file mode 100644 index 0000000..63502f6 --- /dev/null +++ b/epydoc.css @@ -0,0 +1,340 @@ + + +/* Epydoc CSS Stylesheet + * + * This stylesheet can be used to customize the appearance of epydoc's + * HTML output. + * + */ + +/* Default Colors & Styles + * - Set the default foreground & background color with 'body'; and + * link colors with 'a:link' and 'a:visited'. + * - Use bold for decision list terms. + * - The heading styles defined here are used for headings *within* + * docstring descriptions. All headings used by epydoc itself use + * either class='epydoc' or class='toc' (CSS styles for both + * defined below). + */ +body { background: #ffffff; color: #000000; font-family: "HelveticaNeue-Light", + "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", + sans-serif; font-weight: 300;} +p { margin-top: 0.5em; margin-bottom: 0.5em; } +a:link { color: #0000ff; } +a:visited { color: #204080; } +a:hover {text-shadow: 0 0 5px rgba(81, 203, 238, 1); + padding: 0px 0px 0px 0px; + /*margin: 5px 0px 0px 0px; + border: 1px solid rgba(81, 203, 238, 1);*/} +dt { font-weight: bold; } +h1 { font-size: +140%; font-style: italic; + font-weight: bold; } +h2 { font-size: +125%; font-style: italic; + font-weight: bold; } +h3 { font-size: +110%; font-style: italic; + font-weight: normal; } +body::-webkit-scrollbar { + width: 1em; +} + +body::-webkit-scrollbar-track { + -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); +} + +body::-webkit-scrollbar-thumb { + background-color: darkgrey; + outline: 1px solid slategrey; +} +code { font-size: 100%; } +/* N.B.: class, not pseudoclass */ +a.link { font-family: monospace; } + +/* Page Header & Footer + * - The standard page header consists of a navigation bar (with + * pointers to standard pages such as 'home' and 'trees'); a + * breadcrumbs list, which can be used to navigate to containing + * classes or modules; options links, to show/hide private + * variables and to show/hide frames; and a page title (using + *

). The page title may be followed by a link to the + * corresponding source code (using 'span.codelink'). + * - The footer consists of a navigation bar, a timestamp, and a + * pointer to epydoc's homepage. + */ +h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; } +h2.epydoc { font-size: +130%; font-weight: bold; } +h3.epydoc { font-size: +115%; font-weight: bold; + margin-top: 0.2em; } +td h3.epydoc { font-size: +115%; font-weight: bold; + margin-bottom: 0; } +table.navbar { background: #a0c0ff; color: #000000; + border: 2px groove #c0d0d0; } +table.navbar table { color: #000000; } +th.navbar-select { background: #70b0ff; + color: #000000; } +table.navbar a { text-decoration: none; } +table.navbar a:link { color: #0000ff; } +table.navbar a:visited { color: #204080; } +span.breadcrumbs { font-size: 85%; font-weight: bold; } +span.options { font-size: 70%; } +span.codelink { font-size: 85%; } +td.footer { font-size: 85%; } + +/* Table Headers + * - Each summary table and details section begins with a 'header' + * row. This row contains a section title (marked by + * 'span.table-header') as well as a show/hide private link + * (marked by 'span.options', defined above). + * - Summary tables that contain user-defined groups mark those + * groups using 'group header' rows. + */ +td.table-header { background: #70b0ff; color: #000000; + border: 1px solid #608090; } +td.table-header table { color: #000000; } +td.table-header table a:link { color: #0000ff; } +td.table-header table a:visited { color: #204080; } +span.table-header { font-size: 120%; font-weight: bold; } +th.group-header { background: #c0e0f8; color: #000000; + text-align: left; font-style: italic; + font-size: 115%; + border: 1px solid #608090; } + +/* Summary Tables (functions, variables, etc) + * - Each object is described by a single row of the table with + * two cells. The left cell gives the object's type, and is + * marked with 'code.summary-type'. The right cell gives the + * object's name and a summary description. + * - CSS styles for the table's header and group headers are + * defined above, under 'Table Headers' + */ +table.summary { border-collapse: collapse; + background: #e8f0f8; color: #000000; + border: 1px solid #608090; + margin-bottom: 0.5em; } +td.summary { border: 1px solid #608090; } +code.summary-type { font-size: 85%; } +table.summary a:link { color: #0000ff; } +table.summary a:visited { color: #204080; } + + +/* Details Tables (functions, variables, etc) + * - Each object is described in its own div. + * - A single-row summary table w/ table-header is used as + * a header for each details section (CSS style for table-header + * is defined above, under 'Table Headers'). + */ +table.details { border-collapse: collapse; + background: #e8f0f8; color: #000000; + border: 1px solid #608090; + margin: .2em 0 0 0; } +table.details table { color: #000000; } +table.details a:link { color: #0000ff; } +table.details a:visited { color: #204080; } + +/* Fields */ +dl.fields { margin-left: 2em; margin-top: 1em; + margin-bottom: 1em; } +dl.fields dd ul { margin-left: 0em; padding-left: 0em; } +dl.fields dd ul li ul { margin-left: 2em; padding-left: 0em; } +div.fields { margin-left: 2em; } +div.fields p { margin-bottom: 0.5em; } + +/* Index tables (identifier index, term index, etc) + * - link-index is used for indices containing lists of links + * (namely, the identifier index & term index). + * - index-where is used in link indices for the text indicating + * the container/source for each link. + * - metadata-index is used for indices containing metadata + * extracted from fields (namely, the bug index & todo index). + */ +table.link-index { border-collapse: collapse; + background: #e8f0f8; color: #000000; + border: 1px solid #608090; } +td.link-index { border-width: 0px; } +table.link-index a:link { color: #0000ff; } +table.link-index a:visited { color: #204080; } +span.index-where { font-size: 70%; } +table.metadata-index { border-collapse: collapse; + background: #e8f0f8; color: #000000; + border: 1px solid #608090; + margin: .2em 0 0 0; } +td.metadata-index { border-width: 1px; border-style: solid; } +table.metadata-index a:link { color: #0000ff; } +table.metadata-index a:visited { color: #204080; } + +/* Function signatures + * - sig* is used for the signature in the details section. + * - .summary-sig* is used for the signature in the summary + * table, and when listing property accessor functions. + * */ +.sig-name { color: #006080; } +.sig-arg { color: #008060; } +.sig-default { color: #602000; } +.summary-sig { font-family: monospace; } +.summary-sig-name { color: #006080; font-weight: bold; } +table.summary a.summary-sig-name:link + { color: #006080; font-weight: bold; } +table.summary a.summary-sig-name:visited + { color: #006080; font-weight: bold; } +.summary-sig-arg { color: #006040; } +.summary-sig-default { color: #501800; } + +/* Subclass list + */ +ul.subclass-list { display: inline; } +ul.subclass-list li { display: inline; } + +/* To render variables, classes etc. like functions */ +table.summary .summary-name { color: #006080; font-weight: bold; + font-family: monospace; } +table.summary + a.summary-name:link { color: #006080; font-weight: bold; + font-family: monospace; } +table.summary + a.summary-name:visited { color: #006080; font-weight: bold; + font-family: monospace; } + +/* Variable values + * - In the 'variable details' sections, each varaible's value is + * listed in a 'pre.variable' box. The width of this box is + * restricted to 80 chars; if the value's repr is longer than + * this it will be wrapped, using a backslash marked with + * class 'variable-linewrap'. If the value's repr is longer + * than 3 lines, the rest will be ellided; and an ellipsis + * marker ('...' marked with 'variable-ellipsis') will be used. + * - If the value is a string, its quote marks will be marked + * with 'variable-quote'. + * - If the variable is a regexp, it is syntax-highlighted using + * the re* CSS classes. + */ +pre.variable { padding: .5em; margin: 0; + background: #dce4ec; color: #000000; + border: 1px solid #708890; } +.variable-linewrap { color: #604000; font-weight: bold; } +.variable-ellipsis { color: #604000; font-weight: bold; } +.variable-quote { color: #604000; font-weight: bold; } +.variable-group { color: #008000; font-weight: bold; } +.variable-op { color: #604000; font-weight: bold; } +.variable-string { color: #006030; } +.variable-unknown { color: #a00000; font-weight: bold; } +.re { color: #000000; } +.re-char { color: #006030; } +.re-op { color: #600000; } +.re-group { color: #003060; } +.re-ref { color: #404040; } + +/* Base tree + * - Used by class pages to display the base class hierarchy. + */ +pre.base-tree { font-size: 80%; margin: 0; } + +/* Frames-based table of contents headers + * - Consists of two frames: one for selecting modules; and + * the other listing the contents of the selected module. + * - h1.toc is used for each frame's heading + * - h2.toc is used for subheadings within each frame. + */ +h1.toc { text-align: center; font-size: 105%; + margin: 0; font-weight: bold; + padding: 0; } +h2.toc { font-size: 100%; font-weight: bold; + margin: 0.5em 0 0 -0.3em; } + +/* Syntax Highlighting for Source Code + * - doctest examples are displayed in a 'pre.py-doctest' block. + * If the example is in a details table entry, then it will use + * the colors specified by the 'table pre.py-doctest' line. + * - Source code listings are displayed in a 'pre.py-src' block. + * Each line is marked with 'span.py-line' (used to draw a line + * down the left margin, separating the code from the line + * numbers). Line numbers are displayed with 'span.py-lineno'. + * The expand/collapse block toggle button is displayed with + * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not + * modify the font size of the text.) + * - If a source code page is opened with an anchor, then the + * corresponding code block will be highlighted. The code + * block's header is highlighted with 'py-highlight-hdr'; and + * the code block's body is highlighted with 'py-highlight'. + * - The remaining py-* classes are used to perform syntax + * highlighting (py-string for string literals, py-name for names, + * etc.) + */ +pre.py-doctest { padding: .5em; margin: 1em; + background: #e8f0f8; color: #000000; + border: 1px solid #708890; } +table pre.py-doctest { background: #dce4ec; + color: #000000; } +pre.py-src { border: 2px solid #000000; + background: #f0f0f0; color: #000000; } +.py-line { border-left: 2px solid #000000; + margin-left: .2em; padding-left: .4em; } +.py-lineno { font-style: italic; font-size: 90%; + padding-left: .5em; } +a.py-toggle { text-decoration: none; } +div.py-highlight-hdr { border-top: 2px solid #000000; + border-bottom: 2px solid #000000; + background: #d8e8e8; } +div.py-highlight { border-bottom: 2px solid #000000; + background: #d0e0e0; } +.py-prompt { color: #005050; font-weight: bold;} +.py-more { color: #005050; font-weight: bold;} +.py-string { color: #006030; } +.py-comment { color: #003060; } +.py-keyword { color: #600000; } +.py-output { color: #404040; } +.py-name { color: #000050; } +.py-name:link { color: #000050 !important; } +.py-name:visited { color: #000050 !important; } +.py-number { color: #005000; } +.py-defname { color: #000060; font-weight: bold; } +.py-def-name { color: #000060; font-weight: bold; } +.py-base-class { color: #000060; } +.py-param { color: #000060; } +.py-docstring { color: #006030; } +.py-decorator { color: #804020; } +/* Use this if you don't want links to names underlined: */ +/*a.py-name { text-decoration: none; }*/ + +/* Graphs & Diagrams + * - These CSS styles are used for graphs & diagrams generated using + * Graphviz dot. 'img.graph-without-title' is used for bare + * diagrams (to remove the border created by making the image + * clickable). + */ +img.graph-without-title { border: none; } +img.graph-with-title { border: 1px solid #000000; } +span.graph-title { font-weight: bold; } +span.graph-caption { } + +/* General-purpose classes + * - 'p.indent-wrapped-lines' defines a paragraph whose first line + * is not indented, but whose subsequent lines are. + * - The 'nomargin-top' class is used to remove the top margin (e.g. + * from lists). The 'nomargin' class is used to remove both the + * top and bottom margin (but not the left or right margin -- + * for lists, that would cause the bullets to disappear.) + */ +p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em; + margin: 0; } +.nomargin-top { margin-top: 0; } +.nomargin { margin-top: 0; margin-bottom: 0; } + +/* HTML Log */ +div.log-block { padding: 0; margin: .5em 0 .5em 0; + background: #e8f0f8; color: #000000; + border: 1px solid #000000; } +div.log-error { padding: .1em .3em .1em .3em; margin: 4px; + background: #ffb0b0; color: #000000; + border: 1px solid #000000; } +div.log-warning { padding: .1em .3em .1em .3em; margin: 4px; + background: #ffffb0; color: #000000; + border: 1px solid #000000; } +div.log-info { padding: .1em .3em .1em .3em; margin: 4px; + background: #b0ffb0; color: #000000; + border: 1px solid #000000; } +h2.log-hdr { background: #70b0ff; color: #000000; + margin: 0; padding: 0em 0.5em 0em 0.5em; + border-bottom: 1px solid #000000; font-size: 110%; } +p.log { font-weight: bold; margin: .5em 0 .5em 0; } +tr.opt-changed { color: #000000; font-weight: bold; } +tr.opt-default { color: #606060; } +pre.log { margin: 0; padding: 0; padding-left: 1em; } diff --git a/epydoc.js b/epydoc.js new file mode 100644 index 0000000..e787dbc --- /dev/null +++ b/epydoc.js @@ -0,0 +1,293 @@ +function toggle_private() { + // Search for any private/public links on this page. Store + // their old text in "cmd," so we will know what action to + // take; and change their text to the opposite action. + var cmd = "?"; + var elts = document.getElementsByTagName("a"); + for(var i=0; i...
"; + elt.innerHTML = s; + } +} + +function toggle(id) { + elt = document.getElementById(id+"-toggle"); + if (elt.innerHTML == "-") + collapse(id); + else + expand(id); + return false; +} + +function highlight(id) { + var elt = document.getElementById(id+"-def"); + if (elt) elt.className = "py-highlight-hdr"; + var elt = document.getElementById(id+"-expanded"); + if (elt) elt.className = "py-highlight"; + var elt = document.getElementById(id+"-collapsed"); + if (elt) elt.className = "py-highlight"; +} + +function num_lines(s) { + var n = 1; + var pos = s.indexOf("\n"); + while ( pos > 0) { + n += 1; + pos = s.indexOf("\n", pos+1); + } + return n; +} + +// Collapse all blocks that mave more than `min_lines` lines. +function collapse_all(min_lines) { + var elts = document.getElementsByTagName("div"); + for (var i=0; i 0) + if (elt.id.substring(split, elt.id.length) == "-expanded") + if (num_lines(elt.innerHTML) > min_lines) + collapse(elt.id.substring(0, split)); + } +} + +function expandto(href) { + var start = href.indexOf("#")+1; + if (start != 0 && start != href.length) { + if (href.substring(start, href.length) != "-") { + collapse_all(4); + pos = href.indexOf(".", start); + while (pos != -1) { + var id = href.substring(start, pos); + expand(id); + pos = href.indexOf(".", pos+1); + } + var id = href.substring(start, href.length); + expand(id); + highlight(id); + } + } +} + +function kill_doclink(id) { + var parent = document.getElementById(id); + parent.removeChild(parent.childNodes.item(0)); +} +function auto_kill_doclink(ev) { + if (!ev) var ev = window.event; + if (!this.contains(ev.toElement)) { + var parent = document.getElementById(this.parentID); + parent.removeChild(parent.childNodes.item(0)); + } +} + +function doclink(id, name, targets_id) { + var elt = document.getElementById(id); + + // If we already opened the box, then destroy it. + // (This case should never occur, but leave it in just in case.) + if (elt.childNodes.length > 1) { + elt.removeChild(elt.childNodes.item(0)); + } + else { + // The outer box: relative + inline positioning. + var box1 = document.createElement("div"); + box1.style.position = "relative"; + box1.style.display = "inline"; + box1.style.top = 0; + box1.style.left = 0; + + // A shadow for fun + var shadow = document.createElement("div"); + shadow.style.position = "absolute"; + shadow.style.left = "-1.3em"; + shadow.style.top = "-1.3em"; + shadow.style.background = "#404040"; + + // The inner box: absolute positioning. + var box2 = document.createElement("div"); + box2.style.position = "relative"; + box2.style.border = "1px solid #a0a0a0"; + box2.style.left = "-.2em"; + box2.style.top = "-.2em"; + box2.style.background = "white"; + box2.style.padding = ".3em .4em .3em .4em"; + box2.style.fontStyle = "normal"; + box2.onmouseout=auto_kill_doclink; + box2.parentID = id; + + // Get the targets + var targets_elt = document.getElementById(targets_id); + var targets = targets_elt.getAttribute("targets"); + var links = ""; + target_list = targets.split(","); + for (var i=0; i" + + target[0] + ""; + } + + // Put it all together. + elt.insertBefore(box1, elt.childNodes.item(0)); + //box1.appendChild(box2); + box1.appendChild(shadow); + shadow.appendChild(box2); + box2.innerHTML = + "Which "+name+" do you want to see documentation for?" + + ""; + } + return false; +} + +function get_anchor() { + var href = location.href; + var start = href.indexOf("#")+1; + if ((start != 0) && (start != href.length)) + return href.substring(start, href.length); + } +function redirect_url(dottedName) { + // Scan through each element of the "pages" list, and check + // if "name" matches with any of them. + for (var i=0; i-m" or "-c"; + // extract the portion & compare it to dottedName. + var pagename = pages[i].substring(0, pages[i].length-2); + if (pagename == dottedName.substring(0,pagename.length)) { + + // We've found a page that matches `dottedName`; + // construct its URL, using leftover `dottedName` + // content to form an anchor. + var pagetype = pages[i].charAt(pages[i].length-1); + var url = pagename + ((pagetype=="m")?"-module.html": + "-class.html"); + if (dottedName.length > pagename.length) + url += "#" + dottedName.substring(pagename.length+1, + dottedName.length); + return url; + } + } + } diff --git a/frames.html b/frames.html new file mode 100644 index 0000000..e1d43f9 --- /dev/null +++ b/frames.html @@ -0,0 +1,17 @@ + + + + + API Documentation + + + + + + + + + diff --git a/help.html b/help.html new file mode 100644 index 0000000..a25b094 --- /dev/null +++ b/help.html @@ -0,0 +1,262 @@ + + + + + Help + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+ +

API Documentation

+ +

This document contains the API (Application Programming Interface) +documentation for this project. Documentation for the Python +objects defined by the project is divided into separate pages for each +package, module, and class. The API documentation also includes two +pages containing information about the project as a whole: a trees +page, and an index page.

+ +

Object Documentation

+ +

Each Package Documentation page contains:

+
    +
  • A description of the package.
  • +
  • A list of the modules and sub-packages contained by the + package.
  • +
  • A summary of the classes defined by the package.
  • +
  • A summary of the functions defined by the package.
  • +
  • A summary of the variables defined by the package.
  • +
  • A detailed description of each function defined by the + package.
  • +
  • A detailed description of each variable defined by the + package.
  • +
+ +

Each Module Documentation page contains:

+
    +
  • A description of the module.
  • +
  • A summary of the classes defined by the module.
  • +
  • A summary of the functions defined by the module.
  • +
  • A summary of the variables defined by the module.
  • +
  • A detailed description of each function defined by the + module.
  • +
  • A detailed description of each variable defined by the + module.
  • +
+ +

Each Class Documentation page contains:

+
    +
  • A class inheritance diagram.
  • +
  • A list of known subclasses.
  • +
  • A description of the class.
  • +
  • A summary of the methods defined by the class.
  • +
  • A summary of the instance variables defined by the class.
  • +
  • A summary of the class (static) variables defined by the + class.
  • +
  • A detailed description of each method defined by the + class.
  • +
  • A detailed description of each instance variable defined by the + class.
  • +
  • A detailed description of each class (static) variable defined + by the class.
  • +
+ +

Project Documentation

+ +

The Trees page contains the module and class hierarchies:

+
    +
  • The module hierarchy lists every package and module, with + modules grouped into packages. At the top level, and within each + package, modules and sub-packages are listed alphabetically.
  • +
  • The class hierarchy lists every class, grouped by base + class. If a class has more than one base class, then it will be + listed under each base class. At the top level, and under each base + class, classes are listed alphabetically.
  • +
+ +

The Index page contains indices of terms and + identifiers:

+
    +
  • The term index lists every term indexed by any object's + documentation. For each term, the index provides links to each + place where the term is indexed.
  • +
  • The identifier index lists the (short) name of every package, + module, class, method, function, variable, and parameter. For each + identifier, the index provides a short description, and a link to + its documentation.
  • +
+ +

The Table of Contents

+ +

The table of contents occupies the two frames on the left side of +the window. The upper-left frame displays the project +contents, and the lower-left frame displays the module +contents:

+ + + + + + + + + +
+ Project
Contents
...
+ API
Documentation
Frame


+
+ Module
Contents
 
...
  +

+ +

The project contents frame contains a list of all packages +and modules that are defined by the project. Clicking on an entry +will display its contents in the module contents frame. Clicking on a +special entry, labeled "Everything," will display the contents of +the entire project.

+ +

The module contents frame contains a list of every +submodule, class, type, exception, function, and variable defined by a +module or package. Clicking on an entry will display its +documentation in the API documentation frame. Clicking on the name of +the module, at the top of the frame, will display the documentation +for the module itself.

+ +

The "frames" and "no frames" buttons below the top +navigation bar can be used to control whether the table of contents is +displayed or not.

+ +

The Navigation Bar

+ +

A navigation bar is located at the top and bottom of every page. +It indicates what type of page you are currently viewing, and allows +you to go to related pages. The following table describes the labels +on the navigation bar. Note that not some labels (such as +[Parent]) are not displayed on all pages.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LabelHighlighted when...Links to...
[Parent](never highlighted) the parent of the current package
[Package]viewing a packagethe package containing the current object +
[Module]viewing a modulethe module containing the current object +
[Class]viewing a class the class containing the current object
[Trees]viewing the trees page the trees page
[Index]viewing the index page the index page
[Help]viewing the help page the help page
+ +

The "show private" and "hide private" buttons below +the top navigation bar can be used to control whether documentation +for private objects is displayed. Private objects are usually defined +as objects whose (short) names begin with a single underscore, but do +not end with an underscore. For example, "_x", +"__pprint", and "epydoc.epytext._tokenize" +are private objects; but "re.sub", +"__init__", and "type_" are not. However, +if a module defines the "__all__" variable, then its +contents are used to decide which objects are private.

+ +

A timestamp below the bottom navigation bar indicates when each +page was last updated.

+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/identifier-index.html b/identifier-index.html new file mode 100644 index 0000000..0df5a9e --- /dev/null +++ b/identifier-index.html @@ -0,0 +1,735 @@ + + + + + Identifier Index + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| To Do +]

+ +
+

Identifier Index

+
+[ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + _ +] +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

A

+ + + + + + + + + + + + + + + + + + + + + + +

B

+ + + + + + + + +

C

+ + + + + + + + + + + + + + + + + +

D

+ + + + + + + + +

E

+ + + + + + + + +

F

+ + + + + + + + +

G

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +

H

+ + + + + + + + +

I

+ + + + + + + + +

L

+ + + + + + + + + + + + + + + + + +

M

+ + + + + + + + + + + + + + + + + + + + + + + + + + + +

N

+ + + + + + + + + + + + +

P

+ + + + + + + + + + + + +

Q

+ + + + + + + + +

R

+ + + + + + + + + + + + + + + + + +

S

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

T

+ + + + + + + + + + + + + + + + + +

U

+ + + + + + + + +

W

+ + + + + + + + + + + + +

_

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

+ + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..e1d43f9 --- /dev/null +++ b/index.html @@ -0,0 +1,17 @@ + + + + + API Documentation + + + + + + + + + diff --git a/mimetools.Message-class.html b/mimetools.Message-class.html new file mode 100644 index 0000000..16cae5a --- /dev/null +++ b/mimetools.Message-class.html @@ -0,0 +1,369 @@ + + + + + mimetools.Message + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + mimetools :: + Message :: + Class Message + + + + + + +
[hide private]
[frames] | no frames]
+
+ +

Class Message

+
+rfc822.Message --+
+                 |
+                Message
+
+ +
+

A derived class of rfc822.Message that knows about MIME headers and + contains some hooks for decoding encoded and multipart messages.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
Instance Methods[hide private]
+
+   + + + + + + +
__init__(self, + fp, + seekable=1)
+ Initialize the class instance and read the headers.
+ + +
+ +
+   + + + + + + +
getencoding(self) + + +
+ +
+   + + + + + + +
getmaintype(self) + + +
+ +
+   + + + + + + +
getparam(self, + name) + + +
+ +
+   + + + + + + +
getparamnames(self) + + +
+ +
+   + + + + + + +
getplist(self) + + +
+ +
+   + + + + + + +
getsubtype(self) + + +
+ +
+   + + + + + + +
gettype(self) + + +
+ +
+   + + + + + + +
parseplist(self) + + +
+ +
+   + + + + + + +
parsetype(self) + + +
+ +
+

Inherited from rfc822.Message: + __contains__, + __delitem__, + __getitem__, + __iter__, + __len__, + __setitem__, + __str__, + get, + getaddr, + getaddrlist, + getallmatchingheaders, + getdate, + getdate_tz, + getfirstmatchingheader, + getheader, + getheaders, + getrawheader, + has_key, + iscomment, + isheader, + islast, + items, + keys, + readheaders, + rewindbody, + setdefault, + values +

+
+ + + + + + +
+ + + + + +
Method Details[hide private]
+
+ +
+ +
+ + +
+

__init__(self, + fp, + seekable=1) +
(Constructor) +

+
  +
+ +

Initialize the class instance and read the headers.

+
+
Overrides: + rfc822.Message.__init__ +
(inherited documentation)
+ +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/module-tree.html b/module-tree.html new file mode 100644 index 0000000..aa18439 --- /dev/null +++ b/module-tree.html @@ -0,0 +1,142 @@ + + + + + Module Hierarchy + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
+ [ Module Hierarchy + | Class Hierarchy ] +

+

Module Hierarchy

+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/redirect.html b/redirect.html new file mode 100644 index 0000000..ea34c49 --- /dev/null +++ b/redirect.html @@ -0,0 +1,38 @@ +Epydoc Redirect Page + + + + + + + + +

Epydoc Auto-redirect page

+ +

When javascript is enabled, this page will redirect URLs of +the form redirect.html#dotted.name to the +documentation for the object with the given fully-qualified +dotted name.

+

 

+ + + + + diff --git a/toc-Client-module.html b/toc-Client-module.html new file mode 100644 index 0000000..2bc6630 --- /dev/null +++ b/toc-Client-module.html @@ -0,0 +1,31 @@ + + + + + Client + + + + + +

Module Client

+
+

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Client.Classes-module.html b/toc-Client.Classes-module.html new file mode 100644 index 0000000..cfcf830 --- /dev/null +++ b/toc-Client.Classes-module.html @@ -0,0 +1,31 @@ + + + + + Classes + + + + + +

Module Classes

+
+

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Client.Classes.ConfigParser-module.html b/toc-Client.Classes.ConfigParser-module.html new file mode 100644 index 0000000..c7a71a2 --- /dev/null +++ b/toc-Client.Classes.ConfigParser-module.html @@ -0,0 +1,33 @@ + + + + + ConfigParser + + + + + +

Module ConfigParser

+
+

Classes

+ ConfigParser

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Client.Classes.message-module.html b/toc-Client.Classes.message-module.html new file mode 100644 index 0000000..fdc5ab5 --- /dev/null +++ b/toc-Client.Classes.message-module.html @@ -0,0 +1,33 @@ + + + + + message + + + + + +

Module message

+
+

Classes

+ Message

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Client.Classes.slide-module.html b/toc-Client.Classes.slide-module.html new file mode 100644 index 0000000..6637e2d --- /dev/null +++ b/toc-Client.Classes.slide-module.html @@ -0,0 +1,33 @@ + + + + + slide + + + + + +

Module slide

+
+

Classes

+ Slide

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Client.Classes.sockClass-module.html b/toc-Client.Classes.sockClass-module.html new file mode 100644 index 0000000..6396713 --- /dev/null +++ b/toc-Client.Classes.sockClass-module.html @@ -0,0 +1,33 @@ + + + + + sockClass + + + + + +

Module sockClass

+
+

Classes

+ sockClass

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Client.Plugins-module.html b/toc-Client.Plugins-module.html new file mode 100644 index 0000000..9f565e1 --- /dev/null +++ b/toc-Client.Plugins-module.html @@ -0,0 +1,31 @@ + + + + + Plugins + + + + + +

Module Plugins

+
+

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Client.Plugins.ExamplePlugin-module.html b/toc-Client.Plugins.ExamplePlugin-module.html new file mode 100644 index 0000000..36e187b --- /dev/null +++ b/toc-Client.Plugins.ExamplePlugin-module.html @@ -0,0 +1,33 @@ + + + + + ExamplePlugin + + + + + +

Module ExamplePlugin

+
+

Classes

+ ExamplePlugin

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Client.Plugins.plugin-module.html b/toc-Client.Plugins.plugin-module.html new file mode 100644 index 0000000..411458e --- /dev/null +++ b/toc-Client.Plugins.plugin-module.html @@ -0,0 +1,33 @@ + + + + + plugin + + + + + +

Module plugin

+
+

Classes

+ Plugin

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Client.gtkDisplay-module.html b/toc-Client.gtkDisplay-module.html new file mode 100644 index 0000000..07dd17a --- /dev/null +++ b/toc-Client.gtkDisplay-module.html @@ -0,0 +1,34 @@ + + + + + gtkDisplay + + + + + +

Module gtkDisplay

+
+

Classes

+ GTKPlugin
WebBrowser

Functions

+ getUpdateHandle

+[hide private] + + + + diff --git a/toc-Client.logging-module.html b/toc-Client.logging-module.html new file mode 100644 index 0000000..70c8fb1 --- /dev/null +++ b/toc-Client.logging-module.html @@ -0,0 +1,34 @@ + + + + + logging + + + + + +

Module logging

+
+

Classes

+ Logger

Variables

+ __package__
instance

+[hide private] + + + + diff --git a/toc-Client.main-module.html b/toc-Client.main-module.html new file mode 100644 index 0000000..0735935 --- /dev/null +++ b/toc-Client.main-module.html @@ -0,0 +1,32 @@ + + + + + main + + + + + +

Module main

+
+

Functions

+ getAdditionalPlugins
main

+[hide private] + + + + diff --git a/toc-Client.slideShow-module.html b/toc-Client.slideShow-module.html new file mode 100644 index 0000000..df3abfc --- /dev/null +++ b/toc-Client.slideShow-module.html @@ -0,0 +1,33 @@ + + + + + slideShow + + + + + +

Module slideShow

+
+

Classes

+ SlideShowPlugin

Functions

+ runShow

+[hide private] + + + + diff --git a/toc-Client.socketClient-module.html b/toc-Client.socketClient-module.html new file mode 100644 index 0000000..b483911 --- /dev/null +++ b/toc-Client.socketClient-module.html @@ -0,0 +1,36 @@ + + + + + socketClient + + + + + +

Module socketClient

+
+

Classes

+ IOPlugin

Functions

+ socket_in
socket_out

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server-module.html b/toc-Server-module.html new file mode 100644 index 0000000..3c5a69d --- /dev/null +++ b/toc-Server-module.html @@ -0,0 +1,31 @@ + + + + + Server + + + + + +

Module Server

+
+

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server.Classes-module.html b/toc-Server.Classes-module.html new file mode 100644 index 0000000..8b5c142 --- /dev/null +++ b/toc-Server.Classes-module.html @@ -0,0 +1,31 @@ + + + + + Classes + + + + + +

Module Classes

+
+

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server.Classes.ConfigParser-module.html b/toc-Server.Classes.ConfigParser-module.html new file mode 100644 index 0000000..7b01d3d --- /dev/null +++ b/toc-Server.Classes.ConfigParser-module.html @@ -0,0 +1,33 @@ + + + + + ConfigParser + + + + + +

Module ConfigParser

+
+

Classes

+ ConfigParser

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server.Classes.QueueDict-module.html b/toc-Server.Classes.QueueDict-module.html new file mode 100644 index 0000000..d7e6e13 --- /dev/null +++ b/toc-Server.Classes.QueueDict-module.html @@ -0,0 +1,33 @@ + + + + + QueueDict + + + + + +

Module QueueDict

+
+

Classes

+ QueueDict

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server.Classes.ThreadDict-module.html b/toc-Server.Classes.ThreadDict-module.html new file mode 100644 index 0000000..cb76f87 --- /dev/null +++ b/toc-Server.Classes.ThreadDict-module.html @@ -0,0 +1,33 @@ + + + + + ThreadDict + + + + + +

Module ThreadDict

+
+

Classes

+ ThreadDict

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server.Classes.log-module.html b/toc-Server.Classes.log-module.html new file mode 100644 index 0000000..00b3758 --- /dev/null +++ b/toc-Server.Classes.log-module.html @@ -0,0 +1,33 @@ + + + + + log + + + + + +

Module log

+
+

Classes

+ logging

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server.Classes.message-module.html b/toc-Server.Classes.message-module.html new file mode 100644 index 0000000..72d8bab --- /dev/null +++ b/toc-Server.Classes.message-module.html @@ -0,0 +1,33 @@ + + + + + message + + + + + +

Module message

+
+

Classes

+ Message

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server.Classes.slide-module.html b/toc-Server.Classes.slide-module.html new file mode 100644 index 0000000..d9ada3e --- /dev/null +++ b/toc-Server.Classes.slide-module.html @@ -0,0 +1,33 @@ + + + + + slide + + + + + +

Module slide

+
+

Classes

+ Slide

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server.Classes.socketlist-module.html b/toc-Server.Classes.socketlist-module.html new file mode 100644 index 0000000..654abcd --- /dev/null +++ b/toc-Server.Classes.socketlist-module.html @@ -0,0 +1,33 @@ + + + + + socketlist + + + + + +

Module socketlist

+
+

Classes

+ socketList

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server.WPHandler-module.html b/toc-Server.WPHandler-module.html new file mode 100644 index 0000000..7d5d9ec --- /dev/null +++ b/toc-Server.WPHandler-module.html @@ -0,0 +1,36 @@ + + + + + WPHandler + + + + + +

Module WPHandler

+
+

Functions

+ handle
main_WPHandler_thread
querySlidesFor
wpListenerStart

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server.logging-module.html b/toc-Server.logging-module.html new file mode 100644 index 0000000..17cbb65 --- /dev/null +++ b/toc-Server.logging-module.html @@ -0,0 +1,32 @@ + + + + + logging + + + + + +

Module logging

+
+

Functions

+ log
logging_thread

+[hide private] + + + + diff --git a/toc-Server.main-module.html b/toc-Server.main-module.html new file mode 100644 index 0000000..5e20c04 --- /dev/null +++ b/toc-Server.main-module.html @@ -0,0 +1,32 @@ + + + + + main + + + + + +

Module main

+
+

Functions

+ main
terminate

+[hide private] + + + + diff --git a/toc-Server.plugin-module.html b/toc-Server.plugin-module.html new file mode 100644 index 0000000..38c5a6a --- /dev/null +++ b/toc-Server.plugin-module.html @@ -0,0 +1,33 @@ + + + + + plugin + + + + + +

Module plugin

+
+

Functions

+ plugin

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server.socketServer-module.html b/toc-Server.socketServer-module.html new file mode 100644 index 0000000..9fe4c23 --- /dev/null +++ b/toc-Server.socketServer-module.html @@ -0,0 +1,36 @@ + + + + + socketServer + + + + + +

Module socketServer

+
+

Functions

+ connect
log
main_socketServer_thread
socketServer

Variables

+ __package__

+[hide private] + + + + diff --git a/toc-Server.wpPush-module.html b/toc-Server.wpPush-module.html new file mode 100644 index 0000000..72f9c83 --- /dev/null +++ b/toc-Server.wpPush-module.html @@ -0,0 +1,37 @@ + + + + + wpPush + + + + + +

Module wpPush

+
+

Classes

+ RequestHandler

Variables

+ ADDR
PORT
__package__
httpd
writeOut

+[hide private] + + + + diff --git a/toc-everything.html b/toc-everything.html new file mode 100644 index 0000000..6c46084 --- /dev/null +++ b/toc-everything.html @@ -0,0 +1,100 @@ + + + + + Everything + + + + + +

Everything

+
+

All Classes

+ Client.Classes.ConfigParser.ConfigParser
Client.Classes.message.Message
Client.Classes.slide.Slide
Client.Classes.sockClass.sockClass
Client.Plugins.ExamplePlugin.ExamplePlugin
Client.Plugins.plugin.Plugin
Client.gtkDisplay.GTKPlugin
Client.gtkDisplay.WebBrowser
Client.logging.Logger
Client.slideShow.SlideShowPlugin
Client.socketClient.IOPlugin
Server.Classes.ConfigParser.ConfigParser
Server.Classes.QueueDict.QueueDict
Server.Classes.ThreadDict.ThreadDict
Server.Classes.log.logging
Server.Classes.message.Message
Server.Classes.slide.Slide
Server.Classes.socketlist.socketList
Server.wpPush.RequestHandler
mimetools.Message

All Functions

+ Client.gtkDisplay.getUpdateHandle
Client.main.getAdditionalPlugins
Client.main.main
Client.slideShow.runShow
Client.socketClient.socket_in
Client.socketClient.socket_out
Server.WPHandler.handle
Server.WPHandler.main_WPHandler_thread
Server.WPHandler.querySlidesFor
Server.WPHandler.wpListenerStart
Server.logging.log
Server.logging.logging_thread
Server.main.main
Server.main.terminate
Server.plugin.plugin
Server.socketServer.connect
Server.socketServer.log
Server.socketServer.main_socketServer_thread
Server.socketServer.socketServer

All Variables

+ Client.Classes.ConfigParser.__package__
Client.Classes.__package__
Client.Classes.message.__package__
Client.Classes.slide.__package__
Client.Classes.sockClass.__package__
Client.Plugins.ExamplePlugin.__package__
Client.Plugins.__package__
Client.Plugins.plugin.__package__
Client.__package__
Client.logging.__package__
Client.logging.instance
Client.socketClient.__package__
Server.Classes.ConfigParser.__package__
Server.Classes.QueueDict.__package__
Server.Classes.ThreadDict.__package__
Server.Classes.__package__
Server.Classes.log.__package__
Server.Classes.message.__package__
Server.Classes.slide.__package__
Server.Classes.socketlist.__package__
Server.WPHandler.__package__
Server.__package__
Server.plugin.__package__
Server.socketServer.__package__
Server.wpPush.ADDR
Server.wpPush.PORT
Server.wpPush.__package__
Server.wpPush.httpd
Server.wpPush.writeOut

+[hide private] + + + + diff --git a/toc.html b/toc.html new file mode 100644 index 0000000..63804b3 --- /dev/null +++ b/toc.html @@ -0,0 +1,61 @@ + + + + + Table of Contents + + + + + +

Table of Contents

+
+ Everything +
+

Modules

+ Client
Client.Classes
Client.Classes.ConfigParser
Client.Classes.message
Client.Classes.slide
Client.Classes.sockClass
Client.Plugins
Client.Plugins.ExamplePlugin
Client.Plugins.plugin
Client.gtkDisplay
Client.logging
Client.main
Client.slideShow
Client.socketClient
Server
Server.Classes
Server.Classes.ConfigParser
Server.Classes.QueueDict
Server.Classes.ThreadDict
Server.Classes.log
Server.Classes.message
Server.Classes.slide
Server.Classes.socketlist
Server.WPHandler
Server.logging
Server.main
Server.plugin
Server.socketServer
Server.wpPush

+ [hide private] + + + + diff --git a/todo-index.html b/todo-index.html new file mode 100644 index 0000000..936d860 --- /dev/null +++ b/todo-index.html @@ -0,0 +1,138 @@ + + + + + To Do List + + + + + + + + + + + + + + + + + + + + + + + + + + +
  + + + + +
[hide private]
[frames] | no frames]
+
+
[ + Identifiers +| To Do +]

+

To Do List

+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + +
+ + + +