Changeset 1237


Ignore:
Timestamp:
Mar 3, 2013 11:39:23 PM (9 years ago)
Author:
jemian
Message:

revise menu item id numbering - will it work better on Linux now?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mda2idd_report/src/mda2idd_gui.py

    r1236 r1237  
    9797       
    9898    def _init_menus(self):
    99         id_menu_exit    = 8101 # arbitrary starting number
    100         id_menu_prefs   = 1 + id_menu_exit
    101         id_menu_about   = 1 + id_menu_prefs
    102         id_menu_save    = 1 + id_menu_about
    103         self.id_menu_report  = 1 + id_menu_save
    104         id_menu_mrud  = 1 + self.id_menu_report
    105         id_menu_convert_all  = 1 + id_menu_mrud
    106 
    10799        self.menu_file = wx.Menu(title='')
    108         self.menu_file.Append(text=u'&Save\tCtrl+S', id=id_menu_save,
     100        item = self.menu_file.Append(text=u'&Save\tCtrl+S', id=wx.ID_ANY,
    109101                              help=u'Save MDA data to ASCII text file')
    110         self.Bind(wx.EVT_MENU, self.OnMenuFileItemSave, id=id_menu_save)
    111 
    112         self.menu_file.Append(text=u'Convert entire &Directory\tCtrl+D', id=id_menu_convert_all,
     102        self.Bind(wx.EVT_MENU, self.OnMenuFileItemSave, id=item.GetId())
     103
     104        item = self.menu_file.Append(text=u'Convert entire &Directory\tCtrl+D', id=wx.ID_ANY,
    113105                              help=u'Convert all MDA files in current directory to ASCII text files')
    114         self.Bind(wx.EVT_MENU, self.OnConvertAll, id=id_menu_convert_all)
     106        self.Bind(wx.EVT_MENU, self.OnConvertAll, id=item.GetId())
    115107       
    116108        self.menu_file.AppendSeparator()
    117         self.menu_file.AppendCheckItem(text=u'Brief &Report\tCtrl+R', id=self.id_menu_report,
     109        item = self.menu_file.AppendCheckItem(text=u'Brief &Report\tCtrl+R', id=wx.ID_ANY,
    118110                              help=u'Show a brief summary report of the selected MDA file')
    119         self.Bind(wx.EVT_MENU, self.OnMenuFileItemReportStyle, id=self.id_menu_report)
     111        self.Bind(wx.EVT_MENU, self.OnMenuFileItemReportStyle, id=item.GetId())
     112        self.id_menu_report = item.GetId()
     113
    120114        # TODO: provide a control to let user edit self.preferences_file
    121115        # TODO: provide a control to let user edit self.prefs
     
    124118#        self.Bind(wx.EVT_MENU, self.OnMenuFileItemPrefs, id=id_menu_prefs)
    125119        self.menu_file.AppendSeparator()
    126         self.menu_file.Append(text=u'&Save\tCtrl+S', id=id_menu_save,
    127                               help=u'Save MDA data to ASCII text file')
    128         self.menu_file.AppendSeparator()
    129 
    130        
    131         self.menu_file.Append(text=u'MRUD list', id=id_menu_mrud,
     120
     121       
     122        item = self.menu_file.Append(text=u'MRUD list', id=wx.ID_ANY,
    132123                              help=u'Most Recently Used Directories')
    133         self.menu_file.Enable(id_menu_mrud, False)
     124        self.menu_file.Enable(item.GetId(), False)
    134125        self.mrud_insertion_pos = self.menu_file.GetMenuItemCount()
    135126        self.menu_file.AppendSeparator()
    136127       
    137         self.menu_file.Append(text=u'E&xit', id=id_menu_exit,
     128        item = self.menu_file.Append(text=u'E&xit', id=wx.ID_ANY,
    138129                              help=u'Quit this application')
    139         self.Bind(wx.EVT_MENU, self.OnMenuFileItemExit, id=id_menu_exit)
     130        self.Bind(wx.EVT_MENU, self.OnMenuFileItemExit, id=item.GetId())
    140131
    141132        self.menu_edit = wx.Menu(title='')
    142133
    143134        self.menu_help = wx.Menu(title='')
    144         self.menu_help.Append(text=u'&About ...', id=id_menu_about,
     135        item = self.menu_help.Append(text=u'&About ...', id=wx.ID_ANY,
    145136                              help=u'About this application')
    146         self.Bind(wx.EVT_MENU, self.OnAbout, id=id_menu_about)
     137        self.Bind(wx.EVT_MENU, self.OnAbout, id=item.GetId())
    147138
    148139        self.menuBar1 = wx.MenuBar()
Note: See TracChangeset for help on using the changeset viewer.