alright, so here's what I got:

# -*- coding: utf-8 -*-
W = 25
l = [[u'░' for c in range(W)] for r in range(5)]

_Y = 2
for X in range(W):
    Y = _Y+((X&3)-(X&2))-(2*((X&3)==3)) # <-- this could be better
    l[Y][X] = u'█'

for r in l: print ''.join(r)

which generates:

░░░░░░░░░░░░░░░░░░░░░░░░░
░░░█░░░█░░░█░░░█░░░█░░░█░
█░█░█░█░█░█░█░█░█░█░█░█░█
░█░░░█░░░█░░░█░░░█░░░█░░░
░░░░░░░░░░░░░░░░░░░░░░░░░

this is for typos and such for my IDE, like like what spell check does in MS Word

how could I make the pattern generation more efficient??

EDIT: lol, looks like Daniweb doesn't understand unicode characters :P
here's another test using numbers:
0000000000000000000000000
0008000800080008000800080
8080808080808080808080808
0800080008000800080008000
0000000000000000000000000

Recommended Answers

All 4 Replies

looked into something that worked better:
Y = _Y-1+((X&3)^-((X>>1)&1))
not sure if it could be done even better though...

I suggest to prepare a pattern once for all and then to trucate it for a given W

# -*- coding: utf-8 -*-
# first prepare 5 long lines with 100 unicode characters each
dic = {'a': u'\u2591', 'b': u'\u2588'}
data = ['aaaa', 'aaab', 'baba', 'abaa','aaaa']
data = [''.join(dic[x] for x in item) for item in data]
data = [x * 25 for x in data]
for x in data:
    print(x)

# Now for a given length, truncate these lines
W = 30
for r in data:
    print(r[:W])

sounds like a good idea, but I went through a lot of struggle just to get it this far:

            painter.setPen( this.eLineColor )
            for pX in range(x1,x1+x2):
                painter.drawPoint(pX, y1+y2 + ((pX&3)-(pX&2))-(2*((pX&3)==3)))

it calculates the cuttent Y position from the current X position
I just want to get the calculation as efficient as possible
(if performance gets to be an issue, I'll take up your offer)

and yes, I'm using a disgusting QPainter to draw all of these effects because nothing else can get as far as the BG colors (believe me, the best thing I've tried is QScintilla, which is crap for crap)

I've gotten better progress using IDLE's techniques than playing with anything Qt-related.

I can get the autocompletion working on my own and have it be loads better than anything else can provide... blah blah

yes, I F-ing hate Qt for it's content, but it's overall usage is really quite nice. :)

EDIT:
don't worry, I'm not doing anything close to that extremely disgusting QHexEdit widget ;)
I'm only working on the data displayed ;)

I've even improved that QHexEdit widget and rewrote my own:
http://lh3.ggpht.com/-onzArcPdjJA/U46fpc6ra3I/AAAAAAAAGrw/-5RCmghwV2U/s1152/UMC_SIDE_progress_21.PNG

was a pain in the butt to set the focus to only operate on the displayed data, but I got it and it performs MUUUUCH nicer than the original.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.