Hi,
i found an error when trying to load files into wxStyledTextCtrl which have single long lines (up to 1000/2000 chars)
i use simply:
f = open("file.txt","r")
text = f.read()
f.close()
stc.SetText(text)
for all others file it works, but for those files with long lines of chars it causes me to crash the application.
There's a workaround for this issue?
Alessandro Crugnola
Robin
July 28, 2003, 8:30pm
2
Alessandro Crugnola *sephiroth* wrote:
Hi,
i found an error when trying to load files into wxStyledTextCtrl which have single long lines (up to 1000/2000 chars)
i use simply:
f = open("file.txt","r")
text = f.read()
f.close()
stc.SetText(text)
for all others file it works, but for those files with long lines of chars it causes me to crash the application.
There's a workaround for this issue?
It doesn't happen to me. Please send more details or a sample.
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
I use this to add the text to a new opened page in the wxNotebook:
# -------------------------------
# LOAD A FILE
# -------------------------------
def LoadFile(self, filename, *arg):
try:
wxBeginBusyCursor()
try:
f = open(filename, "r")
text = f.read()
f.close()
ext = os.path.splitext(filename)[1]
if arg[0] == 1:
self.GetTextCtrl().ReplaceSelection(text)
else:
self.OnNewDocument(None, filename, text) # WITH THIS I ADD THE TEXT
self.filehistory.AddFileToHistory(filename)
except:
wxMessageDialog(self, '%s:\n%s\n%s' % sys.exc_info(), 'error', wxOK | wxICON_ERROR ).ShowModal()
finally:
wxEndBusyCursor()
and in the editor file:
self.SetText(text)
I send you also the content of the that crashes the application (note that all the text is on a simgle line)
kwlist = "static public private String Array Object Void Null Sound XML XMLSocket Number interface extends implements add and
asfunction break call case chr clearInterval continue default delete do duplicateMovieClip else else eq escape eval evaluate false
for fscommand function ge getProperty getTimer getURL getVersion globalStyleFormat gotoAndPlay gotoAndStop gt if if ifelse
ifFrameLoaded in int isFinite isNaN le length load loadMovie loadMovieNum loadVariables loadVariablesNum lt mbchr mblength mbord
mbsubstring method ne new newline nextFrame nextScene not null on onClipEvent or ord parseFloat parseInt play Play prevFrame
prevScene print printAsBitmap printAsBitmapNum printNum random removeMovieClip return set setInterval setProperty startDrag stop
Stop stopAllSounds stopDrag substring super switch targetPath tellTarget this toggleHighQuality trace true typeof undefined unescape
unloadMovie unloadMovieNum updateAfterEvent var void while with"
mtdlist = "abs acceptConnection acos activityLevel addHeader addItem addItem additemAt addItemAt addListener addListener addlistener
addListener addListener addlistener addProperty agent align align allowDomain appendChild apply apply applyChanges arrow asin atan
atan2 attachAudio attachMovie attachSound attachVideo attributes autoSize background background backgroundColor backgroundDisabled
BACKSPACE bandwith beginFill beginGradientFill blockIndent bold border borderColor bottomScroll bufferLength bufferTime bullet call
call callee caller capabilities CAPSLOCK ceil charAt charCodeAt check childNodes clear clearSharedObjects clearStreams clients
cloneNode close color concat concat connect contentType CONTROL cos createElementcreateTextNode createEmptyMovieClip createTextField
currentFps curveTo darkshadow data deblocking DELETEKEY disconnect docTypeDecl domain DOWN duplicateMovieClip duration E embedFonts
enabled enabled END endFill ENTER ESCAPE exp face firstChild floor flush focusEnabled font foregroundDisabled fps fromCharCode gain
get getAscii getBandwitdthLimit getBeginIndex getBounds getBytesLoaded getBytesloaded getBytesLoaded getBytesLoaded getBytesTotal
getBytesTotal getBytesTotal getbytesTotal getCaretIndex getCode getDate getDay getDepth getDepth getDepth getEnabled getEnabled
getEnabled getEndIndex getFocus getFontList getFullYear getHours getItemAt getItemAt getLabel getLength getLength getLocal
getMilliseconds getMinutes getMonth getNewTextFormat getPan getPaneHeight getPaneWidth getProperty getPropertyNames getRemote getRGB
getRowCount getRowCount getScrollContent getScrollPosition getScrollPosition getScrollPosition getSeconds getSelectedIndex
getSelectedIndex getSelectedIndices getSelectedItem getSelectedItem getSelectedItems getSelectMultiple getSize getState
getTextExtent getTextExtent getTextFormat getTime getTimezoneOffset getTransform getTransform getURL getUTCDate getUTCDay
getUTCFullYear getUTCHours getUTCMilliseconds getUTCMinutes getUTCMonth getUTCSeconds getValue getValue getValue getVolume getYear
globalToLocal gotoAndPlay gotoAndStop handlerName hasAccessibility hasAudio hasAudioEncoder hasChildNodes hasMP3 hasVideoEncoder
height hide highlight highlight3D hitAera hitTest HOME hscroll html htmlText ignoreWhite indent index indexOf INSERT insertBefore
install ip isConnected isDown isToggled italic join keyFrameInterval language lastChild lastIndexOf leading LEFT leftmargin length
length length lineStyle lineTo list LN10 LN2 load load loaded loaded loadMovie loadScrollContent loadSound loadVariables
localToGlobal lock log LOG10E LOG2E loopback manufacturer max maxChars maxhscroll MAX_VALUE min MIN_VALUE motionLevel motionTimeOut
moveTo multiline muted name names NaN NEGATIVE_INFINITY nextFrame nextSibling nodeNamenodeType nodeValue onActivity onAppStart
onAppStop onChanged onClose onConnect onData onData onData onDragOut onDragOut onDragOver onDragOver onEnterFrame onKeyDown
onKeyDown onKeyDown onKeyUp onKeyUp onKeyUp onKillFocus onKillFocus onKillFocus onLoad onLoad onLoad onLoad onMousedown onMouseDown
onMouseMove onMouseMove onMouseUp onMouseUp onPress onPress onRelease onRelease onReleaseOutside onReleaseOutside onResize onRollOut
onRollOut onRollOver onRollOver onScroller onSetFocus onSetFocus onSetFocus onSetFocus onSoundComplete onStatus onStatus onSync
onUnload onXML os parentNode parseXML password PGDN PGUP PI pixelAspectRatio play pop position POSITIVE_INFINITY pow prevFrame
previousSibling prototype publish purge push quality radioDot random rate readAccess receiveAudio receiveVideo record referrer
refreshPane registerClass registerProxy registerSkinElement registerSkinElement registerSkinElement rejectConnection removeAll
removeAll removeItemAt removeItemAt removeListener removeListener removeListener removelistener removeListener removeListener
removeMovieClip removeNode removeTextField replaceItamAt replaceItemAt replaceSel restrict resyncDepth reverse RIGHT rightMargin
round scaleMode screencolor screenDPI screenResolutionX screenResolutionY scroll scrollTrack seek selectable selection
selectionDisabled selectionUnfocused send send sendAndLoad sendsendAndLoad server setAutoHideScrollBar setBandwidthLimit
setBufferTime setChangeHandler setChangeHandler setChangeHandler setClickHandler setData setDataProvider setDataProvider setDate
setDragContent setEditable setEnabled setEnabled setEnabled setFocus setFullYear setGain setgroupName setHorizontal setHours
setHScroll setItemSymbol setItemSymbol setKeyFrameInterval setLabel setLabelPlacement setLargeScroll setLoopback setMask
setMilliseconds setMinutes setMode setMonth setMotionLevel setNewTextFormat setPan setProperty setQuality setRGB setRowCount
setRowCount setScrollContent setScrollPosition setScrollPosition setScrollProperties setScrollTarget setSeconds setSelectedIndex
setSelectedIndex setSelectedIndices setSelection setSelectmultiple setSilenceLevel setSize setSize setSize setSmallScroll setState
setStyleProperty setStyleProperty setStyleProperty setTextFormat setTime setTransform setTransform setUseEchoSuppression setUTCDate
setUTCFullYear setUTCHours setUTCMilliseconds setUTCMinutes setUTCMonth setUTCSeconds setValue setValue setVolume setVScroll
setwidth setYear shadow SHIFT shift show showMenu silenceLevel silenceTimeout sin size slice slice smoothing sort sortItemBy
sortItemBy sortOn SPACE splice split sqrt SQRT1_2 SQRT2 start startDrag status stop stop stopDrag substr substring swapDepths TAB
tabChildren tabEnabled tabEnabled tabEnabled tabIndex tabIndex tabStops tan target text textAlign textBold textColor textColor
textDisabled textFont textheight textIndent textitalic textLeftMargin textRightMargin textSelected textSize textUnderline textWidth
time toLowerCase toString toString toString toString toString toUpperCase trackAsMenu trackAsMenu type underline uninstall
unloadMovie unlock unshift unwatch UP uri url useEchoSuppression useHandCursor useHandCursor UTC valueOf variable version watch
width wordWrap writeAccess x xmlDecl y _alpha _alpha _currentframe _currentframe _droptarget _droptarget _focusrect _focusrect
_framesloaded _framesloaded _global _height _height _highquality _highquality _name _name _parent _parent _quality _quality _root
_rotation _rotation _soundbuftime _soundbuftime _target _target _totalframes _totalframes _url _url _visible _visible _width _width
_x _x _xmouse _xmouse _xscale _xscale _y _y _ymouse _ymouse _yscale _yscale __proto__ __resolve"
Robin
July 28, 2003, 11:47pm
4
Alessandro Crugnola *sephiroth* wrote:
I use this to add the text to a new opened page in the wxNotebook:
Sorry, I still can't duplicate the problem. What is the platform and version?
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Sorry, I still can't duplicate the problem. What is the platform and
version?
WinXP HOME and PRO
both with python 2.2.3 and 2.3rc2
the same problem happens when copy those text and try to paste into a blank notebook page
p.s. in the notebook widget i'm using wxStyledTextCtrl Text editor..
Alessandro Crugnola [sephiroth]
Flash | PHP Developer
> Sorry, I still can't duplicate the problem. What is the platform and
> version?
Hello again,
I discovered that it crashes only when i load that file using SetWrapMode(wxSTC_WRAP_WORD)
it's a wxStyledTextCtrl bug with this?
Alessandro Crugnola [sephiroth]
Flash | PHP Developer
Robin
July 30, 2003, 8:40pm
7
Alessandro Crugnola *sephiroth* wrote:
Sorry, I still can't duplicate the problem. What is the platform and
version?
Hello again,
I discovered that it crashes only when i load that file using SetWrapMode(wxSTC_WRAP_WORD)
it's a wxStyledTextCtrl bug with this?
Probably (in Scintilla actually,) but I still can't duplicate it with the current release, and you still havn't told me which version of wxPython you are using.
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
Probably (in Scintilla actually,) but I still can't duplicate it with
the current release, and you still havn't told me which version of
wxPython you are using.
I'm using the latest (unicode) version with python 2.3 ( wxPythonWIN32-2.4.1.2u-Py23 )
Alessandro Crugnola [sephiroth]
Flash | PHP Developer
Team Macromedia Volunteer for Flash
http://www.macromedia.com/go/team
Flash-php mailing list
http://www.flash-php.it/index.php?ml=fpcoders&action=subscribe
Robin
August 1, 2003, 12:34am
9
Alessandro Crugnola *sephiroth* wrote:
Probably (in Scintilla actually,) but I still can't duplicate it with
the current release, and you still havn't told me which version of
wxPython you are using.
I'm using the latest (unicode) version with python 2.3 ( wxPythonWIN32-2.4.1.2u-Py23 )
Okay, I'll see if I can figure it out.
···
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!