Ticket #1426: add-dict-to-map-strings.patch

File add-dict-to-map-strings.patch, 3.4 KB (added by rgs, 15 years ago)

add dictionary to map strings with spaces and other special cases to their corresponding string

  • tahoverhelp.py

    diff --git a/tahoverhelp.py b/tahoverhelp.py
    index 3f08597..0a1c91c 100644
    a b hover_dict = { \ 
    120120    "template4":_("presentation template: select Journal object (no description)"), \
    121121    "template3":_("presentation template: seven bullets"), \
    122122    "hideblocks":_("declutter canvas by hiding blocks")}
     123
     124blocks_dict = {
     125    'TurtleArt' : _('Turtle Art'),
     126    'loadmyblock' : _('load my block'),
     127    'stack2' : _('stack 2'),
     128    'stack1' : _('stack 1'),
     129    'hideblocks' : _('hide blocks'),
     130    'storeinbox1' : _('store in box 1'),
     131    'box1' : _('box 1'),
     132    'storeinbox2' : _('store in box 2'),
     133    'box2' : _('box 2'),
     134    'pendown' : _('pen down'),
     135    'storein' : _('store in'),
     136    'textsize' : _('text size'),
     137    'emptyheap' : _('empty heap'),
     138    'setscale' : _('set scale'),
     139    'textcolor' : _('text color'),
     140    'fillscreen' : _('fill screen'),
     141    'settextsize' : _('set text size'),
     142    'settextcolor' : _('set text color'),
     143    'penup' : _('pen up'),
     144    'setpensize' : _('set pen size'),
     145    'setcolor' : _('set color'),
     146    'setshade' : _('set shade'),
     147    'pensize' : _('pen size'),
     148    'setxy' : _('set xy'),
     149    'audiooff' : _('audiooff'),
     150    'bottompos' : _('bottom'),
     151    'clearheap' : _('clearheap'),
     152    'color' : _('color'),
     153    'descriptionoff' : _('descriptionoff'),
     154    'division2' : _('division'),
     155    'equal' : _('equal'),
     156    'flow' : _('Flow'),
     157    'greater' : _('greater'),
     158    'hat' : _('hat'),
     159    'hat1' : _('hat1'),
     160    'hat2' : _('hat2'),
     161    'hres' : _('hres'),
     162    'hspace' : _('hspace'),
     163    'identity' : _('identity'),
     164    'identity2' : _('identity2'),
     165    'ifelse' : _('else'),
     166    'journal' : _('journal'),
     167    'kbinput' : _('read key'),
     168    'leftpos' : _('leftpos'),
     169    'less' : _('less'),
     170    'minus2' : _('minus2'),
     171    'myblocks' : _('myblocks'),
     172    'myfunc' : _('myfunc'),
     173    'nop' : _('nop'),
     174    'numbers' : _('Numbers'),
     175    'pen' : _('Pen'),
     176    'plus2' : _('plus2'),
     177    'printheap' : _('printheap'),
     178    'product2' : _('product2'),
     179    'remainder2' : _('mod'),
     180    'rightpos' : _('rightpos'),
     181    'sensors' : _('sensors'),
     182    'seth' : _('seth'),
     183    'sqrt' : _('sqrt'),
     184    'stack' : _('stack'),
     185    'stopstack' : _('stopstack'),
     186    'string' : _('string'),
     187    'template1' : _('template1'),
     188    'template2' : _('template2'),
     189    'template3' : _('template3'),
     190    'template4' : _('template4'),
     191    'template6' : _('template6'),
     192    'template7' : _('template7'),
     193    'templates' : _('templates'),
     194    'toppos' : _('toppos'),
     195    'vres' : _('vres'),
     196    'vspace' : _('vspace')
     197}
  • tawindow.py

    diff --git a/tawindow.py b/tawindow.py
    index bb6567e..fbe2fcc 100644
    a b def xy(event): 
    783783
    784784def showPopup(block_name,tw):
    785785    if hasattr(tw,"activity"):
     786        if block_name in blocks_dict:
     787            block_name_s = _(blocks_dict[block_name])
     788        else:
     789            block_name_s = _(block_name)
     790       
    786791        try:
    787             label = _(block_name) + ": " + hover_dict[block_name]
     792            label = block_name_s + ": " + hover_dict[block_name]
    788793        except:
    789             label = _(block_name)
     794            label = block_name_s
    790795        try:
    791796            # Use new toolbar
    792797            tw.activity.hover_help_label.set_text(label)