X-Git-Url: http://git.maemo.org/git/?p=gonvert;a=blobdiff_plain;f=src%2Fgonvert_glade.py;h=3a9d2ec7ce644af08884467a17fcefa10b4b1c49;hp=555ed8b51f3da55acf27d7316755e3ba956e84f9;hb=797448905789ef3706c111a565040116249831c8;hpb=ac3cdbc8b6cf82d543a0c74dc5fc805c531be175 diff --git a/src/gonvert_glade.py b/src/gonvert_glade.py index 555ed8b..3a9d2ec 100755 --- a/src/gonvert_glade.py +++ b/src/gonvert_glade.py @@ -35,7 +35,7 @@ def shortlist_changed(a): def edit_shortlist(a): print "edit shortlist" - if edit_shortlist1.get_active(): + if toggleShortList.get_active(): print "1" else: print "0" @@ -63,8 +63,8 @@ def exitprogram(a): [categoryname: #1 displayed unit, #2 displayed unit] """ #Determine the contents of the selected category row - selected,iter= cat_clist.get_selection().get_selected() - evil_globals.selected_category = cat_model.get_value(iter,0) + selected,iter= categoryView.get_selection().get_selected() + evil_globals.selected_category = categoryModel.get_value(iter,0) selections = {'evil_globals.selected_category':evil_globals.selected_category, 'evil_globals.selected_units':evil_globals.selected_units} selectionsDatPath = "/".join((constants._data_path_, "selections.dat")) @@ -79,11 +79,11 @@ def exitprogram(a): sys.exit() -def find_entry_changed(a): +def findEntry_changed(a): #Clear out find results since the user wants to look for something new evil_globals.find_result=[] #empty find result list evil_globals.find_count=0 #default to find result number zero - find_label.set_text('') #clear result + findLabel.set_text('') #clear result def find_key_press(a,b): @@ -109,8 +109,8 @@ def messagebox_ok_clicked(a): def find_units(a): - global column1 - global col + global unitNameColumn + global categoryColumn #check if 'new find' or 'last find' or 'next-find' #new-find = run the find algorithm which also selects the first found unit @@ -124,7 +124,7 @@ def find_units(a): #check for new-find if len(evil_globals.find_result)==0: - find_string = string.lower(string.strip(find_entry.get_text())) + find_string = string.lower(string.strip(findEntry.get_text())) #Make sure that a valid find string has been requested if len(find_string)>0: categories = unit_data.list_dic.keys() @@ -149,101 +149,108 @@ def find_units(a): evil_globals.find_count=0 #check if next find is in a new category (prevent category changes when unnecessary if evil_globals.selected_category!=evil_globals.find_result[evil_globals.find_count][0]: - cat_clist.set_cursor(evil_globals.find_result[0][2],col,False) - clist1.set_cursor(evil_globals.find_result[0][3],column1,True) + categoryView.set_cursor(evil_globals.find_result[0][2],categoryColumn,False) + unitsView.set_cursor(evil_globals.find_result[0][3],unitNameColumn,True) if len(evil_globals.find_result)>1: - find_label.set_text(('Press Find for next unit. '+ str(len(evil_globals.find_result))+' result(s).')) + findLabel.set_text(('Press Find for next unit. '+ str(len(evil_globals.find_result))+' result(s).')) else: - find_label.set_text('Text not found') #Display error + findLabel.set_text('Text not found') #Display error else: #must be next-find or last-find #check for last-find if evil_globals.find_count==len(evil_globals.find_result)-1: #select first result evil_globals.find_count=0 - cat_clist.set_cursor(evil_globals.find_result[evil_globals.find_count][2],col,False) - clist1.set_cursor(evil_globals.find_result[evil_globals.find_count][3],column1,True) + categoryView.set_cursor(evil_globals.find_result[evil_globals.find_count][2],categoryColumn,False) + unitsView.set_cursor(evil_globals.find_result[evil_globals.find_count][3],unitNameColumn,True) else: #must be next-find evil_globals.find_count=evil_globals.find_count+1 #check if next find is in a new category (prevent category changes when unnecessary if evil_globals.selected_category!=evil_globals.find_result[evil_globals.find_count][0]: - cat_clist.set_cursor(evil_globals.find_result[evil_globals.find_count][2],col,False) - clist1.set_cursor(evil_globals.find_result[evil_globals.find_count][3],column1,True) + categoryView.set_cursor(evil_globals.find_result[evil_globals.find_count][2],categoryColumn,False) + unitsView.set_cursor(evil_globals.find_result[evil_globals.find_count][3],unitNameColumn,True) -def click_column(col): - ''"Sort the contents of the column when the user clicks on the title.''" - global column1, column2, unit_model +def click_unit_column(col): + """ + Sort the contents of the col when the user clicks on the title. + """ + global unitNameColumn + global unitValueColumn + global unitSymbolColumn + global unitModel #Determine which column requires sorting - if col.get_title()==_(u"Unit Name"): - selected_column=0 - column1.set_sort_indicator(True) - column2.set_sort_indicator(False) - column3.set_sort_indicator(False) - column1.set_sort_order(not evil_globals.unit_sort_direction) - elif col.get_title()==_(u"Value"): - selected_column=1 - column1.set_sort_indicator(False) - column2.set_sort_indicator(True) - column3.set_sort_indicator(False) - column2.set_sort_order(not evil_globals.value_sort_direction) + if col is unitNameColumn: + selectedUnitColumn=0 + unitNameColumn.set_sort_indicator(True) + unitValueColumn.set_sort_indicator(False) + unitSymbolColumn.set_sort_indicator(False) + unitNameColumn.set_sort_order(not evil_globals.unit_sort_direction) + elif col is unitValueColumn: + selectedUnitColumn=1 + unitNameColumn.set_sort_indicator(False) + unitValueColumn.set_sort_indicator(True) + unitSymbolColumn.set_sort_indicator(False) + unitValueColumn.set_sort_order(not evil_globals.value_sort_direction) + elif col is unitSymbolColumn: + selectedUnitColumn=2 + unitNameColumn.set_sort_indicator(False) + unitValueColumn.set_sort_indicator(False) + unitSymbolColumn.set_sort_indicator(True) + unitSymbolColumn.set_sort_order(not evil_globals.units_sort_direction) else: - selected_column=2 - column1.set_sort_indicator(False) - column2.set_sort_indicator(False) - column3.set_sort_indicator(True) - column3.set_sort_order(not evil_globals.units_sort_direction) + assert False, "Unknown column: %s" % (col.get_title(), ) #declare a spot to hold the sorted list sorted_list = [] #point to the first row - iter=unit_model.get_iter_first() + iter=unitModel.get_iter_first() row=0 while (iter): #grab all text from columns for sorting #get the text from each column - unit_text = unit_model.get_value(iter,0) - units_text = unit_model.get_value(iter,2) + unit_text = unitModel.get_value(iter,0) + units_text = unitModel.get_value(iter,2) #do not bother sorting if the value column is empty - if unit_model.get_value(iter,1)=='' and selected_column==1: + if unitModel.get_value(iter,1)=='' and selectedUnitColumn==1: return #special sorting exceptions for ascii values (instead of float values) if evil_globals.selected_category == "Computer Numbers": - value_text = unit_model.get_value(iter,1) + value_text = unitModel.get_value(iter,1) else: - if unit_model.get_value(iter,1)==None or unit_model.get_value(iter,1)=='': + if unitModel.get_value(iter,1)==None or unit_model.get_value(iter,1)=='': value_text = '' else: - value_text = float(unit_model.get_value(iter,1)) + value_text = float(unitModel.get_value(iter,1)) - if selected_column==0: + if selectedUnitColumn==0: sorted_list.append((unit_text,value_text,units_text)) - elif selected_column==1: + elif selectedUnitColumn==1: sorted_list.append((value_text,unit_text,units_text)) else: sorted_list.append((units_text,value_text,unit_text)) - #point to the next row in the unit_model - iter=unit_model.iter_next(iter) + #point to the next row in the unitModel + iter=unitModel.iter_next(iter) row=row+1 #check if no calculations have been made yet (don't bother sorting) if row==0: return else: - if selected_column==0: + if selectedUnitColumn==0: if not evil_globals.unit_sort_direction: sorted_list.sort(lambda (x,xx,xxx), (y,yy,yyy): cmp(string.lower(x),string.lower(y))) evil_globals.unit_sort_direction=True else: sorted_list.sort(lambda (x,xx,xxx), (y,yy,yyy): cmp(string.lower(y),string.lower(x))) evil_globals.unit_sort_direction=False - elif selected_column==1: + elif selectedUnitColumn==1: sorted_list.sort() if not evil_globals.value_sort_direction: evil_globals.value_sort_direction=True @@ -259,57 +266,57 @@ def click_column(col): evil_globals.units_sort_direction=False #Clear out the previous list of units - unit_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING,gobject.TYPE_STRING) - clist1.set_model(unit_model) + unitModel = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING,gobject.TYPE_STRING) + unitsView.set_model(unitModel) #colourize each row differently for easier reading - clist1.set_property( 'rules_hint',1) + unitsView.set_property( 'rules_hint',1) #Clear out the description text_model = gtk.TextBuffer(None) - text1.set_buffer(text_model) + unitDescription.set_buffer(text_model) - if selected_column==0: + if selectedUnitColumn==0: for unit,value,units in sorted_list: - iter = unit_model.append() - unit_model.set(iter,0,unit,1,str(value),2,units) - elif selected_column==1: + iter = unitModel.append() + unitModel.set(iter,0,unit,1,str(value),2,units) + elif selectedUnitColumn==1: for value,unit,units in sorted_list: - iter = unit_model.append() - unit_model.set(iter,0,unit,1,str(value),2,units) + iter = unitModel.append() + unitModel.set(iter,0,unit,1,str(value),2,units) else: for units,value,unit in sorted_list: - iter = unit_model.append() - unit_model.set(iter,0,unit,1,str(value),2,units) + iter = unitModel.append() + unitModel.set(iter,0,unit,1,str(value),2,units) return def click_category(row): - global unit_model, cat_model + global unitModel, categoryModel global unit_dic, list_dic #Clear out the previous list of units - unit_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING,gobject.TYPE_STRING) - clist1.set_model(unit_model) + unitModel = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING,gobject.TYPE_STRING) + unitsView.set_model(unitModel) #Colourize each row alternately for easier reading - clist1.set_property( 'rules_hint',1) + unitsView.set_property( 'rules_hint',1) #Clear out the description text_model = gtk.TextBuffer(None) - text1.set_buffer(text_model) + unitDescription.set_buffer(text_model) #Determine the contents of the selected category row selected,iter= row.get_selection().get_selected() - evil_globals.selected_category = cat_model.get_value(iter,0) + evil_globals.selected_category = categoryModel.get_value(iter,0) evil_globals.unit_sort_direction = False evil_globals.value_sort_direction = False evil_globals.units_sort_direction = False - column1.set_sort_indicator(False) - column2.set_sort_indicator(False) - column3.set_sort_indicator(False) + unitNameColumn.set_sort_indicator(False) + unitValueColumn.set_sort_indicator(False) + unitSymbolColumn.set_sort_indicator(False) unit_dic=unit_data.list_dic[selected.get_value(iter,0)] keys = unit_dic.keys() @@ -318,15 +325,15 @@ def click_category(row): #Fill up the units descriptions and clear the value cells for key in keys: - iter = unit_model.append() - unit_model.set(iter,0,key,1,'',2,unit_dic[key][1]) + iter = unitModel.append() + unitModel.set(iter,0,key,1,'',2,unit_dic[key][1]) unitName.set_text('') unitValue.set_text('') - entry3.set_text('') - entry4.set_text('') + previousUnitName.set_text('') + previousUnitValue.set_text('') unitSymbol.set_text('') - label2.set_text('') + previousUnitSymbol.set_text('') restore_units() @@ -350,14 +357,14 @@ def restore_units(): unit_no=0 for unit in units: if unit==evil_globals.selected_units[evil_globals.selected_category][1]: - clist1.set_cursor(unit_no,column1,True) + unitsView.set_cursor(unit_no,unitNameColumn,True) unit_no=unit_no+1 #Restore newest selection second. unit_no=0 for unit in units: if unit==evil_globals.selected_units[evil_globals.selected_category][0]: - clist1.set_cursor(unit_no,column1,True) + unitsView.set_cursor(unit_no,unitNameColumn,True) unit_no=unit_no+1 # select the text so user can start typing right away @@ -373,7 +380,7 @@ def click_unit(row): evil_globals.calcsuppress = 1 #suppress calculations #Determine the contents of the selected row. - selected,iter= clist1.get_selection().get_selected() + selected,iter= unitsView.get_selection().get_selected() selected_unit=selected.get_value(iter,0) @@ -381,18 +388,18 @@ def click_unit(row): #Clear out the description text_model = gtk.TextBuffer(None) - text1.set_buffer(text_model) + unitDescription.set_buffer(text_model) enditer = text_model.get_end_iter() text_model.insert(enditer,unit_spec[2]) if unitName.get_text() != selected_unit: - entry3.set_text(unitName.get_text()) - entry4.set_text(unitValue.get_text()) + previousUnitName.set_text(unitName.get_text()) + previousUnitValue.set_text(unitValue.get_text()) if unitSymbol.get() == None: - label2.set_text('') + previousUnitSymbol.set_text('') else: - label2.set_text(unitSymbol.get()) + previousUnitSymbol.set_text(unitSymbol.get()) unitName.set_text(selected_unit) unitValue.set_text(selected.get_value(iter,1)) @@ -455,7 +462,7 @@ def write_units(a): class Ccalculate(object): def top(self,a): - global unit_model + global unitModel global testvalue if evil_globals.calcsuppress == 1: @@ -483,23 +490,23 @@ class Ccalculate(object): row = 0 #point to the first row - iter=unit_model.get_iter_first() + iter=unitModel.get_iter_first() while (iter): #get the formula from the name at the row - func,arg = unit_dic[unit_model.get_value(iter,0)][0] + func,arg = unit_dic[unitModel.get_value(iter,0)][0] #set the result in the value column - unit_model.set(iter,1,str(apply(func.from_base,(base,arg,)))) + unitModel.set(iter,1,str(apply(func.from_base,(base,arg,)))) - #point to the next row in the unit_model - iter=unit_model.iter_next(iter) + #point to the next row in the unitModel + iter=unitModel.iter_next(iter) # if the second row has a unit then update its value - if entry3.get_text() != '': + if previousUnitName.get_text() != '': evil_globals.calcsuppress=1 - func,arg = unit_dic[entry3.get_text()][0] - entry4.set_text(str(apply(func.from_base,(base,arg,)))) + func,arg = unit_dic[previousUnitName.get_text()][0] + previousUnitValue.set_text(str(apply(func.from_base,(base,arg,)))) evil_globals.calcsuppress=0 def bottom(self,a): @@ -508,18 +515,18 @@ class Ccalculate(object): return # determine if value to be calculated is empty if evil_globals.selected_category == "Computer Numbers": - if entry4.get_text() =='': + if previousUnitValue.get_text() =='': value = '0' else: - value = entry4.get_text() + value = previousUnitValue.get_text() else: - if entry4.get_text() =='': + if previousUnitValue.get_text() =='': value = 0.0 else: - value = float(entry4.get_text()) + value = float(previousUnitValue.get_text()) - if entry3.get_text() != '': - func,arg = unit_dic[entry3.get_text()][0] #retrieve the conversion function and value from the selected unit + if previousUnitName.get_text() != '': + func,arg = unit_dic[previousUnitName.get_text()][0] #retrieve the conversion function and value from the selected unit base = apply(func.to_base,(value,arg,)) #determine the base unit value keys = unit_dic.keys() @@ -528,17 +535,17 @@ class Ccalculate(object): row = 0 #point to the first row - iter=unit_model.get_iter_first() + iter=unitModel.get_iter_first() while (iter): #get the formula from the name at the row - func,arg = unit_dic[unit_model.get_value(iter,0)][0] + func,arg = unit_dic[unitModel.get_value(iter,0)][0] #set the result in the value column - unit_model.set(iter,1,str(apply(func.from_base,(base,arg,)))) + unitModel.set(iter,1,str(apply(func.from_base,(base,arg,)))) - #point to the next row in the unit_model - iter=unit_model.iter_next(iter) + #point to the next row in the unitModel + iter=unitModel.iter_next(iter) # if the second row has a unit then update its value if unitName.get_text() != '': @@ -548,42 +555,44 @@ class Ccalculate(object): evil_globals.calcsuppress=0 -# vbox2 is mainLayout -# scrolledwindow4 is categoryScrolledWindow -# cat_clist is categoryView -# vbox1 is unitConversionLayout -# hbox1 is selectedUnitLayouta -# unitName is the unit name -# unitValue is the value -# unitSymbol is the unit -# hbox2 is previousSelectedUnitLayouta -# entry3 is the unit name -# entry4 is the value -# label2 is the unit -# vpand1 is unitsAndDescriptionPane -# scrolledWindow1 is unitListScrolledWindow -# clist1 is unitsView -# scrolledWindow2 is unitDescriptionScrolledWindow -# text1 is unitDescription -# hbox3 is the search box +# categoryView is categoryView +# unitConversionLayout +# selectedUnitLayouta +# unitName +# unitValue +# unitSymbol +# previousSelectedUnitLayout +# previousUnitName +# previousUnitValue +# previousUnitSymbol +# unitsAndDescriptionPane +# unitListScrolledWindow +# unitsView +# unitDescriptionScrolledWindow +# unitDescription +# searchLayout is the search box def main(): global mainWindow - global cat_clist - global cat_model + global categoryView + global categoryModel global unitValue global unitName global unitSymbol - global clist1 + global unitsView global calculate global shortlistcheck global about_box - global text1 - global column1 - global column2 - global column3 - global entry3 - global entry4 - global label2 + global unitDescription + global unitNameColumn + global unitValueColumn + global unitSymbolColumn + global previousUnitName + global previousUnitValue + global previousUnitSymbol + global findLabel + global findEntry + global categoryColumn + global toggleShortList logging.basicConfig(level=logging.DEBUG) @@ -641,23 +650,23 @@ def main(): dic = { "on_exitMenuItem_activate": exitprogram, "on_mainWindow_destroy": exitprogram, - "on_cat_clist_select_row": click_category, - "on_clist1_click_column": click_column, + "on_categoryView_select_row": click_category, + "on_unitsView_click_unit_column": click_unit_column, "on_unitValue_changed": calculate.top, - "on_entry4_changed": calculate.bottom, - "on_write_units1_activate": write_units, - "on_find_button_clicked": find_units, - "on_find_entry_key_press_event": find_key_press, - "on_find_entry_changed": find_entry_changed, + "on_previousUnitValue_changed": calculate.bottom, + "on_writeUnitsMenuItem_activate": write_units, + "on_findButton_clicked": find_units, + "on_findEntry_key_press_event": find_key_press, + "on_findEntry_changed": findEntry_changed, "on_about1_activate": about_clicked, "on_about_close_clicked": about_hide, "on_messagebox_ok_clicked": messagebox_ok_clicked, - "on_clear_selections1_activate": clear_selections, - "on_clist1_cursor_changed": click_unit, - "on_clist1_button_released": button_released, + "on_clearSelectionMenuItem_activate": clear_selections, + "on_unitsView_cursor_changed": click_unit, + "on_unitsView_button_released": button_released, "on_mainWindow_size_allocate": app_size_changed, "on_shortlistcheck_toggled": shortlist_changed, - "on_edit_shortlist1_activate": edit_shortlist, + "on_toggleShortList_activate": edit_shortlist, } widgets.signal_autoconnect (dic); @@ -673,25 +682,25 @@ def main(): change_menu_label('fileMenuItem',_('File')) change_menu_label('exitMenuItem',_('Exit')) change_menu_label('toolsMenuItem',_('Tools')) - change_menu_label('clear_selections1',_('Clear selections')) - change_menu_label('write_units1',_('Write Units')) + change_menu_label('clearSelectionMenuItem',_('Clear selections')) + change_menu_label('writeUnitsMenuItem',_('Write Units')) change_menu_label('helpMenuItem',_('Help')) change_menu_label('aboutMenuItem',_('About')) - change_menu_label('find_button',_('Find')) + change_menu_label('findButton',_('Find')) shortlistcheck = widgets.get_widget('shortlistcheck') - edit_shortlist1 = widgets.get_widget('edit_shortlist1') + toggleShortList = widgets.get_widget('toggleShortList') - cat_clist = widgets.get_widget('cat_clist' ) + categoryView = widgets.get_widget('categoryView' ) - clist1 = widgets.get_widget('clist1') - clist1_selection=clist1.get_selection() + unitsView = widgets.get_widget('unitsView') + unitsView_selection=unitsView.get_selection() unitName = widgets.get_widget('unitName') unitValue = widgets.get_widget('unitValue') - entry3 = widgets.get_widget('entry3') - entry4 = widgets.get_widget('entry4') + previousUnitName = widgets.get_widget('previousUnitName') + previousUnitValue = widgets.get_widget('previousUnitValue') about_box = widgets.get_widget('about_box') messagebox = widgets.get_widget('msgbox') messageboxtext = widgets.get_widget('msgboxtext') @@ -702,58 +711,58 @@ def main(): versionlabel.set_text(constants.__version__) unitSymbol =widgets.get_widget('unitSymbol') - label2 =widgets.get_widget('label2') + previousUnitSymbol =widgets.get_widget('previousUnitSymbol') - text1 = widgets.get_widget('text1' ) + unitDescription = widgets.get_widget('unitDescription' ) - find_entry = widgets.get_widget('find_entry') - find_label = widgets.get_widget('find_label') + findEntry = widgets.get_widget('findEntry') + findLabel = widgets.get_widget('findLabel') - #insert a column into the units list even though the heading will not be seen + #insert a categoryColumnumn into the units list even though the heading will not be seen renderer = gtk.CellRendererText() - column1 = gtk.TreeViewColumn( _('Unit Name'), renderer ) - column1.set_property( 'resizable', 1 ) - column1.add_attribute( renderer, 'text', 0 ) - column1.set_clickable(True) - column1.connect("clicked",click_column) - clist1.append_column( column1 ) - - column2 = gtk.TreeViewColumn( _('Value'), renderer ) - column2.set_property( 'resizable', 1 ) - column2.add_attribute( renderer, 'text', 1 ) - column2.set_clickable(True) - column2.connect("clicked",click_column) - clist1.append_column( column2 ) - - column3 = gtk.TreeViewColumn( _('Units'), renderer ) - column3.set_property( 'resizable', 1 ) - column3.add_attribute( renderer, 'text', 2 ) - column3.set_clickable(True) - column3.connect("clicked",click_column) - clist1.append_column( column3 ) + unitNameColumn = gtk.TreeViewColumn( _('Unit Name'), renderer ) + unitNameColumn.set_property( 'resizable', 1 ) + unitNameColumn.add_attribute( renderer, 'text', 0 ) + unitNameColumn.set_clickable(True) + unitNameColumn.connect("clicked",click_unit_column) + unitsView.append_column( unitNameColumn ) + + unitValueColumn = gtk.TreeViewColumn( _('Value'), renderer ) + unitValueColumn.set_property( 'resizable', 1 ) + unitValueColumn.add_attribute( renderer, 'text', 1 ) + unitValueColumn.set_clickable(True) + unitValueColumn.connect("clicked",click_unit_column) + unitsView.append_column( unitValueColumn ) + + unitSymbolColumn = gtk.TreeViewColumn( _('Units'), renderer ) + unitSymbolColumn.set_property( 'resizable', 1 ) + unitSymbolColumn.add_attribute( renderer, 'text', 2 ) + unitSymbolColumn.set_clickable(True) + unitSymbolColumn.connect("clicked",click_unit_column) + unitsView.append_column( unitSymbolColumn ) #Insert a column into the category list even though the heading will not be seen renderer = gtk.CellRendererText() - col = gtk.TreeViewColumn( 'Title', renderer ) - col.set_property( 'resizable', 1 ) - col.add_attribute( renderer, 'text', 0 ) - cat_clist.append_column( col ) + categoryColumn = gtk.TreeViewColumn( 'Title', renderer ) + categoryColumn.set_property( 'resizable', 1 ) + categoryColumn.add_attribute( renderer, 'text', 0 ) + categoryView.append_column( categoryColumn ) - cat_model = gtk.ListStore(gobject.TYPE_STRING) - cat_clist.set_model(cat_model) + categoryModel = gtk.ListStore(gobject.TYPE_STRING) + categoryView.set_model(categoryModel) #colourize each row differently for easier reading - cat_clist.set_property( 'rules_hint',1) + categoryView.set_property( 'rules_hint',1) #Populate the catagories list keys = unit_data.list_dic.keys() keys.sort() for key in keys: - iter = cat_model.append() - cat_model.set(iter,0,key) + iter = categoryModel.append() + categoryModel.set(iter,0,key) ToolTips=gtk.Tooltips() - find_button = widgets.get_widget('find_button') - ToolTips.set_tip(find_button,_(u'Find unit (F6)')) + findButton = widgets.get_widget('findButton') + ToolTips.set_tip(findButton,_(u'Find unit (F6)')) #Restore selections from previously saved settings if it exists and is valid. historical_catergory_found=False @@ -776,16 +785,16 @@ def main(): for counter in range(len(categories)): if selections['evil_globals.selected_category']==categories[counter]: # Restore the previously selected category. - cat_clist.set_cursor(counter, col, False ) - cat_clist.grab_focus() + categoryView.set_cursor(counter, categoryColumn, False ) + categoryView.grab_focus() historical_catergory_found=True if not historical_catergory_found: print "Couldn't find saved category, using default." #If historical records were not kept then default to # put the focus on the first category - cat_clist.set_cursor(0, col, False) - cat_clist.grab_focus() + categoryView.set_cursor(0, categoryColumn, False) + categoryView.grab_focus() restore_units()