partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
test | GetParam | Convenience function for accessing tag parameters | gui/html/__init__.py | def GetParam(tag, param, default=__SENTINEL):
""" Convenience function for accessing tag parameters"""
if tag.HasParam(param):
return tag.GetParam(param)
else:
if default == __SENTINEL:
raise KeyError
else:
return default | def GetParam(tag, param, default=__SENTINEL):
""" Convenience function for accessing tag parameters"""
if tag.HasParam(param):
return tag.GetParam(param)
else:
if default == __SENTINEL:
raise KeyError
else:
return default | [
"Convenience",
"function",
"for",
"accessing",
"tag",
"parameters"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/html/__init__.py#L16-L24 | [
"def",
"GetParam",
"(",
"tag",
",",
"param",
",",
"default",
"=",
"__SENTINEL",
")",
":",
"if",
"tag",
".",
"HasParam",
"(",
"param",
")",
":",
"return",
"tag",
".",
"GetParam",
"(",
"param",
")",
"else",
":",
"if",
"default",
"==",
"__SENTINEL",
":"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | send | Process an outgoing communication | samples/chat/chat.py | def send(evt):
"Process an outgoing communication"
# get the text written by the user (input textbox control)
msg = ctrl_input.value
# send the message (replace with socket/queue/etc.)
gui.alert(msg, "Message")
# record the message (update the UI)
log(msg)
ctrl_input.value = ""
ctrl_... | def send(evt):
"Process an outgoing communication"
# get the text written by the user (input textbox control)
msg = ctrl_input.value
# send the message (replace with socket/queue/etc.)
gui.alert(msg, "Message")
# record the message (update the UI)
log(msg)
ctrl_input.value = ""
ctrl_... | [
"Process",
"an",
"outgoing",
"communication"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/samples/chat/chat.py#L16-L25 | [
"def",
"send",
"(",
"evt",
")",
":",
"# get the text written by the user (input textbox control)",
"msg",
"=",
"ctrl_input",
".",
"value",
"# send the message (replace with socket/queue/etc.)",
"gui",
".",
"alert",
"(",
"msg",
",",
"\"Message\"",
")",
"# record the message ... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | save | Basic save functionality: just replaces the gui code | gui/tools/designer.py | def save(evt, designer):
"Basic save functionality: just replaces the gui code"
# ask the user if we should save the changes:
ok = gui.confirm("Save the changes?", "GUI2PY Designer",
cancel=True, default=True)
if ok:
wx_obj = evt.GetEventObject()
w = wx_obj.obj
... | def save(evt, designer):
"Basic save functionality: just replaces the gui code"
# ask the user if we should save the changes:
ok = gui.confirm("Save the changes?", "GUI2PY Designer",
cancel=True, default=True)
if ok:
wx_obj = evt.GetEventObject()
w = wx_obj.obj
... | [
"Basic",
"save",
"functionality",
":",
"just",
"replaces",
"the",
"gui",
"code"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L559-L629 | [
"def",
"save",
"(",
"evt",
",",
"designer",
")",
":",
"# ask the user if we should save the changes:",
"ok",
"=",
"gui",
".",
"confirm",
"(",
"\"Save the changes?\"",
",",
"\"GUI2PY Designer\"",
",",
"cancel",
"=",
"True",
",",
"default",
"=",
"True",
")",
"if",... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | wellcome_tip | Show a tip message | gui/tools/designer.py | def wellcome_tip(wx_obj):
"Show a tip message"
msg = ("Close the main window to exit & save.\n"
"Drag & Drop / Click the controls from the ToolBox to create new ones.\n"
"Left click on the created controls to select them.\n"
"Double click to edit the default property.\n"
... | def wellcome_tip(wx_obj):
"Show a tip message"
msg = ("Close the main window to exit & save.\n"
"Drag & Drop / Click the controls from the ToolBox to create new ones.\n"
"Left click on the created controls to select them.\n"
"Double click to edit the default property.\n"
... | [
"Show",
"a",
"tip",
"message"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L650-L676 | [
"def",
"wellcome_tip",
"(",
"wx_obj",
")",
":",
"msg",
"=",
"(",
"\"Close the main window to exit & save.\\n\"",
"\"Drag & Drop / Click the controls from the ToolBox to create new ones.\\n\"",
"\"Left click on the created controls to select them.\\n\"",
"\"Double click to edit the default pr... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | BasicDesigner.mouse_down | Get the selected object and store start position | gui/tools/designer.py | def mouse_down(self, evt):
"Get the selected object and store start position"
if DEBUG: print "down!"
if (not evt.ControlDown() and not evt.ShiftDown()) or evt.AltDown():
for obj in self.selection:
# clear marker
if obj.sel_marker:
... | def mouse_down(self, evt):
"Get the selected object and store start position"
if DEBUG: print "down!"
if (not evt.ControlDown() and not evt.ShiftDown()) or evt.AltDown():
for obj in self.selection:
# clear marker
if obj.sel_marker:
... | [
"Get",
"the",
"selected",
"object",
"and",
"store",
"start",
"position"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L123-L163 | [
"def",
"mouse_down",
"(",
"self",
",",
"evt",
")",
":",
"if",
"DEBUG",
":",
"print",
"\"down!\"",
"if",
"(",
"not",
"evt",
".",
"ControlDown",
"(",
")",
"and",
"not",
"evt",
".",
"ShiftDown",
"(",
")",
")",
"or",
"evt",
".",
"AltDown",
"(",
")",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | BasicDesigner.mouse_move | Move the selected object | gui/tools/designer.py | def mouse_move(self, evt):
"Move the selected object"
if DEBUG: print "move!"
if self.current and not self.overlay:
wx_obj = self.current
sx, sy = self.start
x, y = wx.GetMousePosition()
# calculate the new position (this will overwrite relative di... | def mouse_move(self, evt):
"Move the selected object"
if DEBUG: print "move!"
if self.current and not self.overlay:
wx_obj = self.current
sx, sy = self.start
x, y = wx.GetMousePosition()
# calculate the new position (this will overwrite relative di... | [
"Move",
"the",
"selected",
"object"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L165-L206 | [
"def",
"mouse_move",
"(",
"self",
",",
"evt",
")",
":",
"if",
"DEBUG",
":",
"print",
"\"move!\"",
"if",
"self",
".",
"current",
"and",
"not",
"self",
".",
"overlay",
":",
"wx_obj",
"=",
"self",
".",
"current",
"sx",
",",
"sy",
"=",
"self",
".",
"st... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | BasicDesigner.do_resize | Called by SelectionTag | gui/tools/designer.py | def do_resize(self, evt, wx_obj, (n, w, s, e)):
"Called by SelectionTag"
# calculate the pos (minus the offset, not in a panel like rw!)
pos = wx_obj.ScreenToClient(wx.GetMousePosition())
x, y = pos
if evt.ShiftDown(): # snap to grid:
x = x / GRID_SIZE[0] * GRID_S... | def do_resize(self, evt, wx_obj, (n, w, s, e)):
"Called by SelectionTag"
# calculate the pos (minus the offset, not in a panel like rw!)
pos = wx_obj.ScreenToClient(wx.GetMousePosition())
x, y = pos
if evt.ShiftDown(): # snap to grid:
x = x / GRID_SIZE[0] * GRID_S... | [
"Called",
"by",
"SelectionTag"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L209-L265 | [
"def",
"do_resize",
"(",
"self",
",",
"evt",
",",
"wx_obj",
",",
"(",
"n",
",",
"w",
",",
"s",
",",
"e",
")",
")",
":",
"# calculate the pos (minus the offset, not in a panel like rw!)",
"pos",
"=",
"wx_obj",
".",
"ScreenToClient",
"(",
"wx",
".",
"GetMouseP... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | BasicDesigner.mouse_up | Release the selected object (pass a wx_obj if the event was captured) | gui/tools/designer.py | def mouse_up(self, evt, wx_obj=None):
"Release the selected object (pass a wx_obj if the event was captured)"
self.resizing = False
if self.current:
wx_obj = self.current
if self.parent.wx_obj.HasCapture():
self.parent.wx_obj.ReleaseMouse()
se... | def mouse_up(self, evt, wx_obj=None):
"Release the selected object (pass a wx_obj if the event was captured)"
self.resizing = False
if self.current:
wx_obj = self.current
if self.parent.wx_obj.HasCapture():
self.parent.wx_obj.ReleaseMouse()
se... | [
"Release",
"the",
"selected",
"object",
"(",
"pass",
"a",
"wx_obj",
"if",
"the",
"event",
"was",
"captured",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L267-L301 | [
"def",
"mouse_up",
"(",
"self",
",",
"evt",
",",
"wx_obj",
"=",
"None",
")",
":",
"self",
".",
"resizing",
"=",
"False",
"if",
"self",
".",
"current",
":",
"wx_obj",
"=",
"self",
".",
"current",
"if",
"self",
".",
"parent",
".",
"wx_obj",
".",
"Has... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | BasicDesigner.key_press | support cursor keys to move components one pixel at a time | gui/tools/designer.py | def key_press(self, event):
"support cursor keys to move components one pixel at a time"
key = event.GetKeyCode()
if key in (wx.WXK_LEFT, wx.WXK_UP, wx.WXK_RIGHT, wx.WXK_DOWN):
for obj in self.selection:
x, y = obj.pos
if event.ShiftDown(): # snap ... | def key_press(self, event):
"support cursor keys to move components one pixel at a time"
key = event.GetKeyCode()
if key in (wx.WXK_LEFT, wx.WXK_UP, wx.WXK_RIGHT, wx.WXK_DOWN):
for obj in self.selection:
x, y = obj.pos
if event.ShiftDown(): # snap ... | [
"support",
"cursor",
"keys",
"to",
"move",
"components",
"one",
"pixel",
"at",
"a",
"time"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L303-L335 | [
"def",
"key_press",
"(",
"self",
",",
"event",
")",
":",
"key",
"=",
"event",
".",
"GetKeyCode",
"(",
")",
"if",
"key",
"in",
"(",
"wx",
".",
"WXK_LEFT",
",",
"wx",
".",
"WXK_UP",
",",
"wx",
".",
"WXK_RIGHT",
",",
"wx",
".",
"WXK_DOWN",
")",
":",... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | BasicDesigner.delete | delete all of the selected objects | gui/tools/designer.py | def delete(self, event):
"delete all of the selected objects"
# get the selected objects (if any)
for obj in self.selection:
if obj:
if DEBUG: print "deleting", obj.name
obj.destroy()
self.selection = [] # clean selectio... | def delete(self, event):
"delete all of the selected objects"
# get the selected objects (if any)
for obj in self.selection:
if obj:
if DEBUG: print "deleting", obj.name
obj.destroy()
self.selection = [] # clean selectio... | [
"delete",
"all",
"of",
"the",
"selected",
"objects"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L337-L345 | [
"def",
"delete",
"(",
"self",
",",
"event",
")",
":",
"# get the selected objects (if any)",
"for",
"obj",
"in",
"self",
".",
"selection",
":",
"if",
"obj",
":",
"if",
"DEBUG",
":",
"print",
"\"deleting\"",
",",
"obj",
".",
"name",
"obj",
".",
"destroy",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | BasicDesigner.duplicate | create a copy of each selected object | gui/tools/designer.py | def duplicate(self, event):
"create a copy of each selected object"
# duplicate the selected objects (if any)
new_selection = []
for obj in self.selection:
if obj:
if DEBUG: print "duplicating", obj.name
obj.sel_marker.destroy()
... | def duplicate(self, event):
"create a copy of each selected object"
# duplicate the selected objects (if any)
new_selection = []
for obj in self.selection:
if obj:
if DEBUG: print "duplicating", obj.name
obj.sel_marker.destroy()
... | [
"create",
"a",
"copy",
"of",
"each",
"selected",
"object"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L347-L361 | [
"def",
"duplicate",
"(",
"self",
",",
"event",
")",
":",
"# duplicate the selected objects (if any)",
"new_selection",
"=",
"[",
"]",
"for",
"obj",
"in",
"self",
".",
"selection",
":",
"if",
"obj",
":",
"if",
"DEBUG",
":",
"print",
"\"duplicating\"",
",",
"o... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Facade.update | Adjust facade with the dimensions of the original object (and repaint) | gui/tools/designer.py | def update(self):
"Adjust facade with the dimensions of the original object (and repaint)"
x, y = self.obj.wx_obj.GetPosition()
w, h = self.obj.wx_obj.GetSize()
self.Hide()
self.Move((x, y))
self.SetSize((w, h))
# allow original control to repaint before taking th... | def update(self):
"Adjust facade with the dimensions of the original object (and repaint)"
x, y = self.obj.wx_obj.GetPosition()
w, h = self.obj.wx_obj.GetSize()
self.Hide()
self.Move((x, y))
self.SetSize((w, h))
# allow original control to repaint before taking th... | [
"Adjust",
"facade",
"with",
"the",
"dimensions",
"of",
"the",
"original",
"object",
"(",
"and",
"repaint",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L536-L544 | [
"def",
"update",
"(",
"self",
")",
":",
"x",
",",
"y",
"=",
"self",
".",
"obj",
".",
"wx_obj",
".",
"GetPosition",
"(",
")",
"w",
",",
"h",
"=",
"self",
".",
"obj",
".",
"wx_obj",
".",
"GetSize",
"(",
")",
"self",
".",
"Hide",
"(",
")",
"self... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Facade.refresh | Capture the new control superficial image after an update | gui/tools/designer.py | def refresh(self):
"Capture the new control superficial image after an update"
self.bmp = self.obj.snapshot()
# change z-order to overlap controls (windows) and show the image:
self.Raise()
self.Show()
self.Refresh() | def refresh(self):
"Capture the new control superficial image after an update"
self.bmp = self.obj.snapshot()
# change z-order to overlap controls (windows) and show the image:
self.Raise()
self.Show()
self.Refresh() | [
"Capture",
"the",
"new",
"control",
"superficial",
"image",
"after",
"an",
"update"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L546-L552 | [
"def",
"refresh",
"(",
"self",
")",
":",
"self",
".",
"bmp",
"=",
"self",
".",
"obj",
".",
"snapshot",
"(",
")",
"# change z-order to overlap controls (windows) and show the image:",
"self",
".",
"Raise",
"(",
")",
"self",
".",
"Show",
"(",
")",
"self",
".",... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | CustomToolTipWindow.CalculateBestPosition | When dealing with a Top-Level window position it absolute lower-right | gui/tools/designer.py | def CalculateBestPosition(self,widget):
"When dealing with a Top-Level window position it absolute lower-right"
if isinstance(widget, wx.Frame):
screen = wx.ClientDisplayRect()[2:]
left,top = widget.ClientToScreenXY(0,0)
right,bottom = widget.ClientToScreenXY(*widget.... | def CalculateBestPosition(self,widget):
"When dealing with a Top-Level window position it absolute lower-right"
if isinstance(widget, wx.Frame):
screen = wx.ClientDisplayRect()[2:]
left,top = widget.ClientToScreenXY(0,0)
right,bottom = widget.ClientToScreenXY(*widget.... | [
"When",
"dealing",
"with",
"a",
"Top",
"-",
"Level",
"window",
"position",
"it",
"absolute",
"lower",
"-",
"right"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/tools/designer.py#L636-L647 | [
"def",
"CalculateBestPosition",
"(",
"self",
",",
"widget",
")",
":",
"if",
"isinstance",
"(",
"widget",
",",
"wx",
".",
"Frame",
")",
":",
"screen",
"=",
"wx",
".",
"ClientDisplayRect",
"(",
")",
"[",
"2",
":",
"]",
"left",
",",
"top",
"=",
"widget"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | wx_ListCtrl.GetPyData | Returns the pyth item data associated with the item | gui/controls/listview.py | def GetPyData(self, item):
"Returns the pyth item data associated with the item"
wx_data = self.GetItemData(item)
py_data = self._py_data_map.get(wx_data)
return py_data | def GetPyData(self, item):
"Returns the pyth item data associated with the item"
wx_data = self.GetItemData(item)
py_data = self._py_data_map.get(wx_data)
return py_data | [
"Returns",
"the",
"pyth",
"item",
"data",
"associated",
"with",
"the",
"item"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listview.py#L58-L62 | [
"def",
"GetPyData",
"(",
"self",
",",
"item",
")",
":",
"wx_data",
"=",
"self",
".",
"GetItemData",
"(",
"item",
")",
"py_data",
"=",
"self",
".",
"_py_data_map",
".",
"get",
"(",
"wx_data",
")",
"return",
"py_data"
] | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | wx_ListCtrl.SetPyData | Set the python item data associated wit the wx item | gui/controls/listview.py | def SetPyData(self, item, py_data):
"Set the python item data associated wit the wx item"
wx_data = wx.NewId() # create a suitable key
self.SetItemData(item, wx_data) # store it in wx
self._py_data_map[wx_data] = py_data # map it internally
... | def SetPyData(self, item, py_data):
"Set the python item data associated wit the wx item"
wx_data = wx.NewId() # create a suitable key
self.SetItemData(item, wx_data) # store it in wx
self._py_data_map[wx_data] = py_data # map it internally
... | [
"Set",
"the",
"python",
"item",
"data",
"associated",
"wit",
"the",
"wx",
"item"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listview.py#L64-L70 | [
"def",
"SetPyData",
"(",
"self",
",",
"item",
",",
"py_data",
")",
":",
"wx_data",
"=",
"wx",
".",
"NewId",
"(",
")",
"# create a suitable key\r",
"self",
".",
"SetItemData",
"(",
"item",
",",
"wx_data",
")",
"# store it in wx \r",
"self",
".",
"_py_data_map... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | wx_ListCtrl.FindPyData | Do a reverse look up for an item containing the requested data | gui/controls/listview.py | def FindPyData(self, start, py_data):
"Do a reverse look up for an item containing the requested data"
# first, look at our internal dict:
wx_data = self._wx_data_map[py_data]
# do the real search at the wx control:
if wx.VERSION < (3, 0, 0) or 'classic' in wx.version():
... | def FindPyData(self, start, py_data):
"Do a reverse look up for an item containing the requested data"
# first, look at our internal dict:
wx_data = self._wx_data_map[py_data]
# do the real search at the wx control:
if wx.VERSION < (3, 0, 0) or 'classic' in wx.version():
... | [
"Do",
"a",
"reverse",
"look",
"up",
"for",
"an",
"item",
"containing",
"the",
"requested",
"data"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listview.py#L72-L81 | [
"def",
"FindPyData",
"(",
"self",
",",
"start",
",",
"py_data",
")",
":",
"# first, look at our internal dict:\r",
"wx_data",
"=",
"self",
".",
"_wx_data_map",
"[",
"py_data",
"]",
"# do the real search at the wx control:\r",
"if",
"wx",
".",
"VERSION",
"<",
"(",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | wx_ListCtrl.DeleteItem | Remove the item from the list and unset the related data | gui/controls/listview.py | def DeleteItem(self, item):
"Remove the item from the list and unset the related data"
wx_data = self.GetItemData(item)
py_data = self._py_data_map[wx_data]
del self._py_data_map[wx_data]
del self._wx_data_map[py_data]
wx.ListCtrl.DeleteItem(self, item) | def DeleteItem(self, item):
"Remove the item from the list and unset the related data"
wx_data = self.GetItemData(item)
py_data = self._py_data_map[wx_data]
del self._py_data_map[wx_data]
del self._wx_data_map[py_data]
wx.ListCtrl.DeleteItem(self, item) | [
"Remove",
"the",
"item",
"from",
"the",
"list",
"and",
"unset",
"the",
"related",
"data"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listview.py#L83-L89 | [
"def",
"DeleteItem",
"(",
"self",
",",
"item",
")",
":",
"wx_data",
"=",
"self",
".",
"GetItemData",
"(",
"item",
")",
"py_data",
"=",
"self",
".",
"_py_data_map",
"[",
"wx_data",
"]",
"del",
"self",
".",
"_py_data_map",
"[",
"wx_data",
"]",
"del",
"se... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | wx_ListCtrl.DeleteAllItems | Remove all the item from the list and unset the related data | gui/controls/listview.py | def DeleteAllItems(self):
"Remove all the item from the list and unset the related data"
self._py_data_map.clear()
self._wx_data_map.clear()
wx.ListCtrl.DeleteAllItems(self) | def DeleteAllItems(self):
"Remove all the item from the list and unset the related data"
self._py_data_map.clear()
self._wx_data_map.clear()
wx.ListCtrl.DeleteAllItems(self) | [
"Remove",
"all",
"the",
"item",
"from",
"the",
"list",
"and",
"unset",
"the",
"related",
"data"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listview.py#L91-L95 | [
"def",
"DeleteAllItems",
"(",
"self",
")",
":",
"self",
".",
"_py_data_map",
".",
"clear",
"(",
")",
"self",
".",
"_wx_data_map",
".",
"clear",
"(",
")",
"wx",
".",
"ListCtrl",
".",
"DeleteAllItems",
"(",
"self",
")"
] | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ListView.set_count | Set item (row) count -useful only in virtual mode- | gui/controls/listview.py | def set_count(self, value):
"Set item (row) count -useful only in virtual mode-"
if self.view == "report" and self.virtual and value is not None:
self.wx_obj.SetItemCount(value) | def set_count(self, value):
"Set item (row) count -useful only in virtual mode-"
if self.view == "report" and self.virtual and value is not None:
self.wx_obj.SetItemCount(value) | [
"Set",
"item",
"(",
"row",
")",
"count",
"-",
"useful",
"only",
"in",
"virtual",
"mode",
"-"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listview.py#L125-L128 | [
"def",
"set_count",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"view",
"==",
"\"report\"",
"and",
"self",
".",
"virtual",
"and",
"value",
"is",
"not",
"None",
":",
"self",
".",
"wx_obj",
".",
"SetItemCount",
"(",
"value",
")"
] | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ListView.delete | Deletes the item at the zero-based index 'n' from the control. | gui/controls/listview.py | def delete(self, a_position):
"Deletes the item at the zero-based index 'n' from the control."
key = self.wx_obj.GetPyData(a_position)
del self._items[key] | def delete(self, a_position):
"Deletes the item at the zero-based index 'n' from the control."
key = self.wx_obj.GetPyData(a_position)
del self._items[key] | [
"Deletes",
"the",
"item",
"at",
"the",
"zero",
"-",
"based",
"index",
"n",
"from",
"the",
"control",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listview.py#L150-L153 | [
"def",
"delete",
"(",
"self",
",",
"a_position",
")",
":",
"key",
"=",
"self",
".",
"wx_obj",
".",
"GetPyData",
"(",
"a_position",
")",
"del",
"self",
".",
"_items",
"[",
"key",
"]"
] | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ListView.clear_all | Remove all items and column headings | gui/controls/listview.py | def clear_all(self):
"Remove all items and column headings"
self.clear()
for ch in reversed(self.columns):
del self[ch.name] | def clear_all(self):
"Remove all items and column headings"
self.clear()
for ch in reversed(self.columns):
del self[ch.name] | [
"Remove",
"all",
"items",
"and",
"column",
"headings"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listview.py#L183-L187 | [
"def",
"clear_all",
"(",
"self",
")",
":",
"self",
".",
"clear",
"(",
")",
"for",
"ch",
"in",
"reversed",
"(",
"self",
".",
"columns",
")",
":",
"del",
"self",
"[",
"ch",
".",
"name",
"]"
] | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ListColumn.set_parent | Associate the header to the control (it could be recreated) | gui/controls/listview.py | def set_parent(self, new_parent, init=False):
"Associate the header to the control (it could be recreated)"
self._created = False
SubComponent.set_parent(self, new_parent, init)
# if index not given, append the column at the last position:
if self.index == -1 or self.index >... | def set_parent(self, new_parent, init=False):
"Associate the header to the control (it could be recreated)"
self._created = False
SubComponent.set_parent(self, new_parent, init)
# if index not given, append the column at the last position:
if self.index == -1 or self.index >... | [
"Associate",
"the",
"header",
"to",
"the",
"control",
"(",
"it",
"could",
"be",
"recreated",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listview.py#L248-L258 | [
"def",
"set_parent",
"(",
"self",
",",
"new_parent",
",",
"init",
"=",
"False",
")",
":",
"self",
".",
"_created",
"=",
"False",
"SubComponent",
".",
"set_parent",
"(",
"self",
",",
"new_parent",
",",
"init",
")",
"# if index not given, append the column at the ... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ListModel.clear | Remove all items and reset internal structures | gui/controls/listview.py | def clear(self):
"Remove all items and reset internal structures"
dict.clear(self)
self._key = 0
if hasattr(self._list_view, "wx_obj"):
self._list_view.wx_obj.DeleteAllItems() | def clear(self):
"Remove all items and reset internal structures"
dict.clear(self)
self._key = 0
if hasattr(self._list_view, "wx_obj"):
self._list_view.wx_obj.DeleteAllItems() | [
"Remove",
"all",
"items",
"and",
"reset",
"internal",
"structures"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listview.py#L397-L402 | [
"def",
"clear",
"(",
"self",
")",
":",
"dict",
".",
"clear",
"(",
"self",
")",
"self",
".",
"_key",
"=",
"0",
"if",
"hasattr",
"(",
"self",
".",
"_list_view",
",",
"\"wx_obj\"",
")",
":",
"self",
".",
"_list_view",
".",
"wx_obj",
".",
"DeleteAllItems... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ItemContainerControl._get_selection | Returns the index of the selected item (list for multiselect) or None | gui/controls/listbox.py | def _get_selection(self):
"Returns the index of the selected item (list for multiselect) or None"
if self.multiselect:
return self.wx_obj.GetSelections()
else:
sel = self.wx_obj.GetSelection()
if sel == wx.NOT_FOUND:
return None
... | def _get_selection(self):
"Returns the index of the selected item (list for multiselect) or None"
if self.multiselect:
return self.wx_obj.GetSelections()
else:
sel = self.wx_obj.GetSelection()
if sel == wx.NOT_FOUND:
return None
... | [
"Returns",
"the",
"index",
"of",
"the",
"selected",
"item",
"(",
"list",
"for",
"multiselect",
")",
"or",
"None"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listbox.py#L23-L32 | [
"def",
"_get_selection",
"(",
"self",
")",
":",
"if",
"self",
".",
"multiselect",
":",
"return",
"self",
".",
"wx_obj",
".",
"GetSelections",
"(",
")",
"else",
":",
"sel",
"=",
"self",
".",
"wx_obj",
".",
"GetSelection",
"(",
")",
"if",
"sel",
"==",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ItemContainerControl._set_selection | Sets the item at index 'n' to be the selected item. | gui/controls/listbox.py | def _set_selection(self, index, dummy=False):
"Sets the item at index 'n' to be the selected item."
# only change selection if index is None and not dummy:
if index is None:
self.wx_obj.SetSelection(-1)
# clean up text if control supports it:
if hasattr(... | def _set_selection(self, index, dummy=False):
"Sets the item at index 'n' to be the selected item."
# only change selection if index is None and not dummy:
if index is None:
self.wx_obj.SetSelection(-1)
# clean up text if control supports it:
if hasattr(... | [
"Sets",
"the",
"item",
"at",
"index",
"n",
"to",
"be",
"the",
"selected",
"item",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listbox.py#L34-L52 | [
"def",
"_set_selection",
"(",
"self",
",",
"index",
",",
"dummy",
"=",
"False",
")",
":",
"# only change selection if index is None and not dummy:\r",
"if",
"index",
"is",
"None",
":",
"self",
".",
"wx_obj",
".",
"SetSelection",
"(",
"-",
"1",
")",
"# clean up t... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ItemContainerControl._get_string_selection | Returns the label of the selected item or an empty string if none | gui/controls/listbox.py | def _get_string_selection(self):
"Returns the label of the selected item or an empty string if none"
if self.multiselect:
return [self.wx_obj.GetString(i) for i in
self.wx_obj.GetSelections()]
else:
return self.wx_obj.GetStringSelection() | def _get_string_selection(self):
"Returns the label of the selected item or an empty string if none"
if self.multiselect:
return [self.wx_obj.GetString(i) for i in
self.wx_obj.GetSelections()]
else:
return self.wx_obj.GetStringSelection() | [
"Returns",
"the",
"label",
"of",
"the",
"selected",
"item",
"or",
"an",
"empty",
"string",
"if",
"none"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listbox.py#L54-L60 | [
"def",
"_get_string_selection",
"(",
"self",
")",
":",
"if",
"self",
".",
"multiselect",
":",
"return",
"[",
"self",
".",
"wx_obj",
".",
"GetString",
"(",
"i",
")",
"for",
"i",
"in",
"self",
".",
"wx_obj",
".",
"GetSelections",
"(",
")",
"]",
"else",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ItemContainerControl._set_items | Clear and set the strings (and data if any) in the control from a list | gui/controls/listbox.py | def _set_items(self, a_iter):
"Clear and set the strings (and data if any) in the control from a list"
self._items_dict = {}
if not a_iter:
string_list = []
data_list = []
elif not isinstance(a_iter, (tuple, list, dict)):
raise ValueError("ite... | def _set_items(self, a_iter):
"Clear and set the strings (and data if any) in the control from a list"
self._items_dict = {}
if not a_iter:
string_list = []
data_list = []
elif not isinstance(a_iter, (tuple, list, dict)):
raise ValueError("ite... | [
"Clear",
"and",
"set",
"the",
"strings",
"(",
"and",
"data",
"if",
"any",
")",
"in",
"the",
"control",
"from",
"a",
"list"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listbox.py#L101-L128 | [
"def",
"_set_items",
"(",
"self",
",",
"a_iter",
")",
":",
"self",
".",
"_items_dict",
"=",
"{",
"}",
"if",
"not",
"a_iter",
":",
"string_list",
"=",
"[",
"]",
"data_list",
"=",
"[",
"]",
"elif",
"not",
"isinstance",
"(",
"a_iter",
",",
"(",
"tuple",... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ItemContainerControl.set_data | Associate the given client data with the item at position n. | gui/controls/listbox.py | def set_data(self, n, data):
"Associate the given client data with the item at position n."
self.wx_obj.SetClientData(n, data)
# reverse association:
self._items_dict[data] = self.get_string(n) | def set_data(self, n, data):
"Associate the given client data with the item at position n."
self.wx_obj.SetClientData(n, data)
# reverse association:
self._items_dict[data] = self.get_string(n) | [
"Associate",
"the",
"given",
"client",
"data",
"with",
"the",
"item",
"at",
"position",
"n",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listbox.py#L130-L134 | [
"def",
"set_data",
"(",
"self",
",",
"n",
",",
"data",
")",
":",
"self",
".",
"wx_obj",
".",
"SetClientData",
"(",
"n",
",",
"data",
")",
"# reverse association:\r",
"self",
".",
"_items_dict",
"[",
"data",
"]",
"=",
"self",
".",
"get_string",
"(",
"n"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ItemContainerControl.append | Adds the item to the control, associating the given data if not None. | gui/controls/listbox.py | def append(self, a_string, data=None):
"Adds the item to the control, associating the given data if not None."
self.wx_obj.Append(a_string, data)
# reverse association:
self._items_dict[data] = a_string | def append(self, a_string, data=None):
"Adds the item to the control, associating the given data if not None."
self.wx_obj.Append(a_string, data)
# reverse association:
self._items_dict[data] = a_string | [
"Adds",
"the",
"item",
"to",
"the",
"control",
"associating",
"the",
"given",
"data",
"if",
"not",
"None",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listbox.py#L140-L144 | [
"def",
"append",
"(",
"self",
",",
"a_string",
",",
"data",
"=",
"None",
")",
":",
"self",
".",
"wx_obj",
".",
"Append",
"(",
"a_string",
",",
"data",
")",
"# reverse association:\r",
"self",
".",
"_items_dict",
"[",
"data",
"]",
"=",
"a_string"
] | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ItemContainerControl.delete | Deletes the item at the zero-based index 'n' from the control. | gui/controls/listbox.py | def delete(self, a_position):
"Deletes the item at the zero-based index 'n' from the control."
self.wx_obj.Delete(a_position)
data = self.get_data()
if data in self._items_dict:
del self._items_dict[data] | def delete(self, a_position):
"Deletes the item at the zero-based index 'n' from the control."
self.wx_obj.Delete(a_position)
data = self.get_data()
if data in self._items_dict:
del self._items_dict[data] | [
"Deletes",
"the",
"item",
"at",
"the",
"zero",
"-",
"based",
"index",
"n",
"from",
"the",
"control",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/listbox.py#L155-L160 | [
"def",
"delete",
"(",
"self",
",",
"a_position",
")",
":",
"self",
".",
"wx_obj",
".",
"Delete",
"(",
"a_position",
")",
"data",
"=",
"self",
".",
"get_data",
"(",
")",
"if",
"data",
"in",
"self",
".",
"_items_dict",
":",
"del",
"self",
".",
"_items_... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | represent | Construct a string representing the object | gui/component.py | def represent(obj, prefix, parent="", indent=0, context=False, max_cols=80):
"Construct a string representing the object"
try:
name = getattr(obj, "name", "")
class_name = "%s.%s" % (prefix, obj.__class__.__name__)
padding = len(class_name) + 1 + indent * 4 + (5 if context else 0)
... | def represent(obj, prefix, parent="", indent=0, context=False, max_cols=80):
"Construct a string representing the object"
try:
name = getattr(obj, "name", "")
class_name = "%s.%s" % (prefix, obj.__class__.__name__)
padding = len(class_name) + 1 + indent * 4 + (5 if context else 0)
... | [
"Construct",
"a",
"string",
"representing",
"the",
"object"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L1138-L1180 | [
"def",
"represent",
"(",
"obj",
",",
"prefix",
",",
"parent",
"=",
"\"\"",
",",
"indent",
"=",
"0",
",",
"context",
"=",
"False",
",",
"max_cols",
"=",
"80",
")",
":",
"try",
":",
"name",
"=",
"getattr",
"(",
"obj",
",",
"\"name\"",
",",
"\"\"",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | get | Find an object already created | gui/component.py | def get(obj_name, init=False):
"Find an object already created"
wx_parent = None
# check if new_parent is given as string (useful for designer!)
if isinstance(obj_name, basestring):
# find the object reference in the already created gui2py objects
# TODO: only useful for designer, ... | def get(obj_name, init=False):
"Find an object already created"
wx_parent = None
# check if new_parent is given as string (useful for designer!)
if isinstance(obj_name, basestring):
# find the object reference in the already created gui2py objects
# TODO: only useful for designer, ... | [
"Find",
"an",
"object",
"already",
"created"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L1183-L1204 | [
"def",
"get",
"(",
"obj_name",
",",
"init",
"=",
"False",
")",
":",
"wx_parent",
"=",
"None",
"# check if new_parent is given as string (useful for designer!)\r",
"if",
"isinstance",
"(",
"obj_name",
",",
"basestring",
")",
":",
"# find the object reference in the already... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Component.rebuild | Recreate (if needed) the wx_obj and apply new properties | gui/component.py | def rebuild(self, recreate=True, force=False, **kwargs):
"Recreate (if needed) the wx_obj and apply new properties"
# detect if this involves a spec that needs to recreate the wx_obj:
needs_rebuild = any([isinstance(spec, (StyleSpec, InitSpec))
for spec_name, sp... | def rebuild(self, recreate=True, force=False, **kwargs):
"Recreate (if needed) the wx_obj and apply new properties"
# detect if this involves a spec that needs to recreate the wx_obj:
needs_rebuild = any([isinstance(spec, (StyleSpec, InitSpec))
for spec_name, sp... | [
"Recreate",
"(",
"if",
"needed",
")",
"the",
"wx_obj",
"and",
"apply",
"new",
"properties"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L235-L249 | [
"def",
"rebuild",
"(",
"self",
",",
"recreate",
"=",
"True",
",",
"force",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# detect if this involves a spec that needs to recreate the wx_obj:\r",
"needs_rebuild",
"=",
"any",
"(",
"[",
"isinstance",
"(",
"spec",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Component.destroy | Remove event references and destroy wx object (and children) | gui/component.py | def destroy(self):
"Remove event references and destroy wx object (and children)"
# unreference the obj from the components map and parent
if self._name:
del COMPONENTS[self._get_fully_qualified_name()]
if DEBUG: print "deleted from components!"
if isins... | def destroy(self):
"Remove event references and destroy wx object (and children)"
# unreference the obj from the components map and parent
if self._name:
del COMPONENTS[self._get_fully_qualified_name()]
if DEBUG: print "deleted from components!"
if isins... | [
"Remove",
"event",
"references",
"and",
"destroy",
"wx",
"object",
"(",
"and",
"children",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L256-L275 | [
"def",
"destroy",
"(",
"self",
")",
":",
"# unreference the obj from the components map and parent\r",
"if",
"self",
".",
"_name",
":",
"del",
"COMPONENTS",
"[",
"self",
".",
"_get_fully_qualified_name",
"(",
")",
"]",
"if",
"DEBUG",
":",
"print",
"\"deleted from co... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Component.duplicate | Create a new object exactly similar to self | gui/component.py | def duplicate(self, new_parent=None):
"Create a new object exactly similar to self"
kwargs = {}
for spec_name, spec in self._meta.specs.items():
value = getattr(self, spec_name)
if isinstance(value, Color):
print "COLOR", value, value.default
... | def duplicate(self, new_parent=None):
"Create a new object exactly similar to self"
kwargs = {}
for spec_name, spec in self._meta.specs.items():
value = getattr(self, spec_name)
if isinstance(value, Color):
print "COLOR", value, value.default
... | [
"Create",
"a",
"new",
"object",
"exactly",
"similar",
"to",
"self"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L277-L296 | [
"def",
"duplicate",
"(",
"self",
",",
"new_parent",
"=",
"None",
")",
":",
"kwargs",
"=",
"{",
"}",
"for",
"spec_name",
",",
"spec",
"in",
"self",
".",
"_meta",
".",
"specs",
".",
"items",
"(",
")",
":",
"value",
"=",
"getattr",
"(",
"self",
",",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Component.reindex | Raises/lower the component in the window hierarchy (Z-order/tab order) | gui/component.py | def reindex(self, z=None):
"Raises/lower the component in the window hierarchy (Z-order/tab order)"
# z=0: lowers(first index), z=-1: raises (last)
# actually, only useful in design mode
if isinstance(self._parent, Component):
# get the current index (z-order)
... | def reindex(self, z=None):
"Raises/lower the component in the window hierarchy (Z-order/tab order)"
# z=0: lowers(first index), z=-1: raises (last)
# actually, only useful in design mode
if isinstance(self._parent, Component):
# get the current index (z-order)
... | [
"Raises",
"/",
"lower",
"the",
"component",
"in",
"the",
"window",
"hierarchy",
"(",
"Z",
"-",
"order",
"/",
"tab",
"order",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L298-L317 | [
"def",
"reindex",
"(",
"self",
",",
"z",
"=",
"None",
")",
":",
"# z=0: lowers(first index), z=-1: raises (last)\r",
"# actually, only useful in design mode\r",
"if",
"isinstance",
"(",
"self",
".",
"_parent",
",",
"Component",
")",
":",
"# get the current index (z-order)... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Component.set_parent | Store the gui/wx object parent for this component | gui/component.py | def set_parent(self, new_parent, init=False):
"Store the gui/wx object parent for this component"
# set init=True if this is called from the constructor
self._parent = get(new_parent, init) | def set_parent(self, new_parent, init=False):
"Store the gui/wx object parent for this component"
# set init=True if this is called from the constructor
self._parent = get(new_parent, init) | [
"Store",
"the",
"gui",
"/",
"wx",
"object",
"parent",
"for",
"this",
"component"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L365-L368 | [
"def",
"set_parent",
"(",
"self",
",",
"new_parent",
",",
"init",
"=",
"False",
")",
":",
"# set init=True if this is called from the constructor\r",
"self",
".",
"_parent",
"=",
"get",
"(",
"new_parent",
",",
"init",
")"
] | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Component._get_parent_name | Return parent window name (used in __repr__ parent spec) | gui/component.py | def _get_parent_name(self):
"Return parent window name (used in __repr__ parent spec)"
parent = self.get_parent()
parent_names = []
while parent:
if isinstance(parent, Component):
parent_name = parent.name
# Top Level Windows has no pare... | def _get_parent_name(self):
"Return parent window name (used in __repr__ parent spec)"
parent = self.get_parent()
parent_names = []
while parent:
if isinstance(parent, Component):
parent_name = parent.name
# Top Level Windows has no pare... | [
"Return",
"parent",
"window",
"name",
"(",
"used",
"in",
"__repr__",
"parent",
"spec",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L374-L390 | [
"def",
"_get_parent_name",
"(",
"self",
")",
":",
"parent",
"=",
"self",
".",
"get_parent",
"(",
")",
"parent_names",
"=",
"[",
"]",
"while",
"parent",
":",
"if",
"isinstance",
"(",
"parent",
",",
"Component",
")",
":",
"parent_name",
"=",
"parent",
".",... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Component._get_fully_qualified_name | return full parents name + self name (useful as key) | gui/component.py | def _get_fully_qualified_name(self):
"return full parents name + self name (useful as key)"
parent_name = self._get_parent_name()
if not parent_name:
return self._name
else:
return "%s.%s" % (parent_name, self._name) | def _get_fully_qualified_name(self):
"return full parents name + self name (useful as key)"
parent_name = self._get_parent_name()
if not parent_name:
return self._name
else:
return "%s.%s" % (parent_name, self._name) | [
"return",
"full",
"parents",
"name",
"+",
"self",
"name",
"(",
"useful",
"as",
"key",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L392-L398 | [
"def",
"_get_fully_qualified_name",
"(",
"self",
")",
":",
"parent_name",
"=",
"self",
".",
"_get_parent_name",
"(",
")",
"if",
"not",
"parent_name",
":",
"return",
"self",
".",
"_name",
"else",
":",
"return",
"\"%s.%s\"",
"%",
"(",
"parent_name",
",",
"self... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | DesignerMixin.snapshot | Capture the screen appearance of the control (to be used as facade) | gui/component.py | def snapshot(self):
"Capture the screen appearance of the control (to be used as facade)"
width, height = self.wx_obj.GetSize()
bmp = wx.EmptyBitmap(width, height)
wdc = wx.ClientDC(self.wx_obj)
mdc = wx.MemoryDC(bmp)
mdc.Blit(0, 0, width, height, wdc, 0, 0)
... | def snapshot(self):
"Capture the screen appearance of the control (to be used as facade)"
width, height = self.wx_obj.GetSize()
bmp = wx.EmptyBitmap(width, height)
wdc = wx.ClientDC(self.wx_obj)
mdc = wx.MemoryDC(bmp)
mdc.Blit(0, 0, width, height, wdc, 0, 0)
... | [
"Capture",
"the",
"screen",
"appearance",
"of",
"the",
"control",
"(",
"to",
"be",
"used",
"as",
"facade",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L595-L605 | [
"def",
"snapshot",
"(",
"self",
")",
":",
"width",
",",
"height",
"=",
"self",
".",
"wx_obj",
".",
"GetSize",
"(",
")",
"bmp",
"=",
"wx",
".",
"EmptyBitmap",
"(",
"width",
",",
"height",
")",
"wdc",
"=",
"wx",
".",
"ClientDC",
"(",
"self",
".",
"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | SizerMixin._sizer_add | called when adding a control to the window | gui/component.py | def _sizer_add(self, child):
"called when adding a control to the window"
if self.sizer:
if DEBUG: print "adding to sizer:", child.name
border = None
if not border:
border = child.sizer_border
flags = child._sizer_flags
... | def _sizer_add(self, child):
"called when adding a control to the window"
if self.sizer:
if DEBUG: print "adding to sizer:", child.name
border = None
if not border:
border = child.sizer_border
flags = child._sizer_flags
... | [
"called",
"when",
"adding",
"a",
"control",
"to",
"the",
"window"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L672-L689 | [
"def",
"_sizer_add",
"(",
"self",
",",
"child",
")",
":",
"if",
"self",
".",
"sizer",
":",
"if",
"DEBUG",
":",
"print",
"\"adding to sizer:\"",
",",
"child",
".",
"name",
"border",
"=",
"None",
"if",
"not",
"border",
":",
"border",
"=",
"child",
".",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ControlSuper.set_parent | Re-parent a child control with the new wx_obj parent | gui/component.py | def set_parent(self, new_parent, init=False):
"Re-parent a child control with the new wx_obj parent"
Component.set_parent(self, new_parent, init)
# if not called from constructor, we must also reparent in wx:
if not init:
if DEBUG: print "reparenting", ctrl.name
... | def set_parent(self, new_parent, init=False):
"Re-parent a child control with the new wx_obj parent"
Component.set_parent(self, new_parent, init)
# if not called from constructor, we must also reparent in wx:
if not init:
if DEBUG: print "reparenting", ctrl.name
... | [
"Re",
"-",
"parent",
"a",
"child",
"control",
"with",
"the",
"new",
"wx_obj",
"parent"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L730-L737 | [
"def",
"set_parent",
"(",
"self",
",",
"new_parent",
",",
"init",
"=",
"False",
")",
":",
"Component",
".",
"set_parent",
"(",
"self",
",",
"new_parent",
",",
"init",
")",
"# if not called from constructor, we must also reparent in wx:\r",
"if",
"not",
"init",
":"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ControlSuper._calc_dimension | Calculate final pos and size (auto, absolute in pixels & relativa) | gui/component.py | def _calc_dimension(self, dim_val, dim_max, font_dim):
"Calculate final pos and size (auto, absolute in pixels & relativa)"
if dim_val is None:
return -1 # let wx automatic pos/size
elif isinstance(dim_val, int):
return dim_val # use fixed pixel value (absolute)
... | def _calc_dimension(self, dim_val, dim_max, font_dim):
"Calculate final pos and size (auto, absolute in pixels & relativa)"
if dim_val is None:
return -1 # let wx automatic pos/size
elif isinstance(dim_val, int):
return dim_val # use fixed pixel value (absolute)
... | [
"Calculate",
"final",
"pos",
"and",
"size",
"(",
"auto",
"absolute",
"in",
"pixels",
"&",
"relativa",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L741-L761 | [
"def",
"_calc_dimension",
"(",
"self",
",",
"dim_val",
",",
"dim_max",
",",
"font_dim",
")",
":",
"if",
"dim_val",
"is",
"None",
":",
"return",
"-",
"1",
"# let wx automatic pos/size\r",
"elif",
"isinstance",
"(",
"dim_val",
",",
"int",
")",
":",
"return",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ControlSuper.resize | automatically adjust relative pos and size of children controls | gui/component.py | def resize(self, evt=None):
"automatically adjust relative pos and size of children controls"
if DEBUG: print "RESIZE!", self.name, self.width, self.height
if not isinstance(self.wx_obj, wx.TopLevelWindow):
# check that size and pos is relative, then resize/move
if s... | def resize(self, evt=None):
"automatically adjust relative pos and size of children controls"
if DEBUG: print "RESIZE!", self.name, self.width, self.height
if not isinstance(self.wx_obj, wx.TopLevelWindow):
# check that size and pos is relative, then resize/move
if s... | [
"automatically",
"adjust",
"relative",
"pos",
"and",
"size",
"of",
"children",
"controls"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L866-L884 | [
"def",
"resize",
"(",
"self",
",",
"evt",
"=",
"None",
")",
":",
"if",
"DEBUG",
":",
"print",
"\"RESIZE!\"",
",",
"self",
".",
"name",
",",
"self",
".",
"width",
",",
"self",
".",
"height",
"if",
"not",
"isinstance",
"(",
"self",
".",
"wx_obj",
","... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ImageBackgroundMixin.__tile_background | make several copies of the background bitmap | gui/component.py | def __tile_background(self, dc):
"make several copies of the background bitmap"
sz = self.wx_obj.GetClientSize()
bmp = self._bitmap.get_bits()
w = bmp.GetWidth()
h = bmp.GetHeight()
if isinstance(self, wx.ScrolledWindow):
# adjust for scrolled positio... | def __tile_background(self, dc):
"make several copies of the background bitmap"
sz = self.wx_obj.GetClientSize()
bmp = self._bitmap.get_bits()
w = bmp.GetWidth()
h = bmp.GetHeight()
if isinstance(self, wx.ScrolledWindow):
# adjust for scrolled positio... | [
"make",
"several",
"copies",
"of",
"the",
"background",
"bitmap"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L1022-L1043 | [
"def",
"__tile_background",
"(",
"self",
",",
"dc",
")",
":",
"sz",
"=",
"self",
".",
"wx_obj",
".",
"GetClientSize",
"(",
")",
"bmp",
"=",
"self",
".",
"_bitmap",
".",
"get_bits",
"(",
")",
"w",
"=",
"bmp",
".",
"GetWidth",
"(",
")",
"h",
"=",
"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ImageBackgroundMixin.__on_erase_background | Draw the image as background | gui/component.py | def __on_erase_background(self, evt):
"Draw the image as background"
if self._bitmap:
dc = evt.GetDC()
if not dc:
dc = wx.ClientDC(self)
r = self.wx_obj.GetUpdateRegion().GetBox()
dc.SetClippingRegion(r.x, r.y, ... | def __on_erase_background(self, evt):
"Draw the image as background"
if self._bitmap:
dc = evt.GetDC()
if not dc:
dc = wx.ClientDC(self)
r = self.wx_obj.GetUpdateRegion().GetBox()
dc.SetClippingRegion(r.x, r.y, ... | [
"Draw",
"the",
"image",
"as",
"background"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L1050-L1063 | [
"def",
"__on_erase_background",
"(",
"self",
",",
"evt",
")",
":",
"if",
"self",
".",
"_bitmap",
":",
"dc",
"=",
"evt",
".",
"GetDC",
"(",
")",
"if",
"not",
"dc",
":",
"dc",
"=",
"wx",
".",
"ClientDC",
"(",
"self",
")",
"r",
"=",
"self",
".",
"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | SubComponent.set_parent | Associate the component to the control (it could be recreated) | gui/component.py | def set_parent(self, new_parent, init=False):
"Associate the component to the control (it could be recreated)"
# store gui reference inside of wx object (this will enable rebuild...)
self._parent = get(new_parent, init=False) # store new parent
if init:
self._parent[s... | def set_parent(self, new_parent, init=False):
"Associate the component to the control (it could be recreated)"
# store gui reference inside of wx object (this will enable rebuild...)
self._parent = get(new_parent, init=False) # store new parent
if init:
self._parent[s... | [
"Associate",
"the",
"component",
"to",
"the",
"control",
"(",
"it",
"could",
"be",
"recreated",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L1098-L1103 | [
"def",
"set_parent",
"(",
"self",
",",
"new_parent",
",",
"init",
"=",
"False",
")",
":",
"# store gui reference inside of wx object (this will enable rebuild...)\r",
"self",
".",
"_parent",
"=",
"get",
"(",
"new_parent",
",",
"init",
"=",
"False",
")",
"# store new... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | SubComponent.rebuild | Update a property value with (used by the designer) | gui/component.py | def rebuild(self, **kwargs):
"Update a property value with (used by the designer)"
for name, value in kwargs.items():
setattr(self, name, value) | def rebuild(self, **kwargs):
"Update a property value with (used by the designer)"
for name, value in kwargs.items():
setattr(self, name, value) | [
"Update",
"a",
"property",
"value",
"with",
"(",
"used",
"by",
"the",
"designer",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/component.py#L1105-L1108 | [
"def",
"rebuild",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"name",
",",
"value",
"in",
"kwargs",
".",
"items",
"(",
")",
":",
"setattr",
"(",
"self",
",",
"name",
",",
"value",
")"
] | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Label.__on_paint | Custom draws the label when transparent background is needed | gui/controls/label.py | def __on_paint(self, event):
"Custom draws the label when transparent background is needed"
# use a Device Context that supports anti-aliased drawing
# and semi-transparent colours on all platforms
dc = wx.GCDC(wx.PaintDC(self.wx_obj))
dc.SetFont(self.wx_obj.GetFont())
... | def __on_paint(self, event):
"Custom draws the label when transparent background is needed"
# use a Device Context that supports anti-aliased drawing
# and semi-transparent colours on all platforms
dc = wx.GCDC(wx.PaintDC(self.wx_obj))
dc.SetFont(self.wx_obj.GetFont())
... | [
"Custom",
"draws",
"the",
"label",
"when",
"transparent",
"background",
"is",
"needed"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/label.py#L40-L47 | [
"def",
"__on_paint",
"(",
"self",
",",
"event",
")",
":",
"# use a Device Context that supports anti-aliased drawing \r",
"# and semi-transparent colours on all platforms\r",
"dc",
"=",
"wx",
".",
"GCDC",
"(",
"wx",
".",
"PaintDC",
"(",
"self",
".",
"wx_obj",
")",
")"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | find_modules | Look for every file in the directory tree and return a dict
Hacked from sphinx.autodoc | gui/doc/ext/sphinx_mod.py | def find_modules(rootpath, skip):
"""
Look for every file in the directory tree and return a dict
Hacked from sphinx.autodoc
"""
INITPY = '__init__.py'
rootpath = os.path.normpath(os.path.abspath(rootpath))
if INITPY in os.listdir(rootpath):
root_package = rootpath.split(... | def find_modules(rootpath, skip):
"""
Look for every file in the directory tree and return a dict
Hacked from sphinx.autodoc
"""
INITPY = '__init__.py'
rootpath = os.path.normpath(os.path.abspath(rootpath))
if INITPY in os.listdir(rootpath):
root_package = rootpath.split(... | [
"Look",
"for",
"every",
"file",
"in",
"the",
"directory",
"tree",
"and",
"return",
"a",
"dict",
"Hacked",
"from",
"sphinx",
".",
"autodoc"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/sphinx_mod.py#L28-L101 | [
"def",
"find_modules",
"(",
"rootpath",
",",
"skip",
")",
":",
"INITPY",
"=",
"'__init__.py'",
"rootpath",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"rootpath",
")",
")",
"if",
"INITPY",
"in",
"os",
".",
"l... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | GridView._get_column_headings | Return a list of children sub-components that are column headings | gui/controls/gridview.py | def _get_column_headings(self):
"Return a list of children sub-components that are column headings"
# return it in the same order as inserted in the Grid
headers = [ctrl for ctrl in self if isinstance(ctrl, GridColumn)]
return sorted(headers, key=lambda ch: ch.index) | def _get_column_headings(self):
"Return a list of children sub-components that are column headings"
# return it in the same order as inserted in the Grid
headers = [ctrl for ctrl in self if isinstance(ctrl, GridColumn)]
return sorted(headers, key=lambda ch: ch.index) | [
"Return",
"a",
"list",
"of",
"children",
"sub",
"-",
"components",
"that",
"are",
"column",
"headings"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L68-L72 | [
"def",
"_get_column_headings",
"(",
"self",
")",
":",
"# return it in the same order as inserted in the Grid\r",
"headers",
"=",
"[",
"ctrl",
"for",
"ctrl",
"in",
"self",
"if",
"isinstance",
"(",
"ctrl",
",",
"GridColumn",
")",
"]",
"return",
"sorted",
"(",
"heade... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | GridView._set_row_label | Set the row label format string (empty to hide) | gui/controls/gridview.py | def _set_row_label(self, value):
"Set the row label format string (empty to hide)"
if not value:
self.wx_obj.SetRowLabelSize(0)
else:
self.wx_obj._table._row_label = value | def _set_row_label(self, value):
"Set the row label format string (empty to hide)"
if not value:
self.wx_obj.SetRowLabelSize(0)
else:
self.wx_obj._table._row_label = value | [
"Set",
"the",
"row",
"label",
"format",
"string",
"(",
"empty",
"to",
"hide",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L78-L83 | [
"def",
"_set_row_label",
"(",
"self",
",",
"value",
")",
":",
"if",
"not",
"value",
":",
"self",
".",
"wx_obj",
".",
"SetRowLabelSize",
"(",
"0",
")",
"else",
":",
"self",
".",
"wx_obj",
".",
"_table",
".",
"_row_label",
"=",
"value"
] | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | GridTable.ResetView | Update the grid if rows and columns have been added or deleted | gui/controls/gridview.py | def ResetView(self, grid):
"Update the grid if rows and columns have been added or deleted"
grid.BeginBatch()
for current, new, delmsg, addmsg in [
(self._rows, self.GetNumberRows(),
gridlib.GRIDTABLE_NOTIFY_ROWS_DELETED,
gridlib.GRIDTABLE_NOTIFY_R... | def ResetView(self, grid):
"Update the grid if rows and columns have been added or deleted"
grid.BeginBatch()
for current, new, delmsg, addmsg in [
(self._rows, self.GetNumberRows(),
gridlib.GRIDTABLE_NOTIFY_ROWS_DELETED,
gridlib.GRIDTABLE_NOTIFY_R... | [
"Update",
"the",
"grid",
"if",
"rows",
"and",
"columns",
"have",
"been",
"added",
"or",
"deleted"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L258-L288 | [
"def",
"ResetView",
"(",
"self",
",",
"grid",
")",
":",
"grid",
".",
"BeginBatch",
"(",
")",
"for",
"current",
",",
"new",
",",
"delmsg",
",",
"addmsg",
"in",
"[",
"(",
"self",
".",
"_rows",
",",
"self",
".",
"GetNumberRows",
"(",
")",
",",
"gridli... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | GridTable.UpdateValues | Update all displayed values | gui/controls/gridview.py | def UpdateValues(self, grid):
"Update all displayed values"
# This sends an event to the grid table to update all of the values
msg = gridlib.GridTableMessage(self,
gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
grid.ProcessTableMessage(msg) | def UpdateValues(self, grid):
"Update all displayed values"
# This sends an event to the grid table to update all of the values
msg = gridlib.GridTableMessage(self,
gridlib.GRIDTABLE_REQUEST_VIEW_GET_VALUES)
grid.ProcessTableMessage(msg) | [
"Update",
"all",
"displayed",
"values"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L291-L296 | [
"def",
"UpdateValues",
"(",
"self",
",",
"grid",
")",
":",
"# This sends an event to the grid table to update all of the values\r",
"msg",
"=",
"gridlib",
".",
"GridTableMessage",
"(",
"self",
",",
"gridlib",
".",
"GRIDTABLE_REQUEST_VIEW_GET_VALUES",
")",
"grid",
".",
"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | GridTable._updateColAttrs | update the column attributes to add the appropriate renderer | gui/controls/gridview.py | def _updateColAttrs(self, grid):
"update the column attributes to add the appropriate renderer"
col = 0
for column in self.columns:
attr = gridlib.GridCellAttr()
if False: # column.readonly
attr.SetReadOnly()
if False: # column.rende... | def _updateColAttrs(self, grid):
"update the column attributes to add the appropriate renderer"
col = 0
for column in self.columns:
attr = gridlib.GridCellAttr()
if False: # column.readonly
attr.SetReadOnly()
if False: # column.rende... | [
"update",
"the",
"column",
"attributes",
"to",
"add",
"the",
"appropriate",
"renderer"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L298-L310 | [
"def",
"_updateColAttrs",
"(",
"self",
",",
"grid",
")",
":",
"col",
"=",
"0",
"for",
"column",
"in",
"self",
".",
"columns",
":",
"attr",
"=",
"gridlib",
".",
"GridCellAttr",
"(",
")",
"if",
"False",
":",
"# column.readonly\r",
"attr",
".",
"SetReadOnly... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | GridTable.SortColumn | col -> sort the data based on the column indexed by col | gui/controls/gridview.py | def SortColumn(self, col):
"col -> sort the data based on the column indexed by col"
name = self.columns[col].name
_data = []
for row in self.data:
rowname, entry = row
_data.append((entry.get(name, None), row))
_data.sort()
self.data =... | def SortColumn(self, col):
"col -> sort the data based on the column indexed by col"
name = self.columns[col].name
_data = []
for row in self.data:
rowname, entry = row
_data.append((entry.get(name, None), row))
_data.sort()
self.data =... | [
"col",
"-",
">",
"sort",
"the",
"data",
"based",
"on",
"the",
"column",
"indexed",
"by",
"col"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L313-L326 | [
"def",
"SortColumn",
"(",
"self",
",",
"col",
")",
":",
"name",
"=",
"self",
".",
"columns",
"[",
"col",
"]",
".",
"name",
"_data",
"=",
"[",
"]",
"for",
"row",
"in",
"self",
".",
"data",
":",
"rowname",
",",
"entry",
"=",
"row",
"_data",
".",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | GridColumn.set_parent | Associate the header to the control (it could be recreated) | gui/controls/gridview.py | def set_parent(self, new_parent, init=False):
"Associate the header to the control (it could be recreated)"
self._created = False
SubComponent.set_parent(self, new_parent, init)
# if index not given, append the column at the last position:
if self.index == -1 or self.index >... | def set_parent(self, new_parent, init=False):
"Associate the header to the control (it could be recreated)"
self._created = False
SubComponent.set_parent(self, new_parent, init)
# if index not given, append the column at the last position:
if self.index == -1 or self.index >... | [
"Associate",
"the",
"header",
"to",
"the",
"control",
"(",
"it",
"could",
"be",
"recreated",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L338-L350 | [
"def",
"set_parent",
"(",
"self",
",",
"new_parent",
",",
"init",
"=",
"False",
")",
":",
"self",
".",
"_created",
"=",
"False",
"SubComponent",
".",
"set_parent",
"(",
"self",
",",
"new_parent",
",",
"init",
")",
"# if index not given, append the column at the ... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | GridModel.insert | Insert a number of rows into the grid (and associated table) | gui/controls/gridview.py | def insert(self, pos, values):
"Insert a number of rows into the grid (and associated table)"
if isinstance(values, dict):
row = GridRow(self, **values)
else:
row = GridRow(self, *values)
list.insert(self, pos, row)
self._grid_view.wx_obj.InsertRows... | def insert(self, pos, values):
"Insert a number of rows into the grid (and associated table)"
if isinstance(values, dict):
row = GridRow(self, **values)
else:
row = GridRow(self, *values)
list.insert(self, pos, row)
self._grid_view.wx_obj.InsertRows... | [
"Insert",
"a",
"number",
"of",
"rows",
"into",
"the",
"grid",
"(",
"and",
"associated",
"table",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L410-L417 | [
"def",
"insert",
"(",
"self",
",",
"pos",
",",
"values",
")",
":",
"if",
"isinstance",
"(",
"values",
",",
"dict",
")",
":",
"row",
"=",
"GridRow",
"(",
"self",
",",
"*",
"*",
"values",
")",
"else",
":",
"row",
"=",
"GridRow",
"(",
"self",
",",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | GridModel.append | Insert a number of rows into the grid (and associated table) | gui/controls/gridview.py | def append(self, values):
"Insert a number of rows into the grid (and associated table)"
if isinstance(values, dict):
row = GridRow(self, **values)
else:
row = GridRow(self, *values)
list.append(self, row)
self._grid_view.wx_obj.AppendRows(numRows=1... | def append(self, values):
"Insert a number of rows into the grid (and associated table)"
if isinstance(values, dict):
row = GridRow(self, **values)
else:
row = GridRow(self, *values)
list.append(self, row)
self._grid_view.wx_obj.AppendRows(numRows=1... | [
"Insert",
"a",
"number",
"of",
"rows",
"into",
"the",
"grid",
"(",
"and",
"associated",
"table",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L419-L426 | [
"def",
"append",
"(",
"self",
",",
"values",
")",
":",
"if",
"isinstance",
"(",
"values",
",",
"dict",
")",
":",
"row",
"=",
"GridRow",
"(",
"self",
",",
"*",
"*",
"values",
")",
"else",
":",
"row",
"=",
"GridRow",
"(",
"self",
",",
"*",
"values"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | GridModel.clear | Remove all rows and reset internal structures | gui/controls/gridview.py | def clear(self):
"Remove all rows and reset internal structures"
## list has no clear ... remove items in reverse order
for i in range(len(self)-1, -1, -1):
del self[i]
self._key = 0
if hasattr(self._grid_view, "wx_obj"):
self._grid_view.wx_obj.Clea... | def clear(self):
"Remove all rows and reset internal structures"
## list has no clear ... remove items in reverse order
for i in range(len(self)-1, -1, -1):
del self[i]
self._key = 0
if hasattr(self._grid_view, "wx_obj"):
self._grid_view.wx_obj.Clea... | [
"Remove",
"all",
"rows",
"and",
"reset",
"internal",
"structures"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L448-L455 | [
"def",
"clear",
"(",
"self",
")",
":",
"## list has no clear ... remove items in reverse order\r",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"self",
")",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"del",
"self",
"[",
"i",
"]",
"self",
".",
"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ComboCellEditor.Create | Called to create the control, which must derive from wxControl. | gui/controls/gridview.py | def Create(self, parent, id, evtHandler):
"Called to create the control, which must derive from wxControl."
self._tc = wx.ComboBox(parent, id, "", (100, 50))
self.SetControl(self._tc)
# pushing a different event handler instead evtHandler:
self._tc.PushEventHandler(w... | def Create(self, parent, id, evtHandler):
"Called to create the control, which must derive from wxControl."
self._tc = wx.ComboBox(parent, id, "", (100, 50))
self.SetControl(self._tc)
# pushing a different event handler instead evtHandler:
self._tc.PushEventHandler(w... | [
"Called",
"to",
"create",
"the",
"control",
"which",
"must",
"derive",
"from",
"wxControl",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L528-L534 | [
"def",
"Create",
"(",
"self",
",",
"parent",
",",
"id",
",",
"evtHandler",
")",
":",
"self",
".",
"_tc",
"=",
"wx",
".",
"ComboBox",
"(",
"parent",
",",
"id",
",",
"\"\"",
",",
"(",
"100",
",",
"50",
")",
")",
"self",
".",
"SetControl",
"(",
"s... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ComboCellEditor.SetSize | Called to position/size the edit control within the cell rectangle. | gui/controls/gridview.py | def SetSize(self, rect):
"Called to position/size the edit control within the cell rectangle."
self._tc.SetDimensions(rect.x, rect.y, rect.width+2, rect.height+2,
wx.SIZE_ALLOW_MINUS_ONE) | def SetSize(self, rect):
"Called to position/size the edit control within the cell rectangle."
self._tc.SetDimensions(rect.x, rect.y, rect.width+2, rect.height+2,
wx.SIZE_ALLOW_MINUS_ONE) | [
"Called",
"to",
"position",
"/",
"size",
"the",
"edit",
"control",
"within",
"the",
"cell",
"rectangle",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L539-L542 | [
"def",
"SetSize",
"(",
"self",
",",
"rect",
")",
":",
"self",
".",
"_tc",
".",
"SetDimensions",
"(",
"rect",
".",
"x",
",",
"rect",
".",
"y",
",",
"rect",
".",
"width",
"+",
"2",
",",
"rect",
".",
"height",
"+",
"2",
",",
"wx",
".",
"SIZE_ALLOW... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ComboCellEditor.BeginEdit | Fetch the value from the table and prepare the edit control | gui/controls/gridview.py | def BeginEdit(self, row, col, grid):
"Fetch the value from the table and prepare the edit control"
self.startValue = grid.GetTable().GetValue(row, col)
choices = grid.GetTable().columns[col]._choices
self._tc.Clear()
self._tc.AppendItems(choices)
self._tc.SetStringS... | def BeginEdit(self, row, col, grid):
"Fetch the value from the table and prepare the edit control"
self.startValue = grid.GetTable().GetValue(row, col)
choices = grid.GetTable().columns[col]._choices
self._tc.Clear()
self._tc.AppendItems(choices)
self._tc.SetStringS... | [
"Fetch",
"the",
"value",
"from",
"the",
"table",
"and",
"prepare",
"the",
"edit",
"control"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L551-L558 | [
"def",
"BeginEdit",
"(",
"self",
",",
"row",
",",
"col",
",",
"grid",
")",
":",
"self",
".",
"startValue",
"=",
"grid",
".",
"GetTable",
"(",
")",
".",
"GetValue",
"(",
"row",
",",
"col",
")",
"choices",
"=",
"grid",
".",
"GetTable",
"(",
")",
".... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ComboCellEditor.EndEdit | Complete the editing of the current cell. Returns True if changed | gui/controls/gridview.py | def EndEdit(self, row, col, grid, val=None):
"Complete the editing of the current cell. Returns True if changed"
changed = False
val = self._tc.GetStringSelection()
print "val", val, row, col, self.startValue
if val != self.startValue:
changed = True
... | def EndEdit(self, row, col, grid, val=None):
"Complete the editing of the current cell. Returns True if changed"
changed = False
val = self._tc.GetStringSelection()
print "val", val, row, col, self.startValue
if val != self.startValue:
changed = True
... | [
"Complete",
"the",
"editing",
"of",
"the",
"current",
"cell",
".",
"Returns",
"True",
"if",
"changed"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L560-L570 | [
"def",
"EndEdit",
"(",
"self",
",",
"row",
",",
"col",
",",
"grid",
",",
"val",
"=",
"None",
")",
":",
"changed",
"=",
"False",
"val",
"=",
"self",
".",
"_tc",
".",
"GetStringSelection",
"(",
")",
"print",
"\"val\"",
",",
"val",
",",
"row",
",",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ComboCellEditor.IsAcceptedKey | Return True to allow the given key to start editing | gui/controls/gridview.py | def IsAcceptedKey(self, evt):
"Return True to allow the given key to start editing"
## Oops, there's a bug here, we'll have to do it ourself..
##return self.base_IsAcceptedKey(evt)
return (not (evt.ControlDown() or evt.AltDown()) and
evt.GetKeyCode() != wx.WXK_SHIFT) | def IsAcceptedKey(self, evt):
"Return True to allow the given key to start editing"
## Oops, there's a bug here, we'll have to do it ourself..
##return self.base_IsAcceptedKey(evt)
return (not (evt.ControlDown() or evt.AltDown()) and
evt.GetKeyCode() != wx.WXK_SHIFT) | [
"Return",
"True",
"to",
"allow",
"the",
"given",
"key",
"to",
"start",
"editing"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L584-L589 | [
"def",
"IsAcceptedKey",
"(",
"self",
",",
"evt",
")",
":",
"## Oops, there's a bug here, we'll have to do it ourself..\r",
"##return self.base_IsAcceptedKey(evt)\r",
"return",
"(",
"not",
"(",
"evt",
".",
"ControlDown",
"(",
")",
"or",
"evt",
".",
"AltDown",
"(",
")",... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | ComboCellEditor.StartingKey | This will be called to let the editor do something with the first key | gui/controls/gridview.py | def StartingKey(self, evt):
"This will be called to let the editor do something with the first key"
key = evt.GetKeyCode()
ch = None
if key in [wx.WXK_NUMPAD0, wx.WXK_NUMPAD1, wx.WXK_NUMPAD2, wx.WXK_NUMPAD3, wx.WXK_NUMPAD4,
wx.WXK_NUMPAD5, wx.WXK_NUMPAD6, wx.WXK_N... | def StartingKey(self, evt):
"This will be called to let the editor do something with the first key"
key = evt.GetKeyCode()
ch = None
if key in [wx.WXK_NUMPAD0, wx.WXK_NUMPAD1, wx.WXK_NUMPAD2, wx.WXK_NUMPAD3, wx.WXK_NUMPAD4,
wx.WXK_NUMPAD5, wx.WXK_NUMPAD6, wx.WXK_N... | [
"This",
"will",
"be",
"called",
"to",
"let",
"the",
"editor",
"do",
"something",
"with",
"the",
"first",
"key"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/gridview.py#L591-L605 | [
"def",
"StartingKey",
"(",
"self",
",",
"evt",
")",
":",
"key",
"=",
"evt",
".",
"GetKeyCode",
"(",
")",
"ch",
"=",
"None",
"if",
"key",
"in",
"[",
"wx",
".",
"WXK_NUMPAD0",
",",
"wx",
".",
"WXK_NUMPAD1",
",",
"wx",
".",
"WXK_NUMPAD2",
",",
"wx",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | TypeHandler | A metaclass generator. Returns a metaclass which
will register it's class as the class that handles input type=typeName | gui/html/input.py | def TypeHandler(type_name):
""" A metaclass generator. Returns a metaclass which
will register it's class as the class that handles input type=typeName
"""
def metaclass(name, bases, dict):
klass = type(name, bases, dict)
form.FormTagHandler.register_type(type_name.upper(), klass)
... | def TypeHandler(type_name):
""" A metaclass generator. Returns a metaclass which
will register it's class as the class that handles input type=typeName
"""
def metaclass(name, bases, dict):
klass = type(name, bases, dict)
form.FormTagHandler.register_type(type_name.upper(), klass)
... | [
"A",
"metaclass",
"generator",
".",
"Returns",
"a",
"metaclass",
"which",
"will",
"register",
"it",
"s",
"class",
"as",
"the",
"class",
"that",
"handles",
"input",
"type",
"=",
"typeName"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/html/input.py#L12-L20 | [
"def",
"TypeHandler",
"(",
"type_name",
")",
":",
"def",
"metaclass",
"(",
"name",
",",
"bases",
",",
"dict",
")",
":",
"klass",
"=",
"type",
"(",
"name",
",",
"bases",
",",
"dict",
")",
"form",
".",
"FormTagHandler",
".",
"register_type",
"(",
"type_n... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | wx_Menu.Enable | enable or disable all menu items | gui/menu.py | def Enable(self, value):
"enable or disable all menu items"
for i in range(self.GetMenuItemCount()):
it = self.FindItemByPosition(i)
it.Enable(value) | def Enable(self, value):
"enable or disable all menu items"
for i in range(self.GetMenuItemCount()):
it = self.FindItemByPosition(i)
it.Enable(value) | [
"enable",
"or",
"disable",
"all",
"menu",
"items"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/menu.py#L181-L185 | [
"def",
"Enable",
"(",
"self",
",",
"value",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"GetMenuItemCount",
"(",
")",
")",
":",
"it",
"=",
"self",
".",
"FindItemByPosition",
"(",
"i",
")",
"it",
".",
"Enable",
"(",
"value",
")"
] | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | wx_Menu.IsEnabled | check if all menu items are enabled | gui/menu.py | def IsEnabled(self, *args, **kwargs):
"check if all menu items are enabled"
for i in range(self.GetMenuItemCount()):
it = self.FindItemByPosition(i)
if not it.IsEnabled():
return False
return True | def IsEnabled(self, *args, **kwargs):
"check if all menu items are enabled"
for i in range(self.GetMenuItemCount()):
it = self.FindItemByPosition(i)
if not it.IsEnabled():
return False
return True | [
"check",
"if",
"all",
"menu",
"items",
"are",
"enabled"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/menu.py#L187-L193 | [
"def",
"IsEnabled",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"GetMenuItemCount",
"(",
")",
")",
":",
"it",
"=",
"self",
".",
"FindItemByPosition",
"(",
"i",
")",
"if",
"not",
"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Menu.find | Recursively find a menu item by its id (useful for event handlers) | gui/menu.py | def find(self, item_id=None):
"Recursively find a menu item by its id (useful for event handlers)"
for it in self:
if it.id == item_id:
return it
elif isinstance(it, Menu):
found = it.find(item_id)
if found:
... | def find(self, item_id=None):
"Recursively find a menu item by its id (useful for event handlers)"
for it in self:
if it.id == item_id:
return it
elif isinstance(it, Menu):
found = it.find(item_id)
if found:
... | [
"Recursively",
"find",
"a",
"menu",
"item",
"by",
"its",
"id",
"(",
"useful",
"for",
"event",
"handlers",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/menu.py#L229-L237 | [
"def",
"find",
"(",
"self",
",",
"item_id",
"=",
"None",
")",
":",
"for",
"it",
"in",
"self",
":",
"if",
"it",
".",
"id",
"==",
"item_id",
":",
"return",
"it",
"elif",
"isinstance",
"(",
"it",
",",
"Menu",
")",
":",
"found",
"=",
"it",
".",
"fi... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | wx_MenuBar.Enable | enable or disable all top menus | gui/menu.py | def Enable(self, value):
"enable or disable all top menus"
for i in range(self.GetMenuCount()):
self.EnableTop(i, value) | def Enable(self, value):
"enable or disable all top menus"
for i in range(self.GetMenuCount()):
self.EnableTop(i, value) | [
"enable",
"or",
"disable",
"all",
"top",
"menus"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/menu.py#L265-L268 | [
"def",
"Enable",
"(",
"self",
",",
"value",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"GetMenuCount",
"(",
")",
")",
":",
"self",
".",
"EnableTop",
"(",
"i",
",",
"value",
")"
] | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | wx_MenuBar.IsEnabled | check if all top menus are enabled | gui/menu.py | def IsEnabled(self, *args, **kwargs):
"check if all top menus are enabled"
for i in range(self.GetMenuCount()):
if not self.IsEnabledTop(i):
return False
return True | def IsEnabled(self, *args, **kwargs):
"check if all top menus are enabled"
for i in range(self.GetMenuCount()):
if not self.IsEnabledTop(i):
return False
return True | [
"check",
"if",
"all",
"top",
"menus",
"are",
"enabled"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/menu.py#L270-L275 | [
"def",
"IsEnabled",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"GetMenuCount",
"(",
")",
")",
":",
"if",
"not",
"self",
".",
"IsEnabledTop",
"(",
"i",
")",
":",
"return",
"False"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | wx_MenuBar.RemoveItem | Helper method to remove a menu avoiding using its position | gui/menu.py | def RemoveItem(self, menu):
"Helper method to remove a menu avoiding using its position"
menus = self.GetMenus() # get the list of (menu, title)
menus = [submenu for submenu in menus if submenu[0] != menu]
self.SetMenus(menus) | def RemoveItem(self, menu):
"Helper method to remove a menu avoiding using its position"
menus = self.GetMenus() # get the list of (menu, title)
menus = [submenu for submenu in menus if submenu[0] != menu]
self.SetMenus(menus) | [
"Helper",
"method",
"to",
"remove",
"a",
"menu",
"avoiding",
"using",
"its",
"position"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/menu.py#L277-L281 | [
"def",
"RemoveItem",
"(",
"self",
",",
"menu",
")",
":",
"menus",
"=",
"self",
".",
"GetMenus",
"(",
")",
"# get the list of (menu, title)\r",
"menus",
"=",
"[",
"submenu",
"for",
"submenu",
"in",
"menus",
"if",
"submenu",
"[",
"0",
"]",
"!=",
"menu",
"]... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | MenuBar.find | Recursively find a menu item by its id (useful for event handlers) | gui/menu.py | def find(self, item_id=None):
"Recursively find a menu item by its id (useful for event handlers)"
for it in self:
found = it.find(item_id)
if found:
return found | def find(self, item_id=None):
"Recursively find a menu item by its id (useful for event handlers)"
for it in self:
found = it.find(item_id)
if found:
return found | [
"Recursively",
"find",
"a",
"menu",
"item",
"by",
"its",
"id",
"(",
"useful",
"for",
"event",
"handlers",
")"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/menu.py#L323-L328 | [
"def",
"find",
"(",
"self",
",",
"item_id",
"=",
"None",
")",
":",
"for",
"it",
"in",
"self",
":",
"found",
"=",
"it",
".",
"find",
"(",
"item_id",
")",
"if",
"found",
":",
"return",
"found"
] | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | HTMLForm.submit | Process form submission | gui/html/form.py | def submit(self, btn=None):
"Process form submission"
data = self.build_data_set()
if btn and btn.name:
data[btn.name] = btn.name
evt = FormSubmitEvent(self, data)
self.container.ProcessEvent(evt) | def submit(self, btn=None):
"Process form submission"
data = self.build_data_set()
if btn and btn.name:
data[btn.name] = btn.name
evt = FormSubmitEvent(self, data)
self.container.ProcessEvent(evt) | [
"Process",
"form",
"submission"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/html/form.py#L39-L45 | [
"def",
"submit",
"(",
"self",
",",
"btn",
"=",
"None",
")",
":",
"data",
"=",
"self",
".",
"build_data_set",
"(",
")",
"if",
"btn",
"and",
"btn",
".",
"name",
":",
"data",
"[",
"btn",
".",
"name",
"]",
"=",
"btn",
".",
"name",
"evt",
"=",
"Form... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | HTMLForm.build_data_set | Construct a sequence of name/value pairs from controls | gui/html/form.py | def build_data_set(self):
"Construct a sequence of name/value pairs from controls"
data = {}
for field in self.fields:
if field.name:# and field.enabled: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
val = field.get_value()
if val is None:
... | def build_data_set(self):
"Construct a sequence of name/value pairs from controls"
data = {}
for field in self.fields:
if field.name:# and field.enabled: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
val = field.get_value()
if val is None:
... | [
"Construct",
"a",
"sequence",
"of",
"name",
"/",
"value",
"pairs",
"from",
"controls"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/html/form.py#L47-L60 | [
"def",
"build_data_set",
"(",
"self",
")",
":",
"data",
"=",
"{",
"}",
"for",
"field",
"in",
"self",
".",
"fields",
":",
"if",
"field",
".",
"name",
":",
"# and field.enabled: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
"val",
"=",
"field",
".",
"get_value"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | FormTagHandler.setObjectTag | Add a tag attribute to the wx window | gui/html/form.py | def setObjectTag(self, object, tag):
""" Add a tag attribute to the wx window """
object._attributes = {}
object._name = tag.GetName().lower()
for name in self.attributes:
object._attributes["_%s" % name] = tag.GetParam(name)
if object._attributes["_%s" % name] ==... | def setObjectTag(self, object, tag):
""" Add a tag attribute to the wx window """
object._attributes = {}
object._name = tag.GetName().lower()
for name in self.attributes:
object._attributes["_%s" % name] = tag.GetParam(name)
if object._attributes["_%s" % name] ==... | [
"Add",
"a",
"tag",
"attribute",
"to",
"the",
"wx",
"window"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/html/form.py#L193-L200 | [
"def",
"setObjectTag",
"(",
"self",
",",
"object",
",",
"tag",
")",
":",
"object",
".",
"_attributes",
"=",
"{",
"}",
"object",
".",
"_name",
"=",
"tag",
".",
"GetName",
"(",
")",
".",
"lower",
"(",
")",
"for",
"name",
"in",
"self",
".",
"attribute... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | process_autosummary_toc | Insert items described in autosummary:: to the TOC tree, but do
not generate the toctree:: list. | gui/doc/ext/autosummary/__init__.py | def process_autosummary_toc(app, doctree):
"""Insert items described in autosummary:: to the TOC tree, but do
not generate the toctree:: list.
"""
env = app.builder.env
crawled = {}
def crawl_toc(node, depth=1):
crawled[node] = True
for j, subnode in enumerate(node):
... | def process_autosummary_toc(app, doctree):
"""Insert items described in autosummary:: to the TOC tree, but do
not generate the toctree:: list.
"""
env = app.builder.env
crawled = {}
def crawl_toc(node, depth=1):
crawled[node] = True
for j, subnode in enumerate(node):
... | [
"Insert",
"items",
"described",
"in",
"autosummary",
"::",
"to",
"the",
"TOC",
"tree",
"but",
"do",
"not",
"generate",
"the",
"toctree",
"::",
"list",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L75-L95 | [
"def",
"process_autosummary_toc",
"(",
"app",
",",
"doctree",
")",
":",
"env",
"=",
"app",
".",
"builder",
".",
"env",
"crawled",
"=",
"{",
"}",
"def",
"crawl_toc",
"(",
"node",
",",
"depth",
"=",
"1",
")",
":",
"crawled",
"[",
"node",
"]",
"=",
"T... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | autosummary_table_visit_html | Make the first column of the table non-breaking. | gui/doc/ext/autosummary/__init__.py | def autosummary_table_visit_html(self, node):
"""Make the first column of the table non-breaking."""
try:
tbody = node[0][0][-1]
for row in tbody:
col1_entry = row[0]
par = col1_entry[0]
for j, subnode in enumerate(list(par)):
if isinstance(sub... | def autosummary_table_visit_html(self, node):
"""Make the first column of the table non-breaking."""
try:
tbody = node[0][0][-1]
for row in tbody:
col1_entry = row[0]
par = col1_entry[0]
for j, subnode in enumerate(list(par)):
if isinstance(sub... | [
"Make",
"the",
"first",
"column",
"of",
"the",
"table",
"non",
"-",
"breaking",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L110-L123 | [
"def",
"autosummary_table_visit_html",
"(",
"self",
",",
"node",
")",
":",
"try",
":",
"tbody",
"=",
"node",
"[",
"0",
"]",
"[",
"0",
"]",
"[",
"-",
"1",
"]",
"for",
"row",
"in",
"tbody",
":",
"col1_entry",
"=",
"row",
"[",
"0",
"]",
"par",
"=",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | get_documenter | Get an autodoc.Documenter class suitable for documenting the given
object.
*obj* is the Python object to be documented, and *parent* is an
another Python object (e.g. a module or a class) to which *obj*
belongs to. | gui/doc/ext/autosummary/__init__.py | def get_documenter(obj, parent):
"""Get an autodoc.Documenter class suitable for documenting the given
object.
*obj* is the Python object to be documented, and *parent* is an
another Python object (e.g. a module or a class) to which *obj*
belongs to.
"""
from sphinx.ext.autodoc import AutoD... | def get_documenter(obj, parent):
"""Get an autodoc.Documenter class suitable for documenting the given
object.
*obj* is the Python object to be documented, and *parent* is an
another Python object (e.g. a module or a class) to which *obj*
belongs to.
"""
from sphinx.ext.autodoc import AutoD... | [
"Get",
"an",
"autodoc",
".",
"Documenter",
"class",
"suitable",
"for",
"documenting",
"the",
"given",
"object",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L132-L165 | [
"def",
"get_documenter",
"(",
"obj",
",",
"parent",
")",
":",
"from",
"sphinx",
".",
"ext",
".",
"autodoc",
"import",
"AutoDirective",
",",
"DataDocumenter",
",",
"ModuleDocumenter",
"if",
"inspect",
".",
"ismodule",
"(",
"obj",
")",
":",
"# ModuleDocumenter.c... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | mangle_signature | Reformat a function signature to a more compact form. | gui/doc/ext/autosummary/__init__.py | def mangle_signature(sig, max_chars=30):
"""Reformat a function signature to a more compact form."""
s = re.sub(r"^\((.*)\)$", r"\1", sig).strip()
# Strip strings (which can contain things that confuse the code below)
s = re.sub(r"\\\\", "", s)
s = re.sub(r"\\'", "", s)
s = re.sub(r"'[^']*'", "... | def mangle_signature(sig, max_chars=30):
"""Reformat a function signature to a more compact form."""
s = re.sub(r"^\((.*)\)$", r"\1", sig).strip()
# Strip strings (which can contain things that confuse the code below)
s = re.sub(r"\\\\", "", s)
s = re.sub(r"\\'", "", s)
s = re.sub(r"'[^']*'", "... | [
"Reformat",
"a",
"function",
"signature",
"to",
"a",
"more",
"compact",
"form",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L342-L375 | [
"def",
"mangle_signature",
"(",
"sig",
",",
"max_chars",
"=",
"30",
")",
":",
"s",
"=",
"re",
".",
"sub",
"(",
"r\"^\\((.*)\\)$\"",
",",
"r\"\\1\"",
",",
"sig",
")",
".",
"strip",
"(",
")",
"# Strip strings (which can contain things that confuse the code below)",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | limited_join | Join a number of strings to one, limiting the length to *max_chars*.
If the string overflows this limit, replace the last fitting item by
*overflow_marker*.
Returns: joined_string | gui/doc/ext/autosummary/__init__.py | def limited_join(sep, items, max_chars=30, overflow_marker="..."):
"""Join a number of strings to one, limiting the length to *max_chars*.
If the string overflows this limit, replace the last fitting item by
*overflow_marker*.
Returns: joined_string
"""
full_str = sep.join(items)
if len(fu... | def limited_join(sep, items, max_chars=30, overflow_marker="..."):
"""Join a number of strings to one, limiting the length to *max_chars*.
If the string overflows this limit, replace the last fitting item by
*overflow_marker*.
Returns: joined_string
"""
full_str = sep.join(items)
if len(fu... | [
"Join",
"a",
"number",
"of",
"strings",
"to",
"one",
"limiting",
"the",
"length",
"to",
"*",
"max_chars",
"*",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L377-L398 | [
"def",
"limited_join",
"(",
"sep",
",",
"items",
",",
"max_chars",
"=",
"30",
",",
"overflow_marker",
"=",
"\"...\"",
")",
":",
"full_str",
"=",
"sep",
".",
"join",
"(",
"items",
")",
"if",
"len",
"(",
"full_str",
")",
"<",
"max_chars",
":",
"return",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | get_import_prefixes_from_env | Obtain current Python import prefixes (for `import_by_name`)
from ``document.env`` | gui/doc/ext/autosummary/__init__.py | def get_import_prefixes_from_env(env):
"""
Obtain current Python import prefixes (for `import_by_name`)
from ``document.env``
"""
prefixes = [None]
currmodule = env.temp_data.get('py:module')
if currmodule:
prefixes.insert(0, currmodule)
currclass = env.temp_data.get('py:class'... | def get_import_prefixes_from_env(env):
"""
Obtain current Python import prefixes (for `import_by_name`)
from ``document.env``
"""
prefixes = [None]
currmodule = env.temp_data.get('py:module')
if currmodule:
prefixes.insert(0, currmodule)
currclass = env.temp_data.get('py:class'... | [
"Obtain",
"current",
"Python",
"import",
"prefixes",
"(",
"for",
"import_by_name",
")",
"from",
"document",
".",
"env"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L402-L420 | [
"def",
"get_import_prefixes_from_env",
"(",
"env",
")",
":",
"prefixes",
"=",
"[",
"None",
"]",
"currmodule",
"=",
"env",
".",
"temp_data",
".",
"get",
"(",
"'py:module'",
")",
"if",
"currmodule",
":",
"prefixes",
".",
"insert",
"(",
"0",
",",
"currmodule"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | import_by_name | Import a Python object that has the given *name*, under one of the
*prefixes*. The first name that succeeds is used. | gui/doc/ext/autosummary/__init__.py | def import_by_name(name, prefixes=[None]):
"""Import a Python object that has the given *name*, under one of the
*prefixes*. The first name that succeeds is used.
"""
tried = []
for prefix in prefixes:
try:
if prefix:
prefixed_name = '.'.join([prefix, name])
... | def import_by_name(name, prefixes=[None]):
"""Import a Python object that has the given *name*, under one of the
*prefixes*. The first name that succeeds is used.
"""
tried = []
for prefix in prefixes:
try:
if prefix:
prefixed_name = '.'.join([prefix, name])
... | [
"Import",
"a",
"Python",
"object",
"that",
"has",
"the",
"given",
"*",
"name",
"*",
"under",
"one",
"of",
"the",
"*",
"prefixes",
"*",
".",
"The",
"first",
"name",
"that",
"succeeds",
"is",
"used",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L422-L437 | [
"def",
"import_by_name",
"(",
"name",
",",
"prefixes",
"=",
"[",
"None",
"]",
")",
":",
"tried",
"=",
"[",
"]",
"for",
"prefix",
"in",
"prefixes",
":",
"try",
":",
"if",
"prefix",
":",
"prefixed_name",
"=",
"'.'",
".",
"join",
"(",
"[",
"prefix",
"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | _import_by_name | Import a Python object given its full name. | gui/doc/ext/autosummary/__init__.py | def _import_by_name(name):
"""Import a Python object given its full name."""
try:
name_parts = name.split('.')
# try first interpret `name` as MODNAME.OBJ
modname = '.'.join(name_parts[:-1])
if modname:
try:
__import__(modname)
mod = s... | def _import_by_name(name):
"""Import a Python object given its full name."""
try:
name_parts = name.split('.')
# try first interpret `name` as MODNAME.OBJ
modname = '.'.join(name_parts[:-1])
if modname:
try:
__import__(modname)
mod = s... | [
"Import",
"a",
"Python",
"object",
"given",
"its",
"full",
"name",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L439-L477 | [
"def",
"_import_by_name",
"(",
"name",
")",
":",
"try",
":",
"name_parts",
"=",
"name",
".",
"split",
"(",
"'.'",
")",
"# try first interpret `name` as MODNAME.OBJ",
"modname",
"=",
"'.'",
".",
"join",
"(",
"name_parts",
"[",
":",
"-",
"1",
"]",
")",
"if",... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | autolink_role | Smart linking role.
Expands to ':obj:`text`' if `text` is an object that can be imported;
otherwise expands to '*text*'. | gui/doc/ext/autosummary/__init__.py | def autolink_role(typ, rawtext, etext, lineno, inliner,
options={}, content=[]):
"""Smart linking role.
Expands to ':obj:`text`' if `text` is an object that can be imported;
otherwise expands to '*text*'.
"""
env = inliner.document.settings.env
r = env.get_domain('py').role('o... | def autolink_role(typ, rawtext, etext, lineno, inliner,
options={}, content=[]):
"""Smart linking role.
Expands to ':obj:`text`' if `text` is an object that can be imported;
otherwise expands to '*text*'.
"""
env = inliner.document.settings.env
r = env.get_domain('py').role('o... | [
"Smart",
"linking",
"role",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L482-L501 | [
"def",
"autolink_role",
"(",
"typ",
",",
"rawtext",
",",
"etext",
",",
"lineno",
",",
"inliner",
",",
"options",
"=",
"{",
"}",
",",
"content",
"=",
"[",
"]",
")",
":",
"env",
"=",
"inliner",
".",
"document",
".",
"settings",
".",
"env",
"r",
"=",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Autosummary.get_items | Try to import the given names, and return a list of
``[(name, signature, summary_string, real_name), ...]``. | gui/doc/ext/autosummary/__init__.py | def get_items(self, names):
"""Try to import the given names, and return a list of
``[(name, signature, summary_string, real_name), ...]``.
"""
env = self.state.document.settings.env
prefixes = get_import_prefixes_from_env(env)
items = []
max_item_chars = 50
... | def get_items(self, names):
"""Try to import the given names, and return a list of
``[(name, signature, summary_string, real_name), ...]``.
"""
env = self.state.document.settings.env
prefixes = get_import_prefixes_from_env(env)
items = []
max_item_chars = 50
... | [
"Try",
"to",
"import",
"the",
"given",
"names",
"and",
"return",
"a",
"list",
"of",
"[",
"(",
"name",
"signature",
"summary_string",
"real_name",
")",
"...",
"]",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L233-L296 | [
"def",
"get_items",
"(",
"self",
",",
"names",
")",
":",
"env",
"=",
"self",
".",
"state",
".",
"document",
".",
"settings",
".",
"env",
"prefixes",
"=",
"get_import_prefixes_from_env",
"(",
"env",
")",
"items",
"=",
"[",
"]",
"max_item_chars",
"=",
"50"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | Autosummary.get_table | Generate a proper list of table nodes for autosummary:: directive.
*items* is a list produced by :meth:`get_items`. | gui/doc/ext/autosummary/__init__.py | def get_table(self, items):
"""Generate a proper list of table nodes for autosummary:: directive.
*items* is a list produced by :meth:`get_items`.
"""
table_spec = addnodes.tabular_col_spec()
table_spec['spec'] = 'll'
table = autosummary_table('')
real_table = n... | def get_table(self, items):
"""Generate a proper list of table nodes for autosummary:: directive.
*items* is a list produced by :meth:`get_items`.
"""
table_spec = addnodes.tabular_col_spec()
table_spec['spec'] = 'll'
table = autosummary_table('')
real_table = n... | [
"Generate",
"a",
"proper",
"list",
"of",
"table",
"nodes",
"for",
"autosummary",
"::",
"directive",
"."
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/doc/ext/autosummary/__init__.py#L298-L340 | [
"def",
"get_table",
"(",
"self",
",",
"items",
")",
":",
"table_spec",
"=",
"addnodes",
".",
"tabular_col_spec",
"(",
")",
"table_spec",
"[",
"'spec'",
"]",
"=",
"'ll'",
"table",
"=",
"autosummary_table",
"(",
"''",
")",
"real_table",
"=",
"nodes",
".",
... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | alert | Show a simple pop-up modal dialog | gui/dialog.py | def alert(message, title="", parent=None, scrolled=False, icon="exclamation"):
"Show a simple pop-up modal dialog"
if not scrolled:
icons = {'exclamation': wx.ICON_EXCLAMATION, 'error': wx.ICON_ERROR,
'question': wx.ICON_QUESTION, 'info': wx.ICON_INFORMATION}
style = wx.OK | ic... | def alert(message, title="", parent=None, scrolled=False, icon="exclamation"):
"Show a simple pop-up modal dialog"
if not scrolled:
icons = {'exclamation': wx.ICON_EXCLAMATION, 'error': wx.ICON_ERROR,
'question': wx.ICON_QUESTION, 'info': wx.ICON_INFORMATION}
style = wx.OK | ic... | [
"Show",
"a",
"simple",
"pop",
"-",
"up",
"modal",
"dialog"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/dialog.py#L15-L23 | [
"def",
"alert",
"(",
"message",
",",
"title",
"=",
"\"\"",
",",
"parent",
"=",
"None",
",",
"scrolled",
"=",
"False",
",",
"icon",
"=",
"\"exclamation\"",
")",
":",
"if",
"not",
"scrolled",
":",
"icons",
"=",
"{",
"'exclamation'",
":",
"wx",
".",
"IC... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | prompt | Modal dialog asking for an input, returns string or None if cancelled | gui/dialog.py | def prompt(message="", title="", default="", multiline=False, password=None,
parent=None):
"Modal dialog asking for an input, returns string or None if cancelled"
if password:
style = wx.TE_PASSWORD | wx.OK | wx.CANCEL
result = dialogs.textEntryDialog(parent, message, title, def... | def prompt(message="", title="", default="", multiline=False, password=None,
parent=None):
"Modal dialog asking for an input, returns string or None if cancelled"
if password:
style = wx.TE_PASSWORD | wx.OK | wx.CANCEL
result = dialogs.textEntryDialog(parent, message, title, def... | [
"Modal",
"dialog",
"asking",
"for",
"an",
"input",
"returns",
"string",
"or",
"None",
"if",
"cancelled"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/dialog.py#L26-L40 | [
"def",
"prompt",
"(",
"message",
"=",
"\"\"",
",",
"title",
"=",
"\"\"",
",",
"default",
"=",
"\"\"",
",",
"multiline",
"=",
"False",
",",
"password",
"=",
"None",
",",
"parent",
"=",
"None",
")",
":",
"if",
"password",
":",
"style",
"=",
"wx",
"."... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | confirm | Ask for confirmation (yes/no or ok and cancel), returns True or False | gui/dialog.py | def confirm(message="", title="", default=False, ok=False, cancel=False,
parent=None):
"Ask for confirmation (yes/no or ok and cancel), returns True or False"
style = wx.CENTRE
if ok:
style |= wx.OK
else:
style |= wx.YES | wx.NO
if default:
style... | def confirm(message="", title="", default=False, ok=False, cancel=False,
parent=None):
"Ask for confirmation (yes/no or ok and cancel), returns True or False"
style = wx.CENTRE
if ok:
style |= wx.OK
else:
style |= wx.YES | wx.NO
if default:
style... | [
"Ask",
"for",
"confirmation",
"(",
"yes",
"/",
"no",
"or",
"ok",
"and",
"cancel",
")",
"returns",
"True",
"or",
"False"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/dialog.py#L43-L60 | [
"def",
"confirm",
"(",
"message",
"=",
"\"\"",
",",
"title",
"=",
"\"\"",
",",
"default",
"=",
"False",
",",
"ok",
"=",
"False",
",",
"cancel",
"=",
"False",
",",
"parent",
"=",
"None",
")",
":",
"style",
"=",
"wx",
".",
"CENTRE",
"if",
"ok",
":"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | select_font | Show a dialog to select a font | gui/dialog.py | def select_font(message="", title="", font=None, parent=None):
"Show a dialog to select a font"
if font is not None:
wx_font = font._get_wx_font() # use as default
else:
wx_font = None
font = Font() # create an empty font
... | def select_font(message="", title="", font=None, parent=None):
"Show a dialog to select a font"
if font is not None:
wx_font = font._get_wx_font() # use as default
else:
wx_font = None
font = Font() # create an empty font
... | [
"Show",
"a",
"dialog",
"to",
"select",
"a",
"font"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/dialog.py#L63-L77 | [
"def",
"select_font",
"(",
"message",
"=",
"\"\"",
",",
"title",
"=",
"\"\"",
",",
"font",
"=",
"None",
",",
"parent",
"=",
"None",
")",
":",
"if",
"font",
"is",
"not",
"None",
":",
"wx_font",
"=",
"font",
".",
"_get_wx_font",
"(",
")",
"# use as def... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | select_color | Show a dialog to pick a color | gui/dialog.py | def select_color(message="", title="", color=None, parent=None):
"Show a dialog to pick a color"
result = dialogs.colorDialog(parent, color=color)
return result.accepted and result.color | def select_color(message="", title="", color=None, parent=None):
"Show a dialog to pick a color"
result = dialogs.colorDialog(parent, color=color)
return result.accepted and result.color | [
"Show",
"a",
"dialog",
"to",
"pick",
"a",
"color"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/dialog.py#L80-L83 | [
"def",
"select_color",
"(",
"message",
"=",
"\"\"",
",",
"title",
"=",
"\"\"",
",",
"color",
"=",
"None",
",",
"parent",
"=",
"None",
")",
":",
"result",
"=",
"dialogs",
".",
"colorDialog",
"(",
"parent",
",",
"color",
"=",
"color",
")",
"return",
"r... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | open_file | Show a dialog to select files to open, return path(s) if accepted | gui/dialog.py | def open_file(title="Open", directory='', filename='',
wildcard='All Files (*.*)|*.*', multiple=False, parent=None):
"Show a dialog to select files to open, return path(s) if accepted"
style = wx.OPEN
if multiple:
style |= wx.MULTIPLE
result = dialogs.fileDialog(parent, ti... | def open_file(title="Open", directory='', filename='',
wildcard='All Files (*.*)|*.*', multiple=False, parent=None):
"Show a dialog to select files to open, return path(s) if accepted"
style = wx.OPEN
if multiple:
style |= wx.MULTIPLE
result = dialogs.fileDialog(parent, ti... | [
"Show",
"a",
"dialog",
"to",
"select",
"files",
"to",
"open",
"return",
"path",
"(",
"s",
")",
"if",
"accepted"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/dialog.py#L86-L97 | [
"def",
"open_file",
"(",
"title",
"=",
"\"Open\"",
",",
"directory",
"=",
"''",
",",
"filename",
"=",
"''",
",",
"wildcard",
"=",
"'All Files (*.*)|*.*'",
",",
"multiple",
"=",
"False",
",",
"parent",
"=",
"None",
")",
":",
"style",
"=",
"wx",
".",
"OP... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | save_file | Show a dialog to select file to save, return path(s) if accepted | gui/dialog.py | def save_file(title="Save", directory='', filename='',
wildcard='All Files (*.*)|*.*', overwrite=False, parent=None):
"Show a dialog to select file to save, return path(s) if accepted"
style = wx.SAVE
if not overwrite:
style |= wx.OVERWRITE_PROMPT
result = dialogs.fileDial... | def save_file(title="Save", directory='', filename='',
wildcard='All Files (*.*)|*.*', overwrite=False, parent=None):
"Show a dialog to select file to save, return path(s) if accepted"
style = wx.SAVE
if not overwrite:
style |= wx.OVERWRITE_PROMPT
result = dialogs.fileDial... | [
"Show",
"a",
"dialog",
"to",
"select",
"file",
"to",
"save",
"return",
"path",
"(",
"s",
")",
"if",
"accepted"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/dialog.py#L100-L108 | [
"def",
"save_file",
"(",
"title",
"=",
"\"Save\"",
",",
"directory",
"=",
"''",
",",
"filename",
"=",
"''",
",",
"wildcard",
"=",
"'All Files (*.*)|*.*'",
",",
"overwrite",
"=",
"False",
",",
"parent",
"=",
"None",
")",
":",
"style",
"=",
"wx",
".",
"S... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | choose_directory | Show a dialog to choose a directory | gui/dialog.py | def choose_directory(message='Choose a directory', path="", parent=None):
"Show a dialog to choose a directory"
result = dialogs.directoryDialog(parent, message, path)
return result.path | def choose_directory(message='Choose a directory', path="", parent=None):
"Show a dialog to choose a directory"
result = dialogs.directoryDialog(parent, message, path)
return result.path | [
"Show",
"a",
"dialog",
"to",
"choose",
"a",
"directory"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/dialog.py#L111-L114 | [
"def",
"choose_directory",
"(",
"message",
"=",
"'Choose a directory'",
",",
"path",
"=",
"\"\"",
",",
"parent",
"=",
"None",
")",
":",
"result",
"=",
"dialogs",
".",
"directoryDialog",
"(",
"parent",
",",
"message",
",",
"path",
")",
"return",
"result",
"... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | find | Shows a find text dialog | gui/dialog.py | def find(default='', whole_words=0, case_sensitive=0, parent=None):
"Shows a find text dialog"
result = dialogs.findDialog(parent, default, whole_words, case_sensitive)
return {'text': result.searchText, 'whole_words': result.wholeWordsOnly,
'case_sensitive': result.caseSensitive} | def find(default='', whole_words=0, case_sensitive=0, parent=None):
"Shows a find text dialog"
result = dialogs.findDialog(parent, default, whole_words, case_sensitive)
return {'text': result.searchText, 'whole_words': result.wholeWordsOnly,
'case_sensitive': result.caseSensitive} | [
"Shows",
"a",
"find",
"text",
"dialog"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/dialog.py#L127-L131 | [
"def",
"find",
"(",
"default",
"=",
"''",
",",
"whole_words",
"=",
"0",
",",
"case_sensitive",
"=",
"0",
",",
"parent",
"=",
"None",
")",
":",
"result",
"=",
"dialogs",
".",
"findDialog",
"(",
"parent",
",",
"default",
",",
"whole_words",
",",
"case_se... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | TreeModel.clear | Remove all items and reset internal structures | gui/controls/treeview.py | def clear(self):
"Remove all items and reset internal structures"
dict.clear(self)
self._key = 0
if hasattr(self._tree_view, "wx_obj"):
self._tree_view.wx_obj.DeleteAllItems() | def clear(self):
"Remove all items and reset internal structures"
dict.clear(self)
self._key = 0
if hasattr(self._tree_view, "wx_obj"):
self._tree_view.wx_obj.DeleteAllItems() | [
"Remove",
"all",
"items",
"and",
"reset",
"internal",
"structures"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/treeview.py#L137-L142 | [
"def",
"clear",
"(",
"self",
")",
":",
"dict",
".",
"clear",
"(",
"self",
")",
"self",
".",
"_key",
"=",
"0",
"if",
"hasattr",
"(",
"self",
".",
"_tree_view",
",",
"\"wx_obj\"",
")",
":",
"self",
".",
"_tree_view",
".",
"wx_obj",
".",
"DeleteAllItems... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
test | TreeItem.set_has_children | Force appearance of the button next to the item | gui/controls/treeview.py | def set_has_children(self, has_children=True):
"Force appearance of the button next to the item"
# This is useful to allow the user to expand the items which don't have
# any children now, but instead adding them only when needed, thus
# minimizing memory usage and loading time.
... | def set_has_children(self, has_children=True):
"Force appearance of the button next to the item"
# This is useful to allow the user to expand the items which don't have
# any children now, but instead adding them only when needed, thus
# minimizing memory usage and loading time.
... | [
"Force",
"appearance",
"of",
"the",
"button",
"next",
"to",
"the",
"item"
] | reingart/gui2py | python | https://github.com/reingart/gui2py/blob/aca0a05f6fcde55c94ad7cc058671a06608b01a4/gui/controls/treeview.py#L184-L190 | [
"def",
"set_has_children",
"(",
"self",
",",
"has_children",
"=",
"True",
")",
":",
"# This is useful to allow the user to expand the items which don't have\r",
"# any children now, but instead adding them only when needed, thus \r",
"# minimizing memory usage and loading time.\r",
"self",... | aca0a05f6fcde55c94ad7cc058671a06608b01a4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.