rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
raise VersionError("wxversion.select() must be called before wxPython is imported") | raise VersionError("wxversion.selectNewest() must be called before wxPython is imported") | def selectNewest(minVersion): """ Selects a version of wxPython that has a version number greater than or equal to the version given. If a matching version is not found then instead of raising an exception like select() does this function will inform the user of that fact with a message dialog, open the system's defau... |
0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL |wx.LEFT, 10) | 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL |wx.LEFT|wx.RIGHT, 10) | def __init__(self): wx.Frame.__init__(self, None, -1, "Widget Layout Tester") |
idx = self.testHistory.GetSelection() | idx = evt.GetInt() | def OnHistorySelect(self, evt): idx = self.testHistory.GetSelection() if idx != wx.NOT_FOUND: item = self.history[idx] self.moduleName.SetValue(item[0]) self.className.SetValue(item[1]) self.parameters.SetValue(item[2]) self.postCreate.SetValue(item[3]) |
app = wx.PySimpleApp(redirect=True) | app = wx.PySimpleApp(redirect=False) | def Clear(self): self._fgtxt.SetValue("") self._bgtxt.SetValue("") self._fgclr.SetBackgroundColour(self.GetBackgroundColour()) self._bgclr.SetBackgroundColour(self.GetBackgroundColour()) self._fgclr.Refresh() self._bgclr.Refresh() |
if WXPREFIX.startswith(root): | if root is None or WXPREFIX.startswith(root): | def run(self): if os.name == 'nt': return headers = self.distribution.headers if not headers: return |
"wx.Choice and then move the mouse into the dineo below \n" | "wx.Choice and then move the mouse into the window below \n" | def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) |
self._controlPoints.Append(control) | self._controlPoints.append(control) | def MakeControlPoints(self): """Make handle control points.""" if self._canvas and self._lineControlPoints: first = self._lineControlPoints[0] last = self._lineControlPoints[-1] |
repr_ = reduce(lambda a,b: '%s|%s' % (a,b), value) | if value: repr_ = reduce(lambda a,b: '%s|%s' % (a,b), value) else: repr_ = '' | def SetValue(self, value): self.freeze = True if not value: value = [] self.value = value repr_ = reduce(lambda a,b: '%s|%s' % (a,b), value) self.text.SetValue(repr_) # update text ctrl self.freeze = False |
self.InsertWindow(sys.maxint, window, sashPos) | self.InsertWindow(len(self._windows), window, sashPos) | def AppendWindow(self, window, sashPos=-1): """ Add a new window to the splitter at the right side or bottom of the window stack. If sashPos is given then it is used to size the new window. """ self.InsertWindow(sys.maxint, window, sashPos) |
idx = idx * 5 + ends[1] / 12 idx = idx - 1 if idx < 0 or idx > 59: | idx = idx * 5 + ends[1] / 12 - 1 elif idx <= 0 or idx > 60: | def _draw(self, dc, shadow=False): ends = [int(x) for x in strftime("%I %M %S", localtime()).split()] |
print icon.__class__.__name__ | def AddIcon(self, icon, mask = wxNullBitmap): '''Add an icon to the image list, or get the index if already there''' index = self.__magicImageListMapping.get (id (icon)) if index is None: if isinstance( icon, wxIconPtr ): index = self.__magicImageList.AddIcon( icon ) elif isinstance( icon, wxBitmapPtr ): if isinstance(... | |
self._lastColMinWidth = None | self._resizeColMinWidth = None self._resizeColStyle = "LAST" self._resizeCol = 0 | def __init__(self): """ Standard initialiser. """ self._lastColMinWidth = None |
self._lastColMinWidth = minWidth | self.resizeCloumn(self, minWidth) def resizeColumn(self, minWidth): self._resizeColMinWidth = minWidth | def resizeLastColumn(self, minWidth): """ Resize the last column appropriately. |
if self._lastColMinWidth == None: self._lastColMinWidth = self.GetColumnWidth(numCols - 1) | if(self._resizeColStyle == "LAST"): resizeCol = self.GetColumnCount() else: resizeCol = self._resizeCol if self._resizeColMinWidth == None: self._resizeColMinWidth = self.GetColumnWidth(resizeCol - 1) | def _doResize(self): """ Resize the last column as appropriate. |
for col in range(numCols-1): totColWidth = totColWidth + self.GetColumnWidth(col) lastColWidth = self.GetColumnWidth(numCols - 1) if totColWidth + self._lastColMinWidth > listWidth: | for col in range(numCols): if col != (resizeCol-1): totColWidth = totColWidth + self.GetColumnWidth(col) resizeColWidth = self.GetColumnWidth(resizeCol - 1) if totColWidth + self._resizeColMinWidth > listWidth: | def _doResize(self): """ Resize the last column as appropriate. |
self.SetColumnWidth(numCols-1, self._lastColMinWidth) | self.SetColumnWidth(resizeCol-1, self._resizeColMinWidth) | def _doResize(self): """ Resize the last column as appropriate. |
self.SetColumnWidth(numCols-1, listWidth - totColWidth) | self.SetColumnWidth(resizeCol-1, listWidth - totColWidth) | def _doResize(self): """ Resize the last column as appropriate. |
w = self.text.GetSize().width + self.text.GetPosition().x | w = self.text.GetSize().width + self.text.GetPosition().x + 2 | def __init__(self, parent, log): wx.Panel.__init__(self, parent, -1) self.log = log self.count = 0 |
self.spin = wx.SpinButton(self, -1, (w + 6, 50), (h/2, h), wx.SP_VERTICAL) | self.spin = wx.SpinButton(self, -1, (w, 50), (h*2/3, h), wx.SP_VERTICAL) | def __init__(self, parent, log): wx.Panel.__init__(self, parent, -1) self.log = log self.count = 0 |
dc.DrawLineXY(*coords) | dc.DrawLine(*coords) | def DrawSavedLines(self, dc): dc.BeginDrawing() dc.SetPen(wx.Pen(wx.BLUE, 3)) for line in self.lines: for coords in line: dc.DrawLineXY(*coords) dc.EndDrawing() |
coords = ((self.x, self.y), event.GetPosition()) | coords = ((self.x, self.y), event.GetPositionTuple()) | def OnMotion(self, event): if event.Dragging() and not self.mode == "Drag": dc = wx.ClientDC(self) dc.BeginDrawing() dc.SetPen(wx.Pen(wx.BLUE, 3)) coords = ((self.x, self.y), event.GetPosition()) self.curLine.append(coords) dc.DrawLineXY(*coords) self.x, self.y = event.GetPositionTuple() dc.EndDrawing() |
dc.DrawLineXY(*coords) | dc.DrawLine(*coords) | def OnMotion(self, event): if event.Dragging() and not self.mode == "Drag": dc = wx.ClientDC(self) dc.BeginDrawing() dc.SetPen(wx.Pen(wx.BLUE, 3)) coords = ((self.x, self.y), event.GetPosition()) self.curLine.append(coords) dc.DrawLineXY(*coords) self.x, self.y = event.GetPositionTuple() dc.EndDrawing() |
lines = wx.InputStream(cPickle.loads(linesdata)) | lines = cPickle.loads(linesdata) | def OnData(self, x, y, d): self.log.WriteText("OnData: %d, %d, %d\n" % (x, y, d)) |
dc.DrawLineXY(*coords) | dc.DrawLine(*coords) | def DrawSavedLines(self, dc): dc.BeginDrawing() dc.SetPen(wx.Pen(wx.RED, 3)) |
new_select_to = min(edit_end, len(newvalue.rstrip())) | new_select_to = min(edit_end, len(newtext.rstrip())) | def _insertKey(self, char, pos, sel_start, sel_to, value, allowAutoSelect=False): """ Handles replacement of the character at the current insertion point.""" |
if self.callCallback: | if self.callCallback and self.changeCallback: | def OnChanged(self, evt): if self.callCallback: self.changeCallback(evt) |
This demo shows Drand and Drop using a custom data type and a custom data object. A type called "DoodleLines" is created and a Python Pickle of a list is actually transfered in the drag and drop opperation. | This demo shows Drag and Drop using a custom data type and a custom data object. A type called "DoodleLines" is created and a Python Pickle of a list is actually transfered in the drag and drop opperation. | def runTest(frame, nb, log): win = TestPanel(nb, log) return win |
wxART_TOOLBAR = misc2c.wxART_TOOLBAR wxART_MENU = misc2c.wxART_MENU wxART_FRAME_ICON = misc2c.wxART_FRAME_ICON wxART_CMN_DIALOG = misc2c.wxART_CMN_DIALOG wxART_HELP_BROWSER = misc2c.wxART_HELP_BROWSER wxART_MESSAGE_BOX = misc2c.wxART_MESSAGE_BOX wxART_OTHER = misc2c.wxART_OTHER wxART_ADD_BOOKMARK = misc2c.wxART_ADD_BOO... | def wxArtProvider_GetIcon(*_args, **_kwargs): val = apply(misc2c.wxArtProvider_GetIcon,_args,_kwargs) if val: val = wxIconPtr(val); val.thisown = 1 return val | |
self, parent, id=-1, | self, parent, id=-1, value = 0, | def __init__ ( self, parent, id=-1, pos = wxDefaultPosition, size = wxDefaultSize, style = 0, validator = wxDefaultValidator, name = "integer", value = 0, min=None, max=None, limited = 0, allow_none = 0, allow_long = 0, default_color = wxBLACK, oob_color = wxRED, ): |
value = 0, min=None, max=None, | min=None, max=None, | def __init__ ( self, parent, id=-1, pos = wxDefaultPosition, size = wxDefaultSize, style = 0, validator = wxDefaultValidator, name = "integer", value = 0, min=None, max=None, limited = 0, allow_none = 0, allow_long = 0, default_color = wxBLACK, oob_color = wxRED, ): |
if dy == 0 or dx == 0: return False | if dy == 0 and dx == 0: continue | def HitTest(self, x, y): if not self._lineControlPoints: return False |
if len(self._lineControlPoints) > 2: self.Initialise() | def OnMoveLink(self, dc, moveControlPoints = True): """Called when a connected object has moved, to move the link to correct position """ if not self._from or not self._to: return | |
if len(self._lineControlPoints) > 2: | if len(self._lineControlPoints) > 2 and self._initialised: | def FindLineEndPoints(self): """Finds the x, y points at the two ends of the line. |
if self._canvas and self._lineControlPoints: | if self._canvas and self._lineControlPoints and self._controlPoints: | def ResetControlPoints(self): if self._canvas and self._lineControlPoints: for i in range(min(len(self._controlPoints), len(self._lineControlPoints))): point = self._lineControlPoints[i] control = self._controlPoints[i] control.SetX(point[0]) control.SetY(point[1]) |
pt._point = x, y | pt._point[0] = x pt._point[1] = y | def OnSizingDragLeft(self, pt, draw, x, y, keys = 0, attachment = 0): dc = wx.ClientDC(self.GetCanvas()) self.GetCanvas().PrepareDC(dc) |
pt._point = x, y | pt._point[0] = x pt._point[1] = y | def OnSizingBeginDragLeft(self, pt, x, y, keys = 0, attachment = 0): dc = wx.ClientDC(self.GetCanvas()) self.GetCanvas().PrepareDC(dc) |
pt._point = pt._originalPos[0], pt._originalPos[1] | pt._point[0] = pt._originalPos[0] pt._point[1] = pt._originalPos[1] | def OnSizingEndDragLeft(self, pt, x, y, keys = 0, attachment = 0): dc = wx.ClientDC(self.GetCanvas()) self.GetCanvas().PrepareDC(dc) |
lpt._point = pt[0], pt[1] | lpt._point[0] = pt[0] lpt._point[1] = pt[1] | def OnMoveMiddleControlPoint(self, dc, lpt, pt): lpt._xpos = pt[0] lpt._ypos = pt[1] |
""" | ''' | def debug(msg): if DEBUG: print msg |
class DemoCodeViewer(PythonSTC): def __init__(self, parent, ID): PythonSTC.__init__(self, parent, ID, wx.BORDER_NONE) | class DemoCodeEditor(PythonSTC): def __init__(self, parent): PythonSTC.__init__(self, parent, -1, wx.BORDER_NONE) | def GetTip(self): return "This is my tip" |
self.SetReadOnly(False) | def SetValue(self, value): if wx.USE_UNICODE: value = value.decode('iso8859_1') self.SetReadOnly(False) self.SetText(value) self.SetReadOnly(True) | |
self.SetReadOnly(True) | self.EmptyUndoBuffer() self.SetSavePoint() def IsModified(self): return self.GetModify() | def SetValue(self, value): if wx.USE_UNICODE: value = value.decode('iso8859_1') self.SetReadOnly(False) self.SetText(value) self.SetReadOnly(True) |
self.GotoPos(pos) | line = self.LineFromPosition(pos) self.EnsureVisible(line) | def ShowPosition(self, pos): self.GotoPos(pos) |
class DemoCodeViewer(wx.TextCtrl): def __init__(self, parent, ID): wx.TextCtrl.__init__(self, parent, ID, style = wx.TE_MULTILINE | wx.TE_READONLY | | class DemoCodeEditor(wx.TextCtrl): def __init__(self, parent): wx.TextCtrl.__init__(self, parent, -1, style = wx.TE_MULTILINE | | def SetUpEditor(self): """ This method carries out the work of setting up the demo editor. It's seperate so as not to clutter up the init code. """ import keyword self.SetLexer(stc.STC_LEX_PYTHON) self.SetKeyWords(0, " ".join(keyword.kwlist)) |
return apply(os.path.join, tuple(path.split('/'))) | str = apply(os.path.join, tuple(path.split('/'))) if path.startswith('/'): str = '/' + str return str def GetModifiedDirectory(): """ Returns the directory where modified versions of the demo files are stored """ return opj(wx.GetHomeDir() + "/.wxPyDemo/modified/") def GetModifiedFilename(name): """ Returns the fi... | def opj(path): """Convert paths to the platform-specific separator""" return apply(os.path.join, tuple(path.split('/'))) |
def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, -1, title, size = (800, 600), style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE) | def __init__(self, parent, title): wx.Frame.__init__(self, parent, -1, title, size = (950, 750), style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE) self.loaded = False | def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, -1, title, size = (800, 600), style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE) |
self.window = None | self.demoPage = None self.codePage = None self.useModified = False | def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, -1, title, size = (800, 600), style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE) |
self.log = wx.TextCtrl(splitter2, -1, style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL) wx.Log_SetActiveTarget(MyLog(self.log)) | def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, -1, title, size = (800, 600), style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE) | |
self.nb = wx.Notebook(splitter2, -1, style=wx.CLIP_CHILDREN) | def EmptyHandler(evt): pass | |
self.SetOverview(self.overviewText, overview) self.txt = DemoCodeViewer(self.nb, -1) self.nb.AddPage(self.txt, "Demo Code") self.LoadDemoSource('Main.py') | if "gtk2" in wx.PlatformInfo: self.ovr.NormalizeFontSizes() self.SetOverview(self.overviewText, mainOverview) self.log = wx.TextCtrl(splitter2, -1, style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL) wx.Log_SetActiveTarget(MyLog(self.log)) | def OnOvrSize(evt, ovr=self.ovr): ovr.SetSize(evt.GetSize()) |
splitter2.SplitHorizontally(self.nb, self.log, -120) splitter.SplitVertically(self.tree, splitter2, 180) | splitter2.SplitHorizontally(self.nb, self.log, -160) splitter.SplitVertically(self.tree, splitter2, 200) | def OnOvrSize(evt, ovr=self.ovr): ovr.SetSize(evt.GetSize()) |
splitter.SetSashPosition(sz.height - 120, False) | splitter.SetSashPosition(sz.height - 160, False) | def SplitterOnSize(evt): splitter = evt.GetEventObject() sz = splitter.GetSize() splitter.SetSashPosition(sz.height - 120, False) evt.Skip() |
if len(sys.argv) == 2: try: selectedDemo = self.treeMap[sys.argv[1]] except: selectedDemo = None | self.LoadDemo(self.overviewText) self.loaded = True if len(sys.argv) > 1: arg = sys.argv[1] if arg.endswith('.py'): arg = arg[:-3] selectedDemo = self.treeMap.get(arg, None) | def SplitterOnSize(evt): splitter = evt.GetEventObject() sz = splitter.GetSize() splitter.SetSashPosition(sz.height - 120, False) evt.Skip() |
if self.dying: | if self.dying or not self.loaded: | def OnSelChanged(self, event): if self.dying: return |
self.RunDemo(itemText) def RunDemo(self, itemText): os.chdir(self.cwd) if self.nb.GetPageCount() == 3: if self.nb.GetSelection() == 2: self.nb.SetSelection(0) | self.LoadDemo(itemText) def LoadDemo(self, demoName): try: wx.BeginBusyCursor() os.chdir(self.cwd) self.ShutdownDemoModule() if demoName == self.overviewText: self.demoModules = DemoModules(__name__) self.SetOverview(self.overviewText, mainOverview) self.LoadDemoSource() self.UpdateNotebook(0) else: if os.path.e... | def OnSelChanged(self, event): if self.dying: return |
if self.window is not None: if hasattr(self.window, "ShutdownDemo"): self.window.ShutdownDemo() wx.SafeYield() self.nb.DeletePage(2) if itemText == self.overviewText: self.LoadDemoSource('Main.py') self.SetOverview(self.overviewText, overview) self.window = None else: if os.path.exists(itemText + '.py'): wx.BeginBusy... | if hasattr(self.demoPage, "ShutdownDemo"): self.demoPage.ShutdownDemo() wx.YieldIfNeeded() self.demoPage = None def UpdateNotebook(self, select = -1): nb = self.nb debug = False def UpdatePage(page, pageText): pageExists = False pagePos = -1 for i in range(nb.GetPageCount()): if nb.GetPageText(i) == pageText: pageEx... | def RunDemo(self, itemText): os.chdir(self.cwd) if self.nb.GetPageCount() == 3: if self.nb.GetSelection() == 2: self.nb.SetSelection(0) # inform the window that it's time to quit if it cares if self.window is not None: if hasattr(self.window, "ShutdownDemo"): self.window.ShutdownDemo() wx.SafeYield() # in case the page... |
self.ovr.SetPage("") self.txt.Clear() self.window = None self.tree.SetFocus() def LoadDemoSource(self, filename): self.txt.Clear() try: self.txt.SetValue(open(filename).read()) except IOError: self.txt.SetValue("Cannot open %s file." % filename) self.txt.SetInsertionPoint(0) self.txt.ShowPosition(0) | if debug: wx.LogMessage("DBG: STILL GONE - %s" % pageText) if select == -1: select = nb.GetSelection() UpdatePage(self.codePage, "Demo Code") UpdatePage(self.demoPage, "Demo") if select >= 0: nb.SetSelection(select) | def RunDemo(self, itemText): os.chdir(self.cwd) if self.nb.GetPageCount() == 3: if self.nb.GetSelection() == 2: self.nb.SetSelection(0) # inform the window that it's time to quit if it cares if self.window is not None: if hasattr(self.window, "ShutdownDemo"): self.window.ShutdownDemo() wx.SafeYield() # in case the page... |
end = self.txt.GetLastPosition() textstring = self.txt.GetRange(0, end).lower() start = self.txt.GetSelection()[1] | end = editor.GetLastPosition() textstring = editor.GetRange(0, end).lower() start = editor.GetSelection()[1] | def OnFind(self, event): self.nb.SetSelection(1) end = self.txt.GetLastPosition() textstring = self.txt.GetRange(0, end).lower() start = self.txt.GetSelection()[1] findstring = self.finddata.GetFindString().lower() loc = textstring.find(findstring, start) if loc == -1 and start != 0: # string not found, start at beginn... |
self.txt.ShowPosition(loc) self.txt.SetSelection(loc, loc + len(findstring)) | editor.ShowPosition(loc) editor.SetSelection(loc, loc + len(findstring)) | def OnFind(self, event): self.nb.SetSelection(1) end = self.txt.GetLastPosition() textstring = self.txt.GetRange(0, end).lower() start = self.txt.GetSelection()[1] findstring = self.finddata.GetFindString().lower() loc = textstring.find(findstring, start) if loc == -1 and start != 0: # string not found, start at beginn... |
self.window = None | self.demoPage = None self.codePage = None | def OnCloseWindow(self, event): self.dying = True self.window = None self.mainmenu = None self.Destroy() |
self.window = self.otherWin | self.demoPage = self.otherWin | def OnIdle(self, event): if self.otherWin: self.otherWin.Raise() self.window = self.otherWin self.otherWin = None |
wx.LogMessage("OnIconfiy") | wx.LogMessage("OnIconfiy: %d" % evt.Iconized()) | def OnIconfiy(self, evt): wx.LogMessage("OnIconfiy") evt.Skip() |
frame = wxPythonDemo(None, -1, "wxPython: (A Demonstration)") | frame = wxPythonDemo(None, "wxPython: (A Demonstration)") | def OnClose(self, evt): self.Hide() frame = wxPythonDemo(None, -1, "wxPython: (A Demonstration)") frame.Show() evt.Skip() # Make sure the default handler runs too... |
overview = """<html><body> | mainOverview = """<html><body> | def main(): try: demoPath = os.path.dirname(__file__) os.chdir(demoPath) except: pass app = MyApp(0) ##wx.Platform == "__WXMAC__") app.MainLoop() |
EVT_CHILD_FOCUS(self, self.OnChildFocus) | wxCallAfter(self.Scroll, 0, 0) | def __init__(self, parent, log): self.log = log wxScrolledWindow.__init__(self, parent, -1, style = wxTAB_TRAVERSAL) |
return val def SetVerbose(self, *_args, **_kwargs): val = apply(misc2c.wxLog_SetVerbose,(self,) + _args, _kwargs) | def HasPendingMessages(self, *_args, **_kwargs): val = apply(misc2c.wxLog_HasPendingMessages,(self,) + _args, _kwargs) return val | |
borderSizer = wx.BoxSizer(wx.HORIZONTAL) | def OnAddDirToProject(self, event): frame = wx.Dialog(None, -1, _("Add All Files from Directory to Project"), size= (320,200)) borderSizer = wx.BoxSizer(wx.HORIZONTAL) | |
lineSizer.Add(wx.StaticText(frame, -1, _("Directory:")), 0, wx.ALIGN_CENTER | wx.RIGHT, HALF_SPACE) dirCtrl = wx.TextCtrl(frame, -1, os.path.dirname(self.GetDocument().GetFilename()), size=(200,-1)) | dirCtrl = wx.TextCtrl(frame, -1, os.path.dirname(self.GetDocument().GetFilename()), size=(250,-1)) | def OnAddDirToProject(self, event): frame = wx.Dialog(None, -1, _("Add All Files from Directory to Project"), size= (320,200)) borderSizer = wx.BoxSizer(wx.HORIZONTAL) |
lineSizer.Add(dirCtrl, 0, wx.LEFT, HALF_SPACE) | lineSizer.Add(dirCtrl, 1, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND) | def OnAddDirToProject(self, event): frame = wx.Dialog(None, -1, _("Add All Files from Directory to Project"), size= (320,200)) borderSizer = wx.BoxSizer(wx.HORIZONTAL) |
lineSizer.Add(findDirButton, 0, wx.LEFT, HALF_SPACE) contentSizer.Add(lineSizer, 0, wx.BOTTOM, SPACE) | lineSizer.Add(findDirButton, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, HALF_SPACE) flexGridSizer.Add(lineSizer, 1, wx.EXPAND) | def OnAddDirToProject(self, event): frame = wx.Dialog(None, -1, _("Add All Files from Directory to Project"), size= (320,200)) borderSizer = wx.BoxSizer(wx.HORIZONTAL) |
filterChoice = wx.Choice(frame, -1, size=(210, -1), choices=choices) | filterChoice = wx.Choice(frame, -1, size=(250, -1), choices=choices) | def OnBrowseButton(event): dlg = wx.DirDialog(frame, _("Choose a directory:"), style=wx.DD_DEFAULT_STYLE) dir = dirCtrl.GetValue() if len(dir): dlg.SetPath(dir) if dlg.ShowModal() == wx.ID_OK: dirCtrl.SetValue(dlg.GetPath()) dirCtrl.SetToolTipString(dirCtrl.GetValue()) dirCtrl.SetInsertionPointEnd() |
lineSizer = wx.BoxSizer(wx.HORIZONTAL) lineSizer.Add(wx.StaticText(frame, -1, _("Files of type:")), 0, wx.ALIGN_CENTER | wx.RIGHT, HALF_SPACE) lineSizer.Add(filterChoice, 1, wx.LEFT, HALF_SPACE) contentSizer.Add(lineSizer, 0, wx.BOTTOM|wx.EXPAND, SPACE) | flexGridSizer.Add(wx.StaticText(frame, -1, _("Files of type:")), 0, wx.ALIGN_CENTER_VERTICAL) flexGridSizer.Add(filterChoice, 1, wx.EXPAND) contentSizer.Add(flexGridSizer, 0, wx.ALL|wx.EXPAND, SPACE) | def OnBrowseButton(event): dlg = wx.DirDialog(frame, _("Choose a directory:"), style=wx.DD_DEFAULT_STYLE) dir = dirCtrl.GetValue() if len(dir): dlg.SetPath(dir) if dlg.ShowModal() == wx.ID_OK: dirCtrl.SetValue(dlg.GetPath()) dirCtrl.SetToolTipString(dirCtrl.GetValue()) dirCtrl.SetInsertionPointEnd() |
contentSizer.Add(subfolderCtrl, 0, wx.BOTTOM, SPACE) borderSizer.Add(contentSizer, 0, wx.TOP|wx.BOTTOM|wx.LEFT, SPACE) buttonSizer = wx.BoxSizer(wx.VERTICAL) | contentSizer.Add(subfolderCtrl, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, SPACE) buttonSizer = wx.BoxSizer(wx.HORIZONTAL) | def OnBrowseButton(event): dlg = wx.DirDialog(frame, _("Choose a directory:"), style=wx.DD_DEFAULT_STYLE) dir = dirCtrl.GetValue() if len(dir): dlg.SetPath(dir) if dlg.ShowModal() == wx.ID_OK: dirCtrl.SetValue(dlg.GetPath()) dirCtrl.SetToolTipString(dirCtrl.GetValue()) dirCtrl.SetInsertionPointEnd() |
buttonSizer.Add(findBtn, 0, wx.BOTTOM, HALF_SPACE) | buttonSizer.Add(findBtn, 0, wx.RIGHT, HALF_SPACE) | def OnBrowseButton(event): dlg = wx.DirDialog(frame, _("Choose a directory:"), style=wx.DD_DEFAULT_STYLE) dir = dirCtrl.GetValue() if len(dir): dlg.SetPath(dir) if dlg.ShowModal() == wx.ID_OK: dirCtrl.SetValue(dlg.GetPath()) dirCtrl.SetToolTipString(dirCtrl.GetValue()) dirCtrl.SetInsertionPointEnd() |
borderSizer.Add(buttonSizer, 0, wx.ALL, SPACE) frame.SetSizer(borderSizer) | contentSizer.Add(buttonSizer, 0, wx.ALL|wx.ALIGN_RIGHT, SPACE) frame.SetSizer(contentSizer) | def OnBrowseButton(event): dlg = wx.DirDialog(frame, _("Choose a directory:"), style=wx.DD_DEFAULT_STYLE) dir = dirCtrl.GetValue() if len(dir): dlg.SetPath(dir) if dlg.ShowModal() == wx.ID_OK: dirCtrl.SetValue(dlg.GetPath()) dirCtrl.SetToolTipString(dirCtrl.GetValue()) dirCtrl.SetInsertionPointEnd() |
(child, cookie2) = self._treeCtrl.GetNextChild(project, cookie) | (child, cookie2) = self._treeCtrl.GetNextChild(project, cookie2) | def _GetFileItem(self, shortFileName = None, longFileName = None): """ Returns the tree item for a file given the short (display) or long (fullpath) file name. """ rootItem = self._treeCtrl.GetRootItem() (project, cookie) = self._treeCtrl.GetFirstChild(rootItem) while project.IsOk(): (child, cookie2) = self._treeCtrl.... |
self.SetHandSize(h, SECOND) | self.SetHandSize(s, SECOND) | def SetHandWeights(self, h=None, m=None, s=None): if h: self.SetHandSize(h, HOUR) if m: self.SetHandSize(m, MINUTE) if s: self.SetHandSize(h, SECOND) |
self.SetHandBorderColour(h, SECOND) self.SetHandFillColour(h, SECOND) | self.SetHandBorderColour(s, SECOND) self.SetHandFillColour(s, SECOND) | def SetHandColours(self, h=None, m=None, s=None): if h and not m and not s: m=h s=h if h: self.SetHandBorderColour(h, HOUR) self.SetHandFillColour(h, HOUR) if m: self.SetHandBorderColour(m, MINUTE) self.SetHandFillColour(m, MINUTE) if s: self.SetHandBorderColour(h, SECOND) self.SetHandFillColour(h, SECOND) |
self.SetTickSize(h, MINUTE) | self.SetTickSize(m, MINUTE) | def SetTickSizes(self, h=None, m=None): if h: self.SetTickSize(h, HOUR) if m: self.SetTickSize(h, MINUTE) |
self.SetTickFont(h, MINUTE) | self.SetTickFont(m, MINUTE) | def SetTickFontss(self, h=None, m=None): if h: self.SetTickFont(h, HOUR) if m: self.SetTickFont(h, MINUTE) |
lrsizer.Add(self.mimelist, 1, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER, 4) | lrsizer.Add(self.mimelist, 1, wx.ALL | wx.EXPAND | wx.ALIGN_CENTER | wx.FIXED_SIZE, 4) | def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) |
import PyCrust | from wx import py | def setUp(self): GetAttributeTestCase.setUp(self) import PyCrust spam = Spam() self.f = open('test_introspect.py') self.items = ( None, int(123), long(123), float(123), complex(123), "", unicode(""), [], (), xrange(0), {}, # Builtin function. len, # Builtin method. [].append, # User function. ham, # Byte-compiled code.... |
PyCrust, | py, | def setUp(self): GetAttributeTestCase.setUp(self) import PyCrust spam = Spam() self.f = open('test_introspect.py') self.items = ( None, int(123), long(123), float(123), complex(123), "", unicode(""), [], (), xrange(0), {}, # Builtin function. len, # Builtin method. [].append, # User function. ham, # Byte-compiled code.... |
def InsertLineControlPoint(self, dc = None): """Insert a control point at an arbitrary position.""" | def InsertLineControlPoint(self, dc = None, point = None): """Insert a control point at an optional given position.""" | def InsertLineControlPoint(self, dc = None): """Insert a control point at an arbitrary position.""" if dc: self.Erase(dc) |
last_point = self._lineControlPoints[-1] second_last_point = self._lineControlPoints[-2] line_x = (last_point[0] + second_last_point[0]) / 2.0 line_y = (last_point[1] + second_last_point[1]) / 2.0 | if point: line_x, line_y = point else: last_point = self._lineControlPoints[-1] second_last_point = self._lineControlPoints[-2] line_x = (last_point[0] + second_last_point[0]) / 2.0 line_y = (last_point[1] + second_last_point[1]) / 2.0 | def InsertLineControlPoint(self, dc = None): """Insert a control point at an arbitrary position.""" if dc: self.Erase(dc) |
print flags, col, self.tree.GetItemText(item, col) | self.log.write('Flags: %s, Col:%s, Text: %s' % (flags, col, self.tree.GetItemText(item, col))) | def OnRightUp(self, evt): pos = evt.GetPosition() item, flags, col = self.tree.HitTest(pos) if item: print flags, col, self.tree.GetItemText(item, col) |
g.currentEncoding = dom.encoding | if dom.encoding: g.currentEncoding = dom.encoding | def Open(self, path): if not os.path.exists(path): wxLogError('File does not exists: %s' % path) return False # Try to read the file try: f = open(path) self.Clear() dom = minidom.parse(f) f.close() # Set encoding global variable g.currentEncoding = dom.encoding # Change dir dir = os.path.dirname(path) if dir: os.chdir... |
frame.res.Load(os.path.join(basePath, 'xrced.xrc')) | try: frame.res.Load(os.path.join(basePath, 'xrced.xrc')) except wx._core.PyAssertionError: pass | def OnInit(self): global debug # Process comand-line try: opts = args = None opts, args = getopt.getopt(sys.argv[1:], 'dhiv') for o,a in opts: if o == '-h': usage() sys.exit(0) elif o == '-d': debug = True elif o == '-v': print 'XRCed version', version sys.exit(0) except getopt.GetoptError: if wxPlatform != '__WXMAC__... |
cleanup = ogl.OGLCleanUp def __del__(self): self.cleanup() | def __del__(self, cleanup=ogl.OGLCleanUp): cleanup() | def runTest(frame, nb, log): # This creates some pens and brushes that the OGL library uses. # It should be called after the app object has been created, but # before OGL is used. ogl.OGLInitialize() win = TestWindow(nb, log, frame) return win |
def __init__(self, name, expr, engine): | def __call__(self, econtext): expr = super(TALESProviderExpression, self).__call__(econtext) | def __init__(self, name, expr, engine): if not '/' in expr: raise KeyError('Use `iface/key` for defining the provider.') |
raise KeyError("Do not use more then one / for defining iface/key.") | msg = "Do not use more then one '/' for defining iface/key." raise KeyError(msg) | def __init__(self, name, expr, engine): if not '/' in expr: raise KeyError('Use `iface/key` for defining the provider.') |
def __call__(self, econtext): | def __call__(self, econtext): context = econtext.vars['context'] request = econtext.vars['request'] view = econtext.vars['view'] | |
'Viewlet region interface not found.', str) | 'Provider region interface not found.', str) | def getRegion(str): """Get a region from the string. This function will create the dummy region implementation as well. """ region = zope.component.queryUtility(interfaces.IRegion, name=str) if region is None: raise interfaces.ViewletRegionLookupError( 'Viewlet region interface not found.', str) return region |
raise KeyError('Use `iface/viewletname` for defining the viewlet.') | raise KeyError('Use `iface/key` for defining the provider.') | def __init__(self, name, expr, engine): if not '/' in expr: raise KeyError('Use `iface/viewletname` for defining the viewlet.') |
cpManager = zope.component.queryMultiAdapter( (context, request, view), interfaces.IContentProviderManager) | cpManager = None res = [] iface = interfaces.IContentProviderManager objs = (context, request, view) lookup = ISiteManager(context).adapters.lookup cpManagerClass = lookup(map(providedBy, objs)+[region], iface, name='') if cpManagerClass is not None: cpManager = cpManager(context, request, view, region) | def __call__(self, econtext): context = econtext.vars['context'] request = econtext.vars['request'] view = econtext.vars['view'] |
comp = new_compiler(compiler=compiler, verbose=True, output_dir='build') | print 'Creating library', libName comp = new_compiler(compiler=compiler, verbose=True) | def buildStaticLibrary(sourceFiles, libName, libDir, compiler): '''Build libraries to be linked to simuPOP modules''' # get a c compiler comp = new_compiler(compiler=compiler, verbose=True, output_dir='build') objFiles = comp.compile(sourceFiles, include_dirs=['.']) comp.create_static_lib(objFiles, libName, libDir) |
res['libraries'] = boost_lib_names | res['libraries'] = [x for x in boost_lib_names] | def ModuInfo(modu, SIMUPOP_VER='9.9.9', SIMUPOP_REV='9999'): res = {} res['src'] = ['src/simuPOP_' + modu + '_wrap.cpp'] for src in SOURCE_FILES: res['src'].append(src[:-4] + '_' + modu + '.cpp') res['src'].extend(GSL_FILES) res['libraries'] = boost_lib_names # lib if os.name == 'nt': # Windows res['libraries'].app... |
r.postscript(file=epsFile) r.par(mfrow=[2,1]) | def plotLD(pop, epsFile, jpgFile): ''' plot LD values in R and convert to jpg if possible ''' r.postscript(file=epsFile) r.par(mfrow=[2,1]) # return max LD res = [] # dist: distance (location) of marker # ldprime: D' value dist = [] ldprime = [] for ld in pop.dvars().ctrDSLLD: if ld[1] == pop.dvars().ctrChromDSL: dist.... | |
r.plot( dist, ldprime, main="D' between DSL and other markers on chrom %d" % pop.dvars().ctrChrom, xlab="marker location", ylab="D'", type='b') r.abline( v = pop.locusDist(pop.dvars().ctrChromDSL), lty=3 ) r.axis( 1, [pop.locusDist(pop.dvars().ctrChromDSL)], ['DSL']) | if hasRPy: r.postscript(file=epsFile) r.par(mfrow=[2,1]) r.plot( dist, ldprime, main="D' between DSL and other markers on chrom %d" % pop.dvars().ctrChrom, xlab="marker location", ylab="D'", type='b') r.abline( v = pop.locusDist(pop.dvars().ctrChromDSL), lty=3 ) r.axis( 1, [pop.locusDist(pop.dvars().ctrChromDSL)], ['DS... | def plotLD(pop, epsFile, jpgFile): ''' plot LD values in R and convert to jpg if possible ''' r.postscript(file=epsFile) r.par(mfrow=[2,1]) # return max LD res = [] # dist: distance (location) of marker # ldprime: D' value dist = [] ldprime = [] for ld in pop.dvars().ctrDSLLD: if ld[1] == pop.dvars().ctrChromDSL: dist.... |
r.plot( dist, ldprime, main="D' between marker %d and other markers on chrom %d" \ % (numLoci/2, pop.dvars().noDSLChrom), xlab="marker location", ylab="D'", type='b') r.abline( v = pop.locusDist(pop.chromBegin(pop.dvars().noDSLChrom)+pop.dvars().numLoci/2), lty=3 ) r.dev_off() | if hasRPy: r.plot( dist, ldprime, main="D' between marker %d and other markers on chrom %d" \ % (numLoci/2, pop.dvars().noDSLChrom), xlab="marker location", ylab="D'", type='b') r.abline( v = pop.locusDist(pop.chromBegin(pop.dvars().noDSLChrom)+pop.dvars().numLoci/2), lty=3 ) r.dev_off() | def plotLD(pop, epsFile, jpgFile): ''' plot LD values in R and convert to jpg if possible ''' r.postscript(file=epsFile) r.par(mfrow=[2,1]) # return max LD res = [] # dist: distance (location) of marker # ldprime: D' value dist = [] ldprime = [] for ld in pop.dvars().ctrDSLLD: if ld[1] == pop.dvars().ctrChromDSL: dist.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.