예제 #1
0
                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()
예제 #2
0
        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()
        sub_menu = wx.Menu()
        item = menu.AppendSubMenu(sub_menu, "Subplot")
        menu_bar.Append(menu, "Subplots")
        frame.SetMenuBar(menu_bar)
        artist.add_to_menu(frame, item)
        matplotlib.pyplot.show()

    finally:
        javabridge.kill_vm()