THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/06/2011 at 08:35, xxxxxxxx wrote:
First of all, please post such huge Code's on services like Pastebin.com.
Then, take a look at your idnentation.
GetMinimumHeight() and InputEven() are intendet a space to much.
Also, it should be called InputEven t.
Please use 4-space indentation. It makes the code much more cleaner and overviewable.
Many editors support replacing automatically with a number of spaces, in Python's case it should be 4.
In InputEvent you wanted to call the container, instead of use __getitem__ .
y = msg(c4d.BFM_INPUT_Y) -> y = msg[c4d.BFM_INPUT_Y]
You donÄt get any text, because the 2nd for-loop after the commend "Draw self.data" is wrong intended.
for i in xrange(len(self.data)) :
if i == self.marked:
self.DrawSetPen(self.colors["markedText"])
for j in xrange(self.data[i].GetLengthOfData()) :
if j >= len(self.columnwidth) :
width = self.columnwidth[-1]
else:
width = self.columnwidth[j]
should be
for i in xrange(len(self.data)) :
if i == self.marked:
self.DrawSetPen(self.colors["markedText"])
for j in xrange(self.data[i].GetLengthOfData()) :
if j >= len(self.columnwidth) :
width = self.columnwidth[-1]
else:
width = self.columnwidth[j]
Next, you don't see any coloured lines,because the drawing-clause is wrong intended.
#Draw lighter areas
self.DrawSetPen(self.colors["lighter"])
for i in xrange(0, len(self.data), 2) :
if i == self.marked:
self.DrawSetPen(self.colors["marked"])
self.DrawRectangle(x1=0, y1 = rHeight*i, x2=x2, y2 = rHeight * (i+1))
if i == self.marked:
self.DrawSetPen(self.colors["lighter"])
should be
#Draw lighter areas
self.DrawSetPen(self.colors["lighter"])
for i in xrange(0, len(self.data), 2) :
if i == self.marked:
self.DrawSetPen(self.colors["marked"])
self.DrawRectangle(x1=0, y1 = rHeight*i, x2=x2, y2 = rHeight * (i+1))
if i == self.marked:
self.DrawSetPen(self.colors["lighter"])
While drawing the Darker areas, you chose a wrong startingvalue within the xrange function.
It should be 1, not 0 like when drawing the lighter areas.
#Draw darker areas
self.DrawSetPen(self.colors["darker"])
for i in xrange(0, len(self.data), 2) :
pass
should be
#Draw darker areas
self.DrawSetPen(self.colors["darker"])
for i in xrange(1, len(self.data), 2) :
Now it should work.
You also messed up the colors.
colors = {
"background": c4d.Vector(.2),
"lighter": c4d.Vector(.6),
"darker": c4d.Vector(.8, .4, .2),
"marked": c4d.Vector(.2),
"text": c4d.Vector(.1),
"markedText": c4d.Vector(.7, .5, .6),
}
should be
colors = {
"background": c4d.Vector(.2),
"lighter": c4d.Vector(.6),
"darker": c4d.Vector(.2),
"marked": c4d.Vector(.8, .4, .2),
"text": c4d.Vector(.1),
"markedText": c4d.Vector(.7, .5, .6),
}
The full working code is here.
cheers