Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pyqclicadmin.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyqclicadmin.py')
-rw-r--r--pyqclicadmin.py64
1 files changed, 33 insertions, 31 deletions
diff --git a/pyqclicadmin.py b/pyqclicadmin.py
index 220f3cc..2f776b6 100644
--- a/pyqclicadmin.py
+++ b/pyqclicadmin.py
@@ -96,7 +96,7 @@ class PyQClicAdmin:
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 == pyQClicCommon._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 PyQClicAdmin:
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 == pyQClicCommon._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 PyQClicAdmin:
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 == pyQClicCommon._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 PyQClicAdmin:
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 == pyQClicCommon._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 PyQClicAdmin:
#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 == pyQClicCommon._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 == pyQClicCommon._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 PyQClicAdmin:
#create empty self.coordinate list to place coordinates into
self.coordinate=[]
# Look for coordinates tag
- if (item_node.nodeName == pyQClicCommon._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 PyQClicAdmin:
#iterator list called entradas.
self.entradas=[]
#we look for entry tag
- if (item_node.nodeName == pyQClicCommon._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 PyQClicAdmin:
The xml document that we will save the post to."""
#create <quiz></quiz>
- quiz_element = xml_document.createElement(pyQClicCommon._xml_tags[QUIZ_TAG])
+ quiz_element = xml_document.createElement(PyQClicCommon._xml_tags[QUIZ_TAG])
#create <category></category>
- category_element = xml_document.createElement(pyQClicCommon._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(pyQClicCommon._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(pyQClicCommon._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(pyQClicCommon._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(pyQClicCommon._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 PyQClicAdmin:
# there is only one of each.
xml_document.documentElement.appendChild(quiz_element)
#create <questions></questions>
- questions_element = xml_document.createElement(pyQClicCommon._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 PyQClicAdmin:
# 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(pyQClicCommon._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(pyQClicCommon._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(pyQClicCommon._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 PyQClicAdmin:
#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, pyQClicCommon._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 PyQClicAdmin:
"""Allright it all worked! save the current file and
set the title."""
self.xml_file = xml_file
- pyQClicCommon.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):
@@ -617,26 +617,28 @@ class PyQClicAdmin:
# Now lets get all of the supported languages on the system
language = os.environ.get('LANGUAGE', None)
if (language):
- """langage comes back something like en_CA:en_US:en_GB:en
- on linuxy systems, on Win32 it's nothing, so we need to
- split it up into a list"""
+# """langage comes back something like en_CA:en_US:en_GB:en
+# on linuxy systems, on Win32 it's nothing, so we need to
+# split it up into a list"""
langs += language.split(":")
- """Now add on to the back of the list the translations that we
- know that we have, our defaults"""
+# """Now add on to the back of the list the translations that we
+# know that we have, our defaults"""
langs += ["en_US", "es_ES"]
- """Now langs is a list of all of the languages that we are going
- to try to use. First we check the default, then what the system
- told us, and finally the 'known' list"""
+# """Now langs is a list of all of the languages that we are going
+# to try to use. First we check the default, then what the system
+# told us, and finally the 'known' list"""
gettext.bindtextdomain(APP_NAME, self.local_path)
gettext.textdomain(APP_NAME)
# Get the language to use
self.lang = gettext.translation(APP_NAME, self.local_path
, languages=langs, fallback = True)
- """Install the language, map _() (which we marked our
- strings to translate with) to self.lang.gettext() which will
- translate them."""
+# """Install the language, map _() (which we marked our
+# strings to translate with) to self.lang.gettext() which will
+# translate them."""
+
+ global _
_ = self.lang.gettext