Exemplo n.º 1
0
 def OnShow(self, event):
     if event.GetShow():
         self.red_residual = RedResidual(data["red"])
         self.graficador = GraficoDeRed(self.red_residual)
         self.red_residual.solucionar()
         self.slider_tiempo.SetRange(0, self.red_residual.i())
         self.ActualizarVistaPrevia()
Exemplo n.º 2
0
 def OnShow(self, event):
     if event.GetShow():
         self.graficador = GraficoDeRed(data["red"])
         self.combo_origen.Clear()
         self.combo_origen.AppendItems(
             [n.nombre for n in data["red"].nodos])
         self.combo_destino.Clear()
         self.combo_destino.AppendItems(
             [n.nombre for n in data["red"].nodos])
Exemplo n.º 3
0
    def __init__(self, parent, data):
        AeroPage.__init__(self, parent, u"Defina la red")
        instrucciones = AeroStaticText(
            self, -1,
            u"Indique la cantidad de nodos que tendrá la red y los arcos que hay entre ellos."
        )
        self.content.Add(instrucciones, 0, wx.BOTTOM, 10)

        # cantidad de nodos
        hb = wx.BoxSizer(wx.HORIZONTAL)
        l = wx.StaticText(self, -1, u"Nodos:")
        hb.Add(l, 0, wx.ALIGN_CENTER_VERTICAL, 0)
        self.cantidad_nodos = wx.SpinCtrl(self, -1, "3")
        self.cantidad_nodos.SetRange(1, 50)
        self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.cantidad_nodos)
        hb.Add(self.cantidad_nodos)
        self.content.Add(hb, 0, wx.BOTTOM, 10)

        hb = wx.BoxSizer(wx.HORIZONTAL)
        # tabla de arcos
        box = wx.StaticBox(self, -1, u"Capacidad de los arcos")
        bsizer = wx.StaticBoxSizer(box, wx.VERTICAL)
        self.tabla_de_arcos = wx.grid.Grid(self, -1, (-1, -1), (400, 300))
        self.datos_de_arcos = TablaDeArcos()
        self.tabla_de_arcos.SetDefaultCellAlignment(wx.ALIGN_CENTER,
                                                    wx.ALIGN_CENTER)
        self.tabla_de_arcos.SetDefaultColSize(36)
        self.tabla_de_arcos.SetDefaultRowSize(36)
        self.tabla_de_arcos.SetDefaultRenderer(Renderer())
        self.tabla_de_arcos.Bind(wx.grid.EVT_GRID_CELL_CHANGE,
                                 self.OnCellChange)
        self.tabla_de_arcos.Bind(wx.grid.EVT_GRID_SELECT_CELL,
                                 self.OnCellSelect)
        bsizer.Add(self.tabla_de_arcos, 1, wx.EXPAND)
        hb.Add(bsizer, 1, wx.EXPAND)
        hb.AddSpacer(10)

        # vista previa
        box = wx.StaticBox(self, -1, u"Vista previa")
        bsizer = wx.StaticBoxSizer(box, wx.VERTICAL)
        self.panel_vista_previa = scrolledpanel.ScrolledPanel(self,
                                                              -1,
                                                              size=(400, 300))
        self.panel_vista_previa.SetBackgroundColour("#000000")
        self.bitmap_grafo = wx.StaticBitmap(self.panel_vista_previa, -1)
        self.panel_vista_previa.SetAutoLayout(1)
        self.panel_vista_previa.SetBackgroundColour(wx.WHITE)
        self.panel_vista_previa.SetSizer(wx.BoxSizer(wx.VERTICAL))
        self.panel_vista_previa.GetSizer().Add(
            self.bitmap_grafo, 1,
            wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL)
        self.graficador = GraficoDeRed(self.datos_de_arcos.GetRed())
        bsizer.Add(self.panel_vista_previa, 0, wx.EXPAND)
        hb.Add(bsizer, 0, wx.EXPAND)
        self.content.Add(hb, 0, wx.BOTTOM, 20)