Esempio n. 1
0
 def init_function(self):
     ll = []
     for k,v in self.func_object.request_gn_interpret_dict.items():
         ll.append(k + ' ' + v)
     self.combobox1['values'] = tuple(ll)
     
     self.combobox1.set('')
     for widget in self.labelframe1.grid_slaves():
         widget.destroy()
         
     #功能参数初始化
     if self.func_object.request_gn_interpret_dict != {}:
         self.combobox1.current(0)
         self.request_data = ''.join("8=DZH1.0\x0121004=%s\x0121010=%s"%(self.combobox1.get()[:5],self.func_object.guid))
         items = map(lambda zd: str(zd)+' '+self.func_object.zd_interpret_dic[zd], 
                    self.func_object.request_gn_zd_dict[self.combobox1.get()[:5]])              
         num = 0
         for i in items:
             num = num + 1
             tempvalue = config.readfunc(self.current_scheme, self.combobox1.get()[:5], i[:4])
             templabel = ttk.Label(self.labelframe1,text = i+':',font = self.ft,width = 20)
             templabel.grid(row = num,column = 0,padx = 2,sticky = W)
             tempentry = ttk.Entry(self.labelframe1,width = 25)
             tempentry.grid(row = num,column = 1,padx = 2,sticky = E)
             tempentry.insert(0, tempvalue)
             tempentry.bind('<KeyRelease>', self.func_backup)
             self.request_data += '\x01' + i[:4] + '=' + tempvalue
         self.ent7_value.set(self.request_data)                
Esempio n. 2
0
 def combo1_selection(self, event):
     func_num = self.combobox1.get()[:5]
     items = map(lambda zd: str(zd)+' '+self.func_object.zd_interpret_dic[zd], 
                self.func_object.request_gn_zd_dict[func_num])       
     for widget in self.labelframe1.grid_slaves():
         widget.destroy()
         
     self.request_data = ''.join("8=DZH1.0\x0121004=%s\x0121010=%s"%(func_num,self.func_object.guid))
     if func_num in ['18400','18402','18404']:
         self.request_data += '\x0121000=1\x0121002=0'
         
     num = 0
     for i in items:
         num = num + 1
         #取备份文件中的value
         tempvalue = config.readfunc(self.combobox2.get(), func_num, i[:4])
         templabel = ttk.Label(self.labelframe1,text = i+':',font = self.ft,width = 20)
         templabel.grid(row = num,column = 0,padx = 2,sticky = W)
         tempentry = ttk.Entry(self.labelframe1,width = 25)        
         tempentry.grid(row = num,column = 1,padx = 2,sticky = E)
         tempentry.insert(0, tempvalue)
         tempentry.bind('<KeyRelease>', self.func_backup)
         self.request_data += '\x01' + i[:4] + '=' + tempvalue
         
     if func_num in ['18400','18402','18404']:
         self.request_data += '\x0121003=0\x0121001=1'
     self.ent7_value.set(self.request_data)