Browse Source

Merge branch 'dev' of ssh://git.csrichter.com:2222/~/git/gr-multirds into dev

dev
Clemens Richter 9 years ago
parent
commit
4db323af94
  1. 6
      apps/fft-multi-decoder_fixed_hackrf.grc
  2. 12
      apps/ifft-RDS-decoder_hier-block.grc
  3. 187
      apps/read_fmdec.grc
  4. 4
      apps/read_sync_decim.grc
  5. 35
      lib/rds_decoder_redsea_impl.cc
  6. 32
      lib/sync_decim_impl.cc
  7. 2
      lib/sync_decim_impl.h
  8. 15
      python/tmc_classes.py
  9. 64
      python/tmc_parser.py

6
apps/fft-multi-decoder_fixed_hackrf.grc

@ -2516,7 +2516,7 @@ class blk(gr.sync_block): # other base classes are basic_block, decim_block, in
</param> </param>
<param> <param>
<key>log</key> <key>log</key>
<value>False</value> <value>True</value>
</param> </param>
<param> <param>
<key>loop_bw</key> <key>loop_bw</key>
@ -3170,7 +3170,7 @@ class blk(gr.sync_block): # other base classes are basic_block, decim_block, in
</param> </param>
<param> <param>
<key>writeDB</key> <key>writeDB</key>
<value>True</value> <value>False</value>
</param> </param>
</block> </block>
<block> <block>
@ -3244,7 +3244,7 @@ class blk(gr.sync_block): # other base classes are basic_block, decim_block, in
</param> </param>
<param> <param>
<key>_enabled</key> <key>_enabled</key>
<value>True</value> <value>1</value>
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>

12
apps/ifft-RDS-decoder_hier-block.grc

@ -482,7 +482,7 @@
</param> </param>
<param> <param>
<key>_enabled</key> <key>_enabled</key>
<value>1</value> <value>0</value>
</param> </param>
<param> <param>
<key>file</key> <key>file</key>
@ -533,11 +533,11 @@
</param> </param>
<param> <param>
<key>_enabled</key> <key>_enabled</key>
<value>0</value> <value>1</value>
</param> </param>
<param> <param>
<key>file</key> <key>file</key>
<value>"/tmp/psk_out_2375_"+str(cutpoint)</value> <value>"/tmp/cr/psk_out_2375_"+str(cutpoint)</value>
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
@ -584,7 +584,7 @@
</param> </param>
<param> <param>
<key>_enabled</key> <key>_enabled</key>
<value>0</value> <value>1</value>
</param> </param>
<param> <param>
<key>file</key> <key>file</key>
@ -2339,7 +2339,7 @@
</param> </param>
<param> <param>
<key>debug</key> <key>debug</key>
<value>True</value> <value>False</value>
</param> </param>
<param> <param>
<key>_enabled</key> <key>_enabled</key>
@ -2402,7 +2402,7 @@
</param> </param>
<param> <param>
<key>log</key> <key>log</key>
<value>log</value> <value>False</value>
</param> </param>
<param> <param>
<key>maxoutbuf</key> <key>maxoutbuf</key>

187
apps/read_fmdec.grc

@ -162,6 +162,33 @@
<value>240000</value> <value>240000</value>
</param> </param>
</block> </block>
<block>
<key>variable</key>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>_coordinate</key>
<value>(151, 706)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>fft19k_len</value>
</param>
<param>
<key>value</key>
<value>2048</value>
</param>
</block>
<block> <block>
<key>variable_qtgui_range</key> <key>variable_qtgui_range</key>
<param> <param>
@ -535,7 +562,7 @@
</param> </param>
<param> <param>
<key>file</key> <key>file</key>
<value>/user/wire2/richter/fm_dec_rec/fm_dec_240k_597.333333333</value> <value>/tmp/cr/rds_rec_all_1500news/fm_dec_240k_5888.0</value>
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
@ -798,7 +825,7 @@
</param> </param>
<param> <param>
<key>w</key> <key>w</key>
<value>loop_bw</value> <value>3.14/loop_bw</value>
</param> </param>
<param> <param>
<key>M</key> <key>M</key>
@ -1046,6 +1073,140 @@ class blk(gr.sync_block): # other base classes are basic_block, decim_block, in
<value>fcc</value> <value>fcc</value>
</param> </param>
</block> </block>
<block>
<key>logpwrfft_x</key>
<param>
<key>avg_alpha</key>
<value>1.0</value>
</param>
<param>
<key>average</key>
<value>False</value>
</param>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>_enabled</key>
<value>True</value>
</param>
<param>
<key>fft_size</key>
<value>fft19k_len</value>
</param>
<param>
<key>frame_rate</key>
<value>30</value>
</param>
<param>
<key>_coordinate</key>
<value>(231, 519)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>logpwrfft_x_0</value>
</param>
<param>
<key>type</key>
<value>float</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>ref_scale</key>
<value>2</value>
</param>
<param>
<key>sample_rate</key>
<value>baseband_rate</value>
</param>
</block>
<block>
<key>multirds_pilot_SNR</key>
<param>
<key>alias</key>
<value></value>
</param>
<param>
<key>comment</key>
<value></value>
</param>
<param>
<key>affinity</key>
<value></value>
</param>
<param>
<key>debug</key>
<value>False</value>
</param>
<param>
<key>_enabled</key>
<value>1</value>
</param>
<param>
<key>_coordinate</key>
<value>(559, 543)</value>
</param>
<param>
<key>_rotation</key>
<value>0</value>
</param>
<param>
<key>id</key>
<value>multirds_pilot_SNR_0</value>
</param>
<param>
<key>maxoutbuf</key>
<value>0</value>
</param>
<param>
<key>minoutbuf</key>
<value>0</value>
</param>
<param>
<key>carrier_freq</key>
<value>19e3</value>
</param>
<param>
<key>fft_len</key>
<value>fft19k_len</value>
</param>
<param>
<key>gap_width</key>
<value>4e3</value>
</param>
<param>
<key>msg_adr</key>
<value>3</value>
</param>
<param>
<key>samp_rate</key>
<value>baseband_rate</value>
</param>
<param>
<key>update_period</key>
<value>0.4</value>
</param>
</block>
<block> <block>
<key>multirds_rds_decoder_redsea</key> <key>multirds_rds_decoder_redsea</key>
<param> <param>
@ -1082,7 +1243,7 @@ class blk(gr.sync_block): # other base classes are basic_block, decim_block, in
</param> </param>
<param> <param>
<key>log</key> <key>log</key>
<value>False</value> <value>True</value>
</param> </param>
<param> <param>
<key>maxoutbuf</key> <key>maxoutbuf</key>
@ -1235,7 +1396,7 @@ class blk(gr.sync_block): # other base classes are basic_block, decim_block, in
</param> </param>
<param> <param>
<key>_enabled</key> <key>_enabled</key>
<value>True</value> <value>0</value>
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
@ -2142,6 +2303,12 @@ class blk(gr.sync_block): # other base classes are basic_block, decim_block, in
<source_key>0</source_key> <source_key>0</source_key>
<sink_key>0</sink_key> <sink_key>0</sink_key>
</connection> </connection>
<connection>
<source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>logpwrfft_x_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection> <connection>
<source_block_id>blocks_throttle_0</source_block_id> <source_block_id>blocks_throttle_0</source_block_id>
<sink_block_id>qtgui_freq_sink_x_0_0_1_2</sink_block_id> <sink_block_id>qtgui_freq_sink_x_0_0_1_2</sink_block_id>
@ -2190,6 +2357,18 @@ class blk(gr.sync_block): # other base classes are basic_block, decim_block, in
<source_key>0</source_key> <source_key>0</source_key>
<sink_key>0</sink_key> <sink_key>0</sink_key>
</connection> </connection>
<connection>
<source_block_id>logpwrfft_x_0</source_block_id>
<sink_block_id>multirds_pilot_SNR_0</sink_block_id>
<source_key>0</source_key>
<sink_key>0</sink_key>
</connection>
<connection>
<source_block_id>multirds_pilot_SNR_0</source_block_id>
<sink_block_id>multirds_rds_parser_table_qt_0</sink_block_id>
<source_key>out</source_key>
<sink_key>in</sink_key>
</connection>
<connection> <connection>
<source_block_id>multirds_rds_decoder_redsea_0</source_block_id> <source_block_id>multirds_rds_decoder_redsea_0</source_block_id>
<sink_block_id>multirds_rds_parser_table_qt_0</sink_block_id> <sink_block_id>multirds_rds_parser_table_qt_0</sink_block_id>

4
apps/read_sync_decim.grc

@ -344,7 +344,7 @@
</param> </param>
<param> <param>
<key>file</key> <key>file</key>
<value>/tmp/cr/rds-rec_sync-decim_170324_weekend/sync_decim_out_11861</value> <value>/tmp/cr/rds_rec_all_1500news/sync_decim_out_5888.0</value>
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>
@ -800,7 +800,7 @@ class blk(gr.sync_block): # other base classes are basic_block, decim_block, in
</param> </param>
<param> <param>
<key>_enabled</key> <key>_enabled</key>
<value>True</value> <value>1</value>
</param> </param>
<param> <param>
<key>_coordinate</key> <key>_coordinate</key>

35
lib/rds_decoder_redsea_impl.cc

@ -120,6 +120,30 @@ uint16_t rds_decoder_redsea_impl::calc_syndrome(uint32_t message,uint8_t mlen) {
} }
//redsea stuff: //redsea stuff:
// Section B.1.1: '-- calculated by the modulo-two addition of all the rows of
// the -- matrix for which the corresponding coefficient in the -- vector is 1.'
uint32_t matrixMultiply(uint32_t vec, const std::vector<uint32_t>& matrix) {
uint32_t result = 0;
for (size_t k=0; k < matrix.size(); k++)
if ((vec >> k) & 0x01)
result ^= matrix[matrix.size() - 1 - k];
return result;
}
// Section B.2.1: 'The calculation of the syndromes -- can easily be done by
// multiplying each word with the parity matrix H.'
uint32_t calcSyndrome_vec(uint32_t vec) {
static const std::vector<uint32_t> parity_check_matrix({
0x200, 0x100, 0x080, 0x040, 0x020, 0x010, 0x008, 0x004,
0x002, 0x001, 0x2dc, 0x16e, 0x0b7, 0x287, 0x39f, 0x313,
0x355, 0x376, 0x1bb, 0x201, 0x3dc,
0x1ee, 0x0f7, 0x2a7, 0x38f, 0x31b
});
return matrixMultiply(vec, parity_check_matrix);
}
const unsigned kBitmask16 = 0x000FFFF; const unsigned kBitmask16 = 0x000FFFF;
const unsigned kBitmask26 = 0x3FFFFFF; const unsigned kBitmask26 = 0x3FFFFFF;
const unsigned kBitmask28 = 0xFFFFFFF; const unsigned kBitmask28 = 0xFFFFFFF;
@ -144,8 +168,8 @@ static const char * const offset_name[]={"A","B","C","D","c"};*/
for (uint32_t e : {0x1,0x3}) {//fix up to 2-bit burst errors (as book says) for (uint32_t e : {0x1,0x3}) {//fix up to 2-bit burst errors (as book says)
for (int shift=0; shift < 26; shift++) { for (int shift=0; shift < 26; shift++) {
uint32_t errvec = ((e << shift) & kBitmask26); uint32_t errvec = ((e << shift) & kBitmask26);
//uint16_t sy = calc_syndrome(errvec ^ offset_word[offset_num],26);
uint32_t sy = calc_syndrome(errvec ^ offset_word[offset_num],26);//why uint32 and not uint16 as everywhere else??? uint32_t sy = calc_syndrome(errvec ^ offset_word[offset_num],26);//why uint32 and not uint16 as everywhere else???
//uint32_t sy = calcSyndrome_vec(errvec ^ offset_word[offset_num]);
result.insert({{sy, offset_name[offset_num]}, errvec}); result.insert({{sy, offset_name[offset_num]}, errvec});
//dout << "adding sy:"<<sy<<"\t\toffset:"<<offset_name[offset_num]<<"\terrvec:"<<std::bitset<32>(errvec) <<std::endl; //dout << "adding sy:"<<sy<<"\t\toffset:"<<offset_name[offset_num]<<"\terrvec:"<<std::bitset<32>(errvec) <<std::endl;
} }
@ -155,14 +179,15 @@ static const char * const offset_name[]={"A","B","C","D","c"};*/
} }
uint32_t rds_decoder_redsea_impl::correctBurstErrors(uint32_t block, char offset) { uint32_t rds_decoder_redsea_impl::correctBurstErrors(uint32_t block, char offset) {
uint16_t syndrome = calc_syndrome(block,26); uint32_t syndrome = calc_syndrome(block,26);
//uint32_t syndrome = calcSyndrome_vec(block);
uint32_t corrected_block = block; uint32_t corrected_block = block;
//dout << "trying to correct sy:"<<syndrome<<"\t\toffset:"<<offset;//<<std::endl; //dout << "trying to correct sy:"<<syndrome<<"\t\toffset:"<<offset;//<<std::endl;
//dout << "\tcount:"<<kErrorLookup.count({(uint16_t)syndrome, (char)offset})<<std::endl; //dout << "\tcount:"<<kErrorLookup.count({(uint16_t)syndrome, (char)offset})<<std::endl;
if (kErrorLookup.count({(uint16_t)syndrome, (char)offset}) > 0) { if (kErrorLookup.count({syndrome, offset}) > 0) {
uint32_t err = kErrorLookup.at({(uint16_t)syndrome, (char)offset}); uint32_t err = kErrorLookup.at({syndrome, offset});
//dout << "correcting"<<std::endl; //dout << "correcting"<<std::endl;
err=0;//correction disabled //err=0;//correction disabled
corrected_block ^= err; corrected_block ^= err;
} }

32
lib/sync_decim_impl.cc

@ -57,6 +57,7 @@ namespace gr {
last_input=0; last_input=0;
mode=COPY; mode=COPY;
dosync_counter=0; dosync_counter=0;
weakout_counter=0;
} }
/* /*
* Our virtual destructor. * Our virtual destructor.
@ -73,10 +74,13 @@ namespace gr {
pmt::pmt_t meta = pmt::car(pdu); // meta declares type 0:RDS, 1:sync/nosync pmt::pmt_t meta = pmt::car(pdu); // meta declares type 0:RDS, 1:sync/nosync
pmt::pmt_t sync = pmt::cdr(pdu); pmt::pmt_t sync = pmt::cdr(pdu);
if(1L==pmt::to_long(meta) && pmt::eqv(sync,pmt::PMT_F)){ if(1L==pmt::to_long(meta) && pmt::eqv(sync,pmt::PMT_F)){
lout<< "entered nosync"<<std::endl; lout<< "switched to copy"<<std::endl;
lout<<"mode: "<<mode<<std::endl; //lout<<"mode: "<<mode<<std::endl;
mode=COPY; mode=COPY;
lout<<"mode: "<<mode<<std::endl; lout<<"mode: "<<mode<<std::endl;
//lout<<"weakout_counter:"<<weakout_counter<<std::endl;
//weakout_counter=0;
//outbit_counter=0;
} }
} }
@ -88,7 +92,12 @@ namespace gr {
{ {
const float *in = (const float *) input_items[0]; const float *in = (const float *) input_items[0];
float *out = (float *) output_items[0]; float *out = (float *) output_items[0];
if(outbit_counter>1000){
outbit_counter=0;
weakout_counter=0;
lout<<"mode: "<<mode<<std::endl;
lout<<"weakout_counter:"<<weakout_counter<<std::endl;
}
for (int i = 0; i < noutput_items; i++) { for (int i = 0; i < noutput_items; i++) {
if(mode==COPY){ if(mode==COPY){
out[i]=in[DECIM*i]; out[i]=in[DECIM*i];
@ -102,12 +111,16 @@ namespace gr {
else if(mode==NOSKIP){ else if(mode==NOSKIP){
out[i]=in[DECIM*i]-in[DECIM*i+1]; out[i]=in[DECIM*i]-in[DECIM*i+1];
} }
//lout<<std::fixed << std::setprecision(3)<<out[i]<<".";
if(mode!=COPY and std::abs(out[i])<threshold){
weakout_counter++;
}
} }
last_input=in[(noutput_items-1)*DECIM+1];//to use for next iteration of work last_input=in[(noutput_items-1)*DECIM+1];//to use for next iteration of work
//lout<<noutput_items<<std::endl; //lout<<noutput_items<<std::endl;
/*synchronize:*/ /*synchronize:*/
if(mode==COPY and dosync_counter==SYNC_COUNTER_MAX){ if(mode==COPY and dosync_counter>=SYNC_COUNTER_MAX){
dosync_counter=0; dosync_counter=0;
float out_noskip; float out_noskip;
float out_skip; float out_skip;
@ -132,23 +145,22 @@ namespace gr {
//lout<<"\t,out_skip:"<<out_skip<<std::endl; //lout<<"\t,out_skip:"<<out_skip<<std::endl;
} }
if (skip_is_better_counter>6){ if (skip_is_better_counter>3){//2017-05-02 lowered from 6
mode=SKIP; mode=SKIP;
lout<<"switched to skip"<< std::endl; lout<<"switched to skip"<< std::endl;
} }
else if (skip_is_better_counter<-6){ else if (skip_is_better_counter<-3){
mode=NOSKIP; mode=NOSKIP;
lout<<"switched to noskip"<< std::endl; lout<<"switched to noskip"<< std::endl;
} }
} }
else if(mode==COPY){ }
else if(mode==COPY){
dosync_counter++; dosync_counter++;
}
} }
// Tell runtime system how many output items we produced. // Tell runtime system how many output items we produced.
outbit_counter+=noutput_items;
return noutput_items; return noutput_items;
}/*end of work*/ }/*end of work*/
} /* namespace multirds */ } /* namespace multirds */

2
lib/sync_decim_impl.h

@ -47,6 +47,8 @@ namespace gr {
unsigned int skip; unsigned int skip;
void parse_ctrl_msg(pmt::pmt_t pdu); void parse_ctrl_msg(pmt::pmt_t pdu);
int dosync_counter; int dosync_counter;
int weakout_counter;
int outbit_counter;
}; };
} // namespace multirds } // namespace multirds

15
python/tmc_classes.py

@ -596,16 +596,16 @@ class tmc_dict:
self.dict_lock=threading.Lock() self.dict_lock=threading.Lock()
self.list_lock=threading.Lock() self.list_lock=threading.Lock()
@staticmethod @staticmethod
def matchFilter(msg,filters): def matchFilter(msg,showInvalid,filters):
if not msg.location.is_valid: #print("fun:matchFilter:%s,showInvalid:%i"%(filters,showInvalid))
if showInvalid and not msg.location.is_valid:
return True#always show invalid messages return True#always show invalid messages
loc_str=str(msg.location)+str(msg.location.reflocs) loc_str=str(msg.location)+str(msg.location.reflocs)
if not msg.location.linRef==None: if not msg.location.linRef==None:
loc_str+=str(msg.location.linRef.roadnumber) loc_str+=str(msg.location.linRef.roadnumber)
for f in filters:#filters is list of dicts {"type":"event","str":"Stau"} for f in filters:#filters is list of dicts {"type":"event","str":"Stau"}
stringlist=f["str"].lower().split(";") stringlist=f["str"].lower().split(";")#filters can be separated by semicolon
for string in stringlist: for string in stringlist:
if f["type"]=="event" and unicode(str(msg.event), encoding="UTF-8").lower().find(string)==-1:#if event filter does not match if f["type"]=="event" and unicode(str(msg.event), encoding="UTF-8").lower().find(string)==-1:#if event filter does not match
return False return False
@ -638,11 +638,12 @@ class tmc_dict:
print("ERROR, not adding: "+str(message)) print("ERROR, not adding: "+str(message))
finally: finally:
self.dict_lock.release() self.dict_lock.release()
def getLogString(self,filters): def getLogString(self,showInvalid,filters):
self.list_lock.acquire() self.list_lock.acquire()
retStr="" retStr=""
#print("fun:getLogString,filters:%s"%filters)
for message in self.message_list: for message in self.message_list:
if tmc_dict.matchFilter(message,filters): if tmc_dict.matchFilter(message,showInvalid,filters):
retStr+=message.log_string() retStr+=message.log_string()
retStr+="\n" retStr+="\n"
retStr+=message.multi_str() retStr+=message.multi_str()
@ -830,7 +831,7 @@ class tmc_message:
text+=templates[language+"_2b"].format(D=self.location.first_name) text+=templates[language+"_2b"].format(D=self.location.first_name)
else: else:
text+=templates[language+"_2a"].format(D=self.location.first_name,E=offset_loc_name) text+=templates[language+"_2a"].format(D=self.location.first_name,E=offset_loc_name)
text+=", dir:"+str(self.tmc_dir)
#LocCode: RefLine: RoadNr #LocCode: RefLine: RoadNr
#A #A
#LocCode:RefLine:Name2 #LocCode:RefLine:Name2

64
python/tmc_parser.py

@ -253,60 +253,63 @@ class tmc_parser(gr.sync_block):
print("symbol not decoded: "+"?%02X?"%ord(char)+"in string:"+return_string) print("symbol not decoded: "+"?%02X?"%ord(char)+"in string:"+return_string)
pass pass
return return_string return return_string
def print_dbg(message,end="\n"):
dbg=False
if dbg:
print(message,end=end)
class tmc_parser_Widget(QtGui.QWidget): class tmc_parser_Widget(QtGui.QWidget):
def print_tmc_msg(self,tmc_msg): def print_tmc_msg(self,tmc_msg):
print("print:",end="")
self.logMutex.acquire(1) self.logMutex.acquire(1)
print("got mutex,",end="") print_dbg("print:got mutex,",end="")
sb=self.logOutput.verticalScrollBar() sb=self.logOutput.verticalScrollBar()
print(".",end="") print_dbg(".",end="")
oldmax=sb.maximum() oldmax=sb.maximum()
print(".",end="") print_dbg(".",end="")
auto_scroll= abs(oldmax-sb.value())<60#auto_scroll if scrollbar was at max auto_scroll= abs(oldmax-sb.value())<60#auto_scroll if scrollbar was at max
print(".",end="") print_dbg(".",end="")
#print("%i %i %r"%(sb.maximum(),sb.value(),auto_scroll))
ef=unicode(self.event_filter.text().toUtf8(), encoding="UTF-8").lower() ef=unicode(self.event_filter.text().toUtf8(), encoding="UTF-8").lower()
lf=unicode(self.location_filter.text().toUtf8(), encoding="UTF-8").lower() lf=unicode(self.location_filter.text().toUtf8(), encoding="UTF-8").lower()
filters=[{"type":"location", "str":lf},{"type":"event", "str":ef}] filters=[{"type":"location", "str":lf},{"type":"event", "str":ef}]
if tmc_dict.matchFilter(tmc_msg,filters): if tmc_dict.matchFilter(tmc_msg,self.showInvalid,filters):
print("a",end="") print_dbg("a",end="")
self.logOutput.append(Qt.QString.fromUtf8(tmc_msg.log_string())) self.logOutput.append(Qt.QString.fromUtf8(tmc_msg.log_string()))
print("a",end="") print_dbg("a",end="")
self.logOutput.append(Qt.QString.fromUtf8(tmc_msg.multi_str())) self.logOutput.append(Qt.QString.fromUtf8(tmc_msg.multi_str()))
print("a",end="") print_dbg("a",end="")
#print("new message")
if auto_scroll: if auto_scroll:
#sb=self.logOutput.verticalScrollBar() #disabled 2017-04-28 might be cause of double free #sb=self.logOutput.verticalScrollBar() #disabled 2017-04-28 might be cause of double free
new_max=sb.maximum() new_max=sb.maximum()
print("s",end="") print_dbg("s",end="")
sb.setValue(new_max) sb.setValue(new_max)
print("s",end="") print_dbg("s",end="")
print("\tdone")
# code.interact(local=locals())
#print("scrolling %i %i %r"%(oldmax,new_max,sb.value()))
#code.interact(local=locals())
self.logMutex.release(1) self.logMutex.release(1)
print_dbg("\tdone")
def filterChanged(self): def filterChanged(self):
print("filterChanged:",end="")
self.logMutex.acquire(1) self.logMutex.acquire(1)
print("got mutex,",end="") #code.interact(local=locals())
print_dbg("filterChanged:got mutex,",end="")
ef="" ef=""
lf="" lf=""
try: try:
ef=unicode(self.event_filter.text().toUtf8(), encoding="UTF-8").lower() ef=unicode(self.event_filter.text().toUtf8(), encoding="UTF-8").lower()
lf=unicode(self.location_filter.text().toUtf8(), encoding="UTF-8").lower() lf=unicode(self.location_filter.text().toUtf8(), encoding="UTF-8").lower()
except Exception as e: except Exception as e:
print(e) print_dbg(e)
print("error getting filter strings") print_dbg("error getting filter strings")
code.interact(local=locals()) code.interact(local=locals())
print("read filters,",end="") print_dbg("read filters,",end="")
self.logOutput.clear() self.logOutput.clear()
print("cleared,",end="") print_dbg("cleared,",end="")
filters=[{"type":"location", "str":lf},{"type":"event", "str":ef}] filters=[{"type":"location", "str":lf},{"type":"event", "str":ef}]
self.logOutput.append(Qt.QString.fromUtf8(self.parser.tmc_messages.getLogString(filters))) #print("getting logstring with filters:%s, showInvalid:%i"%(filters,self.showInvalid))
print("appended,",end="") self.logOutput.append(Qt.QString.fromUtf8(self.parser.tmc_messages.getLogString(self.showInvalid,filters)))
print_dbg("appended,",end="")
self.logMutex.release(1) self.logMutex.release(1)
print("done") print_dbg("done")
def update_showInvalid(self):
self.showInvalid=self.GUI_showInvalid.isChecked()
def __init__(self, parser,maxheight): def __init__(self, parser,maxheight):
QtGui.QWidget.__init__(self) QtGui.QWidget.__init__(self)
layout = Qt.QVBoxLayout() layout = Qt.QVBoxLayout()
@ -318,13 +321,18 @@ class tmc_parser_Widget(QtGui.QWidget):
self.location_filter=QtGui.QLineEdit(u"Baden-Württemberg") self.location_filter=QtGui.QLineEdit(u"Baden-Württemberg")
self.event_filter.returnPressed.connect(self.filterChanged) self.event_filter.returnPressed.connect(self.filterChanged)
self.location_filter.returnPressed.connect(self.filterChanged) self.location_filter.returnPressed.connect(self.filterChanged)
self.showInvalid=False
self.GUI_showInvalid=QtGui.QCheckBox()
self.GUI_showInvalid.setChecked(self.showInvalid)
#self.showInvalid.stateChanged.connect(lambda:self.btnstate(self.b1))
self.GUI_showInvalid.stateChanged.connect(self.update_showInvalid)
filter_layout = Qt.QHBoxLayout() filter_layout = Qt.QHBoxLayout()
filter_layout.addWidget(QtGui.QLabel("event filter:")) filter_layout.addWidget(QtGui.QLabel("event filter:"))
filter_layout.addWidget(self.event_filter) filter_layout.addWidget(self.event_filter)
filter_layout.addWidget(QtGui.QLabel("location filter:")) filter_layout.addWidget(QtGui.QLabel("location filter:"))
filter_layout.addWidget(self.location_filter) filter_layout.addWidget(self.location_filter)
filter_layout.addWidget(QtGui.QLabel("showInvalid:"))
filter_layout.addWidget(self.GUI_showInvalid)
layout.addLayout(filter_layout) layout.addLayout(filter_layout)
layout.addWidget(self.tmc_message_label) layout.addWidget(self.tmc_message_label)
self.logOutput = Qt.QTextEdit() self.logOutput = Qt.QTextEdit()

Loading…
Cancel
Save