Changeset 35987
- Timestamp:
- Feb 20, 2009, 9:48:13 AM (15 years ago)
- Location:
- grass/branches/releasebranch_6_4/gui/wxpython
- Files:
-
- 3 edited
-
gui_modules/georect.py (modified) (1 diff)
-
gui_modules/location_wizard.py (modified) (24 diffs)
-
wxgui.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/georect.py
r35710 r35987 91 91 f = open(self.orig_gisrc, 'r') 92 92 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() 97 99 finally: 98 100 f.close() -
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/location_wizard.py
r35981 r35987 1 1 """ 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 5 from multiple methods. 6 7 Classes: 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 25 COPYRIGHT: (C) 2007-2009 by the GRASS Development Team 30 26 This program is free software under the GNU General Public 31 27 License (>=v2). Read the file COPYING that comes with GRASS 32 28 for details. 29 30 @author Michael Barton 31 @author Jachym Cepicky 32 @author Martin Landa <landa.martin gmail.com> 33 33 """ 34 34 import os … … 74 74 pass 75 75 76 def MakeLabel(self, text="", style=wx.ALIGN_LEFT ):76 def MakeLabel(self, text="", style=wx.ALIGN_LEFT, parent=None): 77 77 """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, 79 81 style=style) 80 82 81 def MakeTextCtrl(self, text='', size=(100,-1), style=0 ):83 def MakeTextCtrl(self, text='', size=(100,-1), style=0, parent=None): 82 84 """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, 84 88 size=size, style=style) 85 89 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): 87 91 """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, 89 95 size=size) 90 96 … … 1393 1399 def OnBrowseCodes(self, event, search=None): 1394 1400 """Browse EPSG codes""" 1395 try: 1401 # try: 1402 if True: 1396 1403 data = [] 1397 1404 self.epsgCodeDict = {} … … 1418 1425 1419 1426 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) 1425 1432 1426 1433 class CustomPage(TitledPage): … … 1732 1739 dlg.Destroy() 1733 1740 defineRegion = RegionDef(self.parent, location=self.location) 1734 defineRegion.Cent re()1741 defineRegion.CenterOnScreen() 1735 1742 defineRegion.Show() 1736 1743 else: … … 2148 2155 Page for setting default region extents and resolution 2149 2156 """ 2150 2151 2157 def __init__(self, parent, id=wx.ID_ANY, 2152 2158 title=_("Set default region extent and resolution"), location=None): 2153 2159 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 2155 2164 self.parent = parent 2156 2165 self.location = location 2157 2158 # 2159 # values2166 2167 # 2168 # default values 2160 2169 # 2161 2170 # 2D … … 2172 2181 # self.ewres3 = 1.0 2173 2182 self.tbres = 1.0 2174 2183 2175 2184 # 2176 2185 # inputs 2177 2186 # 2178 2187 # 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 2186 2195 # 2187 2196 # labels 2188 2197 # 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 2193 2202 # 2194 2203 # buttons 2195 2204 # 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) 2198 2207 self.bset.SetDefault() 2199 2208 2200 2209 # 2201 2210 # image … … 2203 2212 self.img = wx.Image(os.path.join(globalvar.ETCWXDIR, "images", 2204 2213 "qgis_world.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap() 2205 2214 2206 2215 # 2207 2216 # set current working environment to PERMANENT mapset … … 2221 2230 self.currmapset = envval['MAPSET'].strip("';") 2222 2231 if self.currlocation != self.location or self.currmapset != 'PERMANENT': 2223 # cmdlist = ['g.mapset', 'location=%s' % self.location, 'mapset=PERMANENT']2224 # gcmd.Command(cmdlist2225 2232 gcmd.Command(["g.gisenv", 2226 2233 "set=LOCATION_NAME=%s" % self.location]) 2227 2234 gcmd.Command(["g.gisenv", 2228 2235 "set=MAPSET=PERMANENT"]) 2229 2236 2230 2237 else: 2231 2238 dlg = wx.MessageBox(parent=self, … … 2233 2240 caption=_("Error"), style=wx.ID_OK | wx.ICON_ERROR) 2234 2241 return 2235 2242 2236 2243 # 2237 2244 # get current region settings … … 2254 2261 dlg.Destroy() 2255 2262 return 2256 2263 2257 2264 # 2258 2265 # update values … … 2275 2282 self.depth = int(region['depths']) 2276 2283 self.cells3 = int(region['3dcells']) 2277 2284 2278 2285 # 2279 2286 # 3D box collapsable … … 2281 2288 self.infoCollapseLabelExp = _("Click here to show 3D settings") 2282 2289 self.infoCollapseLabelCol = _("Click here to hide 3D settings") 2283 self.settings3D = wx.CollapsiblePane(parent= self,2290 self.settings3D = wx.CollapsiblePane(parent=panel, 2284 2291 label=self.infoCollapseLabelExp, 2285 2292 style=wx.CP_DEFAULT_STYLE | … … 2288 2295 self.settings3D.Collapse(False) # FIXME 2289 2296 self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnSettings3DPaneChanged, self.settings3D) 2290 2297 2291 2298 # 2292 2299 # set current region settings … … 2306 2313 self.lcols.SetLabel(_("Cols: %d" % self.cols)) 2307 2314 self.lcells.SetLabel(_("Cells: %d" % self.cells)) 2308 2315 2309 2316 # 2310 2317 # bindings … … 2323 2330 # self.tewres3.Bind(wx.EVT_TEXT, self.OnValue) 2324 2331 self.ttbres.Bind(wx.EVT_TEXT, self.OnValue) 2325 2326 self.__DoLayout( )2332 2333 self.__DoLayout(panel) 2327 2334 self.SetMinSize(self.GetBestSize()) 2328 2335 self.minWindowSize = self.GetMinSize() 2329 2336 2330 2337 def MakeSettings3DPaneContent(self, pane): 2331 2338 """Create 3D region settings pane""" … … 2421 2428 self.SendSizeEvent() 2422 2429 2423 def __DoLayout(self ):2430 def __DoLayout(self, panel): 2424 2431 """Window layout""" 2425 2432 frameSizer = wx.BoxSizer(wx.VERTICAL) … … 2429 2436 2430 2437 # north 2431 gridSizer.Add(item=self.MakeLabel( _("North")),2438 gridSizer.Add(item=self.MakeLabel(text=_("North"), parent=panel), 2432 2439 flag=wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL | 2433 2440 wx.TOP | wx.LEFT | wx.RIGHT, border=5, pos=(0, 2)) … … 2437 2444 wx.ALL, border=5, pos=(1, 2)) 2438 2445 # west 2439 gridSizer.Add(item=self.MakeLabel( _("West")),2446 gridSizer.Add(item=self.MakeLabel(text=_("West"), parent=panel), 2440 2447 flag=wx.ALIGN_RIGHT | 2441 2448 wx.ALIGN_CENTER_VERTICAL | … … 2446 2453 wx.ALL, border=5, pos=(2, 1)) 2447 2454 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), 2449 2456 (self.img.GetWidth(), self.img.GetHeight())), 2450 2457 flag=wx.ALIGN_CENTER | … … 2457 2464 wx.ALIGN_CENTER_VERTICAL | 2458 2465 wx.ALL, border=5, pos=(2, 3)) 2459 gridSizer.Add(item=self.MakeLabel( _("East")),2466 gridSizer.Add(item=self.MakeLabel(text=_("East"), parent=panel), 2460 2467 flag=wx.ALIGN_LEFT | 2461 2468 wx.ALIGN_CENTER_VERTICAL | … … 2466 2473 wx.ALIGN_CENTER_VERTICAL | 2467 2474 wx.ALL, border=5, pos=(3, 2)) 2468 gridSizer.Add(item=self.MakeLabel( _("South")),2475 gridSizer.Add(item=self.MakeLabel(text=_("South"), parent=panel), 2469 2476 flag=wx.ALIGN_TOP | wx.ALIGN_CENTER_HORIZONTAL | 2470 2477 wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5, pos=(4, 2)) 2471 2478 # ns-res 2472 gridSizer.Add(item=self.MakeLabel( _("N-S resolution")),2479 gridSizer.Add(item=self.MakeLabel(text=_("N-S resolution"), parent=panel), 2473 2480 flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER | 2474 2481 wx.TOP | wx.LEFT | wx.RIGHT, border=5, pos=(5, 1)) … … 2478 2485 wx.ALL, border=5, pos=(6, 1)) 2479 2486 # ew-res 2480 gridSizer.Add(item=self.MakeLabel( _("E-W resolution")),2487 gridSizer.Add(item=self.MakeLabel(text=_("E-W resolution"), parent=panel), 2481 2488 flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER | 2482 2489 wx.TOP | wx.LEFT | wx.RIGHT, border=5, pos=(5, 3)) … … 2521 2528 2522 2529 self.SetAutoLayout(True) 2523 self.SetSizer(frameSizer)2524 frameSizer.Fit( self)2530 panel.SetSizer(frameSizer) 2531 frameSizer.Fit(panel) 2525 2532 self.Layout() 2526 2533 -
grass/branches/releasebranch_6_4/gui/wxpython/wxgui.py
r35980 r35987 507 507 """Run command selected from menu""" 508 508 cmd = self.GetMenuCmd(event) 509 self.goutput.RunCmd(cmd )509 self.goutput.RunCmd(cmd, switchPage=True) 510 510 511 511 def OnMenuCmd(self, event):
Note:
See TracChangeset
for help on using the changeset viewer.
