def OnTaskBarWXInspector(self, evt): # Activate the widget inspection tool from wx.lib.inspection import InspectionTool if not InspectionTool().initialized: InspectionTool().Init(**self._LiveShellLocals()) wnd = wx.GetApp() InspectionTool().Show(wnd, True)
def openWXInspectTool(self, event): if not InspectionTool().initialized: InspectionTool().Init() # Find a widget to be selected in the tree. Use either the # one under the cursor, if any, or this frame. wnd, _ = wx.FindWindowAtPointer() if not wnd: wnd = self InspectionTool().Show(wnd, True)
def OnOpenWidgetInspector(self, evt): # Activate the widget inspection tool from wx.lib.inspection import InspectionTool if not InspectionTool().initialized: InspectionTool().Init() # Find a widget to be selected in the tree. Use either the # one under the cursor, if any, or this frame. wnd = wx.FindWindowAtPointer() if not wnd: wnd = self InspectionTool().Show(wnd, True)
def __init__(self, parent): wx.Dialog.__init__(self, parent, -1, title=u"Logon", style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER) vsizer = wx.BoxSizer(orient=wx.VERTICAL) gb = wx.GridBagSizer() gb.Add(wx.StaticText(self, -1, u"Username"), flag=wx.ALL | wx.EXPAND, border=10, pos=(0, 0)) self._name = wx.TextCtrl(self, -1) gb.Add(self._name, flag=wx.ALL | wx.EXPAND, border=10, pos=(0, 1)) gb.Add(wx.StaticText(self, -1, u"Password"), flag=wx.ALL | wx.EXPAND, pos=(1, 0), border=10) self._pass = wx.TextCtrl(self, -1, style=wx.TE_PASSWORD) gb.Add(self._pass, border=10, flag=wx.EXPAND | wx.ALL, pos=(1, 1)) gb.AddGrowableCol(1) butsz = wx.StdDialogButtonSizer() okbut = wx.Button(self, wx.ID_OK, u"OK") butsz.AddButton(okbut) cbut = wx.Button(self, wx.ID_CANCEL, u"Cancel") butsz.AddButton(cbut) insp = wx.Button(self, wx.ID_HELP, u"Help") butsz.AddButton(insp) insp.Bind(wx.EVT_BUTTON, InspectionTool().Show) butsz.Realize() okbut.SetDefault() vsizer.Add(gb, 0, wx.EXPAND) vsizer.Add(butsz, 0, wx.EXPAND) self.SetSizer(vsizer) self.Fit()
def InitInspection(self, pos=wx.DefaultPosition, size=wx.Size(850, 700), config=None, locals=None, alt=True, cmd=True, shift=False, keyCode=ord('I')): """ Make the event binding that will activate the InspectionFrame window. :param `pos`: the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform; :param `size`: the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform; :param `config`: A :class:`Config` object to be used to store layout and other info to when the inspection frame is closed. This info will be restored the next time the inspection frame is used. :param `locals`: A dictionary of names to be added to the PyCrust namespace. :param boolean `alt`: use alt in the short cut sequence :param boolean `cmd`: use ctrl/cmd in the short cut sequence :param boolean `shift`: use shift in the short cut sequence :param string `keyCode`: the key code for the short cut sequence """ self.Bind(wx.EVT_KEY_DOWN, self._OnKeyPress) self._alt = alt self._cmd = cmd self._shift = shift self._keyCode = keyCode InspectionTool().Init(pos, size, config, locals, self)
def start(self, debug_mode=False): if debug_mode: from wx.lib.inspection import InspectionTool InspectionTool().Show() frame = SciFrame(None, title='SciEnv', size=(1075, 650)) frame.Show()
def __init__(self, parent): with iz.Dialog(init=self, title=u"Logon", orient=wx.VERTICAL, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER): with iz.GridBagSizer(orient=wx.HORIZONTAL, proportion=1) as gb: # Defaults for StaticText and TextCtrl are normally border=0,proportion=0,flag=0. Change them temporarily # to avoid repeating the same options for each and every control: with iz.StaticText.Default(border=10), iz.TextCtrl.Default( border=10, proportion=1, flag=wx.EXPAND): # Now the sizer parameters can be omitted in the control definitions, since the defaults are # now appropriate. iz.StaticText(u"Username") self._name = iz.TextCtrl().wx iz.StaticText(u"Password", x=0) self._pass = iz.TextCtrl(style=wx.TE_PASSWORD).wx gb.AddGrowableCol(1) with iz.StdDialogButtonSizer(): okbut = iz.Button(u"OK", id=wx.ID_OK).wx iz.Button(u"Cancel", id=wx.ID_CANCEL) insp = iz.Button(u"Help", id=wx.ID_HELP, border=10, EVT_BUTTON=InspectionTool().Show).wx okbut.SetDefault() self.Fit()
def ShowInspectionTool(self): """ Show the Inspection tool, creating it if neccesary, setting it to display the widget under the cursor. """ # get the current widget under the mouse wnd, pt = wx.FindWindowAtPointer() InspectionTool().Show(wnd)
def OnCmdWIT(self): if eg.wit: eg.wit.Show(refreshTree=True) return from wx.lib.inspection import InspectionTool eg.wit = InspectionTool() eg.wit.Show(refreshTree=True)
def __init__(self, title): super().__init__(None, title=title, size=(500, 500)) main_sizer = wx.BoxSizer(wx.VERTICAL) self.statsPane = MainPanel(self) main_sizer.Add(self.statsPane, 0, wx.EXPAND) self.SetSizerAndFit(main_sizer) if not InspectionTool().initialized: InspectionTool().Init() # Find a widget to be selected in the tree. Use either the # one under the cursor, if any, or this frame. wnd, _ = wx.FindWindowAtPointer() if not wnd: wnd = self InspectionTool().Show(wnd, True)
def InitInspection(self, pos=wx.DefaultPosition, size=wx.Size(850,700), config=None, locals=None, alt=True, cmd=True, shift=False, keyCode=ord('I')): """ Make the event binding that will activate the InspectionFrame window. """ self.Bind(wx.EVT_KEY_DOWN, self._OnKeyPress) self._alt = alt self._cmd = cmd self._shift = shift self._keyCode = keyCode InspectionTool().Init(pos, size, config, locals, self)
def OnOpenWidgetInspector(self, event): """ Activate the widget inspection tool, giving it a widget to preselect in the tree. Use either the one under the cursor, if any, or this frame. """ from wx.lib.inspection import InspectionTool wnd = wx.FindWindowAtPointer() if not wnd: wnd = self InspectionTool().Show(wnd, True)
def __init__(self, parent): with iz.Dialog(init=self, title=u"Logon", orient=wx.VERTICAL, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER): with iz.GridBagSizer(orient=wx.HORIZONTAL, proportion=1) as gb: iz.StaticText(u"Username", border=10) self._name = iz.TextCtrl(border=10, proportion=1, flag=wx.EXPAND).wx iz.StaticText(u"Password", x=0, border=10) self._pass = iz.TextCtrl(style=wx.TE_PASSWORD, border=10, proportion=1, flag=wx.EXPAND).wx gb.AddGrowableCol(1) with iz.StdDialogButtonSizer(): okbut = iz.Button(u"OK", id=wx.ID_OK).wx iz.Button(u"Cancel", id=wx.ID_CANCEL) insp = iz.Button(u"Help", id=wx.ID_HELP,border=10, EVT_BUTTON=InspectionTool().Show).wx okbut.SetDefault() self.Fit()
(2 * i + 2)) < .75 masks.append( MaskData("Mask %d" % (i + 1), mask, mode=MODE_LINES, color=outline_color)) artist = CPImageArtist(images=images, objects=objects, masks=masks) figure = matplotlib.pyplot.figure() ax = figure.add_axes((0.05, 0.05, .9, .9)) assert isinstance(ax, matplotlib.axes.Axes) ax.set_aspect('equal') ax.set_xlim(0, images[0].pixel_data.shape[1]) ax.set_ylim(0, images[0].pixel_data.shape[0]) ax.add_artist(artist) inspector = InspectionTool() my_locals = dict([(k, v) for k, v in globals().items() if k.isupper()]) my_locals['images'] = images my_locals['objects'] = objects my_locals['masks'] = masks for fmt, sequence in (("i%d", images), ("o%d", objects), ("m%d", masks)): for i, v in enumerate(sequence): my_locals[fmt % (i + 1)] = v my_locals['draw'] = matplotlib.pyplot.draw inspector.Init(locals=my_locals) inspector.Show() matplotlib.pyplot.draw() frame = matplotlib.pyplot.gcf().canvas.GetTopLevelParent() menu_bar = wx.MenuBar() menu = wx.Menu()
def onUserShowInspectionTool(self, e): InspectionTool().Show() e.Skip()
def action(self, index=-1, multiplier=1): from wx.lib.inspection import InspectionTool if not InspectionTool().initialized: InspectionTool().Init() InspectionTool().Show(self.frame, True)
def _on_inspect(self, evt): from wx.lib.inspection import InspectionTool InspectionTool().Show()
def onWidgetInspector(self, event: CommandEvent): InspectionTool().Show()
self.tree.SetItemText(src.node, src.label) self.tree.SetItemData(src.node, src) self.fn_to_src[src.path] = src else: src = self.fn_to_src[fn] if not defer_open: self.tree.SelectItem(src.node) if __name__ == "__main__": import sys if len(sys.argv) <= 1: filenames = glob.glob("*.log") else: filenames = [] for arg in sys.argv[1:]: if os.path.isdir(arg): filenames.extend(glob.glob(os.path.join(arg, "*.log"))) else: filenames.append(arg) from wx.lib.inspection import InspectionTool app = wx.App(False) window = CSVPlotter(None) window.add_data_sources(filenames, defer_open=True) window.Show() if DEBUG: it = InspectionTool() it.Show() app.MainLoop()
def on_debug_ShowWidgetInspectorEvent(self, event): from wx.lib.inspection import InspectionTool InspectionTool().Show()