def __init__(self, verbose=False): self.ct = ColumnsTable.ColumnsTable([ ('orderid', 13, '%13s', 'orderid', 'issuepriceid + sequencenumber'), ('ticker', 6, '%6s', 'ticker', 'ticker'), ('maturity', 10, '%10s', 'maturity', 'maturity'), ('n_prints', 10, '%10d', 'nprints', 'number of prints (transactions)'), ('n_buy', 10, '%10d', 'n_buy', 'number of buy transactions'), ('n_dealer', 10, '%10d', 'n_dealer', 'number of dealer transactions'), ('n_sell', 10, '%10d', 'n_sell', 'number of sell transactions'), ('q_buy', 10, '%10d', 'q_buy', 'total quantity of buy transactions'), ('q_dealer', 10, '%10d', 'q_dealer', 'total quantity of dealer transactions'), ('q_sell', 10, '%10d', 'q_sell', 'total quantity of sell transactions'), ]) self.report = Report.Report(also_print=verbose, ) self.report.append('Buy-Dealer-Sell Analysis: Counts by trade_type') self.report.append(' ') self.n_prints = collections.defaultdict(int) self.n_buy = collections.defaultdict(int) self.n_dealer = collections.defaultdict(int) self.n_sell = collections.defaultdict(int) self.q_buy = collections.defaultdict(int) self.q_dealer = collections.defaultdict(int) self.q_sell = collections.defaultdict(int)
def main(self, method, args): signal.signal(signal.SIGINT, self.sig_handler) signal.signal(signal.SIGTERM, self.sig_handler) self.method = method self.r = CRedis.CRedis() self.r.clear() path = os.path.dirname(os.path.realpath(__file__)) + os.sep + 'logs' if not os.path.exists(path): os.makedirs(path) self.r.set('ctime', time.time()) self.r.set('is_report', 1) fd_list = [] for arg in args: p2 = multiprocessing.Process(target=self.sendMsg, args=(arg)) p2.start() fd_list.append(p2) # 测试报告 report = Report.Report() p3 = multiprocessing.Process(target=report.report, args=()) p3.start() p3.join() print("main exit.") sys.exit(0)
def application(self): toExit = input("Press ENTER to continue\n") q = False while q == False: #prompt the user as to what they would like to do print("\nWhat would you like to do?") usr_input = input("\nEnter: Insert - Delete - Modify - Report.\nTo Exit enter 'q'\n") usr_input = usr_input.lower() if usr_input == 'delete': #open the delete class b = Delete() b.checkTour() elif usr_input == 'insert': #open the insert class c = Add() c.usrInputForInsert() elif usr_input == 'modify': #open modify class d = Modify() d.updateInput() elif usr_input == "report": a = Report() a.reportInput() #quit the program elif usr_input == 'q': print("End the Program") q = True return else: print('Invalid choice\n') # self.application() usr_input = input("\nEnter: Insert - Delete - Modify - Report.\nTo Exit enter 'q'\n")
def init(self): report = re.Report() report.init( 123, 42, "pepe", 28, "juan", 2019, fileDescriptor= "<fo:block ><fo:image ></fo:image><fo:block >Value of Variable: $Variable1$</fo:block></fo:block><fo:block ></fo:block>" ) with flx.VBox(): with flx.HBox(): with flx.HBox(): self.new = flx.Button(text='Create New Template', flex=0) self.save = flx.Button(text='Save Template', flex=1) self.load = flx.Button(text='Load Template', flex=2) self.download = flx.Button(text='Get_XML_File', flex=3) with flx.HBox(): self.region = flx.Button(text='Add Region Container', flex=4) self.text = flx.Button(text='Add Text Container', flex=5) self.image = flx.Button(text='Add Image Container', flex=6) self.XML = flx.Label(text="No XML Available Yet", flex=7)
def send_report(self, proxy, service_target, capability_target, time): ''' Create a report on a given proxy. ''' note = self.take_note(proxy, service_target, capability_target) return Report.Report(service_target, capability_target, note, time)
def __init__(self, tag, verbose=True): self.ct = ColumnsTable.ColumnsTable( column_defs('orderid', 'effectivedatetime', 'quantity', 'oasspread_buy', 'oasspread_dealer', 'oasspread_sell', 'restated_trade_type', 'retained_order')) self.report = Report.Report(also_print=verbose) self.report.append(tag) self.report.append(' ')
def main(self, method, args): signal.signal(signal.SIGINT, self.sig_handler) signal.signal(signal.SIGTERM, self.sig_handler) self.r = CRedis.CRedis() self.r.clear() path = os.path.dirname(os.path.realpath(__file__)) + os.sep + 'logs' if not os.path.exists(path): os.makedirs(path) self.r.set('ctime', time.time()) self.r.set('is_report', 1) self.fds = [] for arg in args: tname_Connect2txByIpaddr = 'Connect2txByIpaddr' ctime_Connect2txByIpaddr = time.time() res_Connect2txByIpaddr = Pysensor.Connect2txByIpaddr(*arg) self.record(tname_Connect2txByIpaddr, res_Connect2txByIpaddr[1], ctime_Connect2txByIpaddr, time.time()) self.fds.append(res_Connect2txByIpaddr[0]) self.fd_args[res_Connect2txByIpaddr[0]] = arg fd_list = [] for fd in self.fds: if method == 'all': p1 = multiprocessing.Process(target=self.getMsg, args=(fd, )) p2 = multiprocessing.Process(target=self.sendMsg, args=(fd, )) p1.start() p2.start() fd_list.append((p1, p2)) if method == 'get': p1 = multiprocessing.Process(target=self.getMsg, args=(fd, )) p1.start() fd_list.append(p1) if method == 'send': p2 = multiprocessing.Process(target=self.sendMsg, args=(fd, )) p2.start() fd_list.append(p2) # 测试报告 report = Report.Report() p3 = multiprocessing.Process(target=report.report, args=()) p3.start() p3.join() for p in fd_list: if method == 'all': p[0].join() p[1].join() if method == 'get' or method == 'send': p.join() print("main exit.") sys.exit(0)
def extract(self): try: print self.export_file target = open(self.export_file, 'w') target.truncate() target.write( "Report name\t\t\t\t\t\t\t\t\t\t\t\tInitial time Generate time \t Duration(H:M:S)\tStatus\n\n" ) reportList = self.filteredFileContent() #get report generate starting date reportDate = reportList[-1] del reportList[-1] ## tempReport = {} for index in range(len(reportList)): if index % 2 is 0: #get the starting-ending points for each generated report #[::-1] used to reverse list current_item = reportList[index] #starting point next_item = reportList[index + 1] #ending point tempReport = self.extractReportDetails( current_item, next_item) #print tempReport reportItem = Report() reportItem.setName(tempReport['name']) reportItem.setStatus(tempReport['status']) reportItem.setInitialTimeStamp( self.toTimeStamp(tempReport['initTime'], isDecimal=False)) reportItem.setGeneratedTimeStamp( self.toTimeStamp(tempReport['genTime'], isDecimal=False)) m, r = self.extactBeautify( len(reportItem.getName()) ) # m => multiplier, r => reminder(user to calculate whitespace between columns) target.write(reportItem.getName()) target.write("\t" * m) target.write("" * r) target.write(str(reportItem.getInitialTimeStamp())) target.write("\t") target.write(str(reportItem.getGeneratedTimeStamp())) target.write("\t\t\t\t") h, m, s = self.timeDiff(reportDate, reportItem.getInitialTimeStamp(), reportItem.getGeneratedTimeStamp()) target.write('{}h:{}m:{}s'.format(h, m, s)) target.write("\t") target.write(reportItem.getStatus()) timeInSec = int(h) * 3600 + int(m) * 60 + int(s) if timeInSec > 1800: # more than 30 min target.write("\t") target.write("DELAYS(more than 30 min)") target.write("\n") target.close() except: None
def report_create(self, service, capability, note, time): ''' Test the creation of reports. ''' report = Report.Report(service, capability, note, time) self.assertEqual(report.get_service(), service) self.assertEqual(report.get_capability(), capability) self.assertEqual(report.get_note(), note) self.assertEqual(report.get_time(), time) self.assertEqual(report.csv_output(), f"{service},{capability},{note}")
def __init__(self, ticker, msg, verbose=True): self.ct = ColumnsTable.ColumnsTable([ ('column', 22, '%22s', 'column', 'column in input csv file'), ('n_nans', 7, '%7d', 'n_NaNs', 'number of NaN (missing) values in column in input csv file'), ]) self.report = Report.Report(also_print=verbose, ) self.report.append('Missing Values in Input File %s For Ticker %s' % (msg, ticker)) self.report.append(' ') self.appended = []
def create_record_table(records_data): headers = records_data.columns # print(headers) # print(type(records_data)) records_table = [ Report.Report(headers, record) for record in records_data.values ] # print("Elementow: {0}".format(records_table.__len__())) # for x in records_table: # print(x.shortDesc()) return records_table
def setDiag(self, sender): if sender == 'CQC Check-out': return Checkout.Checkout() elif sender == 'CQC WIP Report': return Report.Report(self.cs) elif sender == 'Product Manager': return Manager.Manager(self.cs) elif sender == 'CQC on the Way': return Shipment.Shipment(self.cs) elif sender == 'CQC Check-in': return Receipt.Receipt(self.cs) elif sender == ' CQC Transfer ': return Lookup.Lookup(self.cs)
def findFailReport(self): try: reportList = self.filterReportList() for reportListItem in reportList: reportItem = Report() reportItem.setName(reportListItem[0]) reportItem.setStatus(reportListItem[3]) reportItem.setGeneratedTimeStamp( self.getFormatedTime(reportListItem[4])) reportItem.setSortByTime(self.getDecimalTime( reportListItem[4])) self.reportFailList.append(reportItem) except: return True
def change_report(self, par, widgets: list): t, m = widgets[0], widgets[1] if t.get_active() == -1 or m.get_active() == -1: return mode = model_report[m.get_active()][0] d = datetime.date.today() d = str(d) if mode == "Monthly": d = d[:-3] if mode == "Yearly": d = d[:-6] if mode == "All Time": d = "" report = Report.Report( self.visit.get_report_info(self.model_trail[t.get_active()][0], d)) report_grid = Gtk.Grid( halign=3, column_spacing=16, margin_bottom=64, ) if report.get_num_visitas() != 0: max_rating = Gtk.Label(label="Max Rating") min_rating = Gtk.Label(label="Min Rating") number_visitors = Gtk.Label(label="Number of Visitors") mode_rating = Gtk.Label(label="Rating Mode") max_rating_value = Gtk.Label( label=str(report.get_classificacao_max())) min_rating_value = Gtk.Label( label=str(report.get_classificacao_min())) number_visitors_value = Gtk.Label( label=str(report.get_num_visitas())) mode_rating_value = Gtk.Label(label=str(report.get_moda())) report_grid.attach(max_rating, 0, 0, 1, 1) report_grid.attach(min_rating, 1, 0, 1, 1) report_grid.attach(number_visitors, 2, 0, 1, 1) report_grid.attach(mode_rating, 3, 0, 1, 1) report_grid.attach(max_rating_value, 0, 1, 1, 1) report_grid.attach(min_rating_value, 1, 1, 1, 1) report_grid.attach(number_visitors_value, 2, 1, 1, 1) report_grid.attach(mode_rating_value, 3, 1, 1, 1) else: report_grid.attach(Gtk.Label(label="No Ratings..."), 0, 0, 1, 1) while (self.grid.get_child_at(0, 3) != None): self.grid.remove_row(3) self.grid.attach(report_grid, 0, 3, 1, 1) self.grid.show_all()
def __init__(self, tank_capacity=0, car_cost=0, cost_losing=0.0, fuel_cost=0.0, fuel_consumption=0, service_cost=0, mileage_till_recovery=0): self.__tank_capacity = tank_capacity self.__current_tank_capacity = tank_capacity self._car_cost = car_cost self.__cost_losing = cost_losing self.__fuel_cost = fuel_cost self.__fuel_consumption = fuel_consumption self.__start_fuel_consumption = fuel_consumption self.__service_cost = service_cost self.__mileage_till_recovery = mileage_till_recovery self.__mileage = 0 self._board_computer = Report.Report()
def __init__(self, folder_path, take_max=-1, get_classes_function=None): self.folder_path = folder_path self.dataset_name = os.path.basename(folder_path).replace( 'pairs_', '').replace('_new', '') self.take_max = take_max self.number_of_files_in_folder = countJsonFiles(folder_path) errors_report_path = os.path.normcase(folder_path + '/pairs_errors') self.errors_report = Report(errors_report_path) self.get_classes_function = get_classes_function self.index_file_path = os.path.normcase(self.folder_path + '/classes_index.json') self.filters_indexes_file_path = os.path.normcase( self.folder_path + '/filters_indexes.json') self.classes_list_file_path = os.path.normcase(self.folder_path + '/classes_list.json') self.numbers_from_index = None self.took = 0 self.return_names = False if not os.path.exists(self.index_file_path): self.dumpClassesIndex()
def ReportTable(self, hypo_table=True, p_teacher_xy_h=False, p_y_xh=False, p_teacher_x_h=True, p_learner_h_xy=True, format=False, textcopy=False): Report.Report(self.num_hypo, self.num_feature, self.num_label, self.hypo_table if hypo_table == True else None, self.p_teacher_xy_h if p_teacher_xy_h == True else None, self.p_y_xh if p_y_xh == True else None, self.p_teacher_x_h if p_teacher_x_h == True else None, self.p_learner_h_xy if p_learner_h_xy == True else None, None) if textcopy: Report.Report_to_File( self.hypo_table if hypo_table == True else None, self.p_teacher_xy_h if p_teacher_xy_h == True else None, self.p_y_xh if p_y_xh == True else None, self.p_teacher_x_h if p_teacher_x_h == True else None, self.p_learner_h_xy if p_learner_h_xy == True else None)
def __init__(self, ticker, maturity, verbose=False): self.ct = ColumnsTable.ColumnsTable([ ('orderid', 14, '%14s', ('unique', 'orderid'), 'issuepriceid + sequencenumber'), ('cusip', 9, '%9s', ('', 'cusip'), 'cusip'), ('effectivedate', 10, '%10s', ('effective', 'date'), 'effectivedate'), ('effectivetime', 10, '%10s', ('effective', 'time'), 'effectivetime'), ('quantity', 8, '%8d', (' ', 'quantity'), 'quantity'), ('oasspread_buy', 6, '%6.0f', ('dealer', 'buy'), 'oasspread if trade_type is B'), ('oasspread_dealer', 6, '%6.0f', ('dealer', 'dealer'), 'oasspread if trade_type is D'), ('oasspread_sell', 6, '%6.0f', ('dealer', 'sell'), 'oasspread if trade_type is S'), ]) self.report = Report.Report(also_print=verbose, ) self.report.append( 'Buy-Dealer-Sell Analysis for Ticker %s Maturity %s' % (ticker, maturity)) self.report.append(' ')
def listReport(): ''' Return List of all Issues ''' try: reportList= [] keys = [project.key for project in projects] for key in keys : try: proj_key = jira.project(key) issues = jira.search_issues('project='+key) for issue in issues: isstype=issue.fields.issuetype summary=issue.fields.summary due=issue.fields.duedate ass=issue.fields.assignee createdate = issue.fields.created reportList.append(Report.Report(proj_key.name,issue,isstype,summary,due,ass,createdate)) except Exception as Ex: pass continue except Exception as ex: pass return reportList
def __init__(self, **kwargs): self.data = kwargs if (self.data.get("reporter", None) != None): print("Report Class Already Initialized") else: self.data["reporter"] = Report.Report() print("New Report Class Initialized") self.recording_function_thread = threading.Thread( target=self.recording_function) self.pre_processing_function_thread = threading.Thread( target=self.pre_processing_function) self.processing_function_thread = threading.Thread( target=self.processing_function) #self.error_function_thread = threading.Thread(target=self.processing_function) self.processing_q = Queue() self.pre_processing_q = Queue() self.recording = False self.stopped = threading.Event() self.sqlock = threading.Lock() self.apilock = threading.Lock() self.data["reporter"].set_locks(self.apilock, self.sqlock) self.pyaudio_obj = pyaudio.PyAudio() self.stream = self.pyaudio_obj.open(format=self.FORMAT, channels=self.CHANNELS, rate=self.RATE, input=True, frames_per_buffer=self.CHUNK) self.THRESHOLD = self.reset_threshold(100)
def __init__(self, verbose=True): self.report = Report.Report(also_print=verbose)
print("Converge layer objectmatching in the processing model") image_group, image_mask, Layer_Group = markProcess.Vagroup(vectorL1[0], vectorL1[1], vectorL2[0], vectorL2[1]) image_mark, object_mask, vector_object, counter = markProcess.countIntegration(image, image_mask) print(" ") print("Writting the information on the disk") cv2.imwrite(path_processed + image_path + "Marked_"+ element, image_mark.astype('uint8')) cv2.imwrite(path_processed + image_path + "Mask_"+ element, image_mask.astype('uint8')) cv2.imwrite(path_processed + image_path + "L10_"+ element, imageL10.astype('uint8')) cv2.imwrite(path_processed + image_path + "L11_"+ element, imageL11.astype('uint8')) cv2.imwrite(path_processed + image_path + "L20_"+ element, imageL20.astype('uint8')) cv2.imwrite(path_processed + image_path + "L21_"+ element, imageL21.astype('uint8')) ## Reporte print("Agroup information for report the process") name = element[0:element.find(".")] time_end = time.time() - image_time report_image = Report.Report() report_image.Generate(name, path_processed, time_end, vector_object, vectorL1, vectorL2, counter) print("Ending process for image " + element) print("Image time processing : " + str(time.time() - image_time) + "Seconds") # break else: print("WARNING ") print(element + " Not a image file allowed") Total_time = time.time() - init_time print("TOTAL TIME FOR THE ELEMENTS " + str(Total_time) + "Seconds") finish = input("Push any key to finish ")
if len(nuclei_result) == 0: print("[*] Nuclei scan completed no results found.") notify_bot.send_debug_notification( "Nuclei scan completed, no results found.") print("[*] Running Takemeon Scanner") tmo_wrapper = TMOWrapper() tmo_result = tmo_wrapper.check_takeover(data) if len(tmo_result) == 0: print("[*] takemeon scan completed no results found.") notify_bot.send_debug_notification( "Takemeon scan completed, no results found.") nuclei_result.extend(tmo_result) if len(nuclei_result) == 0: print("[*] No subdomain takeovers found") notify_bot.send_debug_notification( "SDTKO scan completed, no results found.") exit(0) for item in nuclei_result: notify_bot.send_important_notification("Found Subdomain " + item['sub'] + " pointing to " + item['resolution']) print("Found Subdomain " + item['sub'] + " pointing to " + item['resolution']) r = Report(domain_name) r.create_report(nuclei_result) notify_bot.send_debug_notification("SDTKO scan completed with " + str(len(nuclei_result)) + " results.")
def Main(): rptObj = Report('c:\\overnitebld.log'); # TODO: When debugging is complete, remove the following line of code to turn # verbose mode off rptObj.verboseModeOn() # Get command line arguments, the first of which is this script's name arguments = sys.argv # Name of script + two parameters = 3 parameters (we just don't care about the first one) if len(arguments) < 3: misc_DisplayUsage(rptObj) raise Exception, 'Too few command line parameters' nodebugbld = false noreleasebld = false noboundsbld = false noautotest = false norefreshsrc = false nocreatedbs = false noinstallbldr = false nocreatedoc = false testrefresh = false testdoc = false testdb = false testdb = false testinst = false nodeloutput = false # Assume the first two arguments are the build root and output root, and ensure they # end with \ (backslashes) strBldFldr = arguments[1] strBldFldr = re.sub('\\\\*$', '\\\\', strBldFldr, 1) strOutputFldr = arguments[2] strOutputFldr = re.sub('\\\\*$', '\\\\', strOutputFldr, 1) bldLevel = '' TODO: Add strFWDeliverables variable and retrieve off the command line. # Loop through and process the command line arguments for iArgs in range(3, len(arguments)): strArg = arguments[iArgs] if strArg[0] != '-': rptObj.echoIt('Options must be preceeded by a "-".') raise Exception, 'Option not preceeded by a "-"' cmd = string.lower(strArg[1]) if cmd == 'b': bldLevel = long(strArg[2]) if bldLevel < 0 or bldLevel > 8: rpt.echoIt('ERROR: Buildlevel must be an integer between 0 and 8.') raise Exception, 'Invalid Buildlevel--must be an integer between 0 and 8' rptObj.echoItVerbose('Build level set to ' + strArg[2]) elif cmd == 'l': strVSLabel = strArg[2] rptObj.echoItVerbose('Applying label ' + strVSSLabel) # The command dVariableName results in the the code "VariableName = true" being executed elif cmd == 'd': strVar = strArg[2:len(strArg)] strVar = string.lower(strVar) try: exec strVar + '= true' except: raise 'Could not assign variable ' + strVar rptObj.echoItVerbose('Defining ' + strVar) elif cmd == 'o': strOutputFldrOverride = strArg[2:len(strArg)] rptObj.echoItVerbose('Overriding output directory ' + strVar) else: rptObj.echoIt('ERROR: Invalid argument, "' + strArg + '"') raise Exception, 'Invalid argument, "' + strArg + '"' if testrefresh: nodebugbld = true noreleasebld = true noboundsbld = true noautotest = true nodeloutput = true norefreshsrc = false nocreatedbs = true noinstallbldr = true nocreatedoc = true if testdoc: nodebugbld = true noreleasebld = true noboundsbld = true noautotest = true nodeloutput = true norefreshsrc = true nocreatedbs = true noinstallbldr = true nocreatedoc = false if testdb: nodebugbld = true noreleasebld = true noboundsbld = true noautotest = true nodeloutput = true norefreshsrc = true nocreatedbs = false noinstallbldr = true nocreatedoc = true if testinst: nodebugbld = true noreleasebld = true noboundsbld = true noautotest = true nodeloutput = true norefreshsrc = true nocreatedbs = true noinstallbldr = false nocreatedoc = true rptObj.echoItVerbose('Setting up build system') rptObj.echoItVerbose('Setting env vars.') os.environ['BUILD_LEVEL'] = str(bldLevel) #os.environ['FWROOT'] = strBldFldr # Set FWROOT and BUILD_ROOT to the source file directory (used w/mkall.bat) os.environ['FWROOT'] = 'c:\fwsrc' os.environ['BUILD_ROOT'] = 'c:\fwsrc' # Delete output directories if not nodeloutput: rptObj.echoItVerbose('Removing the output folders...') try: rptObj.echoItVerbose('Removing the output folder...') file_DeleteFolder(os.path.join(strBldFldr, 'output')) rptObj.echoItVerbose('Removing the obj folder...') file_DeleteFolder(os.path.join(strBldFldr, 'obj')) rptObj.echoItVerbose('Removing the overnite files...') file_DeleteFile(os.path.join(strOutputFldr, 'overnite.tst')) rptObj.echoItVerbose('Done clearing out source tree') except Exception, err: rptObj.reportFailure('Unable to recreate source tree, ' + str(err), 1) raise
import buildfw from Report import * #-------------------------- FUNCTION EXITSCRIPT ------------------------------ def exitScript(rptObj): #Reset the FWROOT environment variable. if (rptObj == 1): rptObj.closeLog() return #------------------------------- MAIN PROGRAM -------------------------------- rptObj = Report('t.txt') try: print "Now in main" Main() except Exception, err: print "Unhandled exception, check for spelling errors: " + str(err) exitScript(0)
def report(): return Report.Report()
def Observation(): Report.Report(self.var_Batch_Number.get()).Plot() Report.Report(self.var_Batch_Number.get()).Report() #Jumping window# messagebox.showinfo(title = "From Sherlock", message = "You see, but you do not observe.")
def __init__(self): self.report = Report() self.lock = threading.RLock()
def __init__(self, project, trace, title, path, reportFormat): self.project = project self.trace = trace self.path = path self.reportFormat = reportFormat self.library = project.targets["code"].library self.constants = Collections.DictProxy(self.library.constants) self.report = Report.Report(title) self.frames = [] self.interestingFrames = [] # Lazy loading of charting support global pylab, Charting import Charting from Charting import pylab try: self.compiler = Report.createCompiler(reportFormat, self.report) except KeyError: raise RuntimeError("Unsupported format: %s" % format) if not trace.events: raise RuntimeError("Trace is empty.") # Make sure the output directory exists Report.makePath(self.path) # Report appearance self.primaryColor = "orange" self.secondaryColor = "lightgrey" self.highlightColor = "red" self.thumbnailSize = (64, 64) # Chart appearance if pylab: pylab.subplots_adjust(hspace=.5) pylab.rc("font", size=7) pylab.rc("xtick", labelsize=7) pylab.rc("ytick", labelsize=7) pylab.rc("axes", labelsize=7) pylab.rc("legend", fontsize=9) # HTML report appearance if reportFormat == "html": self.compiler.setStyle("h1,h2,h3,h4,h5,h6", "clear: both;") self.compiler.setStyle("a", "color: %s;" % self.primaryColor, "text-decoration: none;") self.compiler.setStyle("a:hover", "color: %s;" % self.highlightColor, "text-decoration: underline;") self.compiler.setStyle("a img", "border: none;") self.compiler.setStyle("p.code", "background-color: #eee;", "border: solid 1px #ddd;", "width: 66%;", "padding: 1em;", "margin-left: 4em;") self.compiler.setStyle("p.checkpass", "float: right;", "padding: 1em;", "border: solid 1px black;", "background-color: %s;" % self.primaryColor) self.compiler.setStyle( "p.checkfail", "float: right;", "padding: 1em;", "border: solid 1px black;", "background-color: %s;" % self.highlightColor) self.compiler.setStyle("div.toc li", "list-style-type: none") self.compiler.setStyle("div.toc a", "color: black;") self.compiler.setStyle("table", "border: solid thin #aaa;", "margin: 1em;", "border-collapse: collapse;", "margin-left: 4em;") self.compiler.setStyle( "table th", "text-align: left;", "padding: .1em 1em .1em 1em;", "background-color: %s;" % (self.primaryColor)) self.compiler.setStyle("tr.odd", "background-color: #eee;") self.compiler.setStyle("table td", "padding: .1em 1em .1em 1em;") self.compiler.setStyle("img.screenshot", "float: right;")
import Report as re import ReportItem as ri report = re.Report() report.init( 123, 42, "pepe", 28, "juan", 2019, fileDescriptor= "<fo:block ><fo:image ></fo:image><fo:block >Value of Variable: $Variable1$</fo:block></fo:block><fo:block ></fo:block>" ) print("\nResult after initialization from file") report.saveFile() item = report.items[-1] item.setText("Value of Variable: ") item.setReplaceValue("Variable1") print("\nResult after adding replacement values") report.saveFile() report.addItem(ri.TextItemType) item = report.items[-1] item.setText("This is the newly added value") item.setCharacteristic("margin-left", "20pt") item.setCharacteristic("font-weight", "bold") print("\nResult after adding a new item with formatting") report.saveFile() report.items[2].moveToOtherDomain(report.items[0])