rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
'''
"""
def debug(msg): if DEBUG: print msg
"""
'''
def PickActor(self,x,y): if self._CurrentRenderer: renderer = self._CurrentRenderer picker = self._Picker
if et == wx.EVT_COMMAND_FIND_REPLACE or et == wx.EVT_COMMAND_FIND_REPLACE_ALL:
if et in [wx.wxEVT_COMMAND_FIND_REPLACE, wx.wxEVT_COMMAND_FIND_REPLACE_ALL]:
def OnFind(self, evt): map = { wx.wxEVT_COMMAND_FIND : "FIND", wx.wxEVT_COMMAND_FIND_NEXT : "FIND_NEXT", wx.wxEVT_COMMAND_FIND_REPLACE : "REPLACE", wx.wxEVT_COMMAND_FIND_REPLACE_ALL : "REPLACE_ALL", }
rootObject=shellWin.interp.locals
rootObject=shellWin.interp.locals, rootIsNamespace=1
def runTest(frame, nb, log): win = wxSplitterWindow(nb, -1, size=(640, 480)) shellWin = shell.Shell(win, -1, introText=intro) fillingWin = filling.Filling(win, -1, size=(640, 480), rootObject=shellWin.interp.locals ) win.SplitHorizontally(shellWin, fillingWin) return win
%s
#ifdef __WXMSW__
"""); for i in table: ican = '"%s"' % i[1] if ican == '"-"': ican = '""' ilang = i[2] if ilang == '-': ilang = '0' isublang = i[3] if isublang == '-': isublang = '0' f.write(' LNG(%-38s %-7s, %-15s, %-34s, %s)\n' % \ ((i[0]+','), ican, ilang, isublang, i[4]))
#ifdef __WXMSW__
f.write("""};
%s };
#ifdef __WXMSW__
""")
""" % (ifdefs, lngtable))
#undef LNG
print 'wxpTagHandler'
def __init__(self): print 'wxpTagHandler' wxHtmlWinTagHandler.__init__(self) self.ctx = None
print 'wxpTagHandler.GetSupportedTags'
def GetSupportedTags(self): print 'wxpTagHandler.GetSupportedTags' return WXPTAG+','+PARAMTAG
print 'wxpTagHandler.HandleTag'
def HandleTag(self, tag): print 'wxpTagHandler.HandleTag' name = tag.GetName() if name == WXPTAG: return self.HandleWxpTag(tag) elif name == PARAMTAG: return self.HandleParamTag(tag) else: raise ValueError, 'unknown tag: ' + name
self._setCallbackInfo(self, wxFontEnumerator)
self._setCallbackInfo(self, wxFontEnumerator, 0)
def __init__(self,*_args,**_kwargs): self.this = apply(misc2c.new_wxFontEnumerator,_args,_kwargs) self.thisown = 1 self._setCallbackInfo(self, wxFontEnumerator)
self.grid_color = 'BLACK' self.back_color = 'WHITE' self.sel_color = 'RED' self.high_color = 'LIGHT BLUE' self.border_color = 'BLACK' self.week_color = 'LIGHT GREY' self.week_font_color = 'BLACK' self.day_font_color = 'BLACK'
self.colors = DefaultColors()
def DefParms(self): self.num_auto = True # auto scale of the cal number day size self.num_size = 12 # default size of calendar if no auto size self.max_num_size = 12 # maximum size for calendar number
def SetWeekColor(self, font_color, week_color): self.week_font_color = font_color self.week_color = week_color
def SetWeekColor(self, font_color, week_color): self.colors[COLOR_HEADER_FONT] = MakeColor(font_color) self.colors[COLOR_HEADER_BACKGROUND] = MakeColor(week_color) self.colors[COLOR_3D_LIGHT] = MakeColor(week_color) self.colors[COLOR_3D_DARK] = MakeColor(week_color)
def SetWeekColor(self, font_color, week_color): # set font and background color for week title self.week_font_color = font_color self.week_color = week_color
self.set_y_mrg = 15 self.set_x_mrg = 10 self.set_y_end = 10
self.set_y_mrg = 1 self.set_x_mrg = 1 self.set_y_end = 1
def InitValues(self): # default dimensions of various elements of the calendar self.rg = {} self.cal_sel = {} self.set_cy_st = 0 # start position self.set_cx_st = 0
self.set_x_st = xmarg self.set_y_st = ymarg
self.set_x_mrg = xmarg self.set_y_mrg = ymarg
def SetMarg(self, xmarg, ymarg): self.set_x_st = xmarg self.set_y_st = ymarg self.set_y_end = ymarg
self.DC = DC
def DrawCal(self, DC, sel_lst=[]): self.DC = DC self.InitScale()
self.DrawBorder()
self.DrawBorder(DC)
def DrawCal(self, DC, sel_lst=[]): self.DC = DC self.InitScale()
self.DrawMonth()
self.DrawMonth(DC)
def DrawCal(self, DC, sel_lst=[]): self.DC = DC self.InitScale()
self.DrawGrid()
self.DrawGrid(DC)
def DrawCal(self, DC, sel_lst=[]): self.DC = DC self.InitScale()
self.DrawSel() self.DrawWeek() self.DrawNum()
self.DrawSel(DC) self.DrawWeek(DC) self.DrawNum(DC)
def DrawCal(self, DC, sel_lst=[]): self.DC = DC self.InitScale()
cfont = self.sel_color
cfont = self.colors[COLOR_SELECTION_FONT]
def AddSelect(self, list, cfont=None, cbackgrd = None): if cfont is None: cfont = self.sel_color # font digit color
cbackgrd = self.high_color
cbackgrd = self.colors[COLOR_SELECTION_BACKGROUND]
def AddSelect(self, list, cfont=None, cbackgrd = None): if cfont is None: cfont = self.sel_color # font digit color
def DrawBorder(self): brush = wx.Brush(wx.NamedColour(self.back_color), wx.SOLID) self.DC.SetBrush(brush) self.DC.SetPen(wx.Pen(wx.NamedColour(self.border_color), 1))
def DrawBorder(self, DC): brush = wx.Brush(MakeColor(self.colors[COLOR_BACKGROUND]), wx.SOLID) DC.SetBrush(brush) DC.SetPen(wx.Pen(MakeColor(self.colors[COLOR_BORDER]), 1))
def DrawBorder(self): brush = wx.Brush(wx.NamedColour(self.back_color), wx.SOLID) self.DC.SetBrush(brush) self.DC.SetPen(wx.Pen(wx.NamedColour(self.border_color), 1))
self.DC.DrawRectangleRect(rect)
DC.DrawRectangleRect(rect)
def DrawBorder(self): brush = wx.Brush(wx.NamedColour(self.back_color), wx.SOLID) self.DC.SetBrush(brush) self.DC.SetPen(wx.Pen(wx.NamedColour(self.border_color), 1))
self.cal = []
self.cal_days = []
def SetCal(self, year, month): self.InitValues() # reset initial values
self.cal.append('')
self.cal_days.append('')
def SetCal(self, year, month): self.InitValues() # reset initial values
self.cal.append(str(i))
self.cal_days.append(str(i))
def SetCal(self, year, month): self.InitValues() # reset initial values
def SetWeekEnd(self, font_color='BLACK', backgrd = 'LIGHT GREY'):
def SetWeekEnd(self, font_color=None, backgrd = None): if font_color != None: self.SetColor(COLOR_WEEKEND_FONT, MakeColor(font_color)) if backgrd != None: self.SetColor(COLOR_WEEKEND_BACKGROUND, MakeColor(backgrd))
def SetWeekEnd(self, font_color='BLACK', backgrd = 'LIGHT GREY'): date = 6 - int(self.dow) # start day of first saturday
self.cal_sel[date] = (font_color, backgrd)
self.cal_sel[date] = (self.GetColor(COLOR_WEEKEND_FONT), self.GetColor(COLOR_WEEKEND_BACKGROUND))
def SetWeekEnd(self, font_color='BLACK', backgrd = 'LIGHT GREY'): date = 6 - int(self.dow) # start day of first saturday
rect = wx.Rect(x, y, self.dl_w, self.dl_h)
w = self.cellW h = self.cellH if x == self.gridx[-2]: w = w + self.restW rect = wx.Rect(x, y, w+1, h+1)
def GetRect(self): cnt = 0 for y in self.gridy[1:-1]: for x in self.gridx[:-1]: assert type(y) == int assert type(x) == int rect = wx.Rect(x, y, self.dl_w, self.dl_h) # create rect region self.rg[cnt] = rect cnt = cnt + 1
return self.cal
return self.cal_days
def GetCal(self): return self.cal
def DrawMonth(self):
def DrawMonth(self, DC):
def DrawMonth(self): month = Month[self.month]
self.DC.SetFont(f) tw,th = self.DC.GetTextExtent(month)
DC.SetFont(f) tw,th = DC.GetTextExtent(month)
def DrawMonth(self): month = Month[self.month]
self.DC.DrawText(month, (adjust, self.cy_st + th))
DC.DrawText(month, (adjust, self.cy_st + th))
def DrawMonth(self): month = Month[self.month]
tw,th = self.DC.GetTextExtent(year)
tw,th = DC.GetTextExtent(year)
def DrawMonth(self): month = Month[self.month]
self.DC.SetFont(f) self.DC.DrawText(year, (self.cx_st + adjust, self.cy_st + th)) def DrawWeek(self): width = self.gridx[1]-self.gridx[0] height = self.gridy[1] - self.gridy[0] rect_w = self.gridx[7]-self.gridx[0]
DC.SetFont(f) DC.DrawText(year, (self.cx_st + adjust, self.cy_st + th)) def DrawWeek(self, DC): width = self.gridx[1] - self.gridx[0] + 1 height = self.gridy[1] - self.gridy[0] + 1 rect_w = self.gridx[-1] - self.gridx[0]
def DrawMonth(self): month = Month[self.month]
self.DC.SetFont(f) tw,th = self.DC.GetTextExtent(test_day)
DC.SetFont(f) tw,th = DC.GetTextExtent(test_day)
def DrawWeek(self): # draw the week days width = self.gridx[1]-self.gridx[0] height = self.gridy[1] - self.gridy[0] rect_w = self.gridx[7]-self.gridx[0]
self.DC.SetFont(f) self.DC.SetTextForeground(wx.NamedColour(self.week_font_color))
DC.SetFont(f) DC.SetTextForeground(MakeColor(self.colors[COLOR_HEADER_FONT]))
def DrawWeek(self): # draw the week days width = self.gridx[1]-self.gridx[0] height = self.gridy[1] - self.gridy[0] rect_w = self.gridx[7]-self.gridx[0]
brush = wx.Brush(wx.NamedColour(self.week_color), wx.SOLID) self.DC.SetBrush(brush) self.DC.DrawRectangle((self.gridx[0], self.gridy[0]), (rect_w+1, height))
brush = wx.Brush(MakeColor(self.colors[COLOR_HEADER_BACKGROUND]), wx.SOLID) DC.SetBrush(brush)
def DrawWeek(self): # draw the week days width = self.gridx[1]-self.gridx[0] height = self.gridy[1] - self.gridy[0] rect_w = self.gridx[7]-self.gridx[0]
dw,dh = self.DC.GetTextExtent(day)
dw,dh = DC.GetTextExtent(day)
def DrawWeek(self): # draw the week days width = self.gridx[1]-self.gridx[0] height = self.gridy[1] - self.gridy[0] rect_w = self.gridx[7]-self.gridx[0]
self.DC.DrawRectangle((self.gridx[cnt_x], self.gridy[0]), (width+1, height)) self.DC.DrawText(day, (x+diffx, y+diffy))
pointXY = (x, y) pointWH = (width, height) if self.hide_grid == False: pen = wx.Pen(MakeColor(self.GetColor(COLOR_GRID_LINES)), 1, wx.SOLID) else: pen = wx.Pen(MakeColor(self.GetColor(COLOR_BACKGROUND)), 1, wx.SOLID) DC.SetPen(pen) DC.DrawRectangle( pointXY, pointWH) old_pen = DC.GetPen() pen = wx.Pen(MakeColor(self.colors[COLOR_3D_LIGHT]), 1, wx.SOLID) DC.SetPen(pen) startPoint = wx.Point(x + 1 , y + 1) endPoint = wx.Point(x + width - 1, y + 1) DC.DrawLine(startPoint, endPoint ) startPoint = wx.Point(x + 1 , y + 1) endPoint = wx.Point(x + 1, y + height - 2) DC.DrawLine(startPoint, endPoint ) pen = wx.Pen(MakeColor(self.colors[COLOR_3D_DARK]), 1, wx.SOLID) DC.SetPen(pen) startPoint = wx.Point(x + 1, y + height - 2) endPoint = wx.Point(x + width - 1, y + height - 2) DC.DrawLine(startPoint, endPoint ) startPoint = wx.Point(x + width - 2 , y + 2) endPoint = wx.Point(x + width - 2, y + height - 2) DC.DrawLine(startPoint, endPoint ) pen = wx.Pen(MakeColor(self.colors[COLOR_FONT]), 1, wx.SOLID) DC.SetPen(pen) point = (x+diffx, y+diffy) DC.DrawText(day, point)
def DrawWeek(self): # draw the week days width = self.gridx[1]-self.gridx[0] height = self.gridy[1] - self.gridy[0] rect_w = self.gridx[7]-self.gridx[0]
def DrawNum(self):
def DrawNum(self, DC):
def DrawNum(self): f = wx.Font(10, self.font, wx.NORMAL, self.bold) # initial font setting
self.DC.SetFont(f) tw,th = self.DC.GetTextExtent(test_day) if tw < self.dl_w and th < self.dl_h:
DC.SetFont(f) tw,th = DC.GetTextExtent(test_day) if tw < self.cellW and th < self.cellH:
def DrawNum(self): f = wx.Font(10, self.font, wx.NORMAL, self.bold) # initial font setting
self.DC.SetFont(f)
DC.SetFont(f)
def DrawNum(self): f = wx.Font(10, self.font, wx.NORMAL, self.bold) # initial font setting
for val in self.cal:
for val in self.cal_days:
def DrawNum(self): f = wx.Font(10, self.font, wx.NORMAL, self.bold) # initial font setting
try: num_val = int(val) num_color = self.cal_sel[num_val][0] except: num_color = self.day_font_color self.DC.SetTextForeground(wx.NamedColour(num_color)) self.DC.SetFont(f) tw,th = self.DC.GetTextExtent(val) if self.num_align_horz == wx.ALIGN_CENTRE: adj_h = (self.dl_w - tw)/2 elif self.num_align_horz == wx.ALIGN_RIGHT: adj_h = self.dl_w - tw else: adj_h = 0 adj_h = adj_h + self.num_indent_horz if self.num_align_vert == wx.ALIGN_CENTRE: adj_v = (self.dl_h - th)/2 elif self.num_align_horz == wx.ALIGN_RIGHT: adj_v = self.dl_h - th else: adj_v = 0 adj_v = adj_v + self.num_indent_vert self.DC.DrawText(val, (x+adj_h, y+adj_v))
self.DrawDayText(x, y, val, f, DC)
def DrawNum(self): f = wx.Font(10, self.font, wx.NORMAL, self.bold) # initial font setting
bdw = self.x_mrg * 2 bdh = self.y_mrg + self.y_end + self.title_offset self.dl_w = int((self.sizew-bdw)/7) self.dl_h = int((self.sizeh-bdh)/7)
borderW = self.x_mrg * 2 borderH = self.y_mrg + self.y_end + self.title_offset self.cellW = int((self.sizew-borderW)/7) self.cellH = int((self.sizeh-borderH)/7) self.restW = ((self.sizew - borderW)%7 ) - 1
def Center(self): bdw = self.x_mrg * 2 bdh = self.y_mrg + self.y_end + self.title_offset
self.dl_th = int(self.dl_h*self.cal_week_scale) self.cwidth = self.dl_w * 7 self.cheight = self.dl_h * 6 + self.dl_th
self.weekHdrCellH = int(self.cellH*self.cal_week_scale) self.cellH = int((self.sizeh-borderH-self.weekHdrCellH)/6) self.restH = ((self.sizeh-borderH-self.weekHdrCellH)%6 ) - 1 self.calW = self.cellW * 7 self.calH = self.cellH * 6 + self.weekHdrCellH
def Center(self): bdw = self.x_mrg * 2 bdh = self.y_mrg + self.y_end + self.title_offset
def DrawSel(self):
def DrawSel(self, DC):
def DrawSel(self): for key in self.cal_sel.keys(): sel_color = self.cal_sel[key][1] brush = wx.Brush(wx.NamedColour(sel_color), wx.SOLID) self.DC.SetBrush(brush)
brush = wx.Brush(wx.NamedColour(sel_color), wx.SOLID) self.DC.SetBrush(brush)
brush = wx.Brush(MakeColor(sel_color), wx.SOLID) DC.SetBrush(brush)
def DrawSel(self): for key in self.cal_sel.keys(): sel_color = self.cal_sel[key][1] brush = wx.Brush(wx.NamedColour(sel_color), wx.SOLID) self.DC.SetBrush(brush)
self.DC.SetPen(wx.Pen(wx.NamedColour(self.grid_color), 0))
DC.SetPen(wx.Pen(MakeColor(self.colors[COLOR_GRID_LINES]), 0))
def DrawSel(self): for key in self.cal_sel.keys(): sel_color = self.cal_sel[key][1] brush = wx.Brush(wx.NamedColour(sel_color), wx.SOLID) self.DC.SetBrush(brush)
self.DC.SetPen(wx.Pen(wx.NamedColour(self.back_color), 0))
DC.SetPen(wx.Pen(MakeColor(self.colors[COLOR_BACKGROUND]), 0))
def DrawSel(self): for key in self.cal_sel.keys(): sel_color = self.cal_sel[key][1] brush = wx.Brush(wx.NamedColour(sel_color), wx.SOLID) self.DC.SetBrush(brush)
self.DC.DrawRectangle((rect.x, rect.y), (rect.width+1, rect.height+1))
DC.DrawRectangle((rect.x, rect.y), (rect.width, rect.height))
def DrawSel(self): for key in self.cal_sel.keys(): sel_color = self.cal_sel[key][1] brush = wx.Brush(wx.NamedColour(sel_color), wx.SOLID) self.DC.SetBrush(brush)
def DrawGrid(self): self.DC.SetPen(wx.Pen(wx.NamedColour(self.grid_color), 0))
def DrawGrid(self, DC): DC.SetPen(wx.Pen(MakeColor(self.colors[COLOR_GRID_LINES]), 0))
def DrawGrid(self): self.DC.SetPen(wx.Pen(wx.NamedColour(self.grid_color), 0))
y2 = y1 + self.cheight
y2 = y1 + self.calH + self.restH
def DrawGrid(self): self.DC.SetPen(wx.Pen(wx.NamedColour(self.grid_color), 0))
self.DC.DrawLine((x1, y1), (x1, y2))
DC.DrawLine((x1, y1), (x1, y2))
def DrawGrid(self): self.DC.SetPen(wx.Pen(wx.NamedColour(self.grid_color), 0))
x1 = x1 + self.dl_w
x1 = x1 + self.cellW
def DrawGrid(self): self.DC.SetPen(wx.Pen(wx.NamedColour(self.grid_color), 0))
x2 = x1 + self.cwidth
x2 = x1 + self.calW + self.restW
def DrawGrid(self): self.DC.SetPen(wx.Pen(wx.NamedColour(self.grid_color), 0))
self.DC.DrawLine((x1, y1), (x2, y1))
DC.DrawLine((x1, y1), (x2, y1))
def DrawGrid(self): self.DC.SetPen(wx.Pen(wx.NamedColour(self.grid_color), 0))
y1 = y1 + self.dl_th
y1 = y1 + self.weekHdrCellH
def DrawGrid(self): self.DC.SetPen(wx.Pen(wx.NamedColour(self.grid_color), 0))
y1 = y1 + self.dl_h
y1 = y1 + self.cellH def GetColor(self, name): return MakeColor(self.colors[name]) def SetColor(self, name, value): self.colors[name] = MakeColor(value)
def DrawGrid(self): self.DC.SetPen(wx.Pen(wx.NamedColour(self.grid_color), 0))
self.grid_color = 'BLACK' self.back_color = 'WHITE'
self.cal = None
def __init__(self, parent, id, pos=wx.DefaultPosition, size=wx.DefaultSize): wx.Window.__init__(self, parent, id, pos, size)
self.sel_color = 'RED'
def __init__(self, parent, id, pos=wx.DefaultPosition, size=wx.DefaultSize): wx.Window.__init__(self, parent, id, pos, size)
self.week_color = 'LIGHT GREY' self.week_font_color = 'BLACK'
self.outer_border = True self.num_align_horz = wx.ALIGN_CENTRE self.num_align_vert = wx.ALIGN_CENTRE self.colors = DefaultColors() self.set_x_mrg = 1 self.set_y_mrg = 1 self.set_y_end = 1
def __init__(self, parent, id, pos=wx.DefaultPosition, size=wx.DefaultSize): wx.Window.__init__(self, parent, id, pos, size)
self.SetBackgroundColour(self.back_color)
self.SetBackgroundColour(MakeColor(self.colors[COLOR_BACKGROUND]))
def __init__(self, parent, id, pos=wx.DefaultPosition, size=wx.DefaultSize): wx.Window.__init__(self, parent, id, pos, size)
self.day = int(self.cal[key])
self.day = int(self.cal_days[key])
def TestDay(self, key): try: self.day = int(self.cal[key]) except: return None if self.day == "": return None else: # Changed 12/1/03 by jmg (see above) to support 2.5 event binding evt = wx.PyCommandEvent(wxEVT_COMMAND_PYCALENDAR_DAY_CLICKED, self.GetId()) evt.click, evt.day, evt.month, evt.year = self.click, self.day, self.month, self.year evt.shiftkey = self.shiftkey evt.ctrlkey = self.ctrlkey self.GetEventHandler().ProcessEvent(evt)
self.week_font_color = font_color self.week_color = week_color
self.colors[COLOR_HEADER_FONT] = MakeColor(font_color) self.colors[COLOR_HEADER_BACKGROUND] = MakeColor(week_color) self.colors[COLOR_3D_LIGHT] = MakeColor(week_color) self.colors[COLOR_3D_DARK] = MakeColor(week_color) def SetTextAlign(self, vert, horz): self.num_align_horz = horz self.num_align_vert = vert
def SetWeekColor(self, font_color, week_color): # set font and background color for week title self.week_font_color = font_color self.week_color = week_color
DC = wx.PaintDC(self)
def DoDrawing(self, DC): DC = wx.PaintDC(self) DC.BeginDrawing()
self.cal = cal = CalDraw(self) cal.grid_color = self.grid_color cal.back_color = self.back_color
try: cal = self.caldraw except: self.caldraw = CalDraw(self) cal = self.caldraw
def DoDrawing(self, DC): DC = wx.PaintDC(self) DC.BeginDrawing()
cal.grid_color = self.grid_color
def DoDrawing(self, DC): DC = wx.PaintDC(self) DC.BeginDrawing()
cal.week_font_color = self.week_font_color cal.week_color = self.week_color
def DoDrawing(self, DC): DC = wx.PaintDC(self) DC.BeginDrawing()
self.cal = cal.GetCal()
self.cal_days = cal.GetCal()
def DoDrawing(self, DC): DC = wx.PaintDC(self) DC.BeginDrawing()
def DrawRect(self, key, color = 'BLACK', width = 0):
def DrawRect(self, key, fgcolor = 'BLACK', width = 0):
def DrawRect(self, key, color = 'BLACK', width = 0): if key == None: return
DC.SetPen(wx.Pen(wx.NamedColour(color), width))
try: DC.SetPen(wx.Pen(MakeColor(fgcolor), width)) except: DC.SetPen(wx.Pen(MakeColor(self.GetColor(COLOR_GRID_LINES)), width))
def DrawRect(self, key, color = 'BLACK', width = 0): if key == None: return
DC.DrawRectangle((rect.x, rect.y), (rect.width+1, rect.height+1))
DC.DrawRectangle((rect.x, rect.y), (rect.width, rect.height))
def DrawRect(self, key, color = 'BLACK', width = 0): if key == None: return
self.DrawRect(self.sel_key, self.back_color, sel_size)
self.DrawRect(self.sel_key, self.GetColor(COLOR_BACKGROUND), sel_size)
def SelectDay(self, key): sel_size = 1 # clear large selection self.DrawRect(self.sel_key, self.back_color, sel_size)
self.DrawRect(self.sel_key, self.grid_color) self.DrawRect(key, self.sel_color, sel_size)
self.DrawRect(self.sel_key, self.GetColor(COLOR_GRID_LINES), sel_size) self.DrawRect(key, self.GetColor(COLOR_HIGHLIGHT_BACKGROUND), sel_size)
def SelectDay(self, key): sel_size = 1 # clear large selection self.DrawRect(self.sel_key, self.back_color, sel_size)
value.append((dlg.list.GetString(i), dlg.list.IsChecked(i)))
value.append((dlg.list.GetString(i), int(dlg.list.IsChecked(i))))
def OnButtonEdit(self, evt): if self.textModified: # text has newer value try: self.value = eval(self.text.GetValue()) except SyntaxError: wxLogError('Syntax error in parameter value: ' + self.GetName()) self.value = [] dlg = ContentCheckListDialog(self, self.value) if dlg.ShowModal() == wxID_OK: value = [] for i in range(dlg.list.GetCount()): value.append((dlg.list.GetString(i), dlg.list.IsChecked(i))) # Add ignored flags self.SetValue(value) self.SetModified() self.textModified = False dlg.Destroy()
wx.Panel.__init__(self, parent, ID, style=wx.RAISED_BORDER)
wx.Panel.__init__(self, parent, ID, style=wx.RAISED_BORDER, size=(20,20))
def __init__(self, parent, ID, doodle): wx.Panel.__init__(self, parent, ID, style=wx.RAISED_BORDER)
self.SetSize( (-1, 45) )
self.SetSize( (45, 45) )
def __init__(self, parent): wx.Window.__init__(self, parent, -1, style=wx.SUNKEN_BORDER) self.SetBackgroundColour(wx.WHITE) self.SetSize( (-1, 45) ) self.colour = self.thickness = None self.Bind(wx.EVT_PAINT, self.OnPaint)
print w, h
def OnSize(self, evt): if hasattr(self, 't'): sz = self.GetSize() w, h = self.t.GetTextExtent(self.t.GetLabel()) print w, h self.t.SetPosition(((sz.width-w)/2, (sz.height-h)/2))
self.CCC = os.popen('$(WXCONFIG) --cxx', 'r').read()[:-1]
self.CCC = os.popen('%(WXCONFIG)s --cxx' % self.__dict__, 'r').read()[:-1]
def doFixups(self): # This is called after the config files have been evaluated # so we can do some sanity checking... if sys.platform != 'win32': if not self.CCC: self.CCC = os.popen('$(WXCONFIG) --cxx', 'r').read()[:-1] if not self.CCC: print "Warning: C++ compiler not specified (CCC). Assuming c++" self.CCC = 'c++' if not self.CC: self.CCC = os.popen('$(WXCONFIG) --cc', 'r').read()[:-1] if not self.CC: print "Warning: C compiler not specified (CC). Assuming cc" self.CC = 'cc'
self.CCC = os.popen('$(WXCONFIG) --cc', 'r').read()[:-1]
self.CCC = os.popen('%(WXCONFIG)s --cc' % self.__dict__, 'r').read()[:-1]
def doFixups(self): # This is called after the config files have been evaluated # so we can do some sanity checking... if sys.platform != 'win32': if not self.CCC: self.CCC = os.popen('$(WXCONFIG) --cxx', 'r').read()[:-1] if not self.CCC: print "Warning: C++ compiler not specified (CCC). Assuming c++" self.CCC = 'c++' if not self.CC: self.CCC = os.popen('$(WXCONFIG) --cc', 'r').read()[:-1] if not self.CC: print "Warning: C compiler not specified (CC). Assuming cc" self.CC = 'cc'
WXCONFIG=wx-config
WXCONFIG=%(WXCONFIG)s
def processArgs(self, args): try: for st in args: pair = string.split(st, '=') name = pair[0] value = pair[1] self.__dict__[name] = value except: print "Error parsing command-line: %s" % st return 0
def DrawOutLine(self, dc, x1, y1, x2, y2):
def DrawOutline(self, dc, x1, y1, x2, y2):
def DrawOutLine(self, dc, x1, y1, x2, y2): """Draw an outline rectangle on the current device context.""" dc.SetPen(wx.Pen(wx.Color(0, 0, 0), 1, wx.DOT)) dc.SetBrush(wx.TRANSPARENT_BRUSH)
gl_libs = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1] gl_libs = string.split(gl_libs)
gl_config = os.popen(WX_CONFIG + ' --gl-libs', 'r').read()[:-1] gl_lflags = string.split(gl_config) + lflags gl_libs = libs
def opj(*args): path = apply(os.path.join, args) return os.path.normpath(path)
gl_libs = ['opengl32', 'glu32']
gl_libs = libs + ['opengl32', 'glu32'] gl_lflags = lflags
def opj(*args): path = apply(os.path.join, args) return os.path.normpath(path)
libraries = libs, extra_compile_args = cflags, extra_link_args = gl_libs + lflags,
libraries = gl_libs, extra_compile_args = cflags, extra_link_args = gl_lflags,
def opj(*args): path = apply(os.path.join, args) return os.path.normpath(path)
types, and will properly blend that chennel when drawing a
types, and will properly blend that channel when drawing a
def runTest(frame, nb, log): win = TestPanel(nb, log) return win
'media', 'odbc', 'dbgrid', 'xrc']
'media', 'odbc', 'qa', 'dbgrid', 'xrc']
def mk_wxid(id): """Creates wxWidgets library identifier from bakefile target ID that follows this convention: DLLs end with 'dll', static libraries end with 'lib'. If withPrefix=1, then _wxid is returned instead of wxid.""" if id.endswith('dll') or id.endswith('lib'): wxid = id[:-3] else: wxid = id return wxid
LIBS_GUI = ['core', 'adv', 'html', 'gl', 'dbgrid', 'xrc', 'media']
LIBS_GUI = ['core', 'adv', 'html', 'gl', 'qa', 'dbgrid', 'xrc', 'media']
def mk_wxid(id): """Creates wxWidgets library identifier from bakefile target ID that follows this convention: DLLs end with 'dll', static libraries end with 'lib'. If withPrefix=1, then _wxid is returned instead of wxid.""" if id.endswith('dll') or id.endswith('lib'): wxid = id[:-3] else: wxid = id return wxid
EVT_TEXT(textControl, ID, self.changeCallback) EVT_COMBOBOX(textControl, ID, self.changeCallback)
EVT_TEXT(textControl, ID, self.OnChanged) EVT_COMBOBOX(textControl, ID, self.OnChanged)
def createTextControl( self): """Create the text control""" ID = wxNewId() textControl = wxTextCtrl(self, ID) textControl.SetToolTipString( self.toolTip ) if self.changeCallback: EVT_TEXT(textControl, ID, self.changeCallback) EVT_COMBOBOX(textControl, ID, self.changeCallback) return textControl
self.textControl.SetValue (value)
save = self.callCallback self.callCallback = callBack self.textControl.SetValue(value) self.callCallback = save
def SetValue (self, value, callBack=1): """ Convenient setting of text control value """ # Removed the return from here because SetValue doesn't return anything. self.textControl.SetValue (value)
self.textControl.SetValue (value)
save = self.callCallback self.callCallback = callBack self.textControl.SetValue(value) self.callCallback = save
def SetValue (self, value, callBack=1): """ Convenient setting of text control value, works around limitation of wxComboBox """ # Removed the return from here because SetValue doesn't return anything. self.textControl.SetValue (value) # Hack to call an event handler class LocalEvent: def __init__(self, string): self._string=string def GetString(self): return self._string if callBack==1: # The callback wasn't being called when SetValue was used ?? # So added this explicit call to it self.changeCallback(LocalEvent(value))
def __del__(self,htmlc=htmlc): if self.thisown == 1 : htmlc.delete_wxHtmlPrintout(self)
def __del__(self,htmlc=htmlc): if self.thisown == 1 : htmlc.delete_wxHtmlPrintout(self)
name = os.path.join(os.path.split(sys.argv[0])[0], 'data/test.htm')
name = os.path.join(self.cwd, 'data/test.htm')
def OnShowDefault(self, event): name = os.path.join(os.path.split(sys.argv[0])[0], 'data/test.htm') self.html.LoadPage(name)
os.chdir(os.path.split(sys.argv[0])[0]) name = os.path.join(os.path.split(sys.argv[0])[0], 'data/widgetTest.htm')
print self.cwd os.chdir(self.cwd) name = os.path.join(self.cwd, 'data/widgetTest.htm')
def OnWithWidgets(self, event): os.chdir(os.path.split(sys.argv[0])[0]) name = os.path.join(os.path.split(sys.argv[0])[0], 'data/widgetTest.htm') self.html.LoadPage(name) #self.html.SetPage(_widgetTest)
_widgetTest = '''\ <html><body> The widgets on this page were created dynamically on the fly by a custom wxTagHandler found in wxPython.lib.wxpTag. <hr> <center> <wxp class="wxButton" width="50%"> <param name="label" value="It works!"> <param name="id" value="wxID_OK"> </wxp> </center> <hr> after </body></html> '''
def runTest(frame, nb, log): win = TestHtmlPanel(nb, frame, log) return win
raise "\n ERROR: You Must Create An Image List To Use Images!"
raise Exception("\n ERROR: You Must Create An Image List To Use Images!")
def __init__(self, owner, item=None): """ Default class constructor. For internal use: do not call it in your code! """ self._owner = owner self._itemEdited = item self._startValue = item.GetText() self._finished = False self._aboutToFinish = False