[Bugs] #1903 NORM: OLPC-Calculate Activity – Cannot enter negative values to the entry box.

Sugar Labs Bugs bugtracker-noreply at sugarlabs.org
Mon Apr 12 07:29:56 EDT 2010


#1903: OLPC-Calculate Activity – Cannot enter negative values to the entry box.
------------------------------------------------------------------+---------
    Reporter:  Niranjala80                                        |          Owner:  rwh                        
        Type:  defect                                             |         Status:  new                        
    Priority:  Normal                                             |      Milestone:  Unspecified by Release Team
   Component:  Calculate                                          |        Version:  0.84.x                     
    Severity:  Minor                                              |       Keywords:  OS13                       
Distribution:  Other (name your distribution in the description)  |   Status_field:  New                        
------------------------------------------------------------------+---------

Comment(by quozl):

 Reproduced on XO-1.5 using same activity version.

 Diagnosis:

 The minus key used for entering the negative sign is also a mathematical
 operator key, and the meaning is thus overloaded.  In astparser.py the
 character "-" is in both the DIADIC_OPS and PRE_OPS.

 In calculate.py, when characters typed are being processed, which is in
 function button_pressed where type is set to TYPE_TEXT, the following code
 appears:

 {{{
 if tlen == 0 and (str in self.parser.get_diadic_operators() \
     or str in self.parser.get_post_operators()) and \
     self.parser.get_var('Ans') is not None: # and \
 # logic better?     (str not in self.parser.get_pre_operators() or str ==
 '+'):
     ans = self.format_insert_ans()
     self.text_entry.set_text(ans + str)
     self.text_entry.set_position(len(ans) + len(str))
     self.ans_inserted = True
 }}}

 The check of PRE_OPS is commented out.  This may relate.

-- 
Ticket URL: <http://bugs.sugarlabs.org/ticket/1903#comment:1>
Sugar Labs <http://sugarlabs.org/>
Sugar Labs bug tracking system


More information about the Bugs mailing list