Changeset 35987


Ignore:
Timestamp:
Feb 20, 2009, 9:48:13 AM (15 years ago)
Author:
martinl
Message:

More wxGUI MS Windows-related issues fixed

Location:
grass/branches/releasebranch_6_4/gui/wxpython
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/georect.py

    r35710 r35987  
    9191            f = open(self.orig_gisrc, 'r')
    9292            for line in f.readlines():
    93                 if line != '':
    94                     line = line.replace('\n', '').strip()
    95                     key, value = line.split(':')
    96                     self.gisrc_dict[key.strip()] = value.strip()
     93                line = line.replace('\n', '').strip()
     94                if len(line) < 1:
     95                    continue
     96                print line
     97                key, value = line.split(':', 1)
     98                self.gisrc_dict[key.strip()] = value.strip()
    9799        finally:
    98100            f.close()
  • grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/location_wizard.py

    r35981 r35987  
    11"""
    2 MODULE:    location_wizard.py
    3 
    4 CLASSES:
    5     * BaseClass
    6     * TitledPage
    7     * DatabasePage
    8     * CoordinateSystemPage
    9     * ProjectionsPage
    10     * ItemList
    11     * ProjTypePage
    12     * DatumPage
    13     * EllipsePage
    14     * GeoreferencedFilePage
    15     * EPSGPage
    16     * CustomPage
    17     * SummaryPage
    18     * RegionDef
    19     * LocationWizard
    20     * SelectDatumDialog
    21 
    22 PURPOSE:   Create a new GRASS Location. User can choose from multiple methods.
    23 
    24 AUTHORS:   The GRASS Development Team
    25            Michael Barton
    26            Jachym Cepicky
    27            Martin Landa <landa.martin gmail.com>
    28            
    29 COPYRIGHT: (C) 2006-2007 by the GRASS Development Team
     2@package location_wizard.py
     3
     4@brief Location wizard - creates a new GRASS Location. User can choose
     5from multiple methods.
     6
     7Classes:
     8 - BaseClass
     9 - TitledPage
     10 - DatabasePage
     11 - CoordinateSystemPage
     12 - ProjectionsPage
     13 - ItemList
     14 - ProjTypePage
     15 - DatumPage
     16 - EllipsePage
     17 - GeoreferencedFilePage
     18 - EPSGPage
     19 - CustomPage
     20 - SummaryPage
     21 - RegionDef
     22 - LocationWizard
     23 - SelectDatumDialog
     24
     25COPYRIGHT: (C) 2007-2009 by the GRASS Development Team
    3026           This program is free software under the GNU General Public
    3127           License (>=v2). Read the file COPYING that comes with GRASS
    3228           for details.
     29
     30@author Michael Barton
     31@author Jachym Cepicky
     32@author Martin Landa <landa.martin gmail.com>   
    3333"""
    3434import os
     
    7474        pass
    7575
    76     def MakeLabel(self, text="", style=wx.ALIGN_LEFT):
     76    def MakeLabel(self, text="", style=wx.ALIGN_LEFT, parent=None):
    7777        """Make aligned label"""
    78         return wx.StaticText(parent=self, id=wx.ID_ANY, label=text,
     78        if not parent:
     79            parent = self
     80        return wx.StaticText(parent=parent, id=wx.ID_ANY, label=text,
    7981                             style=style)
    8082
    81     def MakeTextCtrl(self, text='', size=(100,-1), style=0):
     83    def MakeTextCtrl(self, text='', size=(100,-1), style=0, parent=None):
    8284        """Generic text control"""
    83         return wx.TextCtrl(parent=self, id=wx.ID_ANY, value=text,
     85        if not parent:
     86            parent = self
     87        return wx.TextCtrl(parent=parent, id=wx.ID_ANY, value=text,
    8488                           size=size, style=style)
    8589
    86     def MakeButton(self, text, id=wx.ID_ANY, size=(-1,-1)):
     90    def MakeButton(self, text, id=wx.ID_ANY, size=(-1,-1), parent=None):
    8791        """Generic button"""
    88         return wx.Button(parent=self, id=id, label=text,
     92        if not parent:
     93            parent = self
     94        return wx.Button(parent=parent, id=id, label=text,
    8995                         size=size)
    9096
     
    13931399    def OnBrowseCodes(self, event, search=None):
    13941400        """Browse EPSG codes"""
    1395         try:
     1401#        try:
     1402        if True:
    13961403            data = []
    13971404            self.epsgCodeDict = {}
     
    14181425
    14191426            self.epsglist.Populate(data, update=True)
    1420         except StandardError, e:
    1421             wx.MessageBox(parent=self,
    1422                           message=_("Unable to read EPGS codes: %s") % e,
    1423                           caption=_("Error"),  style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
    1424             self.epsglist.Populate([], update=True)
     1427#         except StandardError, e:
     1428#             wx.MessageBox(parent=self,
     1429#                           message=_("Unable to read EPGS codes: %s") % e,
     1430#                           caption=_("Error"),  style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
     1431#             self.epsglist.Populate([], update=True)
    14251432
    14261433class CustomPage(TitledPage):
     
    17321739                    dlg.Destroy()
    17331740                    defineRegion = RegionDef(self.parent, location=self.location)
    1734                     defineRegion.Centre()
     1741                    defineRegion.CenterOnScreen()
    17351742                    defineRegion.Show()
    17361743                else:
     
    21482155    Page for setting default region extents and resolution
    21492156    """
    2150 
    21512157    def __init__(self, parent, id=wx.ID_ANY,
    21522158                 title=_("Set default region extent and resolution"), location=None):
    21532159        wx.Frame.__init__(self, parent, id, title, size=(650,300))
    2154 
     2160        panel = wx.Panel(self, id=wx.ID_ANY)
     2161       
     2162        self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO))
     2163       
    21552164        self.parent = parent
    21562165        self.location = location
    2157 
    2158         #
    2159         # values
     2166       
     2167        #
     2168        # default values
    21602169        #
    21612170        # 2D
     
    21722181        #         self.ewres3 = 1.0
    21732182        self.tbres  = 1.0
    2174 
     2183       
    21752184        #
    21762185        # inputs
    21772186        #
    21782187        # 2D
    2179         self.tnorth = self.MakeTextCtrl(str(self.north), size=(150, -1))
    2180         self.tsouth = self.MakeTextCtrl(str(self.south), size=(150, -1))
    2181         self.twest = self.MakeTextCtrl(str(self.west), size=(150, -1))
    2182         self.teast = self.MakeTextCtrl(str(self.east), size=(150, -1))
    2183         self.tnsres = self.MakeTextCtrl(str(self.nsres), size=(150, -1))
    2184         self.tewres = self.MakeTextCtrl(str(self.ewres), size=(150, -1))
    2185 
     2188        self.tnorth = self.MakeTextCtrl(text=str(self.north), size=(150, -1), parent=panel)
     2189        self.tsouth = self.MakeTextCtrl(str(self.south), size=(150, -1), parent=panel)
     2190        self.twest = self.MakeTextCtrl(str(self.west), size=(150, -1), parent=panel)
     2191        self.teast = self.MakeTextCtrl(str(self.east), size=(150, -1), parent=panel)
     2192        self.tnsres = self.MakeTextCtrl(str(self.nsres), size=(150, -1), parent=panel)
     2193        self.tewres = self.MakeTextCtrl(str(self.ewres), size=(150, -1), parent=panel)
     2194       
    21862195        #
    21872196        # labels
    21882197        #
    2189         self.lrows = self.MakeLabel("")
    2190         self.lcols = self.MakeLabel("")
    2191         self.lcells = self.MakeLabel("")
    2192 
     2198        self.lrows  = self.MakeLabel(parent=panel)
     2199        self.lcols  = self.MakeLabel(parent=panel)
     2200        self.lcells = self.MakeLabel(parent=panel)
     2201       
    21932202        #
    21942203        # buttons
    21952204        #
    2196         self.bset = self.MakeButton(_("&Set region"), id=wx.ID_OK)
    2197         self.bcancel = wx.Button(self, id=wx.ID_CANCEL)
     2205        self.bset = self.MakeButton(text=_("&Set region"), id=wx.ID_OK, parent=panel)
     2206        self.bcancel = wx.Button(panel, id=wx.ID_CANCEL)
    21982207        self.bset.SetDefault()
    2199 
     2208       
    22002209        #
    22012210        # image
     
    22032212        self.img = wx.Image(os.path.join(globalvar.ETCWXDIR, "images",
    22042213                                         "qgis_world.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap()
    2205 
     2214       
    22062215        #
    22072216        # set current working environment to PERMANENT mapset
     
    22212230            self.currmapset = envval['MAPSET'].strip("';")
    22222231            if self.currlocation != self.location or self.currmapset != 'PERMANENT':
    2223                 # cmdlist = ['g.mapset', 'location=%s' % self.location, 'mapset=PERMANENT']
    2224                 # gcmd.Command(cmdlist
    22252232                gcmd.Command(["g.gisenv",
    22262233                              "set=LOCATION_NAME=%s" % self.location])
    22272234                gcmd.Command(["g.gisenv",
    22282235                              "set=MAPSET=PERMANENT"])
    2229 
     2236       
    22302237        else:
    22312238            dlg = wx.MessageBox(parent=self,
     
    22332240                                caption=_("Error"), style=wx.ID_OK | wx.ICON_ERROR)
    22342241            return
    2235 
     2242       
    22362243        #
    22372244        # get current region settings
     
    22542261            dlg.Destroy()
    22552262            return
    2256 
     2263       
    22572264        #
    22582265        # update values
     
    22752282        self.depth = int(region['depths'])
    22762283        self.cells3 = int(region['3dcells'])
    2277 
     2284       
    22782285        #
    22792286        # 3D box collapsable
     
    22812288        self.infoCollapseLabelExp = _("Click here to show 3D settings")
    22822289        self.infoCollapseLabelCol = _("Click here to hide 3D settings")
    2283         self.settings3D = wx.CollapsiblePane(parent=self,
     2290        self.settings3D = wx.CollapsiblePane(parent=panel,
    22842291                                             label=self.infoCollapseLabelExp,
    22852292                                             style=wx.CP_DEFAULT_STYLE |
     
    22882295        self.settings3D.Collapse(False) # FIXME
    22892296        self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnSettings3DPaneChanged, self.settings3D)
    2290 
     2297       
    22912298        #
    22922299        # set current region settings
     
    23062313        self.lcols.SetLabel(_("Cols: %d" % self.cols))
    23072314        self.lcells.SetLabel(_("Cells: %d" % self.cells))
    2308 
     2315       
    23092316        #
    23102317        # bindings
     
    23232330        #         self.tewres3.Bind(wx.EVT_TEXT,  self.OnValue)
    23242331        self.ttbres.Bind(wx.EVT_TEXT,   self.OnValue)
    2325 
    2326         self.__DoLayout()
     2332       
     2333        self.__DoLayout(panel)
    23272334        self.SetMinSize(self.GetBestSize())
    23282335        self.minWindowSize = self.GetMinSize()
    2329 
     2336   
    23302337    def MakeSettings3DPaneContent(self, pane):
    23312338        """Create 3D region settings pane"""
     
    24212428        self.SendSizeEvent()
    24222429
    2423     def __DoLayout(self):
     2430    def __DoLayout(self, panel):
    24242431        """Window layout"""
    24252432        frameSizer = wx.BoxSizer(wx.VERTICAL)
     
    24292436
    24302437        # north
    2431         gridSizer.Add(item=self.MakeLabel(_("North")),
     2438        gridSizer.Add(item=self.MakeLabel(text=_("North"), parent=panel),
    24322439                      flag=wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL |
    24332440                      wx.TOP | wx.LEFT | wx.RIGHT, border=5, pos=(0, 2))
     
    24372444                      wx.ALL, border=5, pos=(1, 2))
    24382445        # west
    2439         gridSizer.Add(item=self.MakeLabel(_("West")),
     2446        gridSizer.Add(item=self.MakeLabel(text=_("West"), parent=panel),
    24402447                      flag=wx.ALIGN_RIGHT |
    24412448                      wx.ALIGN_CENTER_VERTICAL |
     
    24462453                      wx.ALL, border=5,  pos=(2, 1))
    24472454
    2448         gridSizer.Add(item=wx.StaticBitmap(self, wx.ID_ANY, self.img, (-1, -1),
     2455        gridSizer.Add(item=wx.StaticBitmap(panel, wx.ID_ANY, self.img, (-1, -1),
    24492456                                           (self.img.GetWidth(), self.img.GetHeight())),
    24502457                      flag=wx.ALIGN_CENTER |
     
    24572464                      wx.ALIGN_CENTER_VERTICAL |
    24582465                      wx.ALL, border=5,  pos=(2, 3))
    2459         gridSizer.Add(item=self.MakeLabel(_("East")),
     2466        gridSizer.Add(item=self.MakeLabel(text=_("East"), parent=panel),
    24602467                      flag=wx.ALIGN_LEFT |
    24612468                      wx.ALIGN_CENTER_VERTICAL |
     
    24662473                      wx.ALIGN_CENTER_VERTICAL |
    24672474                      wx.ALL, border=5, pos=(3, 2))
    2468         gridSizer.Add(item=self.MakeLabel(_("South")),
     2475        gridSizer.Add(item=self.MakeLabel(text=_("South"), parent=panel),
    24692476                      flag=wx.ALIGN_TOP | wx.ALIGN_CENTER_HORIZONTAL |
    24702477                      wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5, pos=(4, 2))
    24712478        # ns-res
    2472         gridSizer.Add(item=self.MakeLabel(_("N-S resolution")),
     2479        gridSizer.Add(item=self.MakeLabel(text=_("N-S resolution"), parent=panel),
    24732480                      flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER |
    24742481                      wx.TOP | wx.LEFT | wx.RIGHT, border=5, pos=(5, 1))
     
    24782485                      wx.ALL, border=5,  pos=(6, 1))
    24792486        # ew-res
    2480         gridSizer.Add(item=self.MakeLabel(_("E-W resolution")),
     2487        gridSizer.Add(item=self.MakeLabel(text=_("E-W resolution"), parent=panel),
    24812488                      flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER |
    24822489                      wx.TOP | wx.LEFT | wx.RIGHT, border=5, pos=(5, 3))
     
    25212528
    25222529        self.SetAutoLayout(True)
    2523         self.SetSizer(frameSizer)
    2524         frameSizer.Fit(self)
     2530        panel.SetSizer(frameSizer)
     2531        frameSizer.Fit(panel)
    25252532        self.Layout()
    25262533
  • grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py

    r35980 r35987  
    507507        """Run command selected from menu"""
    508508        cmd = self.GetMenuCmd(event)
    509         self.goutput.RunCmd(cmd)
     509        self.goutput.RunCmd(cmd, switchPage=True)
    510510
    511511    def OnMenuCmd(self, event):
Note: See TracChangeset for help on using the changeset viewer.