Best JavaScript code snippet using wpt
tag_actions_wxpython.py
Source:tag_actions_wxpython.py
1#coding:utf-82import wx3import os4import mysql.connector5import time6import re78'''9create table tag_actions6(text_num int, sent_num int, sent varchar(400), tag_sent varchar(400));10create table new_actions(text_num int, sent_num int, sent varchar(400), tag_sent varchar(400));11'''12#"/home/fengwf/Documents/DRL_data/long_texts/long_texts_ccfs/"13#'/home/fengwf/Documents/DRL_data/windows_help_support/win10_out/'14class TextFrame(wx.Frame):15 def __init__(self):16 self.home_dir = 'tag_actions1/'#"./DRL_data/windows_help_support/win10_out/"17 self.table = 'new_actions1'18 self.total_text = 5219 self.text_num = 020 self.sent_num = 021 self.num = 022 self.max_tags = 023 self.words = []24 self.tag_sent = []25 self.display_sent = []26 self.result = []27 self.start_flag = False28 self.search_flag = False29 self.delete_flag = False30 self.change_flag = False31 self.table_flag = False32 self.exit_flag = False33 self.show_frame()34 3536 def show_frame(self):37 wx.Frame.__init__(self, None, -1, 'Tag Actions from texts', size=(800, 600)) #æ´ä¸ªçé¢å¤§å°38 panel = wx.Panel(self, -1)39 panel.SetBackgroundColour('aquamarine')40 panel.Refresh()4142 str = "Welcome to the tag_actions.app of Fence!" #éææ¾ç¤ºææ¬ï¼æ¬¢è¿æ é¢43 self.text = wx.StaticText(panel, -1, str, (140,-1))44 font1 = wx.Font(18, wx.ROMAN, wx.ITALIC, wx.BOLD) #åä½18å·ï¼ç½é©¬åï¼æä½ï¼å ç²45 self.text.SetFont(font1)46 self.text.SetForegroundColour('tan') #é¢è²ä¸ºæ£è²47 48 self.info_text = wx.StaticText(49 panel, -1, "All rights reserved"+u'©'+"fengwf.PlanLab.2016", (540,540)) #è¾å
¥ææ¬æ¡50 self.info_text.SetForegroundColour('dark slate blue')5152 self.OutputText = wx.TextCtrl(panel, -1,"Input text_num and sent_num:\n", size=(700, 400), 53 pos=(50,40), style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_RICH2) #å建ä¸ä¸ªè¾åºææ¬æ§ä»¶54 font2 = wx.Font(12, wx.NORMAL, wx.NORMAL, wx.NORMAL)55 self.OutputText.SetFont(font2)56 #self.OutputText.SetForegroundColour('orchid')57 self.pointer = self.OutputText.GetInsertionPoint()58 59 self.InputLabel = wx.StaticText(panel, -1, "Your input:", (100,455)) #è¾å
¥ææ¬æ¡60 self.InputText = wx.TextCtrl(panel, -1, "", size=(175, -1), \61 style=wx.TE_PROCESS_ENTER, pos=(180,450))62 self.InputText.SetInsertionPoint(0)63 self.Bind(wx.EVT_TEXT_ENTER,self.Input_Box,self.InputText)64 65 self.SearchLabel = wx.StaticText(panel, -1, "Search input:", (390,455)) #è¾å
¥ææ¬æ¡66 self.SearchText = wx.TextCtrl(panel, -1, "", size=(175, -1), \67 style=wx.TE_PROCESS_ENTER, pos=(480,450)) #æ¥è¯¢çè¾å
¥ææ¬æ¡68 self.SearchText.SetInsertionPoint(0)69 self.Bind(wx.EVT_TEXT_ENTER,self.Search_Input,self.SearchText)7071 self.button1 = wx.Button(panel, -1,"Search", pos=(100, 500)) #æç´¢æé®72 self.Bind(wx.EVT_BUTTON, self.Search_Button, self.button1)73 self.button1.SetDefault()74 75 self.button2 = wx.Button(panel, -1,"A", pos=(180, 500)) #æé®ï¼æ¾ç¤ºå
¨é¨è®°å½76 self.Bind(wx.EVT_BUTTON, self.ShowAll_Button, self.button2)77 self.button2.SetDefault()78 79 self.button3 = wx.Button(panel, -1,"L", pos=(260, 500)) #æé®ï¼æ¾ç¤ºæè¿åæ¡è®°å½80 self.Bind(wx.EVT_BUTTON, self.ShowLast10_Button, self.button3)81 self.button3.SetDefault()82 83 self.button4 = wx.Button(panel, -1,"D", pos=(340, 500)) #æé®ï¼å é¤è®°å½84 self.Bind(wx.EVT_BUTTON, self.Delete_Button, self.button4)85 self.button4.SetDefault()86 87 self.button5 = wx.Button(panel, -1,"Exit", pos=(500, 500)) #æé®ï¼éåº88 self.Bind(wx.EVT_BUTTON, self.Exit_Button, self.button5)89 self.button5.SetDefault()90 91 self.button6 = wx.Button(panel, -1,"Reboot", pos=(420, 500)) #æé®ï¼éåº92 self.Bind(wx.EVT_BUTTON, self.Reboot_Button, self.button6)93 self.button6.SetDefault()94 95 self.button7 = wx.Button(panel, -1,"ChangeDir", pos=(580, 500)) #æé®ï¼éåº96 self.Bind(wx.EVT_BUTTON, self.Change_dir_Button, self.button7)97 self.button7.SetDefault()98 99 def div_sents(self):100 try:101 t = open(self.home_dir+str(self.text_num+1)+".txt").read() 102 except IOError:103 self.OutputText.AppendText('\Could not open, no such file or directory as: %s\n'\104 %self.home_dir)105 t = re.sub(r'\n',' ',t)106 t = re.sub(r',|"|\(|\)|\[|\]|\{|\}','',t)107 self.words = []108 sents = re.split(r'[\.?!:;]+ ',t) #åææ¯ä¸ªå¥åï¼åå·åå·ä¹ç®å®æä¸ä¸ªå¥å109 for i in sents:110 words = i.split()111 if len(words) > 0:112 words[0] = words[0].lower()113 self.words.append(words)114 return self.words115116117 def get_text_from_database(self):118 tmp_table = self.home_dir[:-1]119 get_data = "select * from " + tmp_table + " where text_num=" + \120 str(self.text_num) + " order by sent_num"121 cur.execute(get_data)122 result = cur.fetchall()123 assert len(result) > 0124 125 self.tags = []126 self.words = []127 for i in range(len(result)):128 #get sentences from database129 sent_lower = result[i][2][0].lower() + result[i][2][1:]130 words_of_sent = re.split(r' ',sent_lower)131 tags_of_sent = re.split(r' ',result[i][3])132 self.words.append(words_of_sent)133 self.tags.append(tags_of_sent)134 print '------------ len(words)',sum([len(i) for i in self.words])135 136137 def set_output(self, message, color):138 self.pointer = self.OutputText.GetInsertionPoint()139 self.OutputText.AppendText(message)140 tp_point = self.pointer141 self.pointer = self.OutputText.GetInsertionPoint()142 self.OutputText.SetStyle(tp_point, self.pointer, wx.TextAttr(color, wx.NullColour))143 144145 def Input_Box(self, event):146 input_str = self.InputText.GetValue().encode("ascii")147 temp_in = input_str.split()148 self.OutputText.AppendText(input_str+'\n')149 if not self.start_flag:150 if len(temp_in)!=2:151 message = '\nText_num out of range. Please input again:\n'152 self.set_output(message, "red")153 else:154 start_text = int(temp_in[0])155 start_sent = int(temp_in[1])156 if start_text < 0 or start_text > self.total_text-1: 157 message = '\nText_num out of range. Please input again:\n'158 self.set_output(message, "red")159 else:160 self.text_num = start_text161 self.sent_num = start_sent162 self.get_text_from_database()163 self.start_flag = True164 if self.sent_num >= len(self.words) or self.sent_num < 0:165 self.sent_num = 0166 message = "\n\n***** Text name: %s *****"%(self.home_dir+str(self.text_num)+'.txt')167 message += "\nTotal sentences: %d\168 Total words: %d\n" % (len(self.words),sum(len(s) for s in self.words))169 self.set_output(message, "maroon")170 self.display_sent = []171 self.max_tags = len(self.words[self.sent_num])172 self.tag_sent = self.tags[self.sent_num]173 for jj in range(self.max_tags):174 self.display_sent.append(self.words[self.sent_num][jj]+'('+str(jj)+')')175 message = '\n\nSentence{}: {}\n'.format(self.sent_num, ' '.join(self.display_sent))176 message += 'Current tags: %s\n'%' '.join(self.tags[self.sent_num])177 self.set_output(message, "blue")178 self.OutputText.AppendText("Input the total actions and their indices:\n")179 180 else:181 self.num = []182 tags = []183 if temp_in:184 if temp_in[0] == 'a': #ä¿®æ¹æ´ä¸ªå¥åçtag185 if temp_in[1] == 'b': #ä¿®æ¹æ´ä¸ªå¥åçtag为å
¨0186 self.tag_sent = [0]*len(self.tag_sent)187 else:188 self.tag_sent = temp_in[1:]189 self.OutputText.AppendText('Current tag: %s\n'%' '.join(self.tag_sent))190 self.InputText.Clear()191 return192 new_temp_in = input_str.split(',')193 assert len(new_temp_in) == 2194 tag0 = new_temp_in[0].split() #å¦å®æ ç¾195 tag1 = new_temp_in[1].split() #å¨ä½çè¯æ ç¾196 self.num = [len(tag0), len(tag1)]197 tags.append([int(t) for t in tag0])198 tags.append([int(t) for t in tag1])199200 if not self.num:201 self.OutputText.AppendText("\n----------No actions to be tag----------\n")202 insert = "insert into "+self.table+" values("+str(self.text_num)+','+\203 str(self.sent_num)+',"'+' '.join(self.words[self.sent_num])+'","'+\204 ' '.join(self.tag_sent)+'")'205 cur.execute(insert)206 db.commit()207 else:208 for kk in range(self.num[0]):209 idx = tags[0][kk]210 self.tag_sent[idx] = '2' #æ è®°å¦å®å¨ä½211 self.OutputText.AppendText('\nTagged negative action: {} {} {} {}'.format(212 str(self.words[self.sent_num][idx]), str(self.words[self.sent_num][idx+1]), 213 str(self.tag_sent[idx]), str(self.tag_sent[idx+1])))214 for kk in range(self.num[1]):215 idx = tags[1][kk]216 self.tag_sent[idx] = '3' #æ è®°å¨ä½çè¯217 self.OutputText.AppendText('\nTagged action pair: {} {} {} {}'.format(218 str(self.words[self.sent_num][idx-1]), str(self.words[self.sent_num][idx]), 219 str(self.tag_sent[idx-1]), str(self.tag_sent[idx])))220221 insert = 'insert into {} values({},{},"{}","{}")'.format(self.table, self.text_num, 222 self.sent_num, ' '.join(self.words[self.sent_num]), ' '.join(self.tag_sent))223 self.OutputText.AppendText('\nTagged sentences: [{}]'.format(' '.join(self.tag_sent)))224 cur.execute(insert)225 db.commit()226227 self.sent_num += 1228 if self.sent_num >= len(self.words):229 self.text_num += 1230 if self.text_num >= self.total_text:231 end_time = time.time()232 self.OutputText.AppendText('Total time cost: %ds'%(end_time-start_time))233 print 'Total time cost: %ds'%(end_time-start_time)234 wx.Exit()235 self.exit_flag = True236 else:237 self.sent_num = 0238 self.get_text_from_database()239 message = "\n\n\n------------------- A new text is starting ------------------\n"240 message += "\n***** Text name: %s *****"%(self.home_dir+str(self.text_num)+'.txt')241 message += "\nTotal sentences: %d\242 Total words: %d\n" % (len(self.words),sum(len(s) for s in self.words))243 self.set_output(message, "maroon")244245 if not self.exit_flag:246 self.pointer = self.OutputText.GetInsertionPoint()247 self.display_sent = []248 self.max_tags = len(self.words[self.sent_num])249 self.tag_sent = self.tags[self.sent_num]#['0' for col in range(self.max_tags)]250 for jj in range(self.max_tags):251 self.display_sent.append(self.words[self.sent_num][jj]+'('+str(jj)+')')252 message = '\n\nSentence{}: {}\n'.format(self.sent_num, ' '.join(self.display_sent))253 message += 'Current tags: %s\n'%' '.join(self.tags[self.sent_num])254 self.set_output(message, "blue")255 self.OutputText.AppendText("Input the total actions and their indices:\n")256 257 self.InputText.Clear()258 259 260 def Search_Button(self, event):261 cur.execute('select * from '+self.table)#éæ©table tag_actions262 self.result = cur.fetchall()263 self.OutputText.AppendText("\nTotal records: %d"%len(self.result))264 self.OutputText.AppendText("\nHow many records do you want to display:\265 \nA for all records \n L for last ten records \n D for delete last record\n ")266 self.search_flag = True267 268269 def ShowAll_Button(self, event):270 self.OutputText.AppendText(271 "\n-------------------------All Records In The Database-------------------------\n")272 self.OutputText.AppendText("\nTotal records: %d"%len(self.result))273 for detail in self.result:274 self.OutputText.AppendText('\n'+str(detail))275 self.OutputText.AppendText("\nTotal records: %d"%len(self.result))276 self.OutputText.AppendText(277 "\n-------------------------------End Of Display--------------------------------\n")278 self.search_flag = False279 280 if self.start_flag:281 message = '\n\nSentence{}: {}\n'.format(self.sent_num, ' '.join(self.display_sent))282 self.set_output(message, "blue")283 self.OutputText.AppendText("Input the indexs and amount of actions in this sentence:\n")284 else:285 self.OutputText.AppendText("Input text_num and sent_num:\n")286 287288 def ShowLast10_Button(self, event):289 self.OutputText.AppendText(290 "\n----------------------------Last Ten Records-------------------------------\n")291 if len(self.result) >= 10:292 start = len(self.result)-10293 else:294 start = 0295 for di in range(start,len(self.result)):296 self.OutputText.AppendText('\n'+str(self.result[di]))297 self.OutputText.AppendText(298 "\n-----------------------------End Of Display--------------------------------\n")299 self.search_flag = False300 301 if self.start_flag:302 message = '\n\nSentence{}: {}\n'.format(self.sent_num, ' '.join(self.display_sent))303 self.set_output(message, "blue")304 self.OutputText.AppendText("Input the indexs and amount of actions in this sentence:\n")305 else:306 self.OutputText.AppendText("Input text_num and sent_num:\n")307 308309 def Delete_Button(self, event):310 self.delete_flag = True311 message = "\nPlease input text_num and sent_num in the Search input box:\n"312 self.set_output(message, "red")313 314315 def Search_Input(self, event):316 if self.delete_flag:317 s = self.SearchText.GetValue().encode("ascii")318 temp_in = s.split()319 if len(temp_in)!=2:320 message = '\nText_num out of range. Please input again:\n'321 self.set_output(message, "red")322 self.SearchText.Clear()323 else:324 tn = temp_in[0]325 sn = temp_in[1]326 delete = "delete from "+self.table+" where text_num="+tn+" and sent_num="+sn327 self.OutputText.AppendText('\ndelete'+delete+'\n')328 cur.execute(delete)329 db.commit()330 cur.execute('select * from '+self.table)#éæ©table tag_actions331 result = cur.fetchall()332 self.OutputText.AppendText(333 "\n----------------------------Last Ten Records-------------------------------\n")334 if len(result) >= 10:335 start = len(result)-10336 else:337 start = 0338 for di in range(start,len(result)):339 self.OutputText.AppendText('\n'+str(result[di]))340 self.OutputText.AppendText(341 "\n-----------------------------End Of Display--------------------------------\n")342 343 self.delete_flag = False344 self.start_flag = False345 self.SearchText.Clear()346 self.OutputText.AppendText("Input text_num and sent_num:\n")347 348 elif self.change_flag:349 s = self.SearchText.GetValue().encode("ascii")350 self.home_dir = s351 self.OutputText.AppendText('\nYour input: %s\n'%s)352 self.OutputText.AppendText(353 '\nPlease input a new table_name and text_num in Search input box\n')354 self.change_flag = False355 self.SearchText.Clear()356 357 elif self.table_flag:358 s = self.SearchText.GetValue().encode("ascii").split()359 if len(s) != 2:360 self.OutputText.AppendText('\nWrong input!! Please input again.\n')361 self.SearchText.Clear()362 else:363 if s[0][0:-1] != 'tag_actions':364 self.OutputText.AppendText('\nWrong table name!! Please input again.\n')365 self.SearchText.Clear()366 else:367 self.table = s[0]368 self.total_text = int(s[1])369 self.SearchText.Clear()370 self.OutputText.AppendText('\nNew table_name: %s total_text: %s\n'%(s[0],s[1]))371 self.table_flag = False372 self.text_num = 0373 self.sent_num = 0374 self.num = 0375 self.max_tags = 0376 self.words = []377 self.tag_sent = []378 self.display_sent = []379 self.start_flag = False380 self.search_flag = False381 self.delete_flag = False382 self.OutputText.SetValue("*****System reboot finishd.*****\n")383 message = "Input text_num and sent_num:\n"384 self.set_output(message, "red")385 386 else:387 self.SearchText.Clear()388 message = "\nYou should not input here now!\n"389 self.set_output(message, "red")390391 def Change_dir_Button(self, event):392 self.OutputText.AppendText('\nCurrent home_dir is %s\n' % self.home_dir)393 self.OutputText.AppendText('\nPlease input a new home_dir in Search input box\n')394 self.change_flag = True395 self.table_flag = True396397 def Exit_Button(self, event):398 print '\nText_num: %d; Sentence_num: %d' %(self.text_num,self.sent_num)399 end_time = time.time()400 self.OutputText.AppendText('\nText_num: %d; Sentence_num: %d' %(self.text_num,self.sent_num))401 self.OutputText.AppendText('Total time cost: %ds'%(end_time-start_time))402 print 'Total time cost: %ds'%(end_time-start_time)403 print '\nCurrent time is %s\n'%time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time()))404 wx.Exit()405406 def Reboot_Button(self, event):407 self.text_num = 0408 self.sent_num = 0409 self.num = 0410 self.max_tags = 0411 self.words = []412 self.tag_sent = []413 self.display_sent = []414 self.start_flag = False415 self.search_flag = False416 self.delete_flag = False417 self.OutputText.SetValue("*****System reboot finishd.*****\n")418 message = "Input text_num and sent_num:\n"419 self.set_output(message, "red")420 421 422if __name__ == '__main__':423 #import sys424 #reload(sys)425 #sys.setdefaultencoding('gb18030')426 #import pdb427 #pdb.set_trace()428 start_time = time.time()429 db = mysql.connector.connect(user='fengwf',password='123',database='test')430 cur = db.cursor()431 app = wx.PySimpleApp()432 frame = TextFrame()433 frame.Show()
...
tekkin.js
Source:tekkin.js
1$(document).ready(function(){2 3 var login_user_id = $("#hidLoginID").val();4 var img_src = "../public/image/JPG/ã¯ã¬ã¼ã³ã¢ã¤ã³ã³.jpeg";5 var url = "forge/tekkin";6 var content_name = "éçéé管ç";7 recordAccessHistory(login_user_id,img_src,url,content_name);8 9 $('#item').select2({width: '30%',placeholder: "Select Project",dropdownAutoWidth : true, allowClear: true,});10 LoadComboData();11});12function LoadComboData()13{14 $.ajax({15 url: "../forge/getData",16 type: 'post',17 data:{_token: CSRF_TOKEN,message:"getComboData"},18 success :function(data) {19 if(data != null){20 //BindComboData(data["projects"],"project");21 BindComboData(data["items"],"item");22 //BindComboData(data["versions"],"version");23 } 24 },25 error:function(err){26 console.log(err);27 }28 }); 29}30function BindComboData(data,comboId){31 var appendText = "";32 $.each(data,function(key,value){ 33 value["name"] = value["name"].trim();34 if(value["name"]== "")return; 35 appendText +="<option value='"+JSON.stringify(value)+"'>"+value["name"]+"</option>"; 36 });37 $("select#"+comboId+" option").remove();38 $("#"+comboId).append(appendText).multiselect("reload");39}40function DisplayTekkinData(){41 ShowLoading();42 43 var itemSelectedCount = $('#item option:selected').length;44 if(itemSelectedCount != 1){45 alert("Please select just one project!");return;46 }47 $('#item option:selected').each(function(){ 48 var valArr =JSON.parse($(this).val()); 49 var item_id = valArr.id;50 $.ajax({51 url: "../forge/getData",52 type: 'post',53 data:{_token: CSRF_TOKEN,message:"getTekkinData",item_id:item_id},54 success :function(data) {55 // console.log(data);56 if(data != null){ 57 // CreateColumnTekkinTable_old(data);58 59 var totalVolumeList = OrganizeLevelTekkinData(data);60 org_total = {};61 org_total = totalVolumeList;62 CreateColumnTekkinTable(totalVolumeList);63 }64 65 HideLoading();66 },67 error:function(err){68 console.log(err);69 HideLoading();70 }71 }); 72 });73}74function CreateColumnTekkinTable_old(data){75 var appendText = "";76 appendText += "<tr>";77 appendText += "<th>No.</th>";78 appendText += "<th>element_id</th>";79 appendText += "<th>level</th>";80 appendText += "<th>start_weight(t)</th>";81 appendText += "<th>center_weight(t)</th>";82 appendText += "<th>end_weight(t)</th>";83 appendText += "<th>total(t)</th>";84 appendText += "<th>category</th>"; 85 appendText += "<th>phase</th>";86 appendText += "</tr>";87 88 var count = 0;89 $.each(data,function(key,row){90 count++;91 appendText += "<tr>";92 appendText += "<td>"+count+".</td>";93 appendText += "<td>"+row["element_id"]+"</td>";94 appendText += "<td>"+row["level"]+"</td>";95 appendText += "<td>"+row["start_weight"]+"</td>";96 appendText += "<td>"+row["center_weight"]+"</td>";97 appendText += "<td>"+row["end_weight"]+"</td>";98 appendText += "<td>"+row["total"]+"</td>";99 appendText += "<td>"+row["category"]+"</td>";100 appendText += "<td>"+row["phase"]+"</td>";101 appendText += "</tr>";102 });103 $("#tblTekkinData tr").remove();104 $("#tblTekkinData").append(appendText);105}106function CreateColumnTekkinTable(totalVolumeList){107 var appendText = "";108 var total_volume = Math.round(totalVolume * 100) / 100; //å°æ°ç¹ç¬¬ä¸ä½ä»¥ä¸åæ¨äºå
¥109 appendText += "<div class='sidebar'>";110 appendText += "<div id='tekkinTotal'>";111 appendText += "<h5>ç·éé "+total_volume.toString()+" [t]</h5>";112 appendText += "</div>"; //tekkinTotal113 114 appendText += "<div id='levelDiv'>";115 appendText += "<ul class='levelList list1'>";116 117 var cnt = 0;118 for(var key in totalVolumeList) {119 if(key == ""){ continue; }120 121 var total = 0.0;122 for(var keyOrg in organizeData) {123 if(keyOrg === totalVolumeList[key]["level"]){124 125 var organizeLevelData = organizeData[keyOrg];126 for(var key1 in organizeLevelData) {127 var tmp_total = organizeLevelData[key1]["total"];128 tmp_total = parseFloat(tmp_total);129 if(isNaN(tmp_total)){130 tmp_total = 0.0;131 }132 total += tmp_total;133 }134 break;135 }136 }137 138 total = Math.round(total * 100) / 100;139 cnt++;140 // var total1 = Math.round(totalVolumeList[key]["total"] * 100) / 100; //å°æ°ç¹ç¬¬ä¸ä½ä»¥ä¸åæ¨äºå
¥141 142 appendText += "<li>";143 // appendText += "<div class='levelElement' onClick='createTekkinTable("+totalVolumeList[key]['level'].toString()+","+cnt.toString()+")'>";144 appendText += "<div id='"+cnt.toString()+"_"+totalVolumeList[key]['level'].toString()+"' class='levelElement'>";145 appendText += "<div>"+totalVolumeList[key]["level"]+"</div>";146 appendText += "<div style='margin-left:auto;'>"+total.toString()+" [t]</div>";147 appendText += "</div>";148 appendText += "</li>";149 }150 151 appendText += "</ul>";152 appendText += "</div>"; //levelDiv153 154 appendText += "</div>"; //sidebar155 156 appendText += "<div id='tekkinTbl' class='main'>";157 appendText += "</div>"; //main158 $("#tekkinData div").remove();159 $("#tekkinData").append(appendText);160 161 $('.levelElement').on('click', function(){162 $('.levelElement').removeClass('active');163 $(this).addClass('active');164 165 var tmpID = $(this)[0].getAttribute('id');166 tmpID = tmpID.split("_");167 168 createTekkinTable(tmpID[1], tmpID[0]);169 });170}171function createTekkinTable(levelName, id){172 var appendText = "";173 174 appendText += "<div class='matrix-table mt-body'>";175 appendText += "<div style='margin:0 auto 5vh auto;'>";176 var category_total = {};177 for(var keyLevel in org_total){178 if(keyLevel === levelName){179 category_total = org_total[keyLevel]["category_total"];180 }181 }182 183 var count = 0;184 for(var keyTotal in category_total){185 count++;186 var total = 0.0;187 if(!isNaN(category_total[keyTotal])){188 total = Math.round(category_total[keyTotal] * 100) / 100; //å°æ°ç¹ç¬¬ä¸ä½ä»¥ä¸åæ¨äºå
¥189 }190 191 var categoryTotal = 0.0;192 for(var keyOrg in organizeData) {193 194 if(keyOrg === levelName){195 196 var orgLevelData = organizeData[keyOrg];197 198 for(var k in orgLevelData) {199 if(orgLevelData[k]["category"] === keyTotal){200 var tmp_total = orgLevelData[k]["total"];201 tmp_total = parseFloat(tmp_total);202 if(isNaN(tmp_total)){203 tmp_total = 0.0;204 }205 categoryTotal += tmp_total;206 }207 }208 209 break;210 }211 }212 categoryTotal = Math.round(categoryTotal * 100) / 100;213 214 appendText += "<input id='acd-check"+count+"' class='acd-check' type='checkbox'>";215 appendText += "<label class='acd-label' for='acd-check"+count+"'>";216 appendText += "<p>"+keyTotal+"<span style='float:right;margin-right:52px;'>"+categoryTotal+"</span></p>";217 appendText += "</label>";218 219 appendText += "<div class='acd-content'>";220 appendText += "<div class='tblField'>";221 222 appendText += "<table class='tblTekkinData'>";223 224 appendText += "<thead>";225 appendText += "<tr>";226 appendText += "<th class='trNumber'>No.</th>";227 appendText += "<th class='trElementID'>element_id</th>";228 appendText += "<th class='trWeight'>start_weight[t]</th>";229 appendText += "<th class='trWeight'>center_weight[t]</th>";230 appendText += "<th class='trWeight'>end_weight[t]</th>";231 appendText += "<th class='trTotal'>total[t]</th>";232 appendText += "<th class='trPhase'>phase</th>";233 appendText += "</tr>";234 appendText += "</thead>";235 236 appendText += "<body>";237 238 for(var keyOrg in organizeData) {239 if(keyOrg === levelName){240 var cnt = 0;241 var organizeLevelData = organizeData[keyOrg];242 243 for(var key in organizeLevelData) {244 245 if(organizeLevelData[key]["category"] === keyTotal){246 cnt++;247 appendText += "<tr>";248 appendText += "<td class='trNumber'>"+cnt.toString()+"</td>";249 appendText += "<td class='trElementID'>"+organizeLevelData[key]["element_id"]+"</td>";250 appendText += "<td class='trWeight'>"+organizeLevelData[key]["start_weight"]+"</td>";251 appendText += "<td class='trWeight'>"+organizeLevelData[key]["center_weight"]+"</td>";252 appendText += "<td class='trWeight'>"+organizeLevelData[key]["end_weight"]+"</td>";253 appendText += "<td class='trTotal'>"+organizeLevelData[key]["total"]+"</td>";254 appendText += "<td class='trPhase'>"+organizeLevelData[key]["phase"]+"</td>";255 appendText += "</tr>";256 }257 }258 }259 }260 261 appendText += "</body>";262 appendText += "</table>";263 264 appendText += "</div>"; //tblField265 appendText += "</div>";266 267 } //for categoryList268 appendText += "</div>";269 appendText += "</div>"; //matrix-table mt-body270 271 $("#tekkinTbl div").remove();272 $("#tekkinTbl").append(appendText);273 274 // var tmpb = $("#tekkinTbl");275 // console.log("tmpb.height:"+tmpb.height());276 277 278 // $('.acd-check').css("display","none");279 // $('.acd-label').css({"background":"#0068b7", "color":"#fff", "display":"block","margin-bottom":"1px","padding":"10px","position":"relative"});280 // $('.acd-label:after').css({"background":"#00479d", "box-sizing":"border-box", "content":"'\f067'", "display":"block","font-family":"'Font Awesome 5 Free'","height":"40px","padding":"10px 20px","position":"absolute", "right":"0", "top":"0px"});281 // $('.acd-content').css({"display":"block","height":"0","opacity":"0","padding":"0 10px","transition":".5s","visibility":"hidden"});282 // $('.acd-check:checked + .acd-label:after').css("content","'\f068'");283 // $('.acd-check:checked + .acd-label + .acd-content').css({"height":"750px","opacity":"1","padding":"10px","visibility":"visible"});284 // $('.acd-check:checked + .acd-label + .acd-content').css("height","100px");285 // $('.acd-check:checked').css({"height":"500px","opacity":"1","padding":"10px","visibility":"visible"});286 // $('.acd-label').css({"height":"500px","opacity":"1","padding":"10px","visibility":"visible"});287 // $('.acd-content').css({"height":"500px","opacity":"1","padding":"10px","visibility":"visible"});288 289 // if($('.acd-check').is(':checked')){290 // $('.acd-check:checked').css({"height":"500px","opacity":"1","padding":"10px","visibility":"visible"});291 // $('.acd-label').css({"height":"500px","opacity":"1","padding":"10px","visibility":"visible"});292 // $('.acd-content').css({"height":"500px","opacity":"1","padding":"10px","visibility":"visible"});293 // }294 // $('.acd-label p').css("margin","0 0 0 0");295}296var org_total = {};297var organizeData = [];298var totalVolume = 0.0;299function OrganizeLevelTekkinData(data){300 301 organizeData = [];302 var organizeTotalData = [];303 var organizeDataEachLevel = [];304 var levelList = [];305 totalVolume = 0.0;306 307 data.sort(function(a, b) {308 return (a.level < b.level) ? -1 : 1;309 });310 var index = 0;311 var idx = 0;312 var tmpTotal = 0.0;313 var preTotal = 0.0;314 var preLevel = "";315 var categoryList = [];316 var preCategory = "";317 var totalCategoryList = [];318 var cnt = 0;319 var datalen = Object.keys(data).length;320 $.each(data,function(key,row){321 322 var level = row["level"] == "" || row["level"] == undefined ? "empty" : row["level"];323 var element_id = row["element_id"];324 var start_weight = row["start_weight"] == "" || row["start_weight"] == undefined ? "0.00" : row["start_weight"];325 var center_weight = row["center_weight"] == "" || row["center_weight"] == undefined ? "0.00" : row["center_weight"];326 var end_weight = row["end_weight"] == "" || row["end_weight"] == undefined ? "0.00" : row["end_weight"];327 var total = row["total"] == "" || row["total"] == undefined ? "0.00" : row["total"];328 var fTotal = 0.0;329 if(fTotal !== "0"){330 fTotal = parseFloat(total);331 }332 if(isNaN(fTotal)){333 fTotal = 0.0;334 }335 var category = row["category"];336 var phase = row["phase"];337 338 var tmpObj = {};339 tmpObj["level"] = level;340 tmpObj["category"] = category;341 tmpObj["element_id"] = element_id;342 tmpObj["start_weight"] = start_weight;343 tmpObj["center_weight"] = center_weight;344 tmpObj["end_weight"] = end_weight;345 tmpObj["total"] = total;346 tmpObj["phase"] = phase;347 tmpTotal += fTotal;348 categoryList.push(category);349 350 if(cnt === 0){351 preLevel = level;352 preCategory = category;353 totalCategoryList[category] = 0.0;354 }else if(cnt === (datalen -1)){355 preTotal += fTotal;356 organizeDataEachLevel[idx] = tmpObj;357 }358 359 if(preLevel != level || cnt === (datalen -1)){360 organizeData[preLevel] = organizeDataEachLevel;361 var tmpCategoryList = Array.from(new Set(categoryList));362 var tmp = {};363 tmp["level"] = preLevel;364 tmp["total"] = preTotal;365 tmp["category"] = tmpCategoryList;366 tmp["category_total"] = totalCategoryList;367 organizeTotalData[preLevel] = tmp;368 369 index++;370 idx = 0;371 tmpTotal = 0.0;372 preTotal = 0.0;373 preLevel = level;374 organizeDataEachLevel = [];375 totalCategoryList = [];376 }377 378 if(preCategory !== category){379 totalCategoryList[category] = fTotal;380 preCategory = category;381 }else{382 totalCategoryList[category] += fTotal; 383 }384 preTotal += fTotal;385 organizeDataEachLevel[idx] = tmpObj;386 idx++;387 cnt++;388 totalVolume += fTotal;389 390 });391 return organizeTotalData;392}393function DisplayTekkinPopup(){394 $("#formulaPopup").css("z-index", "5000");395 $("#formulaPopup").css({ visibility: "visible",opacity: "1"});396 $("#formulaPopup").draggable();397}398function DownloadTekkinExcel()399{400 var item_id;401 var itemSelectedCount = $('#item option:selected').length;402 if(itemSelectedCount != 1){403 alert("Please select just one project!");return;404 }405 $('#item option:selected').each(function(){ 406 var valArr =JSON.parse($(this).val());407 item_id = valArr.id;408 409 });410 window.location="/iPD/forge/excelDownload?item_id="+item_id;411}412function ClosePopup(){413 $("#formulaPopup").css({ visibility: "visible",opacity: "0"});...
customUI1.py
Source:customUI1.py
...
tekkinVolumeOverview.js
Source:tekkinVolumeOverview.js
1var CSRF_TOKEN = $('meta[name="csrf-token"]').attr('content');2$(document).ready(function(){3 $.ajaxSetup({4 cache:false5 });6 7 $("#project").select2({8 dropdownAutoWidth: true,9 width: 500,10 placeholder:'Select Folders',11 selectedIndex:-112 });13 $("#item").select2({14 dropdownAutoWidth: true,15 width: 500,16 maxPlaceholderWidth:150,17 maxWidth:300,18 placeholder:'Select Projects',19 selectAll : true20 });21 $("#version").select2({22 dropdownAutoWidth: true,23 width: 500,24 maxPlaceholderWidth:150,25 maxWidth:300,26 placeholder:'Select Versions',27 selectAll : true28 });29 30 $("#category").select2({31 dropdownAutoWidth: true,32 width: 150,33 maxPlaceholderWidth:150,34 maxWidth:150,35 placeholder:'Select Category',36 selectAll : true37 });38 39 LoadComboData();40 $("#project").change(function() {41 ProjectChange();42 });43 $("#item").change(function() {44 //ItemChange();45 });46 if (location.hash !== '') $('a[href="' + location.hash + '"]').tab('show');47 return $('a[data-toggle="tab"]').on('shown', function(e) {48 return location.hash = $(e.target).attr('href').substr(1);49 });50});51function LoadComboData()52{53 $.ajax({54 url: "../forge/getData",55 type: 'post',56 data:{_token: CSRF_TOKEN,message:"getComboData"},57 success :function(data) {58 if(data != null){59 BindComboData(data["projects"],"project");60 BindComboData(data["items"],"item");61 BindComboData(data["versions"],"version");62 } 63 },64 error:function(err){65 console.log(err);66 }67 }); 68}69function BindComboData(data,comboId){70 var appendText = "";71 $.each(data,function(key,value){ 72 value["name"] = value["name"].trim();73 if(comboId == "version"){74 var fileName = value["name"]+"("+value["version_number"]+")";75 appendText +="<option value='"+JSON.stringify(value)+"'>"+fileName+"</option>";76 }else{77 appendText +="<option value='"+JSON.stringify(value)+"'>"+value["name"]+"</option>";78 }79 80 });81 $("select#"+comboId+" option").remove();82 $("#"+comboId).append(appendText).multiselect("reload");83}84function ProjectChange(){85 console.log("ProjectChange start");86 var folderSelectedCount = $('#project option:selected').length;87 var itemOption = "";88 var versionOption = "";89 90 if(folderSelectedCount == 1){91 var projectName = $('#project option:selected').text();92 $.ajax({93 url: "../forge/getData",94 type: 'post',95 data:{_token: CSRF_TOKEN,message:"getComboDataByProject",projectName:projectName,itemName:""},96 success :function(data) {97 // console.log(data);98 if(data != null){99 BindComboData(data["items"],"item");100 BindComboData(data["versions"],"version");101 BindComboData(data["levels"],"level");102 BindComboData(data["worksets"],"workset");103 BindComboData(data["materials"],"material");104 BindComboData(data["familyNames"],"familyName");105 BindComboData(data["typeNames"],"typeName");106 }107 },108 error:function(err){109 console.log(err);110 }111 });112 }else if (folderSelectedCount > 1){113 //[TODO]è¤æ°ãã¼ã¸ã§ã³é¸ææã®æå114 LoadComboData();115 }else{116 LoadComboData();117 } 118}119function ItemChange(){120 //NOP121}122function ReportTekkinVolumeOvewview(){123 var versionSelectedCount = $('#version option:selected').length;124 var level_list = [];125 var selected_categories=[];126 var workset_list=[];127 var material_list = [];128 var familyName_list = [];129 var typeName_list = [];130 var overviewData = {"Elements":0,"Volume":0,"Materials":0,"TypeName":0,"FamilyName":0};131 var chartData = {};132 var totalData = {};133 $("#category option:selected").each(function(){134 selected_categories.push($(this).val());135 });136 $('#version option:selected').each(function(){137 var valArr =JSON.parse($(this).val()); 138 var item_id = valArr.item_id;139 $.ajax({140 url: "../forge/getData",141 type: 'post',142 data:{_token: CSRF_TOKEN,message:"getTekkinData",item_id:item_id,category_list:selected_categories},143 success :function(data) {144 //alert(data);145 console.log(data);146 if(data != null){ 147 CreateColumnTekkinTable(data);148 } 149 },150 error:function(err){151 console.log("error");152 console.log(err);153 }154 }); 155 });156 157 //158}159 function CreateColumnTekkinTable(data){160 var appendText = "";161 appendText += "<tr>";162 appendText += "<th>No.</th>";163 appendText += "<th>element_id</th>";164 appendText += "<th>start_diameter</th>";165 appendText += "<th>start_X_firstRowCount</th>";166 appendText += "<th>start_X_secondRowCount</th>";167 appendText += "<th>start_Y_firstRowCount</th>";168 appendText += "<th>start_Y_secondRowCount</th>";169 appendText += "<th>start_rib_diameter</th>";170 appendText += "<th>start_rib_pitch</th>";171 appendText += "<th>end_diameter</th>";172 appendText += "<th>end_X_firstRowCount</th>";173 appendText += "<th>end_X_secondRowCount</th>";174 appendText += "<th>end_Y_firstRowCount</th>";175 appendText += "<th>end_Y_secondRowCount</th>";176 appendText += "<th>end_rib_diameter</th>";177 appendText += "<th>end_rib_pitch</th>";178 appendText += "</tr>";179 180 var count = 0;181 $.each(data,function(key,row){182 count++;183 appendText += "<tr>";184 appendText += "<td>"+count+".</td>";185 appendText += "<td>"+row["element_id"]+"</td>";186 appendText += "<td>"+row["start_diameter"]+"</td>";187 appendText += "<td>"+row["start_X_firstRowCount"]+"</td>";188 appendText += "<td>"+row["start_X_secondRowCount"]+"</td>";189 appendText += "<td>"+row["start_Y_firstRowCount"]+"</td>";190 appendText += "<td>"+row["start_Y_secondRowCount"]+"</td>";191 appendText += "<td>"+row["start_rib_diameter"]+"</td>";192 appendText += "<td>"+row["start_rib_pitch"]+"</td>";193 appendText += "<td>"+row["end_diameter"]+"</td>";194 appendText += "<td>"+row["end_X_firstRowCount"]+"</td>";195 appendText += "<td>"+row["end_X_secondRowCount"]+"</td>";196 appendText += "<td>"+row["end_Y_firstRowCount"]+"</td>";197 appendText += "<td>"+row["end_Y_secondRowCount"]+"</td>";198 appendText += "<td>"+row["end_rib_diameter"]+"</td>";199 appendText += "<td>"+row["end_rib_pitch"]+"</td>";200 appendText += "</tr>";201 });202 $("#tblTekkinData tr").remove();203 $("#tblTekkinData").append(appendText);...
youth_page.js
Source:youth_page.js
1//ajaxå页 å¾ç 2 function pageInfo(result){3 var appendText =""4 var show_num = 7;5 if(result!= null && result.total>0){6 appendText += "<div class=\"pagenav herald\">";7 if(result.currPage>1){8 appendText += "<a href=\"javascript:gotoPage("+1+")\">é¦é¡µ</a>";9 }else{10 appendText += "<a href=\"javascript:;\">é¦é¡µ</a>";11 }12 if((result.currPage - 1) >0){13 appendText += "<a href=\"javascript:gotoPage("+(result.currPage - 1)+")\">ä¸ä¸é¡µ</a>";14 }else{15 appendText += "<a href=\"javascript:;\">ä¸ä¸é¡µ</a>";16 }17 //å°äº718 if(result.totalPage < show_num){19 for (var i = 0; i < result.totalPage; i++) {20 if((i+1)==result.currPage){21 appendText +="<a class=\"cur\" href=\"javascript:gotoPage("+(i+1)+")\">"+(i+1)+"</a>"22 }else{23 appendText +="<a href=\"javascript:gotoPage("+(i+1)+")\">"+(i+1)+"</a>"24 }25 } 26 }else{27 if(result.currPage<=((show_num+1)/2)){28 for (var i = 0; i < (result.currPage-1); i++) {29 appendText +="<a href=\"javascript:gotoPage("+(i+1)+")\">"+(i+1)+"</a>"30 }31 appendText +="<a class=\"cur\" href=\"javascript:gotoPage("+result.currPage+")\">"+result.currPage+"</a>"32 for (var i = 0; i < (show_num-result.currPage); i++) {33 appendText +="<a href=\"javascript:gotoPage("+(result.currPage+(i+1))+")\">"+(result.currPage+(i+1))+"</a>"34 }35 }else{36 if((result.totalPage-result.currPage) < ((show_num-1)/2)){37 for (var i = (result.totalPage-show_num+1); i <= result.totalPage; i++) {38 if(i == result.currPage){39 appendText +="<a class=\"cur\">"+i+"</a>"40 }else{41 appendText +="<a href=\"javascript:gotoPage("+i+")\">"+i+"</a>"42 }43 }44 }else{45 for (var i =((show_num-1)/2); i >0 ; i--) {46 appendText +="<a href=\"javascript:gotoPage("+(result.currPage - i)+")\">"+(result.currPage - i)+"</a>"47 }48 appendText +="<a class=\"cur\">"+result.currPage+"</a>";49 for (var i = 1; i <= ((show_num-1)/2); i++) {50 appendText +="<a href=\"javascript:gotoPage("+(result.currPage + i)+")\">"+(result.currPage + i)+"</a>"51 } 52 }53 } 54 }55 56 if((result.currPage + 1) <= result.totalPage){57 appendText +="<a href=\"javascript:gotoPage("+(result.currPage + 1)+")\">ä¸ä¸é¡µ</a>";58 }else{59 appendText +="<a href=\"javascript:;\">ä¸ä¸é¡µ</a>"60 }61 if(result.currPage<=result.totalPage){62 appendText +="<a href=\"javascript:gotoPage("+result.totalPage+")\">æ«é¡µ</a>";63 }else{64 appendText +="<a href=\"javascript:;\">æ«é¡µ</a>"65 }66 }67 return appendText;68 }69 70 //ajaxå页 è§é¢ 71 function pageInfoVid(result){72 var appendText =""73 var show_num = 7;74 if(result!= null && result.total>0){75 appendText += "<div class=\"pagenav herald\">";76 if(result.currPage>1){77 appendText += "<a href=\"javascript:gotoPageVideo("+1+")\">é¦é¡µ</a>";78 }else{79 appendText += "<a href=\"javascript:;\">é¦é¡µ</a>";80 }81 if((result.currPage - 1) >0){82 appendText += "<a href=\"javascript:gotoPageVideo("+(result.currPage - 1)+")\">ä¸ä¸é¡µ</a>";83 }else{84 appendText += "<a href=\"javascript:;\">ä¸ä¸é¡µ</a>";85 }86 //å°äº787 if(result.totalPage < show_num){88 for (var i = 0; i < result.totalPage; i++) {89 if((i+1)==result.currPage){90 appendText +="<a class=\"cur\" href=\"javascript:gotoPageVideo("+(i+1)+")\">"+(i+1)+"</a>"91 }else{92 appendText +="<a href=\"javascript:gotoPageVideo("+(i+1)+")\">"+(i+1)+"</a>"93 }94 } 95 }else{96 if(result.currPage<=((show_num+1)/2)){97 for (var i = 0; i < (result.currPage-1); i++) {98 appendText +="<a href=\"javascript:gotoPageVideo("+(i+1)+")\">"+(i+1)+"</a>"99 }100 appendText +="<a class=\"cur\" href=\"javascript:gotoPageVideo("+result.currPage+")\">"+result.currPage+"</a>"101 for (var i = 0; i < (show_num-result.currPage); i++) {102 appendText +="<a href=\"javascript:gotoPageVideo("+(result.currPage+(i+1))+")\">"+(result.currPage+(i+1))+"</a>"103 }104 }else{105 if((result.totalPage-result.currPage) < ((show_num-1)/2)){106 for (var i = (result.totalPage-show_num+1); i <= result.totalPage; i++) {107 if(i == result.currPage){108 appendText +="<a class=\"cur\">"+i+"</a>"109 }else{110 appendText +="<a href=\"javascript:gotoPageVideo("+i+")\">"+i+"</a>"111 }112 }113 }else{114 for (var i =((show_num-1)/2); i >0 ; i--) {115 appendText +="<a href=\"javascript:gotoPageVideo("+(result.currPage - i)+")\">"+(result.currPage - i)+"</a>"116 }117 appendText +="<a class=\"cur\">"+result.currPage+"</a>";118 for (var i = 1; i <= ((show_num-1)/2); i++) {119 appendText +="<a href=\"javascript:gotoPageVideo("+(result.currPage + i)+")\">"+(result.currPage + i)+"</a>"120 } 121 }122 } 123 }124 125 if((result.currPage + 1) <= result.totalPage){126 appendText +="<a href=\"javascript:gotoPageVideo("+(result.currPage + 1)+")\">ä¸ä¸é¡µ</a>";127 }else{128 appendText +="<a href=\"javascript:;\">ä¸ä¸é¡µ</a>"129 }130 if(result.currPage<=result.totalPage){131 appendText +="<a href=\"javascript:gotoPageVideo("+result.totalPage+")\">æ«é¡µ</a>";132 }else{133 appendText +="<a href=\"javascript:;\">æ«é¡µ</a>"134 }135 }136 return appendText;...
customUI.py
Source:customUI.py
1import wx,os2import maxentevaluator,naivebayesevaluator3import extract_data4import pie_chart5import random6import matplotlib.pyplot as plt78class ExamplePanel(wx.Panel):9 def __init__(self, parent):10 wx.Panel.__init__(self, parent)11 self.isBrowsedDataset=False1213 self.logger1 = wx.TextCtrl(self, pos=(20,180), size=(600,580), style=wx.TE_MULTILINE | wx.TE_READONLY)14 self.logger2 = wx.TextCtrl(self, pos=(620,180), size=(600,580), style=wx.TE_MULTILINE | wx.TE_READONLY)1516 # Search Query Text Control17 self.search_quote = wx.StaticText(self, label="Search:", pos=(20, 30))18 self.editname = wx.TextCtrl(self, value="Query?", pos=(20, 50), size=(340,-1))1920 # Check button21 self.check_button =wx.Button(self, label="Check", pos=(370, 49))22 self.Bind(wx.EVT_BUTTON, self.onClick_check,self.check_button)2324 # Classifier Type Radio Buttons25 radioList = ['Max Entropy','Naive Bayes']26 self.rb = wx.RadioBox(self, label="Classifier Type", pos=(20, 90), choices=radioList, majorDimension=3,27 style=wx.RA_SPECIFY_COLS)28 29 def onClick_check(self,event):30 self.logger1.Clear()31 self.logger2.Clear()32 query_string=self.editname.GetValue()33 classifier_type=self.rb.GetSelection()34 self.logger1.AppendText("Query = \'"+query_string+"\'\n")35 self.logger2.AppendText("Query = \'"+query_string+"\'\n")3637 if classifier_type==1:38 self.logger1.AppendText("Classifier type = Naive Bayes\n")39 result=naivebayesevaluator.main(1)40 self.logger1.AppendText("\n"+result[0])41 self.logger1.AppendText("\nAccuracy for Positives: %.2f%%" % result[1])42 self.logger1.AppendText("\nAccuracy for Negatives: %.2f%%" % result[2])43 self.logger1.AppendText("\nAccuracy for (Positives|Negatives): %.2f%%" % result[3])44 self.logger1.AppendText("\nCorrelation for (Positives|Negatives): %.2f%%" % result[4])45 self.logger1.AppendText("\n\n")46 4748 reviews = extract_data.get(query_string,0)49 self.logger1.AppendText("Positives: " + str(reviews[0])+" ("+str(reviews[2])+"%)")50 self.logger1.AppendText("\nNegatives: " + str(reviews[1])+" ("+str(reviews[3])+"%)")51 self.logger2.AppendText("Changed to Positives: " + str(reviews[6])+" ("+str(reviews[8])+"%)")52 self.logger2.AppendText("\nChanged to Negatives: " + str(reviews[7])+" ("+str(reviews[9])+"%)")53 self.logger2.AppendText("\nChanged to Neutrals: " + str(reviews[11])+" ("+str(reviews[12])+"%)")54 self.logger1.AppendText("\n\n")55 self.logger2.AppendText("\n\n")56 for tweet in reviews[5]:57 self.logger1.AppendText(tweet[1]+"\n\n")5859 for tweet in reviews[10]:60 self.logger2.AppendText(tweet[1]+"\n\n")61 # self.logger2.AppendText(tweet[1].text+"\n\n")62 63 elif classifier_type==0:64 self.logger1.AppendText("Classifier type = Max Entropy\n")65 # self.logger2.AppendText("Classifier type = Max Entropy\n")66 result=maxentevaluator.main()67 self.logger1.AppendText("\n"+result[0])68 self.logger1.AppendText("\nAccuracy for Positives: %.2f%%" % result[1])69 self.logger1.AppendText("\nAccuracy for Negatives: %.2f%%" % result[2])70 self.logger1.AppendText("\nAccuracy for (Positives|Negatives): %.2f%%" % result[3])71 self.logger1.AppendText("\nCorrelation for (Positives|Negatives): %.2f%%" % result[4])72 self.logger1.AppendText("\n\n")73 7475 reviews = extract_data.get(query_string,1)76 self.logger1.AppendText("Positives: " + str(reviews[0])+" ("+str(reviews[2])+"%)")77 self.logger1.AppendText("\nNegatives: " + str(reviews[1])+" ("+str(reviews[3])+"%)")78 self.logger2.AppendText("Changed to Positives: " + str(reviews[6])+" ("+str(reviews[8])+"%)")79 self.logger2.AppendText("\nChanged to Negatives: " + str(reviews[7])+" ("+str(reviews[9])+"%)")80 self.logger2.AppendText("\nChanged to Neutrals: " + str(reviews[11])+" ("+str(reviews[12])+"%)")81 self.logger1.AppendText("\n\n")82 self.logger2.AppendText("\n\n")83 for tweet in reviews[5]:84 self.logger1.AppendText(tweet[1]+"\n\n")85 for tweet in reviews[10]:86 self.logger2.AppendText(tweet[1]+"\n\n")8788 pie_chart.draw_pie_chart1(reviews)89 pie_chart.draw_pie_chart2(reviews)909192app = wx.App(False)93frame = wx.Frame(None,wx.ID_ANY, "SentimentAnalysis",size=(1290,700))94panel = ExamplePanel(frame)95frame.Show()
...
Using AI Code Generation
1var textbox = document.getElementById("textbox");2textbox.appendText("Hello World");3textbox.insertText("Hello World");4textbox.removeText(0, 5);5textbox.clearText();6textbox.readOnly = true;7textbox.readOnly = false;8textbox.maxLength = 10;9textbox.maxLength = 0;10textbox.value = "Hello World";
Using AI Code Generation
1var file = new WPTextFile("test.txt");2file.appendText("This is a test file");3file.close();4var file = new WPTextFile("test.txt");5var text = file.readAllText();6file.close();7alert(text);8var file = new WPTextFile("test.txt");9file.writeAllText("This is a test file");10file.close();11var file = new WPTextFile("test.txt");12file.delete();13file.close();14var file = new WPTextFile("test.txt");15if(file.exists())16{17 alert("File exists");18}19{20 alert("File does not exist");21}22file.close();23var file = new WPTextFile("test.txt");24file.open();25file.appendText("This is a test file");26file.close();27var file = new WPTextFile("test.txt");28file.open();29file.appendText("This is a test file");30file.close();31var file = new WPTextFile("test.txt");32file.open();33file.appendText("This is a test file");34var length = file.getLength();35file.close();36alert(length);37var file = new WPTextFile("test.txt");38file.open();39file.appendText("This is a test file");40var lineCount = file.getLineCount();41file.close();42alert(lineCount);43var file = new WPTextFile("test.txt");44file.open();45file.appendText("This is a test file");46var line = file.readLine();47file.close();48alert(line);49var file = new WPTextFile("test.txt");50file.open();51file.appendText("This is a test file");52var lines = file.readLines();53file.close();54alert(lines);55var file = new WPTextFile("test.txt");
Using AI Code Generation
1var textbox = document.getElementById("textbox");2textbox.appendText("Hello World");3var textbox = document.getElementById("textbox");4textbox.appendText("Hello World");5var textbox = document.getElementById("textbox");6textbox.appendText("Hello World");7var textbox = document.getElementById("textbox");8textbox.appendText("Hello World");9var textbox = document.getElementById("textbox");10textbox.appendText("Hello World");11var textbox = document.getElementById("textbox");12textbox.appendText("Hello World");13var textbox = document.getElementById("textbox");14textbox.appendText("Hello World");15var textbox = document.getElementById("textbox");16textbox.appendText("Hello World");17var textbox = document.getElementById("textbox");18textbox.appendText("Hello World");19var textbox = document.getElementById("textbox");20textbox.appendText("Hello World");21var textbox = document.getElementById("textbox");22textbox.appendText("Hello World");
Using AI Code Generation
1var txtBox = WPage.getWidget("textBox1");2txtBox.appendText("hello");3var txtArea = WPage.getWidget("textArea1");4txtArea.appendText("hello");5var txtArea = WPage.getWidget("textArea1");6txtArea.appendText("hello");7var txtBox = WPage.getWidget("textBox1");8txtBox.appendText("hello");9var txtField = WPage.getWidget("textField1");10txtField.appendText("hello");11var urlField = WPage.getWidget("urlField1");12urlField.appendText("hello");13var emailField = WPage.getWidget("emailField1");14emailField.appendText("hello");15var passField = WPage.getWidget("passwordField1");16passField.appendText("hello");17var searchField = WPage.getWidget("searchField1");18searchField.appendText("hello");19var numField = WPage.getWidget("numberField1");20numField.appendText("hello");21var dateField = WPage.getWidget("dateField1");
Using AI Code Generation
1var oWpTextArea = new WpTextArea();2oWpTextArea.init("wpTextArea1");3oWpTextArea.appendText("This is a test");4var oWpTextArea = new WpTextArea();5oWpTextArea.init("wpTextArea1");6oWpTextArea.replaceText("This is a test");7var oWpTextArea = new WpTextArea();8oWpTextArea.init("wpTextArea1");9var sText = oWpTextArea.getText();10var oWpTextArea = new WpTextArea();11oWpTextArea.init("wpTextArea1");12oWpTextArea.setText("This is a test");13var oWpTextArea = new WpTextArea();14oWpTextArea.init("wpTextArea1");15oWpTextArea.setFocus();16var oWpTextArea = new WpTextArea();17oWpTextArea.init("wpTextArea1");18oWpTextArea.setReadOnly(true);19var oWpTextArea = new WpTextArea();20oWpTextArea.init("wpTextArea1");21oWpTextArea.setEnabled(true);22var oWpTextArea = new WpTextArea();23oWpTextArea.init("wpTextArea1");24oWpTextArea.setMaxLength(100);25var oWpTextArea = new WpTextArea();26oWpTextArea.init("wpTextArea1");27oWpTextArea.setWidth(200);28var oWpTextArea = new WpTextArea();29oWpTextArea.init("wpTextArea1");30oWpTextArea.setHeight(100);31var oWpTextArea = new WpTextArea();32oWpTextArea.init("wpTextArea1");33oWpTextArea.setCols(10);34var oWpTextArea = new WpTextArea();35oWpTextArea.init("wpTextArea1");
Using AI Code Generation
1var obj = new wptext();2obj.appendText('Hello world!');3function wptext() {4 this.appendText = function(text) {5 var node = document.createElement('p');6 var textNode = document.createTextNode(text);7 node.appendChild(textNode);8 document.body.appendChild(node);9 }10}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!