<div><div><br></div><div>hi I want to use same function to other tables like this</div><div><br></div><div>tablename = Searchtable .... but could be table1 table2 table3 ... table n</div><div><br></div><div><span class="Apple-style-span" style="font-family: monospace; font-size: 11px; line-height: 13px; white-space: pre; background-color: rgb(255, 255, 255); "><span class="pygmentn">addAction</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">triggered</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">connect</span><span class="pygmentp">(</span><span class="pygmentbp" style="color: rgb(0, 128, 0); ">self</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">addFriend</span><span class="pygmentp">)</span><span class="pygment">  </span><span class="pygmento" style="color: rgb(102, 102, 102); "><-</span></span><span class="Apple-style-span" style="font-family: monospace; font-size: 11px; line-height: 13px; white-space: pre; background-color: rgb(255, 255, 255); "><span class="pygment"> This works ok</span>
<span class="pygment">    </span><span class="pygmentk" style="color: rgb(0, 128, 0); font-weight: bold; ">def</span><span class="pygment"> </span><span class="pygmentnf" style="color: rgb(0, 0, 255); ">addFriend</span><span class="pygmentp">(</span><span class="pygmentbp" style="color: rgb(0, 128, 0); ">self</span><span class="pygmentp">,</span><span class="pygment"> </span><span class="pygmentn">event</span><span class="pygmentp">):</span><span class="pygment"></span>
<span class="pygment">        </span><span class="pygmentn">tablename</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygments" style="color: rgb(186, 33, 33); ">'SearchtableWidget'</span><span class="pygment"></span>
<span class="pygment">        </span><span class="pygmentn">table_obj</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygmentnb" style="color: rgb(0, 128, 0); ">getattr</span><span class="pygmentp">(</span><span class="pygmentbp" style="color: rgb(0, 128, 0); ">self</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">ui</span><span class="pygmentp">,</span><span class="pygment"> </span><span class="pygmentn">tablename</span><span class="pygmentp">)</span><span class="pygment">        </span>
<span class="pygment">        </span><span class="pygmentn">current_row</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygmentn">table_obj</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">currentRow</span><span class="pygmentp">()</span><span class="pygment"></span>
<span class="pygment">        </span><span class="pygmentn">current_vid</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygmentn">table_obj</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">item</span><span class="pygmentp">(</span><span class="pygmentn">current_row</span><span class="pygmentp">,</span><span class="pygment"> </span><span class="pygmentmi" style="color: rgb(102, 102, 102); ">0</span><span class="pygmentp">)</span><span class="pygment"></span>
<span class="pygment">        </span><span class="pygmentn">current_realname</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygmentn">table_obj</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">item</span><span class="pygmentp">(</span><span class="pygmentn">current_row</span><span class="pygmentp">,</span><span class="pygment"> </span><span class="pygmentmi" style="color: rgb(102, 102, 102); ">2</span><span class="pygmentp">)</span><span class="pygment"></span>
<span class="pygment">        </span><span class="pygmentn">total_vid</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygmentnb" style="color: rgb(0, 128, 0); ">len</span><span class="pygmentp">(</span><span class="pygmentn">vid</span><span class="pygmentp">)</span><span class="pygment"></span>
<span class="pygment">        </span><span class="pygmentn">insert</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygmentbp" style="color: rgb(0, 128, 0); ">True</span><span class="pygment"></span>
<span class="pygment">        </span><span class="pygmentk" style="color: rgb(0, 128, 0); font-weight: bold; ">if</span><span class="pygment"> </span><span class="pygmentn">total_vid</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">>=</span><span class="pygment"> </span><span class="pygmentmi" style="color: rgb(102, 102, 102); ">0</span><span class="pygmentp">:</span><span class="pygment"></span>
<span class="pygment">            </span><span class="pygmentk" style="color: rgb(0, 128, 0); font-weight: bold; ">for</span><span class="pygment"> </span><span class="pygmentn">i</span><span class="pygment"> </span><span class="pygmentow" style="color: rgb(170, 34, 255); font-weight: bold; ">in</span><span class="pygment"> </span><span class="pygmentnb" style="color: rgb(0, 128, 0); ">range</span><span class="pygmentp">(</span><span class="pygmentmi" style="color: rgb(102, 102, 102); ">0</span><span class="pygmentp">,</span><span class="pygment"> </span><span class="pygmentn">total_vid</span><span class="pygmentp">):</span><span class="pygment"></span>
<span class="pygment">                </span><span class="pygmentk" style="color: rgb(0, 128, 0); font-weight: bold; ">if</span><span class="pygment"> </span><span class="pygmentnb" style="color: rgb(0, 128, 0); ">int</span><span class="pygmentp">(</span><span class="pygmentnb" style="color: rgb(0, 128, 0); ">str</span><span class="pygmentp">(</span><span class="pygmentn">current_vid</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">text</span><span class="pygmentp">()))</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">==</span><span class="pygment"> </span><span class="pygmentn">vid</span><span class="pygmentp">[</span><span class="pygmentn">i</span><span class="pygmentp">][</span><span class="pygmentmi" style="color: rgb(102, 102, 102); ">0</span><span class="pygmentp">]:</span><span class="pygment"></span>
                      ..... rest code run fine ....
<span class="pygmento" style="color: rgb(102, 102, 102); ">-------------------------------------------------------------------</span><span class="pygment"></span>
if i pass this to prepare the connect when right-click button is active...</span></div><div></div><div><span class="Apple-style-span" style="font-family: monospace; font-size: 11px; line-height: 13px; white-space: pre; background-color: rgb(255, 255, 255); ">
<span class="pygmentn">addAction</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">triggered</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">connect</span><span class="pygmentp">(</span><span class="pygmentbp" style="color: rgb(0, 128, 0); ">self</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">addFriend</span><span class="pygmentp">(</span><span class="pygmentbp" style="color: rgb(0, 128, 0); ">self</span><span class="pygmentp">,</span><span class="pygment"> </span><span class="pygments" style="color: rgb(186, 33, 33); ">'SearchtableWidget'</span><span class="pygmentp">))  <-- need fix this because is running function before connected :|</span>

<span class="pygment">    </span><span class="pygmentk" style="color: rgb(0, 128, 0); font-weight: bold; ">def</span><span class="pygment"> </span><span class="pygmentnf" style="color: rgb(0, 0, 255); ">addFriend</span><span class="pygmentp">(</span><span class="pygmentbp" style="color: rgb(0, 128, 0); ">self</span><span class="pygmentp">,</span><span class="pygment"> </span><span class="pygmentn">event</span><span class="pygmentp">,</span><span class="pygment"> </span><span class="pygmentn">tablename</span><span class="pygmentp">):</span><span class="pygment"></span>
<span class="pygment">        </span><span class="pygmentn">table_obj</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygmentnb" style="color: rgb(0, 128, 0); ">getattr</span><span class="pygmentp">(</span><span class="pygmentbp" style="color: rgb(0, 128, 0); ">self</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">ui</span><span class="pygmentp">,</span><span class="pygment"> </span><span class="pygmentn">tablename</span><span class="pygmentp">)</span><span class="pygment">         <-this receive Searchtable same like before BUT...</span>
<span class="pygment">        </span><span class="pygmentn">current_row</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygmentn">table_obj</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">currentRow</span><span class="pygmentp">()</span>
<span class="pygment">        </span><span class="pygmentn">current_vid</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygmentn">table_obj</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">item</span><span class="pygmentp">(</span><span class="pygmentn">current_row</span><span class="pygmentp">,</span><span class="pygment"> </span><span class="pygmentmi" style="color: rgb(102, 102, 102); ">0</span><span class="pygmentp">)</span><span class="pygment"></span>
<span class="pygment">        </span><span class="pygmentn">current_realname</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygmentn">table_obj</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">item</span><span class="pygmentp">(</span><span class="pygmentn">current_row</span><span class="pygmentp">,</span><span class="pygment"> </span><span class="pygmentmi" style="color: rgb(102, 102, 102); ">2</span><span class="pygmentp">)</span><span class="pygment"></span>
<span class="pygment">        </span><span class="pygmentn">total_vid</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygmentnb" style="color: rgb(0, 128, 0); ">len</span><span class="pygmentp">(</span><span class="pygmentn">vid</span><span class="pygmentp">)</span><span class="pygment"></span>
<span class="pygment">        </span><span class="pygmentn">insert</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">=</span><span class="pygment"> </span><span class="pygmentbp" style="color: rgb(0, 128, 0); ">True</span><span class="pygment"></span>
<span class="pygment">        </span><span class="pygmentk" style="color: rgb(0, 128, 0); font-weight: bold; ">if</span><span class="pygment"> </span><span class="pygmentn">total_vid</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">>=</span><span class="pygment"> </span><span class="pygmentmi" style="color: rgb(102, 102, 102); ">0</span><span class="pygmentp">:</span><span class="pygment"></span>
<span class="pygment">            </span><span class="pygmentk" style="color: rgb(0, 128, 0); font-weight: bold; ">for</span><span class="pygment"> </span><span class="pygmentn">i</span><span class="pygment"> </span><span class="pygmentow" style="color: rgb(170, 34, 255); font-weight: bold; ">in</span><span class="pygment"> </span><span class="pygmentnb" style="color: rgb(0, 128, 0); ">range</span><span class="pygmentp">(</span><span class="pygmentmi" style="color: rgb(102, 102, 102); ">0</span><span class="pygmentp">,</span><span class="pygment"> </span><span class="pygmentn">total_vid</span><span class="pygmentp">):</span><span class="pygment"></span>
<span class="pygment">                </span><span class="pygmentk" style="color: rgb(0, 128, 0); font-weight: bold; ">if</span><span class="pygment"> </span><span class="pygmentnb" style="color: rgb(0, 128, 0); ">int</span><span class="pygmentp">(</span><span class="pygmentnb" style="color: rgb(0, 128, 0); ">str</span><span class="pygmentp">(</span><span class="pygmentn">current_vid</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">text</span><span class="pygmentp">()))</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); ">==</span><span class="pygment"> </span><span class="pygmentn">vid</span><span class="pygmentp">[</span><span class="pygmentn">i</span><span class="pygmentp">][</span><span class="pygmentmi" style="color: rgb(102, 102, 102); ">0</span><span class="pygmentp">]:</span><span class="pygment"></span>
<span class="pygment">                          </span><span class="pygmentn">current_vid</span><span class="pygmento" style="color: rgb(102, 102, 102); ">.</span><span class="pygmentn">text</span><span class="pygmentp">()</span><span class="pygment"> </span><span class="pygmento" style="color: rgb(102, 102, 102); "><- current.text() method NOT WORK... because when came tablename as argument is NoneType</span></span></div>

<div>                                            ...stop here... </div><div><br></div><div>I guess to need some help with how can connect to a function with ARG as options... </div><div><br></div><div>any idea?</div><div>

<br></div><div><br></div>-- <br><font color="#888888"><font color="#888888">Antonio Pe</font><span><font color="#888888">ñ</font></span><font color="#888888">a</font><span></span><br><font color="#888888">Secure email with PGP 0x8B021001 available at <a href="http://pgp.mit.edu" target="_blank">http://pgp.mit.edu</a><br>

</font></font><font color="#888888">
<font color="#888888">Fingerprint: 74E6 2974 B090 366D CE71  7BB2 6476 FA09 8B02 1001</font></font><br>
</div>