Changeset 30764


Ignore:
Timestamp:
Mar 27, 2008, 9:33:54 AM (16 years ago)
Author:
martinl
Message:

wxGUI (welcome screen): fix entering GISDBASE manually

File:
1 edited

Legend:

Unmodified
Added
Removed
  • grass/trunk/gui/wxpython/gis_set.py

    r30759 r30764  
    132132        # textinputs
    133133        self.tgisdbase = wx.TextCtrl(parent=self.panel, id=wx.ID_ANY, value="", size=(300, -1),
    134                                      style=wx.TE_LEFT)
     134                                     style=wx.TE_PROCESS_ENTER)
    135135
    136136        # Locations
     
    161161        self.lblocations.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelectLocation)
    162162        self.lbmapsets.Bind(wx.EVT_LIST_ITEM_SELECTED,   self.OnSelectMapset)
    163         self.Bind(wx.EVT_KEY_DOWN,            self.OnKeyPressedInDbase, self.tgisdbase)
     163        self.tgisdbase.Bind(wx.EVT_TEXT_ENTER, self.OnSetDatabase)
    164164        self.Bind(wx.EVT_CLOSE,               self.OnCloseWindow)
    165165
     
    527527        self.lblocations.InsertItems(self.listOfLocations, 0)
    528528
     529        if len(self.listOfLocations) > 0:
     530            self.lblocations.SetSelection(0)
     531        else:
     532            self.lblocations.SetSelection(wx.NOT_FOUND)
     533
    529534        return self.listOfLocations
    530535
     
    575580        """Location selected"""
    576581        if event:
    577             try:
    578                 self.lblocations.SetSelection(event.GetIndex())
    579             except AttributeError:
    580                 self.lblocations.SetSelection(0)
     582            self.lblocations.SetSelection(event.GetIndex())
    581583           
    582         if self.lblocations.GetSelection() > -1:
     584        if self.lblocations.GetSelection() != wx.NOT_FOUND:
    583585            self.UpdateMapsets(os.path.join(self.gisdbase,
    584586                                            self.listOfLocations[self.lblocations.GetSelection()]))
     
    595597        self.lbmapsets.Clear()
    596598        self.lbmapsets.InsertItems(self.listOfMapsets, 0, disabled=disabled)
    597        
    598         self.lbmapsets.SetSelection(0)
     599
     600        if len(self.listOfMapsets) > 0:
     601            self.lbmapsets.SetSelection(0)
     602        else:
     603            self.lbmapsets.SetSelection(wx.NOT_FOUND)
    599604
    600605    def OnSelectMapset(self, event):
     
    618623        if self.listOfLocations != []:
    619624            self.lblocations.SetSelection(0)
    620 
    621         self.OnSelectLocation(event)
     625        else:
     626            self.lblocations.SetSelection(wx.NOT_FOUND)
     627           
     628        self.OnSelectLocation(None)
    622629
    623630    def OnBrowse(self, event):
     
    633640
    634641        self.OnSetDatabase(event)
    635 
    636     def OnKeyPressedInDbase(self,event):
    637         """GIS data directory changed"""
    638         if wx.WXK_RETURN == event.KeyCode:
    639             self.OnSetDatabase(event)
    640         else:
    641             event.Skip()
    642642
    643643    def OnCreateMapset(self,event):
Note: See TracChangeset for help on using the changeset viewer.