Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 4 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
4 .gitignore
@@ -4,4 +4,6 @@
*.wpu
*.coverage
-htmlcov
+htmlcov
+
+scripts/cute_wing_stuff_local_settings.py
View
31 README.markdown
@@ -269,4 +269,33 @@ This is good for automatically formatting long lines into this style:
nose.selector.Selector.wantFile = \
types.MethodType(wantFile, None, nose.selector.Selector)
-Suggested key combination: `Alt-Insert L`
+Suggested key combination: `Alt-Insert L`
+
+
+## start-debug-with-preset-args ##
+
+Start debugging with preset arguments.
+
+You need to have a git-ignored file `cute_wing_stuff_local_settings.py`
+right in this `scripts` folder, which defines a `dict` like this:
+
+ all_debug_argument_presets = {
+ 'my_django_app.wpr': ['runserver --noreload', 'test']
+ 'other_django_app.wpr': ['runserver 80 --noreload', 'test',
+ 'syncdb']
+ None: ['runserver 80 --noreload', 'test'],
+ }
+
+What does this file mean? For each of your projects, you define the
+different presets for debug arguments that will be used for your main debug
+file. `None` is used as the default for any Wing projects that are not
+listed.
+
+Then you call this `start-debug-with-preset-args` with the `i_preset`
+argument equal to the preset index number, and debug will start with those
+arguments.
+
+Suggested key combinations: `Alt-Insert F5` for preset 0
+ `Alt-Insert Shift-F5` for preset 1
+ `Alt-Insert Ctrl-F5` for preset 2
+ `Alt-Insert Ctrl-Shift-F5` for preset 3
View
73 scripts/start_debug_with_preset_args.py
@@ -0,0 +1,73 @@
+# Copyright 2009-2011 Ram Rachum.
+# This program is distributed under the LGPL2.1 license.
+
+'''
+This module defines the `start_debug_with_preset_args` script.
+
+See its documentation for more information.
+'''
+
+from __future__ import division
+from __future__ import with_statement
+
+import os.path, sys; sys.path.append(os.path.dirname(__file__))
+
+import wingapi
+
+import shared
+
+
+def start_debug_with_preset_args(i_preset=0,
+ project=wingapi.kArgProject):
+ '''
+ Start debugging with preset arguments.
+
+ You need to have a git-ignored file `cute_wing_stuff_local_settings.py`
+ right in this `scripts` folder, which defines a `dict` like this:
+
+ all_debug_argument_presets = {
+ 'my_django_app.wpr': ['runserver --noreload', 'test']
+ 'other_django_app.wpr': ['runserver 80 --noreload', 'test',
+ 'syncdb']
+ None: ['runserver 80 --noreload', 'test'],
+ }
+
+ What does this file mean? For each of your projects, you define the
+ different presets for debug arguments that will be used for your main debug
+ file. `None` is used as the default for any Wing projects that are not
+ listed.
+
+ Then you call this `start-debug-with-preset-args` with the `i_preset`
+ argument equal to the preset index number, and debug will start with those
+ arguments.
+ '''
+ assert isinstance(project, wingapi.CAPIProject)
+
+ try:
+ import cute_wing_stuff_local_settings
+ except ImportError:
+ raise Exception('You must have a `cute_wing_stuff_local_settings.py` '
+ 'module for this to work.')
+
+ ### Determining which presets to use: #####################################
+ # #
+ project_filename = os.path.split(project.GetFilename())[1]
+ print (project_filename)
+ if project_filename in \
+ cute_wing_stuff_local_settings.all_debug_argument_presets:
+ print (0)
+ debug_argument_presets = cute_wing_stuff_local_settings. \
+ all_debug_argument_presets[project_filename]
+ else:
+ print (1)
+ debug_argument_presets = cute_wing_stuff_local_settings. \
+ all_debug_argument_presets[None]
+ # #
+ ### Finished determining which presets to use. ############################
+
+ main_debug_file = project.GetMainDebugFile()
+ arguments = debug_argument_presets[i_preset]
+ project.SetRunArguments(main_debug_file, arguments)
+ wingapi.gApplication.ExecuteCommand('debug-kill')
+ wingapi.gApplication.ExecuteCommand('debug-continue')
+

No commit comments for this range

Something went wrong with that request. Please try again.