Demo tweaks

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20089 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-04-08 22:58:03 +00:00
parent 9e94c29759
commit 09aceb98d9
4 changed files with 31 additions and 13 deletions

View File

@@ -42,6 +42,8 @@ class RunDemoApp(wxApp):
wxInitAllImageHandlers() wxInitAllImageHandlers()
wxLog_SetActiveTarget(wxLogStderr()) wxLog_SetActiveTarget(wxLogStderr())
#self.SetAssertMode(wxPYAPP_ASSERT_DIALOG)
frame = wxFrame(None, -1, "RunDemo: " + self.name, pos=(50,50), size=(0,0), frame = wxFrame(None, -1, "RunDemo: " + self.name, pos=(50,50), size=(0,0),
style=wxNO_FULL_REPAINT_ON_RESIZE|wxDEFAULT_FRAME_STYLE) style=wxNO_FULL_REPAINT_ON_RESIZE|wxDEFAULT_FRAME_STYLE)
frame.CreateStatusBar() frame.CreateStatusBar()

View File

@@ -2,6 +2,8 @@
from wxPython.wx import * from wxPython.wx import *
from wxPython.stc import * from wxPython.stc import *
import images
#---------------------------------------------------------------------- #----------------------------------------------------------------------
debug = 1 debug = 1
@@ -212,7 +214,8 @@ def runTest(frame, nb, log):
# setup some markers # setup some markers
ed.SetMarginType(1, wxSTC_MARGIN_SYMBOL) ed.SetMarginType(1, wxSTC_MARGIN_SYMBOL)
ed.MarkerDefine(0, wxSTC_MARK_ROUNDRECT, "#CCFF00", "RED") ed.MarkerDefine(0, wxSTC_MARK_ROUNDRECT, "#CCFF00", "RED")
ed.MarkerDefine(1, wxSTC_MARK_CIRCLE, "FOREST GREEN", "SIENNA") #ed.MarkerDefine(1, wxSTC_MARK_CIRCLE, "FOREST GREEN", "SIENNA")
ed.MarkerDefineBitmap(1, images.getFolder1Bitmap())
ed.MarkerDefine(2, wxSTC_MARK_SHORTARROW, "blue", "blue") ed.MarkerDefine(2, wxSTC_MARK_SHORTARROW, "blue", "blue")
ed.MarkerDefine(3, wxSTC_MARK_ARROW, "#00FF00", "#00FF00") ed.MarkerDefine(3, wxSTC_MARK_ARROW, "#00FF00", "#00FF00")

View File

@@ -1,7 +1,7 @@
from wxPython.wx import * from wxPython.wx import *
from wxPython.stc import * from wxPython.stc import *
import images
import keyword import keyword
#---------------------------------------------------------------------- #----------------------------------------------------------------------
@@ -52,7 +52,7 @@ class PythonSTC(wxStyledTextCtrl):
self.SetMargins(0,0) self.SetMargins(0,0)
self.SetViewWhiteSpace(False) self.SetViewWhiteSpace(False)
#self.SetBufferedDraw(False) ##self.SetBufferedDraw(False)
self.SetEdgeMode(wxSTC_EDGE_BACKGROUND) self.SetEdgeMode(wxSTC_EDGE_BACKGROUND)
self.SetEdgeColumn(78) self.SetEdgeColumn(78)
@@ -85,6 +85,7 @@ class PythonSTC(wxStyledTextCtrl):
EVT_STC_UPDATEUI(self, ID, self.OnUpdateUI) EVT_STC_UPDATEUI(self, ID, self.OnUpdateUI)
EVT_STC_MARGINCLICK(self, ID, self.OnMarginClick) EVT_STC_MARGINCLICK(self, ID, self.OnMarginClick)
EVT_KEY_DOWN(self, self.OnKeyPressed)
# Make some styles, The lexer defines what each style is used for, we # Make some styles, The lexer defines what each style is used for, we
@@ -130,10 +131,15 @@ class PythonSTC(wxStyledTextCtrl):
# End of line where string is not closed # End of line where string is not closed
self.StyleSetSpec(wxSTC_P_STRINGEOL, "fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d" % faces) self.StyleSetSpec(wxSTC_P_STRINGEOL, "fore:#000000,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d" % faces)
self.SetCaretForeground("BLUE") self.SetCaretForeground("BLUE")
EVT_KEY_DOWN(self, self.OnKeyPressed)
# register some images for use in the AutoComplete box.
self.RegisterImage(1, images.getSmilesBitmap())
self.RegisterImage(2, images.getFile1Bitmap())
self.RegisterImage(3, images.getCopyBitmap())
def OnKeyPressed(self, event): def OnKeyPressed(self, event):
@@ -145,7 +151,9 @@ class PythonSTC(wxStyledTextCtrl):
# Tips # Tips
if event.ShiftDown(): if event.ShiftDown():
self.CallTipSetBackground("yellow") self.CallTipSetBackground("yellow")
self.CallTipShow(pos, 'param1, param2') self.CallTipShow(pos, 'lots of of text: blah, blah, blah\n\n'
'show some suff, maybe parameters..\n\n'
'fubar(param1, param2)')
# Code completion # Code completion
else: else:
#lst = [] #lst = []
@@ -156,17 +164,22 @@ class PythonSTC(wxStyledTextCtrl):
#self.AutoCompShow(0, st) #self.AutoCompShow(0, st)
kw = keyword.kwlist[:] kw = keyword.kwlist[:]
kw.append("zzzzzz") kw.append("zzzzzz?2")
kw.append("aaaaa") kw.append("aaaaa?2")
kw.append("__init__") kw.append("__init__?3")
kw.append("zzaaaaa") kw.append("zzaaaaa?2")
kw.append("zzbaaaa") kw.append("zzbaaaa?2")
kw.append("this_is_a_longer_value") kw.append("this_is_a_longer_value")
kw.append("this_is_a_much_much_much_much_much_much_much_longer_value") #kw.append("this_is_a_much_much_much_much_much_much_much_longer_value")
kw.sort() # Python sorts are case sensitive kw.sort() # Python sorts are case sensitive
self.AutoCompSetIgnoreCase(False) # so this needs to match self.AutoCompSetIgnoreCase(False) # so this needs to match
# Images are specified with a appended "?type"
for i in range(len(kw)):
if kw[i] in keyword.kwlist:
kw[i] = kw[i] + "?1"
self.AutoCompShow(0, " ".join(kw)) self.AutoCompShow(0, " ".join(kw))
else: else:
event.Skip() event.Skip()

View File

@@ -11,7 +11,7 @@ resourceText = r'''<?xml version="1.0"?>
<object class="MyBluePanel" name="MyPanel"> <object class="MyBluePanel" name="MyPanel">
<size>200,100</size> <size>200,100</size>
<object class="wxStaticText" name="lable1" subclass="wxPython.wx.wxPreStaticText"> <object class="wxStaticText" name="label1" subclass="wxPython.wx.wxPreStaticText">
<label>This blue panel is a class derived from wxPanel,\nand is loaded by a custom wxXmlResourceHandler.</label> <label>This blue panel is a class derived from wxPanel,\nand is loaded by a custom wxXmlResourceHandler.</label>
<pos>10,10</pos> <pos>10,10</pos>
</object> </object>