def __init__(self, xmlParentNode=None, xmlFile=None): self.db = {} self.eligible_reviewers = {} self.topics = topics.Topics() self.xmlFile = xmlFile if xmlParentNode != None: self.importXml(xmlParentNode)
def clearAllData(self): ''' clear all data (except for self.settings) ''' import email_template self.proposals = prop_mvc_data.AGUP_Proposals_List(self) self.reviewers = revu_mvc_data.AGUP_Reviewers_List(self) self.topics = topics.Topics() self.email = email_template.EmailTemplate()
def __init__(self, xmlParentNode = None, xmlFile = None): ''' :param xmlParentNode: lxml node of the Reviewer :param xmlFile: name of the XML file :param xmlFile: str ''' self.db = {} self.topics = topics.Topics() self.db['name'] = None self.xmlFile = xmlFile for item in self.tagList: self.db[item] = None if xmlParentNode != None: self.importXml( xmlParentNode )
def importTopics(self, xmlFile): ''' import a complete set of Topics (usually from a previous PRP Project file) Completely replace the set of Topics currently in place. ''' topics_obj = topics.Topics() topics_obj.importXml(xmlFile, False) # merge with other lists for topic in topics_obj.topics: if not self.topics.exists(topic): self.topics.add(topic) self.proposals.addTopic(topic) self.reviewers.addTopic(topic)
def __init__(self, parent=None, topics_list=None, settings=None): self.parent = parent self.topics = topics.Topics() self.topics.addTopics(topics_list) self.settings = settings QtGui.QDialog.__init__(self) resources.loadUi(UI_FILE, self) self.restoreWindowGeometry() self.setWindowTitle('AGUP List of Topics') self.listWidget.addItems(self.topics.getTopicList()) self.add_pb.clicked.connect(self.onAdd) self.delete_pb.clicked.connect(self.onDelete) # select the first item in the list idx = self.listWidget.indexAt(QtCore.QPoint(0, 0)) self.listWidget.setCurrentIndex(idx) self.custom_signals = signals.CustomSignals()
def importXml(self, reviewer): ''' Fill the class variables with values from the XML node :param reviewer: lxml node node of the Reviewer ''' self.db['name'] = reviewer.attrib['name'].strip() for k in self.tagList: text = xml_utility.getXmlText(reviewer, k) if text is None: self.db[k] = None else: self.db[k] = tools.text_encode(text) self.topics = topics.Topics() node = reviewer.find('Topics') if node is not None: for t_node in node.findall('Topic'): key = t_node.attrib['name'] try: value = float( t_node.attrib['value']) except ValueError: value = 0.0 self.topics.add(key, value)
def main(): import sys app = QtGui.QApplication(sys.argv) mw = AGUP_ReviewerDetails() mw.setFullName('Joe Reviewer') mw.setSortName('Reviewer') mw.setPhone('555-555-5555') mw.setEmail('*****@*****.**') mw.setJoined('2010-2') mw.setUrl('http://user.com') mw.setNotes('''That URL is fake.\nDo not trust it!''') # setup some examples for testing topic_object = topics.Topics() for k, v in dict(SAXS=0.5, XPCS=0.1, GISAXS=0.9).items(): topic_object.add(k, v) w = {} row = 0 for key in topic_object: value = topic_object.get(key) w[key] = topic_slider.AGUP_TopicSlider(mw.topic_layout, row, key, value) row += 1 mw.topic_layout.setColumnStretch(1, 3) print 'getFullName', mw.getFullName() print 'getSortName', mw.getSortName() print 'getPhone', mw.getPhone() print 'getEmail', mw.getEmail() print 'getJoined', mw.getJoined() print 'getUrl', mw.getUrl() print 'getNotes', mw.getNotes() mw.show() sys.exit(app.exec_())
import os, signal, time import topics, questions, sounds, ui from datetime import datetime curdir = os.path.dirname(os.path.realpath(__file__)) topics = topics.Topics(curdir) bank = questions.QuestionBank(curdir, topics.topic_directory_name, topics.current_topic_directory(), topics.topic_file_name) sounds = sounds.Sounds(curdir) ui = ui.UserInterface(topics, bank, sounds) # the entry point to the application... if __name__ == "__main__": signal.signal(signal.SIGINT, ui.cleanup) while ui.running: time.sleep(0.5)