def beam_choice(self): beam = self.beam_combo.currentText() if beam == 'Other (please choose files)': self.beam_button.setDisabled(False) else: glv.set_value('beam', beam) self.beam_init()
def run(self): time.sleep(1) global xp global xh global tcp_socket while True: time.sleep(0.1) #发送信号到刷新函数,触发界面刷新函数 #self.breakSignal.emit(str(a)) #模拟产生现场信号,用于刷新主界面 lock.lock() xxx = tcp_socket.recv(186) xh = xxx.decode('UTF-8').split(" ") xh = xh[1:] sj.set(xh) #将读取的信号写入自建全局变量 try: j = 0 for i in PZAI + PZAO + PZDI + PZDO: gl.set_value(i, str(xh[j])) #设定值 j += 1 except: pass #发送信号到刷新函数,触发界面刷新函数 self.breakSignal.emit(xh) lock.unlock()
def visual(self, env_name): gl._init() plotter = utils.VisdomLinePlotter(env_name=env_name) gl.set_value(env_name, plotter) return gl.get_value(env_name)
def sensorUpdateThreadFunc(): global sensor_data_dict while True: time.sleep(0.1) sensor_data_dict = sensor_q.get() my_lock.pMain_main_calc_lock.acquire() gl.set_value("sensor_data_dict", sensor_data_dict) my_lock.pMain_main_calc_lock.release() log.debug(light_blue(f"sensor_data_dict:{sensor_data_dict}\n")) if sensor_data_dict["sensor_data_valid_flg"]: break else: print("主进程--主线程--传感器未准备完成:%s\t:" % (sensor_data_dict["sensor_data_valid_flg"])) while True: sensor_data_dict = sensor_q.get() my_lock.pMain_sensor_calc_lock.acquire() gl.set_value("sensor_data_dict", sensor_data_dict) my_lock.pMain_sensor_calc_lock.release() log.debug(light_blue(f"sensor_data_dict:{sensor_data_dict}\n")) time.sleep(0.1)
def consumer(Ready, Buffer, BufferEmpty, BufferFull, Mutex): """ 创建消费者进程 :return: None """ global cid if Ready.empty(): # 创建consumer进程 process = Process('C', cid, 0) cid = cid + 1 else: process = Ready.get() # 操作 if not P(BufferFull, process): if not P(Mutex, process): printLog(Ready, BufferEmpty, BufferFull, Mutex, process) while True: if gl.get_value("exeContinue") == 1: # 放数据并执行取操作 process.data = Buffer.get() # print("%s" % process.data) V(Mutex, Ready, Buffer, BufferEmpty, BufferFull, Mutex) V(BufferEmpty, Ready, Buffer, BufferEmpty, BufferFull, Mutex) gl.set_value("exeContinue", 0) break printLog(Ready, BufferEmpty, BufferFull, Mutex, process)
def fetch_brand_all_product(brand_name, brand_url): soup = urlBS(brand_url) # 列表 product_list = soup.select('.product_list .pro_item') for product in product_list: product_detail_url = product.a.get('href') html_index = product_detail_url.index('.html') # 9是/product/的长度 product_id = product_detail_url[9:html_index] product_name = product.select('.props')[0].a.text gl.set_value(gl.product_name_id_dic, product_name, product_id) # 详情 product_detail = urlBS(gl.website_url + product_detail_url) # 详情-轮播图 scroll_img_list = product_detail.select('.spec-scroll .items img') file.store_scroll_img_list(brand_name, product_id, scroll_img_list) # 详情-商品信息图 detail_box_imgs = product_detail.select('.pro_box_main')[0].find_all( 'img') file.store_box_img_list(brand_name, product_id, detail_box_imgs) file.export_to_excel(brand_name, gl.product_name_id_dic)
def rotate_file(): globalvar.set_value('pulley_flag_global', 'rotate') single_case_flag = globalvar.get_value('single_case_flag_global') fra = globalvar.get_value('show_parameter_win_global') index = 3 if single_case_flag[index] is None: item = [] light_ = tk.Scale(fra, label='旋转', orient=tk.HORIZONTAL, from_=0, to=360, length=200, tickinterval=60, resolution=1, command=do_pulley) light_.set(0) item.append(light_) ok_b = tk.Button(fra, text='确定', width=10, command=lambda: ok_button_method()) item.append(ok_b) single_case_flag[index] = item globalvar.set_value('single_case_flag_global', single_case_flag) clearfr() showfr(single_case_flag[index])
def rpn_loss(self, rpn_map, rpn_bbox_transform, rpn_labels, rpn_bbox_targets): height, width = rpn_map.size()[-2:] rpn_map = rpn_map.view(-1, 2, height, width).permute(0,2, 3, 1).contiguous().view(-1, 2) labels = torch.from_numpy(rpn_labels).long() # convert properly labels = labels.view(1, height, width, -1).permute(0, 3, 1, 2).contiguous() labels = labels.view(-1) idx = labels.ge(0).nonzero()[:, 0] rpn_map = rpn_map.index_select(0, Variable(idx, requires_grad=False)) labels = labels.index_select(0, idx) labels = Variable(labels, requires_grad=False) rpn_bbox_targets = torch.from_numpy(rpn_bbox_targets) rpn_bbox_targets = rpn_bbox_targets.view(1, height, width, -1).permute(0, 3, 1, 2) rpn_bbox_targets = Variable(rpn_bbox_targets, requires_grad=False) cls_crit = nn.CrossEntropyLoss() reg_crit = nn.SmoothL1Loss() cls_loss = cls_crit(rpn_map, labels) # verify normalization and sigma reg_loss = reg_crit(rpn_bbox_transform, rpn_bbox_targets) gl.set_value('rpn_cls_loss', cls_loss.data.numpy() ) gl.set_value('rpn_reg_loss', reg_loss.data.numpy() ) loss = cls_loss + reg_loss return loss
def beauty_file(): img_list = globalvar.get_value('img_list_global') src = img_list[len(img_list) - 1].convert('RGB') src = np.array(src) dst = np.zeros_like(src) # int value1 = 3, value2 = 1; 磨皮程度与细节程度的确定 v1 = 3 v2 = 1 dx = v1 * 5 # 双边滤波参数之一 fc = v1 * 12.5 # 双边滤波参数之一 p = 0.1 temp4 = np.zeros_like(src) temp1 = cv2.bilateralFilter(src, dx, fc, fc) temp2 = cv2.subtract(temp1, src) temp2 = cv2.add(temp2, (10, 10, 10, 128)) temp3 = cv2.GaussianBlur(temp2, (2 * v2 - 1, 2 * v2 - 1), 0) temp4 = cv2.subtract(cv2.add(cv2.add(temp3, temp3), src), (10, 10, 10, 255)) dst = cv2.addWeighted(src, p, temp4, 1 - p, 0.0) dst = cv2.add(dst, (10, 10, 10, 255)) show_img = Image.fromarray(dst) img_list.append(show_img) globalvar.set_value('img_list_global', img_list) project_start.show_img_method(filePath=None, flag=1) processing_setting.update_history()
def run(): db = pymysql.connect("192.168.0.102", "root", "root", "star") cursor = db.cursor() print('Data base Connected') while True: frequency = gl.get_value('frequency') if gl.get_value('flag'): #print('Breaking loop') # Break when flag = True break cursor.execute("SELECT * FROM data8802 where Id=1") data = cursor.fetchone() x = -data[2] / 1000 + 3 x = float('{0:.2f}'.format(x)) y = 6 - data[3] / 1000 y = float('{0:.2f}'.format(y)) # print(x,y) gl.set_value('x', x) gl.set_value('y', y) time.sleep(1 / frequency) # run()
def run(): counter=0 print(' connecting to Data base') db = pymysql.connect("192.168.0.105","root","root","star") cursor = db.cursor() print('Data base Connected') while True: counter+=1 frequency=gl.get_value('frequency') if gl.get_value('flag'): #print('Breaking loop') # Break when flag = True break cursor.execute("SELECT * FROM data8802 where Id=1") data = cursor.fetchone() x=-data[3]/1000+3 x=float('{0:.2f}'.format(x)) y=6+data[2]/1000 y=float('{0:.2f}'.format(y)) # print(x,y) gl.set_value('x',x) gl.set_value('y',y) # print(x,y) # if counter%10==0: # print('data',[data[2]/1000,data[3]/1000]) # print('data',data[3]) time.sleep(0.04) # run()
def franck_turnbull(point): '''Define the Franck-Turnbull mechanism''' # Import parameters Rm = gl.get_value('Rm') Rbk = gl.get_value('Rbk') Rft = gl.get_value('Rft') temperature = gl.get_value('temperature') defect = gl.get_value('defect') # Order in list Rft i = point - len(Rm) - len(Rbk) # Order in list defect, means the jth defect is to F-T j = Rft[i][1] # Append the defect generated by breaking-up to the end of the list and migrate random walk a = MP(ID=int(idmanager()), defect_type='V', x=defect[j].x, y=defect[j].y, z=defect[j].z) defect.append(a) gl.set_value('defect', defect) mesh(defect[len(defect) - 1]) Rm.append([defect[len(defect) - 1].rate(temperature)[0], len(defect) - 1]) gl.set_value('Rm', Rm) migrate(len(Rm) - 1) pass
def water_file(): img_list = globalvar.get_value('img_list_global') show_img = img_list[len(img_list) - 1].convert('RGBA') # 转化为RGBA模式 # 1.创建一张透明的图片,在透明图片上写上字,然后与原图合并 w, h = show_img.size water = Image.new('RGBA', (w, h), (0, 0, 0, 0)) fn_size = 100 fn_str = g.enterbox(msg='请输入文字', title='水印文字设置', default='') if len(fn_str) == 0: fn_str = 'watermark' fn = ImageFont.truetype(r'C:\Windows\Fonts\Arial.ttf', fn_size) fn_w, fn_h = fn.getsize(fn_str) # 获取字体宽高 ct_w, ct_h = (w - fn_w) // 2, (h - fn_h) // 2 # 字体位置设置在中心 draw = ImageDraw.Draw(water) draw.text((ct_w, ct_h), fn_str, font=fn, fill=(255, 255, 255, 100)) water = water.rotate(45) # 2.图片合并,原图被水印覆盖 show_img = Image.alpha_composite(show_img, water) img_list.append(show_img) globalvar.set_value('img_list_global', img_list) project_start.show_img_method(filePath=None, flag=1) processing_setting.update_history()
def profile_check(self): self.data_name_check() self.measured_check() if self.output_file == '': QMessageBox.critical(self, 'Error', 'Please choose output file.') else: try: with open(self.output_file, 'r') as f: lines = f.read() pattern = re.compile(' cell \(3<3\[.* .* 0') if not re.search(pattern, lines): QMessageBox.critical( self, 'Error', 'The output file is not a profile file, please check.' ) else: self.check_dict['output'] = True except FileNotFoundError: QMessageBox.critical(self, 'Error', 'Can not find output file.') if all(value for value in self.check_dict.values()): glv.set_value('Data analyzed', True) return True else: return False
def get_defect_data(filename, unitconvert=1): '''Import data of defect, return a list of defect objects''' # Read and split the data from text with open('data/' + filename) as f: N = int(f.readline()) lines = f.readlines() gl.set_value('defectdata', [lines[i].strip().split() for i in range(N)]) # Generate defect objects and put them in a list defect = [] defectype = gl.get_value('defectype') defectdata = gl.get_value('defectdata') for i in range(N): if defectdata[i][1] in defectype['MP']: a = MP(ID=int(defectdata[i][0]), defect_type=defectdata[i][1], x=float(defectdata[i][2]) * unitconvert, y=float(defectdata[i][3]) * unitconvert, z=float(defectdata[i][4]) * unitconvert) defect.append(a) elif defectdata[i][1] in defectype['ED']: a = ED(ID=int(defectdata[i][0]), defect_type=defectdata[i][1], x=float(defectdata[i][2]) * unitconvert, y=float(defectdata[i][3]) * unitconvert, z=float(defectdata[i][4]) * unitconvert) defect.append(a) gl.set_value('defect', defect) pass
def producer(Ready, Buffer, BufferEmpty, BufferFull, Mutex): """ 创建生产者进程 :return: None """ global pid, data if Ready.empty(): # 创建producer进程 process = Process('P', pid, data) pid = pid + 1 data = data + 1 else: process = Ready.get() # 操作 if not P(BufferEmpty, process): if not P(Mutex, process): printLog(Ready, BufferEmpty, BufferFull, Mutex, process) while True: if gl.get_value("exeContinue") == 1: # 放数据并执行取操作 Buffer.put(process.data) V(Mutex, Ready, Buffer, BufferEmpty, BufferFull, Mutex) V(BufferFull, Ready, Buffer, BufferEmpty, BufferFull, Mutex) gl.set_value("exeContinue", 0) break printLog(Ready, BufferEmpty, BufferFull, Mutex, process)
def on_button_login(self): # 按下“登录”的按钮 account = self.lineEdit_account.text() count = judge_account(account) if count != 1: reply = QMessageBox.warning(self, "警告", "账号不存在,请重新输入", QMessageBox.Retry, QMessageBox.Retry) if reply == QMessageBox.Retry: self.lineEdit_account.clear() self.lineEdit_password.clear() else: password = self.lineEdit_password.text() count = judge_ac_and_pw(account, password) if count == 1: reply = QMessageBox.information(self, '恭喜', '登录成功!', QMessageBox.Ok, QMessageBox.Ok) if reply == QMessageBox.Ok: self.hide() self.mywindow = FormIndex() gl.set_value('username', account) # 设置变量值 user self.mywindow.show() else: reply = QMessageBox.warning(self, "警告", "密码错误", QMessageBox.Retry, QMessageBox.Retry) if reply == QMessageBox.Retry: self.lineEdit_password.clear()
def click_start(self): # 获取SN serial_number = self.serial_number_line.text() # 初始化Log gl._init() now_time = time.strftime('%Y%m%d-%H%M%S') now_day = time.strftime('%Y%m%d') path = "E:\station_log\\" + serial_number + "\\" + now_time + "\\" summary_path = "E:\station_log\\summary_log\\" WhetherPathExist(path) LOG_path = path + "test.log" log = Logger(LOG_path) gl.set_value('SN', serial_number) gl.set_value('path', path) gl.set_value('log_func', log) gl.set_value('now_day', now_day) gl.set_value('summary_path', summary_path) # 将生成Log实例化对象设为全局变量 # SN输入框无法编辑 self.serial_number_line.setReadOnly(True) # 表格设置为空 self.Test_Item.setRowCount(0) self.Test_Item.clearContents() # 开始按键变灰 self.Start_Button.setEnabled(False) # 改变测试标签状态 self.label_status.setText("Runing") self.label_status.setPalette(pe_yel) # 测试线程开始 self.thread.start()
def _4SendFunc(): """ 间隔5秒发送一次心跳 """ heart = Heart(TYPE_HEART, diggerId) heart.send_heart_msg(com_4g) start = datetime.now().replace(minute=0, second=0, microsecond=0) minute = TimeInterval(start, 5, heart.send_heart_msg, [com_4g]) minute.start() minute.cancel() """ 上报 """ while True: # 发送o点x,y,h,w my_lock.p4g_main_send_lock.acquire() _4g_send_dict = gl.get_value("_4g_send_dict") my_lock.p4g_main_send_lock.release() if _4g_send_dict: o_min_flg = _4g_send_dict["o_min_flg"] o_x_4g = _4g_send_dict["x_send"] o_y_4g = _4g_send_dict["y_send"] o_h_4g = _4g_send_dict["h_send"] o_w_4g = _4g_send_dict["w_send"] if o_min_flg: send = SendMessage(TYPE_SEND, diggerId, round(o_x_4g / 1000, 3), round(o_y_4g / 1000, 3), round(o_h_4g / 1000, 3), o_w_4g) # m send_msg_json = send.switch_to_json() com_4g.send_data(send_msg_json.encode('utf-8')) com_4g.send_data('\n'.encode('utf-8')) my_lock.p4g_main_send_lock.acquire() gl.set_value("o_min_flg", False) my_lock.p4g_main_send_lock.release() time.sleep(0.2)
def load_image(): imagebound = {} imagebound['编队'] = (665, 328, 886, 430) imagebound['倍速'] = (1030, 60, 1096, 118) imagebound['行动结束'] = (20, 590, 400, 690) imagebound['代理指挥'] = (1010, 590, 1205, 630) imagebound['芯片搜索二'] = (415, 495, 565, 535) globalvar.set_value('imagebound', imagebound)
def _4gProcess(): gl.gl_init() global COM_ID_4G, TYPE_HEART, TYPE_SEND, com_4g, diggerId if SWITCH_DEVICE: COM_ID_4G = "com13" else: COM_ID_4G = "com4" TYPE_HEART = 1 # 消息类型。1:心跳,2:上报 TYPE_SEND = 2 diggerId = 566609996553388032 com_4g = SerialPortCommunication(COM_ID_4G, 115200, 0.1) # 上报消息socket sk_send = socket.socket() sk_send.bind(("127.0.0.1", 14612)) sk_send.listen() conn_send, addr_send = sk_send.accept() sk_send.setblocking(False) # 接收任务socket sk_recv_tsk = socket.socket() sk_recv_tsk.connect(("127.0.0.1", 9000)) _4g_recv_thread = threading.Thread(target=_4RecFunc, daemon=True).start() _4g_send_thread = threading.Thread(target=_4SendFunc, daemon=True).start() """ 4g 主线程 """ while True: time.sleep(0.2) my_lock.p4g_rec_main_lock.acquire() _4g_recv_flg = gl.get_value("_4g_recv_flg") my_lock.p4g_rec_main_lock.release() if _4g_recv_flg: my_lock.p4g_rec_main_lock.acquire() gl.set_value("_4g_recv_flg", False) _4g_data_dict = { "_4g_data_valid_flg": gl.get_value("_4g_data_valid_flg"), "g_start_x_list": gl.get_value('g_start_x_list'), "g_start_y_list": gl.get_value('g_start_y_list'), "g_start_h_list": gl.get_value('g_start_h_list'), "g_start_w_list": gl.get_value('g_start_w_list'), "g_end_x_list": gl.get_value('g_end_x_list'), "g_end_y_list": gl.get_value('g_end_y_list'), "g_end_h_list": gl.get_value('g_end_h_list'), "g_end_w_list": gl.get_value('g_end_w_list'), } my_lock.p4g_rec_main_lock.release() _4g_data_bytes = json.dumps(_4g_data_dict) sk_recv_tsk.send(bytes(_4g_data_bytes.encode('utf-8'))) # 上报 _4g_send_bytes = conn_send.recv(1024) if _4g_send_bytes: _4g_send_dict = json.loads(_4g_send_bytes) my_lock.p4g_main_send_lock.acquire() gl.set_value("_4g_send_dict", _4g_send_dict) my_lock.p4g_main_send_lock.release()
def readNewFile(self): if len(self.Files) > 0: filename = self.Files[0]["filename"] with open(filename, 'r') as csvFile: self.reader = csv.reader(csvFile) self.result = [] for item in self.reader: # 忽略第一行 if self.reader.line_num == 1: continue if self.starttime == None: self.starttime = datetime.strptime( item[2], "%Y-%m-%d").date() if item[3] == '\\N': self.result.append({ "vmid": item[0], "vmtype": item[1], "createtime": (datetime.strptime(item[2], "%Y-%m-%d").date()), "releasetime": datetime.strptime("2099-12-31 00:00:00", '%Y-%m-%d %H:%M:%S').date(), "AType": "", "BType": 0 }) else: self.result.append({ "vmid": item[0], "vmtype": item[1], "createtime": (datetime.strptime(item[2], "%Y-%m-%d").date()), "releasetime": (datetime.strptime(item[3], "%Y-%m-%d").date()), "AType": "", "BType": 0 }) if gl.get_value('LastDate') == None: gl.set_value( 'LastDate', datetime.strptime(item[3], "%Y-%m-%d").date()) elif gl.get_value('LastDate') < datetime.strptime( item[3], "%Y-%m-%d").date(): gl.set_value( 'LastDate', datetime.strptime(item[3], "%Y-%m-%d").date()) self.Files.remove(self.Files[0]) return True else: return False
def pushButton_TCP_select_Func(self): if globalvar.get_value("TCP_select") == "As TCP Server": globalvar.set_value("TCP_select", "As TCP Client") self.pushButton_TCP_select.setText("As TCP Client") self.printf_sys_log_Func("TCP_select:As TCP Client") elif globalvar.get_value("TCP_select") == "As TCP Client": globalvar.set_value("TCP_select", "As TCP Server") self.pushButton_TCP_select.setText("As TCP Server") self.printf_sys_log_Func("TCP_select:As TCP Server")
def backward(self, grad_output): layer_idx = self.saved_tensors[0].data[0] break_layer_idx = self.saved_tensors[0].data[1] #print("Backward,layer_idx=", layer_idx) if (break_layer_idx > 0) and (layer_idx == break_layer_idx): gl.set_value('backward_ctx', grad_output) print("OK has stored grad_output ",break_layer_idx) #print(grad_output) return grad_output, None, None
def beam_combobox_init(self): self.beam_combo.clear() beam_list = beam_dict.list_beams() if len(beam_list) == 0: self.beam_combo.addItem('No commissioned beam') else: for i in range(len(beam_list)): self.beam_combo.addItem(beam_list[i]) glv.set_value('beam', beam_list[0]) self.beam_combo.addItem('Other (please choose files)')
def sharpening_file(): img_list = globalvar.get_value('img_list_global') show_img = img_list[len(img_list) - 1].convert('RGB') show_img = show_img.filter(ImageFilter.SHARPEN) img_list.append(show_img) globalvar.set_value('img_list_global', img_list) project_start.show_img_method(filePath=None, flag=1) processing_setting.update_history()
def set_value(): # v = 6 # globalvar.set_value('get_value', 6) img_test = r'C:\Users\DHW\Pictures\img\yz.jpg' show_img = Image.open(img_test) save_imgs.append(show_img) # print('test_start: ', show_img, type(show_img)) globalvar.set_value('save_imgs', save_imgs)
def AcceptNewECS(self): #读取现有所有机器 OldList = self.VQ.q OldResource = self.NCPool.NCResource NewList = [] while True: NewEcs = self.NewVm.get1vm(gl.get_value('NowDate')) if NewEcs != None: #列表里还有机器 #EcsListTmp.append(NewEcs) NewVm = Vm(NewEcs["vmid"], NewEcs["vmtype"], NewEcs["createtime"], NewEcs["releasetime"]) # 添加今日新机至机器列表 NewList.append(NewVm) else: #所有机器读完,释放所有资源 break EcsListTmp = OldList + NewList # 机器排序 # 线性规划 while True: DisAns = self.NCPool.Distribute_ECS(EcsListTmp) if DisAns == None: # 无解,要删机器了 self.NCPool.NCResource = OldResource # 恢复资源使用量,避免出现负数 self.NCPool.DeleteEcs(NewList) EcsListTmp = OldList + NewList else: break loseVm = [] # 依次给每个机器安排资源 for NewECS in EcsListTmp: NewVM = self.NCPool.create1Vm(NewECS, DisAns) #给这一块ECS分配内存 if NewVM != None: if NewVM.status == "running": #可以分配成功,计算收益 #self.gl.get_value('OP')writevm((gl.get_value('NowDate'),NewVM.name,NewVM.status,NewVM.NC.NCid,NewVM.Type,NewVM.CPU,NewVM.Memory,NewVM.createtime,NewVM.releasetime)) gl.get_value('OP').writevm( (gl.get_value('NowDate'), NewVM.name, NewVM.status, NewVM.NC.NCid, NewVM.Type, NewVM.CPU, NewVM.Memory, NewVM.createtime, "\\N" if NewVM.releasetime == datetime.datetime.strptime( "2099-12-31 00:00:00", '%Y-%m-%d %H:%M:%S').date() else NewVM.releasetime)) gl.set_value('TodayEarnMoney', gl.get_value('TodayEarnMoney') + NewVM.Income) else: #分配不成功,直接输出,正式答案里不输出 #self.VQ.delete(NewVM)#从现存队列中删除,删除以后队列自动向前移动,会漏数据 loseVm.append(NewVM) #self.gl.get_value('OP')writevm((gl.get_value('NowDate'),NewVM.name,NewVM.status,NewVM.NC.NCid,NewVM.Type,NewVM.CPU,NewVM.Memory,NewVM.createtime,NewVM.releasetime)) #gl.get_value('OP').writevm((gl.get_value('NowDate'),NewVM.name,NewVM.status,None,NewVM.Type,NewVM.CPU,NewVM.Memory,NewVM.createtime,"\\N" if NewVM.releasetime == datetime.datetime.strptime("2099-12-31 00:00:00",'%Y-%m-%d %H:%M:%S').date() else NewVM.releasetime,None,None,None)) self.VQ.q = EcsListTmp self.VQ.delete(loseVm) self.VQ.sortMyself()
def idmanager(initial='no'): '''Record ID''' defect = gl.get_value('defect') if initial == 'yes': gl.set_value('idm', len(defect) + 1) if initial == 'no': idm = gl.get_value('idm') idm += 1 gl.set_value('idm', idm) return idm - 1
def reverse_file(): img_list = globalvar.get_value('img_list_global') show_img = img_list[len(img_list) - 1].convert('RGB') show_img = show_img.point(lambda x: 255 - x) img_list.append(show_img) globalvar.set_value('img_list_global', img_list) project_start.show_img_method(filePath=None, flag=1) processing_setting.update_history()