Skip to content

Commit 4ad0de3

Browse files
committed
Previous uncommitted change: rename processing_ref_lookup because of conflict with processing mode.
Change keybind to "ctrl+shift+[" because of conflict with processing mode. Updates for new build system. Revert to default "ctrl+b" for "build" command. Remove unneeded keybinds for build alts.
1 parent bfaf440 commit 4ad0de3

File tree

4 files changed

+120
-138
lines changed

4 files changed

+120
-138
lines changed

Default (OSX).sublime-keymap

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
[
22
{
3-
"keys": ["ctrl+shift+]"], "command": "processing_ref_lookup"
3+
"keys": ["ctrl+shift+]"], "command": "processing_py_ref_lookup"
44
},
55
{
6-
"keys": ["super+enter"], "command": "build",
7-
"args": {"variant": "OSX Run"}
8-
},
9-
{
10-
"keys": ["super+alt+enter"], "command": "build",
11-
"args": {"variant": "OSX Open with Processing"}
6+
"keys": ["ctrl+alt+shift+b"], "command": "show_overlay",
7+
"args": {"overlay": "command_palette", "text": "Build With: processing"}
128
}
139
]

Default (Windows).sublime-keymap

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
[
22
{
3-
"keys": ["ctrl+shift+]"], "command": "processing_ref_lookup"
3+
"keys": ["ctrl+shift+["], "command": "processing_py_ref_lookup"
44
},
55
{
6-
"keys": ["ctrl+enter"], "command": "build"
7-
},
8-
{
9-
"keys": ["ctrl+alt+enter"], "command": "build",
10-
"args": {"variant": "Open with Processing"}
6+
"keys": ["ctrl+alt+shift+b"], "command": "show_overlay",
7+
"args": {"overlay": "command_palette", "text": "Build With: processing"}
118
}
129
]

processing-py_ref_lookup.py

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
'''
2+
Processing.py reference lookup for Sublimetext 3
3+
4+
Based on "chuck_doc_search.py" by
5+
Dealga McArdle (https://github.com/zeffii), 2013
6+
functionality: Opens webbrowser at Processing.py reference for the
7+
highlighted keyword, if the keyword is valid.
8+
Processing.py reference: http://py.processing.org/reference
9+
10+
- Place this .py inside "Data/Packages/User"
11+
- Add a shortcut to your user keymap file, e.g.;
12+
{ "keys": ["ctrl+shift+]"], "command": "processing_ref_lookup" }
13+
- To use, make a selection of for examples "ADSR", then press your shortcut
14+
key(s).
15+
16+
'''
17+
18+
import sublime
19+
import sublime_plugin
20+
import webbrowser
21+
22+
keywords = ['abs', 'acos', 'alpha', 'ambient', 'ambientLight',
23+
'applyMatrix', 'arc', 'asin', 'atan2', 'atan', 'background',
24+
'beginCamera', 'beginContour', 'beginRaw', 'beginRecord',
25+
'beginShape', 'bezier', 'bezierDetail', 'bezierPoint',
26+
'bezierTangent', 'bezierVertex', 'binary', 'blend', 'blendMode',
27+
'blue', 'Boolean', 'box', 'break', 'brightness', 'BufferedReader',
28+
'camera', 'catch', 'ceil', 'class', 'clear', 'color', 'colorMode',
29+
'concat', 'constrain', 'continue', 'copy', 'cos', 'createFont',
30+
'createGraphics', 'createImage', 'createInput', 'createOutput',
31+
'createReader', 'createShape', 'createWriter', 'cursor', 'curve',
32+
'curveDetail', 'curvePoint', 'curveTangent', 'curveTightness',
33+
'curveVertex', 'day', 'degrees', 'directionalLight',
34+
'displayHeight', 'displayWidth', 'dist', 'draw', 'ellipse',
35+
'ellipseMode', 'else', 'emissive', 'endCamera', 'endContour',
36+
'endRaw', 'endRecord', 'endShape', 'exit', 'exp', 'False', 'fill',
37+
'filter', 'float', 'floatconvert', 'floor', 'focused', 'for',
38+
'frameCount', 'frameRate', 'frameRate_var', 'frustum', 'get',
39+
'green', 'HALF_PI', 'HashMap', 'height', 'hex', 'hour', 'hue',
40+
'if', 'image', 'imageMode', 'int', 'int_convert', 'join',
41+
'JSONArray', 'JSONObject', 'key', 'keyCode', 'keyPressed_var',
42+
'keyPressed', 'keyReleased', 'keyTyped', 'lerp', 'lerpColor',
43+
'lightFalloff', 'lights', 'lightSpecular', 'line', 'loadBytes',
44+
'loadFont', 'loadImage', 'loadJSONArray', 'loadJSONObject',
45+
'loadPixels', 'loadShader', 'loadShape', 'loadStrings',
46+
'loadTable', 'loadXML', 'log', 'loop', 'mag', 'map', 'match',
47+
'matchAll', 'max', 'millis', 'min', 'minute', 'modelX', 'modelY',
48+
'modelZ', 'month', 'mouseButton', 'mouseClicked', 'mouseDragged',
49+
'mouseMoved', 'mousePressed', 'mousePressed_var', 'mouseReleased',
50+
'mouseWheel', 'mouseX', 'mouseY', 'new', 'nf', 'nfc', 'nfp',
51+
'nfs', 'noCursor', 'noFill', 'noise', 'noiseDetail', 'noiseSeed',
52+
'noLights', 'noLoop', 'norm', 'normal', 'noSmooth', 'noStroke',
53+
'noTint', 'Object', 'ortho', 'parseXML', 'perspective', 'PFont',
54+
'PGraphics', 'PI', 'PImage', 'pixels', 'pmouseX', 'pmouseY',
55+
'point', 'pointLight', 'popMatrix', 'popStyle', 'pow', 'print',
56+
'printArray', 'printCamera', 'println', 'printMatrix',
57+
'printProjection', 'PrintWriter', 'PShader', 'PShape',
58+
'pushMatrix', 'pushStyle', 'PVector', 'quad', 'quadraticVertex',
59+
'QUARTER_PI', 'radians', 'random', 'randomGaussian', 'randomSeed',
60+
'rect', 'rectMode', 'red', 'redraw', 'requestImage',
61+
'resetMatrix', 'resetShader', 'return', 'reverse', 'rotate',
62+
'rotateX', 'rotateY', 'rotateZ', 'round', 'saturation', 'save',
63+
'saveBytes', 'saveFrame', 'saveJSONArray', 'saveJSONObject',
64+
'saveStream', 'saveStrings', 'saveTable', 'saveXML', 'scale',
65+
'screenX', 'screenY', 'screenZ', 'second', 'selectFolder',
66+
'selectInput', 'selectOutput', 'set', 'setup', 'shader', 'shape',
67+
'shapeMode', 'shearX', 'shearY', 'shininess', 'shorten', 'sin',
68+
'size', 'smooth', 'list_sort', 'specular', 'sphere',
69+
'sphereDetail', 'splice', 'split', 'splitTokens', 'spotLight',
70+
'sq', 'sqrt', 'static', 'strconvert', 'string', 'stroke',
71+
'strokeCap', 'strokeJoin', 'strokeWeight', 'super', 'tan', 'TAU',
72+
'text', 'textAlign', 'textAscent', 'textDescent', 'textFont',
73+
'textLeading', 'textMode', 'textSize', 'texture', 'textureMode',
74+
'textureWrap', 'textWidth', 'tint', 'translate', 'triangle',
75+
'True', 'TWO_PI', 'unbinary', 'unhex', 'updatePixels', 'vertex',
76+
'while', 'width', 'XML', 'year']
77+
78+
site = 'http://py.processing.org/reference/'
79+
80+
81+
def findDoc(target):
82+
83+
for keyword in keywords:
84+
if target == keyword:
85+
webbrowser.open(site + keyword + '.html')
86+
return
87+
# Methods in our keyword list have an underscore appended, because,
88+
# on the Processing website, e.g. 'constrain' is 'constrain'.
89+
elif target == keyword[0:-1]:
90+
webbrowser.open(site + keyword + '.html')
91+
return
92+
93+
94+
class ProcessingPyRefLookup(sublime_plugin.TextCommand):
95+
def run(self, edit):
96+
if not self.enabled():
97+
tmsg = 'Please select a keyword'
98+
sublime.status_message(tmsg)
99+
return
100+
101+
view = self.view
102+
sel = view.sel()[0]
103+
target = view.substr(sel)
104+
findDoc(target)
105+
106+
def enabled(self):
107+
'''only allow 1 selection for version 0.1'''
108+
109+
sels = self.view.sel() # lists regions,
110+
nsels = len(sels) # dir(sels[0]) for methods
111+
fsel = sels[0] # first selection
112+
113+
if nsels == 1 and not fsel.empty():
114+
return True

processing_ref_lookup.py

Lines changed: 0 additions & 125 deletions
This file was deleted.

0 commit comments

Comments
 (0)