Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Van Assche <dvanassche@guadalinex-nubae.(none)>2009-09-23 10:52:07 (GMT)
committer David Van Assche <dvanassche@guadalinex-nubae.(none)>2009-09-23 10:52:07 (GMT)
commit56c7267f5f7359fc6451b074ba4e3ed48e49aa1f (patch)
treed7bce65320a452dcf8ba5bb07dea1739a76e9316
parent87c5c6316b5aed02d3690ade11c72e3bac084d03 (diff)
changed alll files to pyqclic
-rw-r--r--pyqclic_common.py (renamed from pyclic_common.py)6
-rw-r--r--pyqclicadmin.py (renamed from pyclic.py)54
-rw-r--r--pyqclicuser.py (renamed from pyclicuser.py)56
3 files changed, 58 insertions, 58 deletions
diff --git a/pyclic_common.py b/pyqclic_common.py
index 597f304..fb2eb3c 100644
--- a/pyclic_common.py
+++ b/pyqclic_common.py
@@ -41,7 +41,7 @@ ENTRY_TAG = 10
FILE_EXT = "gpx"
-class PyClicCommon:
+class PyQClicCommon:
_xml_tags = {
@@ -122,10 +122,10 @@ class PyClicCommon:
window.set_title(_("PyQClic - Untitled"))
def decode64(self,data):
- filew = open('/tmp/ruris.png','w')
+ filew = open('/tmp/pyqclic_decode.png','w')
filew.write(data.decode('base64'))
filew.close()
- image = cairo.ImageSurface.create_from_png("/tmp/ruris.png")
+ image = cairo.ImageSurface.create_from_png("/tmp/pyqclic_decode.png")
return image
def grab_click(self,widget,event):
diff --git a/pyclic.py b/pyqclicadmin.py
index 3ce7b81..220f3cc 100644
--- a/pyclic.py
+++ b/pyqclicadmin.py
@@ -16,10 +16,10 @@ from xml.dom import minidom
import os
import sys
import locale
-from pyclic_common import *
+from pyqclic_common import *
import gettext
-class PyClicAdmin:
+class PyQClicAdmin:
#function to open xml file, though parsing of file happens in xml_load_from_file() function.
def on_file_open(self, widget):
@@ -82,10 +82,10 @@ class PyClicAdmin:
#We are looking for the quiz Node, which will contain all the subelements title, author, category
#buttons color, and image. Basically this is seperated as such because it needs to do just one
#iteration per quiz document.
- if (node.nodeName == PyClicCommon._xml_tags[QUIZ_TAG]):
+ if (node.nodeName == PyQClicCommon._xml_tags[QUIZ_TAG]):
# Now loop through the quiz nodes children
for item_node in node.childNodes:
- if (item_node.nodeName == PyClicCommon._xml_tags[TITLE_TAG]):
+ if (item_node.nodeName == PyQClicCommon._xml_tags[TITLE_TAG]):
"""Set the title, the firstChild in this case is
the actual title text that we saved."""
@@ -96,7 +96,7 @@ class PyClicAdmin:
print "Tag not loaded, probably empty"
title_loaded = True
# Title Tag loaded at this point and placed by self.title_entry.set_text
- elif (item_node.nodeName == PyClicCommon._xml_tags[CATEGORY_TAG]):
+ elif (item_node.nodeName == pyQClicCommon._xml_tags[CATEGORY_TAG]):
"""Set the category, the firstChild in this case is
the actual category that we saved."""
#Make sure it's not a blank string
@@ -129,7 +129,7 @@ class PyClicAdmin:
category_loaded = True
#At this point we have found category and title and have placed them in their
#their corresponding positions
- elif (item_node.nodeName == PyClicCommon._xml_tags[AUTHOR_TAG]):
+ elif (item_node.nodeName == pyQClicCommon._xml_tags[AUTHOR_TAG]):
"""Set the author, the firstChild in this case is
the actual author that we saved. This tag is not really that important
and in fact was put in as an after though just in case its wanted"""
@@ -140,7 +140,7 @@ class PyClicAdmin:
print "Tag not loaded, probably empty"
author_loaded = True
#At this point category, title and author have been loaded and placed in the document
- elif (item_node.nodeName == PyClicCommon._xml_tags[IMAGE_TAG]):
+ elif (item_node.nodeName == pyQClicCommon._xml_tags[IMAGE_TAG]):
"""Set the image, the firstChild in this case is
the image that we saved. Then decode from base64"""
#Make sure it's not a blank string
@@ -154,7 +154,7 @@ class PyClicAdmin:
image_loaded = True
#Weve now loaded the image, the category, the title and the author and placed
#them in their corresponding positions.
- elif (item_node.nodeName == PyClicCommon._xml_tags[COLOR_TAG]):
+ elif (item_node.nodeName == pyQClicCommon._xml_tags[COLOR_TAG]):
"""Set the image, the firstChild in this case is
the image that we saved. Then decode from base64"""
#Make sure it's not a blank string
@@ -182,13 +182,13 @@ class PyClicAdmin:
#We've now loaded all the QUIZ tag elements, the ones that require just one iteration.
#We are looking for the questions Node, which contains all the iterrable values, that is to say
#values for each question found.
- elif (node.nodeName == PyClicCommon._xml_tags[QUESTIONS_TAG]):
+ elif (node.nodeName == pyQClicCommon._xml_tags[QUESTIONS_TAG]):
# Now loop through the question nodes children
for item_node in node.childNodes:
#We create an empty questions list to iterate through and place items in
self.questions_list=[]
#we look for the question tag
- if (item_node.nodeName == PyClicCommon._xml_tags[QUESTION_TAG]):
+ if (item_node.nodeName == pyQClicCommon._xml_tags[QUESTION_TAG]):
"""Grab all the questions."""
#Make sure it's not a blank string
if (item_node.firstChild):
@@ -206,7 +206,7 @@ class PyClicAdmin:
#create empty self.coordinate list to place coordinates into
self.coordinate=[]
# Look for coordinates tag
- if (item_node.nodeName == PyClicCommon._xml_tags[COORDINATES_TAG]):
+ if (item_node.nodeName == pyQClicCommon._xml_tags[COORDINATES_TAG]):
"""Grab all the coordinates."""
#Make sure it's not a blank string
if (item_node.firstChild):
@@ -227,7 +227,7 @@ class PyClicAdmin:
#iterator list called entradas.
self.entradas=[]
#we look for entry tag
- if (item_node.nodeName == PyClicCommon._xml_tags[ENTRY_TAG]):
+ if (item_node.nodeName == pyQClicCommon._xml_tags[ENTRY_TAG]):
"""Grab all the entries."""
#Make sure it's not a blank string
if (item_node.firstChild):
@@ -260,25 +260,25 @@ class PyClicAdmin:
The xml document that we will save the post to."""
#create <quiz></quiz>
- quiz_element = xml_document.createElement(PyClicCommon._xml_tags[QUIZ_TAG])
+ quiz_element = xml_document.createElement(pyQClicCommon._xml_tags[QUIZ_TAG])
#create <category></category>
- category_element = xml_document.createElement(PyClicCommon._xml_tags[CATEGORY_TAG])
+ category_element = xml_document.createElement(pyQClicCommon._xml_tags[CATEGORY_TAG])
#Create <category>category</category>
category_element.appendChild(xml_document.createTextNode(self.Category))
#Creates <image></image>
- image_element = xml_document.createElement(PyClicCommon._xml_tags[IMAGE_TAG])
+ image_element = xml_document.createElement(pyQClicCommon._xml_tags[IMAGE_TAG])
#Create <IMAGE>image<IMAGE>
image_element.appendChild(xml_document.createTextNode(self.Image))
#Creates <title></title>
- title_element = xml_document.createElement(PyClicCommon._xml_tags[TITLE_TAG])
+ title_element = xml_document.createElement(pyQClicCommon._xml_tags[TITLE_TAG])
#Creates <title>title</title>
title_element.appendChild(xml_document.createTextNode(self.Title))
#Creates <author></author>
- author_element = xml_document.createElement(PyClicCommon._xml_tags[AUTHOR_TAG])
+ author_element = xml_document.createElement(pyQClicCommon._xml_tags[AUTHOR_TAG])
#Creates <author>author</author>
author_element.appendChild(xml_document.createTextNode(self.Author))
#Creates <color></color>
- color_element = xml_document.createElement(PyClicCommon._xml_tags[COLOR_TAG])
+ color_element = xml_document.createElement(pyQClicCommon._xml_tags[COLOR_TAG])
#Create colorvalues list, and add R,G,B values to it (we should really strip the brackets on string
#conversion here taking out the []), but we do that on load instead. Reason = this function was created
#before the load function
@@ -298,7 +298,7 @@ class PyClicAdmin:
# there is only one of each.
xml_document.documentElement.appendChild(quiz_element)
#create <questions></questions>
- questions_element = xml_document.createElement(PyClicCommon._xml_tags[QUESTIONS_TAG])
+ questions_element = xml_document.createElement(pyQClicCommon._xml_tags[QUESTIONS_TAG])
#Setup iteration
Iterate = 0
#Set questions here, no point in saving values before hand, in fact, come to think of it, we dont really even
@@ -308,17 +308,17 @@ class PyClicAdmin:
# while there are coordinates in the self.coordinates list, iterate through and save stuff
while Iterate < len(self.coordinates):
#Create <question></question>
- question_element = xml_document.createElement(PyClicCommon._xml_tags[QUESTION_TAG])
+ question_element = xml_document.createElement(pyQClicCommon._xml_tags[QUESTION_TAG])
#create <question>question<question> and turn to string (XML requires it)
question_element.appendChild(xml_document.createTextNode(str(question)))
c = self.coordinates[Iterate]
#Create <coordinates></coordinates>
- coordinates_element = xml_document.createElement(PyClicCommon._xml_tags[COORDINATES_TAG])
+ coordinates_element = xml_document.createElement(pyQClicCommon._xml_tags[COORDINATES_TAG])
#create <coordinates>x,y<coordinates>, and turn into strings. This method is better than doing a str
# as no bracets are saved, just value,value for each set of x,y coordinates.
coordinates_element.appendChild(xml_document.createTextNode("%d,%d" % (c[0],c[1])))
#Create <entry></entry>
- entry_element = xml_document.createElement(PyClicCommon._xml_tags[ENTRY_TAG])
+ entry_element = xml_document.createElement(pyQClicCommon._xml_tags[ENTRY_TAG])
#create <entry>entry<entry> and append each entry via th iterator
entry_element.appendChild(xml_document.createTextNode(self.Entries[Iterate]))
@@ -345,7 +345,7 @@ class PyClicAdmin:
#Get the available DOM Implementation, in this case, the XML parser
impl = minidom.getDOMImplementation()
#Create the document, with PyClicAdmin as base node
- xml_document = impl.createDocument(None, PyClicCommon._xml_tags[MAIN_TAG], None)
+ xml_document = impl.createDocument(None, pyQClicCommon._xml_tags[MAIN_TAG], None)
#Save the questions into the xml
self.xml_save(xml_document)
#Now actually try to save the file
@@ -544,7 +544,7 @@ class PyClicAdmin:
"""Allright it all worked! save the current file and
set the title."""
self.xml_file = xml_file
- PyClicCommon.set_window_title_from_file(self.xml_file)
+ pyQClicCommon.set_window_title_from_file(self.xml_file)
#simple little function to grab combobox changed value for category
def on_changed(self,widget):
@@ -652,7 +652,7 @@ class PyClicAdmin:
sys.exit(1)
#instantiate the pycliccomon class which we imported... yay... now I know what instantiate means :-)
- self.pcc=PyClicCommon()
+ self.pcc=PyQClicCommon()
#add the delete_event handler to pyclic common close application method
self.window.connect("delete_event", self.pcc.close_application)
#set size for window
@@ -875,8 +875,8 @@ def main():
gtk.main()
return 0
-#instantiate pyclicadmin class
+#instantiate pyqclicadmin class
if __name__ == "__main__":
- PyClicAdmin()
+ PyQClicAdmin()
main()
diff --git a/pyclicuser.py b/pyqclicuser.py
index a698cc5..7a1f8fd 100644
--- a/pyclicuser.py
+++ b/pyqclicuser.py
@@ -1,6 +1,6 @@
#!/usr/bin/python
-# PyqClicAdmin application, Administration interface. User loads an image, then places lables on them with circled
+# PyqClicUser application, user interface. User loads an image, then places lables on them with circled
# numbers in colour of their choice (application has colour changing ability), then user writes meanings of labels on
# right hand side, and stores all this in an XML file. XML file contains tags as listed in pylic-common.py file,
# along with base 64 encoded image. This is for transportability reasons, specifically, transporting across xmpp
@@ -17,10 +17,10 @@ import os
import sys
import random
import locale
-from pyclic_common import *
+from pyqclic_common import *
import gettext
-class PyClicAdmin:
+class PyQClicUser:
#function to open xml file, though parsing of file happens in xml_load_from_file() function.
def on_file_open(self, widget):
@@ -84,10 +84,10 @@ class PyClicAdmin:
#We are looking for the quiz Node, which will contain all the subelements title, author, category
#buttons color, and image. Basically this is seperated as such because it needs to do just one
#iteration per quiz document.
- if (node.nodeName == PyClicCommon._xml_tags[QUIZ_TAG]):
+ if (node.nodeName == PyQClicCommon._xml_tags[QUIZ_TAG]):
# Now loop through the quiz nodes children
for item_node in node.childNodes:
- if (item_node.nodeName == PyClicCommon._xml_tags[TITLE_TAG]):
+ if (item_node.nodeName == PyQClicCommon._xml_tags[TITLE_TAG]):
"""Set the title, the firstChild in this case is
the actual title text that we saved."""
@@ -97,7 +97,7 @@ class PyClicAdmin:
else:
print "Tag wasnt loaded, probably empy"
title_loaded = True
- elif (item_node.nodeName == PyClicCommon._xml_tags[CATEGORY_TAG]):
+ elif (item_node.nodeName == PyQClicCommon._xml_tags[CATEGORY_TAG]):
"""Set the category, the firstChild in this case is
the actual category that we saved."""
#Make sure it's not a blank string
@@ -106,7 +106,7 @@ class PyClicAdmin:
else:
print "Tag wasnt loaded, probably empy"
category_loaded = True
- elif (item_node.nodeName == PyClicCommon._xml_tags[AUTHOR_TAG]):
+ elif (item_node.nodeName == PyQClicCommon._xml_tags[AUTHOR_TAG]):
"""Set the author, the firstChild in this case is
the actual author that we saved."""
#Make sure it's not a blank string
@@ -116,7 +116,7 @@ class PyClicAdmin:
print "Tag wasnt loaded, probably empy"
author_loaded = True
#At this point category, title and author have been loaded and placed in the document
- elif (item_node.nodeName == PyClicCommon._xml_tags[IMAGE_TAG]):
+ elif (item_node.nodeName == PyQClicCommon._xml_tags[IMAGE_TAG]):
"""Set the image, the firstChild in this case is
the image that we saved. Then decode from base64"""
#Make sure it's not a blank string
@@ -130,7 +130,7 @@ class PyClicAdmin:
image_loaded = True
#Weve now loaded the image, the category, the title and the author and placed
#them in their corresponding positions.
- elif (item_node.nodeName == PyClicCommon._xml_tags[COLOR_TAG]):
+ elif (item_node.nodeName == PyQClicCommon._xml_tags[COLOR_TAG]):
"""Set the image, the firstChild in this case is
the image that we saved. Then decode from base64"""
#Make sure it's not a blank string
@@ -158,13 +158,13 @@ class PyClicAdmin:
#We've now loaded all the QUIZ tag elements, the ones that require just one iteration.
#We are looking for the questions Node, which contains all the iterrable values, that is to say
#values for each question found.
- elif (node.nodeName == PyClicCommon._xml_tags[QUESTIONS_TAG]):
+ elif (node.nodeName == PyQClicCommon._xml_tags[QUESTIONS_TAG]):
# Now loop through the question nodes children
for item_node in node.childNodes:
self.entradas=[]
self.randomnumber=None
#we look for entry tag
- if (item_node.nodeName == PyClicCommon._xml_tags[ENTRY_TAG]):
+ if (item_node.nodeName == PyQClicCommon._xml_tags[ENTRY_TAG]):
"""Grab all the entries."""
#Make sure it's not a blank string
if (item_node.firstChild):
@@ -200,7 +200,7 @@ class PyClicAdmin:
#create empty self.coordinate list to place coordinates into
self.coordinate=[]
# Look for coordinates tag
- if (item_node.nodeName == PyClicCommon._xml_tags[COORDINATES_TAG]):
+ if (item_node.nodeName == PyQClicCommon._xml_tags[COORDINATES_TAG]):
"""Grab all the coordinates."""
#Make sure it's not a blank string
if (item_node.firstChild):
@@ -235,25 +235,25 @@ class PyClicAdmin:
The xml document that we will save the post to."""
#create <quiz></quiz>
- quiz_element = xml_document.createElement(PyClicCommon._xml_tags[QUIZ_TAG])
+ quiz_element = xml_document.createElement(PyQClicCommon._xml_tags[QUIZ_TAG])
#create <category></category>
- category_element = xml_document.createElement(PyClicCommon._xml_tags[CATEGORY_TAG])
+ category_element = xml_document.createElement(PyQClicCommon._xml_tags[CATEGORY_TAG])
#Create <category>category</category>
category_element.appendChild(xml_document.createTextNode(self.Category))
#Creates <image></image>
- image_element = xml_document.createElement(PyClicCommon._xml_tags[IMAGE_TAG])
+ image_element = xml_document.createElement(PyQClicCommon._xml_tags[IMAGE_TAG])
#Create <IMAGE>image<IMAGE>
image_element.appendChild(xml_document.createTextNode(self.Image))
#Creates <title></title>
- title_element = xml_document.createElement(PyClicCommon._xml_tags[TITLE_TAG])
+ title_element = xml_document.createElement(PyQClicCommon._xml_tags[TITLE_TAG])
#Creates <title>title</title>
title_element.appendChild(xml_document.createTextNode(self.Title))
#Creates <author></author>
- author_element = xml_document.createElement(PyClicCommon._xml_tags[AUTHOR_TAG])
+ author_element = xml_document.createElement(PyQClicCommon._xml_tags[AUTHOR_TAG])
#Creates <author>author</author>
author_element.appendChild(xml_document.createTextNode(self.Author))
#Creates <color></color>
- color_element = xml_document.createElement(PyClicCommon._xml_tags[COLOR_TAG])
+ color_element = xml_document.createElement(PyQClicCommon._xml_tags[COLOR_TAG])
#Create colorvalues list, and add R,G,B values to it (we should really strip the brackets on string
#conversion here taking out the []), but we do that on load instead. Reason = this function was created
#before the load function
@@ -273,7 +273,7 @@ class PyClicAdmin:
# there is only one of each.
xml_document.documentElement.appendChild(quiz_element)
#create <questions></questions>
- questions_element = xml_document.createElement(PyClicCommon._xml_tags[QUESTIONS_TAG])
+ questions_element = xml_document.createElement(PyQClicCommon._xml_tags[QUESTIONS_TAG])
#Setup iteration
Iterate = 0
#Set questions here, no point in saving values before hand, in fact, come to think of it, we dont really even
@@ -283,17 +283,17 @@ class PyClicAdmin:
# while there are coordinates in the self.coordinates list, iterate through and save stuff
while Iterate < len(self.coordinates):
#Create <question></question>
- question_element = xml_document.createElement(PyClicCommon._xml_tags[QUESTION_TAG])
+ question_element = xml_document.createElement(PyQClicCommon._xml_tags[QUESTION_TAG])
#create <question>question<question> and turn to string (XML requires it)
question_element.appendChild(xml_document.createTextNode(str(question)))
c = self.coordinates[Iterate]
#Create <coordinates></coordinates>
- coordinates_element = xml_document.createElement(PyClicCommon._xml_tags[COORDINATES_TAG])
+ coordinates_element = xml_document.createElement(PyQClicCommon._xml_tags[COORDINATES_TAG])
#create <coordinates>x,y<coordinates>, and turn into strings. This method is better than doing a str
# as no bracets are saved, just value,value for each set of x,y coordinates.
coordinates_element.appendChild(xml_document.createTextNode("%d,%d" % (c[0],c[1])))
#Create <entry></entry>
- entry_element = xml_document.createElement(PyClicCommon._xml_tags[ENTRY_TAG])
+ entry_element = xml_document.createElement(PyQClicCommon._xml_tags[ENTRY_TAG])
#create <entry>entry<entry> and append each entry via the iterator
entry_element.appendChild(xml_document.createTextNode(self.Entries[Iterate]))
@@ -320,7 +320,7 @@ class PyClicAdmin:
#Get the available DOM Implementation, in this case, the XML parser
impl = minidom.getDOMImplementation()
#Create the document, with PyClicAdmin as base node
- xml_document = impl.createDocument(None, PyClicCommon._xml_tags[MAIN_TAG], None)
+ xml_document = impl.createDocument(None, PyQClicCommon._xml_tags[MAIN_TAG], None)
#Save the questions into the xml
self.xml_save(xml_document)
#Now actually try to save the file
@@ -482,7 +482,7 @@ class PyClicAdmin:
"""Allright it all worked! save the current file and
set the title."""
self.xml_file = xml_file
- PyClicCommon.set_window_title_from_file(self.xml_file)
+ PyQClicCommon.set_window_title_from_file(self.xml_file)
#simple little function to grab combobox changed value for category
def on_changed(self,widget):
@@ -613,7 +613,7 @@ class PyClicAdmin:
sys.exit(1)
#instantiate the pycliccomon class which we imported... yay... now I know what instantiate means :-)
- self.pcc=PyClicCommon()
+ self.pcc=PyQClicCommon()
#add the delete_event handler to pyclic common close application method
self.window.connect("delete_event", self.pcc.close_application)
#set size for window
@@ -637,7 +637,7 @@ class PyClicAdmin:
#add a submenu to the file menu, basically everything that shows up below file
filem.set_submenu(filemenu)
#An about menu suboption, linked by the activate handler to the about_program function
- aboutm = gtk.MenuItem(_("About PyClicAdmin"))
+ aboutm = gtk.MenuItem(_("About PyQClicAdmin"))
aboutm.connect("activate",self.pcc.about_program)
#add it to the filemenu
filemenu.append(aboutm)
@@ -802,8 +802,8 @@ def main():
gtk.main()
return 0
-#instantiate pyclicadmin class
+#instantiate pyqclicuser class
if __name__ == "__main__":
- PyClicAdmin()
+ PyQClicUser()
main()