def exportRequirementsDocument(session, top_items): if False: top_items = session.query(model.Requirement).\ filter(model.Requirement.Name==requirement_name).\ all() if len(top_items) == 0: raise RuntimeError('Could not find %s, sorry'%requirement_name) top_item = top_items[0] renderer = RstRenderer() last_change = session.query(model.ChangeLog.TimeStamp).\ filter(model.ChangeLog.RecordType == model.Requirement.__tablename__).\ order_by(model.ChangeLog.TimeStamp.desc()).first() renderer.renderChapterHead(top_item) renderer.renderVersion(last_change[0] if last_change else None) for chapter in sorted(top_item.Children, cmp=cmpRequirements): renderer.renderChapterHead(chapter) for section in sorted(chapter.Children, cmp=cmpRequirements): renderer.renderSectionHead(section) #renderer.renderRequirementsTable(sorted(section.Children, key=lambda x:x.Id)) offspring = section.getAllOffspring() if offspring: renderer.renderRequirementsTable(sorted(offspring, cmp=cmpRequirements)) print renderer fname = '%s/%s'%(config.getConfig('export_dir'), top_item.Name+'.odt') renderer.write(fname, 'odf_odt')
def __init__(self): # Setup UI first. QtGui.QMainWindow.__init__(self, None) self.current_url = None self.centralwidget = None self.setStyleSheet('font: %spt "%s";' % (config.getConfig('font_size'), config.getConfig('font_name'))) # self.setStyleSheet('font: 12 "MS Shell Dlg 2";') # self.setStyleSheet('font: 12pt "MS Shell Dlg 2";') self.ui = MainWindowForm[0]() self.ui.setupUi(self) for action, func in [(self.ui.actionNew, self.onNew), (self.ui.actionOpen, self.onOpen), (self.ui.actionArchitecture, self.onArchitectureView), (self.ui.actionPlanning, self.onPlanningView), (self.ui.actionExport_as_CSV, self.exportCsv), (self.ui.actionNew_from_CSV, self.newFromCsv), (self.ui.actionWork_Items, self.onWorkItemView), (self.ui.actionRequirements_Document, self.onRequirementsDocument), (self.ui.actionOpen_Database, self.onOpenDatabase), (self.ui.actionProgress_Report, self.onProgressReport) ]: action.triggered.connect(func) # Add the recent files to the menu self.setRecentFileMenu() # Open the most recent file recent = config.getRecentFiles() if len(recent) > 0: self.open(url=recent[0]) # Monkey-patch the menu to show its tooltips. I don't believe QT developers are so arrogant # they purposely disable tooltips in menu's! def handleMenuHovered(action): QtGui.QToolTip.showText( QtGui.QCursor.pos(), action.toolTip(), self.ui.menuRecent_Files, self.ui.menuRecent_Files.actionGeometry(action)) self.ui.menuRecent_Files.hovered.connect(handleMenuHovered)
class MyThread(Thread): def run(self): Thread.run(self) def testBaidu(host, browser): print host, browser driver = webdriver.Remote( command_executor=host, desired_capabilities={"platform": "ANY", "browserName": browser, "version": "", "javascriptEnabled": True}, ) driver.get("http://www.baidu.com") driver.find_element_by_id("kw").send_keys("grid2") t.sleep(2) driver.close() threads = [] files = range(len(getConfig())) for host, browser in getConfig().items(): t1 = MyThread(target=test_baidu, args=(host, browser)) threads.append(t1) if __name__ == "__main__": for i in files: threads[i].start() for i in files: threads[i].join() print "Over"
Thread.run(self) def testBaidu(host, browser): print host, browser driver = webdriver.Remote(command_executor=host, desired_capabilities={ 'platform': 'ANY', 'browserName': browser, 'version': '', 'javascriptEnabled': True }) driver.get('http://www.baidu.com') driver.find_element_by_id('kw').send_keys('grid2') t.sleep(2) driver.close() threads = [] files = range(len(getConfig())) for host, browser in getConfig().items(): t1 = MyThread(target=test_baidu, args=(host, browser)) threads.append(t1) if __name__ == '__main__': for i in files: threads[i].start() for i in files: threads[i].join() print 'Over'