forked from leaflabs/maple-ide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
189 lines (143 loc) · 7.97 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
NOTES 4 Dr3wSh4p!!!!!!!!
========================
Right now a lot of system settings are just stubbed out, and I've only
run it on OS X 10.6.4, but it'll probably work on Linux. Windows is
getting put off until we can use it on UNIX-y OSes.
REQUIREMENTS
------------
You'll need to install wxPython to get started:
http://www.wxpython.org/
You also need the Unix toolchain:
http://leaflabs.com/docs/libmaple/unix-toolchain/
(We'll bundle all this stuff up nice when we're done getting it working)
STRUCTURE
---------
- resources/: this is where i'm putting any data resources the app
depends on. right now it contains:
examples/: these are just the regular examples from the
existing IDE
reference/: maple ref docs, stolen from existing
buttons.png: a (quick/dirty) file containing the main toolbar
buttons
- todo.txt: a bunch of things that need to get done that i don't have
time for just yet. their descriptions are just shorthand that are
probably confusing if you're not me. if any of them looks like
something you might want to do, but you're not clear exactly what i
mean, ask and i'll explain better.
there are also a bunch of TODO and FIXME comments throughout the
source code, which lives in
- src:/ i was going to use model/view/controller but it seemed like
overkill, so it's pretty much a (model+controller)/view setup.
please don't violate this abstraction.
what i would say you should do is read this document and browse the
source until you feel like you understand what's going on, then look
at todo.txt and grep for TODO/FIXME until you find something you
want to do, do it, rinserepeat.
**********************************************************************
DO NOT PUT any literal tab characters or trailing whitespace in any
code you push. i will remove them, and then yell at you (actually,
my emacs is set up to automatically remove them, but i'll yell at
you all on my own). yes, i am serious. for help see:
http://www.gnu.org/software/emacs/emacs-lisp-intro/html_node/Indent-Tabs-Mode.html
http://www.gnu.org/software/emacs/manual/html_node/emacs/Useless-Whitespace.html
**********************************************************************
settings.py: YOU MUST EDIT THIS FILE BEFORE RUNNING THE CODE. go
look at it now. this stores where various things are
in the system (where to find "make", where the user's
sketches are, where the resources are, etc.).
hopefully this goes without saying, but as you make
changes, NOTHING external to the source directory
should be hardcoded in; make a setting for it and refer
to the settings module instead.
MapleIDE: this is the main entry point to the program. fix up your
settings.py, then just run it like
$ cd src/
$ ./MapleIDE
hurray! right now you can do the usual open/edit/save stuff. you
can also compile and upload to Maple, provided that you write C++
sketches, instead of the simplified language of the IDE. i'm
working on preprocessing now.
any feature that isn't implemented will popup a window saying it's
not done when you try to use it.
okay, so now you want to know how the rest of it works? well...
[view]
CPPStyledTextCtrl.py: wx.stc.StyledTextCtrl is a text box that we
use to handle parsing C++ and doing syntax
highlighting. this class is a pretty minimal
subclass to enable the basic functionality.
i wouldn't recommend reading too deeply into
this just yet; just take a look at how it's
set up. StyledTextCtrl is a big hairy
machine.
but if you must, the best docs for it are here
(a little old, they refer to a time when the
`wx' module was called `wxPython'):
http://www.yellowbrain.com/stc/index.html
[model+controller]
Sketch.py: this models the sketch itself -- it knows where all the
files are, what's in them, etc. this gets out of sync as
you edit text, but gets re-synced up when you save.
so remember when i said that model and controller got
mashed together? yeah, well, besides modelling the
sketch, Sketch objects know how to save(), compile(), and
upload() themselves.
when a Sketch is constructed, it gets handed an object
that is its user interface. there's an interface down
(in ui.py) for how this object is supposed to behave.
Sketch objects communicate the results of the operations
(compiling, saving, etc.) performed upon them through the
use of these callback methods. more details on this...
[view]
SketchFrame.py: the class BetterAuiNotebook is just a convenience
wrapper around wx.aui.AuiNotebook, which implements
a tabbed view of the source windows (which, for us,
are CPPStyledTextCtrl objects). ignore for now.
the real meat is in the SketchFrame class. each IDE
window with the toolbar buttons you can click to
verify/compile etc. is one of these objects. these
implement the UserInterface interface. (which of
course exists so there's not a dependency of the
modelcontroller on the view).
(in wx, a "frame" is like an emacs frame -- a
cohesive, on-screen window you can drag, minimize,
etc. a "window" is like an emacs window -- some UI
widget that takes up real estate on a frame.)
wx is event-driven. if you don't know what this
means, go read this:
http://en.wikipedia.org/wiki/Event-driven_programming
i'm not going to go into too many details here,
because if you understand event-driven programming,
i think that the SketchFrame source itself is
well-written and -commented enough to be its own
best documentation. feel free to bug me with any
particular questions, though.
what's left?
[model+controller]
sketchbook.py: this is where functions that operate on the user's
sketch directory live. it's also got a mechanism for
generating fresh sketches that we use in
SketchFrame.py when you ask for a new sketch --
basically, we keep a set called _unsaved_sketches,
and when you ask for a new sketch, it makes up a file
name that
1. you haven't already used in your sketchbook
2. you haven't already used as a new sketch
previously during this session.
and makes a Sketch object for it without saving it on
disk yet. the end result acts exactly like it does in
Arduino. when a SketchFrame saves its Sketch, it
lets the sketchbook know, so it can remove
it from the set of unsaved sketches.
right now, i'm not allowing Sketch to know that
sketchbook exists, as that would be a circular
dependency i don't have a compelling reason to allow.
so try not to import sketchbook within Sketch.py
unless it's really stupid not to.
and finally
[model+controller]
examplebook.py: like sketchbook, except with the pre-made examples.
[view]
wx_util.py: convenience functions for making popups. anything
general enough that more than one GUI class wants to use
it should get put here.
OKGO