[GRASS-SVN] r68406 - grass/trunk/gui/wxpython/gui_core
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat May 7 20:25:12 PDT 2016
Author: wenzeslaus
Date: 2016-05-07 20:25:11 -0700 (Sat, 07 May 2016)
New Revision: 68406
Modified:
grass/trunk/gui/wxpython/gui_core/pyedit.py
Log:
pyedit: add Submitting/Python, refactor URL, remove prints
Modified: grass/trunk/gui/wxpython/gui_core/pyedit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/pyedit.py 2016-05-08 03:01:53 UTC (rev 68405)
+++ grass/trunk/gui/wxpython/gui_core/pyedit.py 2016-05-08 03:25:11 UTC (rev 68406)
@@ -248,6 +248,11 @@
"""
+def open_url(url):
+ import webbrowser
+ webbrowser.open(url)
+
+
class PyEditController(object):
# using the naming GUI convention, change for controller?
# pylint: disable=invalid-name
@@ -290,12 +295,8 @@
# run in console as other modules, avoid Python shell which
# carries variables over to the next execution
env = os.environ.copy()
- if not self.overwrite:
- print "overwrite not active"
if self.overwrite:
- print "overwrite active"
env['GRASS_OVERWRITE'] = '1'
- print self.giface
self.giface.RunCmd([fd.name], env=env)
def SaveAs(self):
@@ -437,38 +438,31 @@
return True
def OnHelp(self, event):
- import webbrowser
-
# inspired by g.manual but simple not using GRASS_HTML_BROWSER
# not using g.manual because it does not show
entry = 'libpython/script_intro.html'
major, minor, patch = gscript.version()['version'].split('.')
url = 'http://grass.osgeo.org/grass%s%s/manuals/%s' % (
major, minor, entry)
- webbrowser.open(url)
+ open_url(url)
def OnPythonHelp(self, event):
- import webbrowser
-
url = 'https://docs.python.org/%s/tutorial/' % sys.version_info[0]
- webbrowser.open(url)
+ open_url(url)
def OnModulesHelp(self, event):
self.giface.Help('full_index')
+ def OnSubmittingHelp(self, event):
+ open_url('https://trac.osgeo.org/grass/wiki/Submitting/Python')
+
def OnAddonsHelp(self, event):
- import webbrowser
+ open_url('https://grass.osgeo.org/development/code-submission/')
- url = 'https://grass.osgeo.org/development/code-submission/'
- webbrowser.open(url)
-
def OnSupport(self, event):
- import webbrowser
+ open_url('https://grass.osgeo.org/support/')
- url = 'https://grass.osgeo.org/support/'
- webbrowser.open(url)
-
class PyEditToolbar(BaseToolbar):
# GUI class
# pylint: disable=too-many-ancestors
@@ -522,14 +516,12 @@
self.icons['overwriteFalse'].GetBitmap())
self.SetToolShortHelp(self.overwrite,
self.icons['overwriteFalse'].GetLabel())
- print "setting overwrite true"
self.parent.overwrite = True
else:
self.SetToolNormalBitmap(self.overwrite,
self.icons['overwriteTrue'].GetBitmap())
self.SetToolShortHelp(self.overwrite,
self.icons['overwriteTrue'].GetLabel())
- print "setting overwrite false"
self.parent.overwrite = False
@@ -617,6 +609,9 @@
def OnModulesHelp(self, *args, **kwargs):
self.controller.OnModulesHelp(*args, **kwargs)
+ def OnSubmittingHelp(self, *args, **kwargs):
+ self.controller.OnSubmittingHelp(*args, **kwargs)
+
def OnAddonsHelp(self, *args, **kwargs):
self.controller.OnAddonsHelp(*args, **kwargs)
More information about the grass-commit
mailing list