def __on_click(self,widget,data=None): if data=='resivescale': selscale=sysfrm.SelectScale(1) selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False self.__clear_text() for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() for i in xrange(1,99): try : num,txt=tigerlib.getSellers_204(i,modesocket=tigerlib.MULTIOPERATION) glu.setKey('Pers Num '+str(num),num) glu.setKey('Pers Text '+str(num),txt) except Exception,ecx : print 'поймали ',ecx continue #time.sleep(1) tigerlib.closesocket() self.__refresh()
def __on_click(self,widget,data=None): if data=='new': if len(self.num.get_text())!=0: ic=len(self.lst) ic +=1 if ic>20: return False glu.setKey('Group Num '+str(ic),self.num.get_text()) glu.setKey('Group Text '+str(ic),self.mes.get_text()) self.__refresh() pass if data=='del': pass if data=='sendcale': selscale=sysfrm.SelectScale() selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() for i in xrange(1,20): if glu.testKey('Group Text '+str(i)): tigerlib.setCommodityGroups_210(int(glu.getKey('Group Num '+str(i))),glu.getKey('Group Text '+str(i)),int(glu.getKey('Group Num '+str(i))),modesocket=tigerlib.MULTIOPERATION) #time.sleep(1) tigerlib.closesocket() pass if data=='resivescale': selscale=sysfrm.SelectScale(1) selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False self.__clear_text() for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() for i in xrange(1,20): try : num,txt,root_group=tigerlib.getCommodityGroups_210(i,tigerlib.MULTIOPERATION) glu.setKey('Group Num '+str(i),num) glu.setKey('Group Text '+str(i),txt) except Exception,ecx : print 'поймали ',ecx continue #time.sleep(1) tigerlib.closesocket() self.__refresh() pass
def __on_click_2(self,widget,data=None): #print widget,data #print glu.pludata if data=='resivescale': ''' данные из весов ''' selscale=sysfrm.SelectScale(1) selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False glu.keyplulink.clear() for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() for i in xrange (1,100): rt=tigerlib.getFixKey_216(i,tigerlib.MULTIOPERATION) x=next((x for x in glu.pludata if x[0]==rt[2]),None) if x!=None: glu.keyplulink['mb'+str(rt[0])]=[str(rt[2]),x[2].encode('utf-8').rstrip('\x00')] tigerlib.closesocket() pass if data=='sendcale': ''' данные в весы ''' selscale=sysfrm.SelectScale(1) selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() for l in glu.keyplulink: tigerlib.setFixKey_216(int(re.sub("[^0-9]","",l)),0,int(glu.keyplulink[l][0]),tigerlib.MULTIOPERATION) pass pass tigerlib.closesocket() pass pass
def __on_click(self,widget,data=None): if data=='resivescale': selscale=sysfrm.SelectScale(1) selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() self.rt=tigerlib.getConfigWrk_202(modesocket=tigerlib.MULTIOPERATION) tigerlib.closesocket() pass self.__set_view_param() pass
def __on_click(self,widgeth,data=None): if data=='load': dialog=gtk.FileChooserDialog('Открыть',None,gtk.FILE_CHOOSER_ACTION_OPEN,(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OK,gtk.RESPONSE_OK)) dialog.set_default_response(gtk.RESPONSE_OK) filter=gtk.FileFilter() filter.set_name('Список товаров') filter.add_pattern('*.csv') dialog.add_filter(filter) response=dialog.run() if response==gtk.RESPONSE_OK: self.__load_csv(dialog.get_filename()) pass dialog.destroy() if data=='save': dialog=gtk.FileChooserDialog('Сохранить',None,gtk.FILE_CHOOSER_ACTION_SAVE,(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,gtk.STOCK_OK,gtk.RESPONSE_OK)) dialog.set_default_response(gtk.RESPONSE_OK) filter=gtk.FileFilter() filter.set_name('Список товаров') filter.add_pattern('*.csv') dialog.add_filter(filter) response=dialog.run() if response==gtk.RESPONSE_OK: self.__save_cvs(dialog.get_filename()) pass dialog.destroy() if data=='sendcale': selscale=sysfrm.SelectScale() selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() for l in self.lst: #tigerlib.setPLU_207(plu,barcode,name_plu,price,tax,tarenum,fixscale=0,group=0,flg=0,timegod=499,timesale=499,misctext=0,modestr=1) tigerlib.setPLU_207(l[0],l[1],l[2],l[4],0,0,timesale=l[5],timegod=l[6],misctext=l[7],modesocket=tigerlib.MULTIOPERATION,modestr=glu.getKey('Number line '+str(ci+1))) tigerlib.closesocket() pass if data=='resivescale': selscale=sysfrm.SelectScale(1) selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False self.lst.clear() glu.pludata=[] for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() for i in xrange (1,2000): rt=tigerlib.getPLU_207(i,tigerlib.MULTIOPERATION) self.lst.append([int(rt[0]),rt[1],rt[2],0,float(rt[3]),int(rt[4]),int(rt[5]),int(rt[10])]) glu.pludata.append([int(rt[0]),rt[1],rt[2],0,float(rt[3]),int(rt[4]),int(rt[5]),int(rt[10])]) #time.sleep(1) pass tigerlib.closesocket() pass if data=='new': #plu=NewPlu() #plu.set_default_response(gtk.RESPONSE_OK) #response=plu.run() self.lst.append(None) pass if data=='del': pass pass
def __on_click(self,widget,data=None): if data=='new': if len(self.mes.get_text())!=0: glu.setKey('Dop Num '+self.num.get_text(),int(self.num.get_text())) glu.setKey('Dop Text '+self.num.get_text(),self.mes.get_text()) self.__refresh() pass pass if data=='del': if len(self.num.get_text())!=0: glu.delKey('Dop Num '+self.num.get_text()) glu.delKey('Dop Text '+self.num.get_text()) self.num.set_text('') self.mes.set_text('') self.__refresh() if data=='resivescale': selscale=sysfrm.SelectScale(1,title='прием') selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False self.__clear_text() for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() for i in xrange(1,2000): try : num,txt=tigerlib.getMoreText_209(i,tigerlib.MULTIOPERATION) glu.setKey('Dop Num '+str(num),num) glu.setKey('Dop Text '+str(num),txt) except : print 'поймали' continue #time.sleep(1) tigerlib.closesocket() self.__refresh() if data=='sendcale': selscale=sysfrm.SelectScale(title='передача') selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() for i in xrange(1,2000): if glu.testKey('Dop Text '+str(i)): tigerlib.setMoreText_209(int(glu.getKey('Dop Num '+str(i))),glu.getKey('Dop Text '+str(i)),tigerlib.MULTIOPERATION) #time.sleep(1) pass tigerlib.closesocket() pass pass
def __on_click(self,widget,data=None): if data=='new': if len(self.num.get_text())!=0 : i=0 if int(self.num.get_text())>8: return None ii=int(self.num.get_text()) if glu.testKey('BarMask count'): i=glu.getKey('BarMask count') glu.setKey('BarMask Num '+str(ii),int(self.num.get_text())) glu.setKey('BarMask '+str(ii),self.mes.get_text()) i +=1 glu.setKey('BarMask count',i) self.__refresh() pass pass if data=='del': glu.delKey('BarMask Num '+str(self.sel_id)) glu.delKey('BarMask '+str(self.sel_id)) self.__refresh() pass if data=='sendcale': selscale=sysfrm.SelectScale() selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() for i in xrange(1,9): tigerlib.setBarCode_214(i,glu.getKey('BarMask '+str(i)),tigerlib.MULTIOPERATION) #time.sleep(1) pass tigerlib.closesocket() pass if data=='resivescale': selscale=sysfrm.SelectScale(1) selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False self.__clear_bar() for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) #print tigerlib.address tigerlib.opensocket() for i in xrange(1,9): num,st=tigerlib.getBarCode_214(i,tigerlib.MULTIOPERATION) glu.setKey('BarMask Num '+str(i),num) glu.setKey('BarMask '+str(i),st) #time.sleep(1) tigerlib.closesocket() self.__refresh() pass
class SetPerson(gtk.Frame): ''' Продавцы ''' def __clear_text(self): for i in xrange(1,99): if glu.testKey('Pers Num '+str(i)): glu.delKey('Pers Num '+str(i)) glu.delKey('Pers Text '+str(i)) def __on_click(self,widget,data=None): if data=='resivescale': selscale=sysfrm.SelectScale(1) selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False self.__clear_text() for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() for i in xrange(1,99): try : num,txt=tigerlib.getSellers_204(i,modesocket=tigerlib.MULTIOPERATION) glu.setKey('Pers Num '+str(num),num) glu.setKey('Pers Text '+str(num),txt) except Exception,ecx : print 'поймали ',ecx continue #time.sleep(1) tigerlib.closesocket() self.__refresh() if data=='sendcale': selscale=sysfrm.SelectScale() selscale.run() if selscale.ok_flg : selscale.destroy() else : selscale.destroy() return False for ci in xrange(glu.getKey('Count Scale')): if glu.testKey('Exchange scale '+str(ci+1)): if glu.getKey('Exchange scale '+str(ci+1)): tigerlib.address=glu.getKey('IP '+str(ci+1)) tigerlib.opensocket() for i in xrange(1,99): if glu.testKey('Pers Text '+str(i)): tigerlib.setSellers_204(int(glu.getKey('Pers Num '+str(i))),glu.getKey('Pers Text '+str(i)),modesocket=tigerlib.MULTIOPERATION) #time.sleep(1) tigerlib.closesocket() if data=='new' : if len(self.num.get_text())!=0: ic=len(self.lst) ic +=1 glu.setKey('Pers Num '+str(ic),self.num.get_text()) glu.setKey('Pers Text '+str(ic),self.mes.get_text()) self.__refresh() if data=='del': if len(self.num.get_text())!=0: glu.delKey('Pers Num '+self.num.get_text()) glu.delKey('Pers Text '+self.num.get_text()) self.num.set_text('') self.mes.set_text('') self.__refresh() pass