Exemplo n.º 1
0
    def __init__(self, argv):
        GenericUI.__init__(self, argv)

        self.sim().delay = 0.15

        self.app = wx.App(False)
        self.win = wx.Frame(None, wx.ID_ANY, "Guyton Model")

        self.plots = Plots(parent=self.win)
        self.plots.add_plot("t", "pa")
        self.plots.add_plot("t", "qao")
        self.plots.add_plot("t", "vud")

        self.btnbox = wx.BoxSizer(wx.HORIZONTAL)
        self.mainbox = wx.BoxSizer(wx.VERTICAL)

        self.btnP = wx.Button(self.win, label="Start")
        self.win.Bind(wx.EVT_BUTTON, self.toggle_simulation, self.btnP)
        self.btnbox.Add(self.btnP, 0)
        self.btnbox.AddStretchSpacer()
        self.btnC = wx.Button(self.win, label="Clear")
        self.win.Bind(wx.EVT_BUTTON, self.clear_plots_ui, self.btnC)
        self.btnbox.Add(self.btnC, 0)
        self.btnbox.AddStretchSpacer()
        self.btnR = wx.Button(self.win, label="Reset")
        self.win.Bind(wx.EVT_BUTTON, self.reset_simulation, self.btnR)
        self.btnbox.Add(self.btnR, 0)
        self.btnbox.AddStretchSpacer()
        self.btnA = wx.Button(self.win, label="Add Plot")
        self.win.Bind(wx.EVT_BUTTON, self.add_plot_ui, self.btnA)
        self.btnbox.Add(self.btnA, 0)
        self.btnbox.AddStretchSpacer()
        self.btnD = wx.Button(self.win, label="Remove Plot")
        self.win.Bind(wx.EVT_BUTTON, self.del_plot_ui, self.btnD)
        self.btnbox.Add(self.btnD, 0)
        self.btnbox.AddStretchSpacer()
        self.btnL = wx.Button(self.win, label="Load")
        self.win.Bind(wx.EVT_BUTTON, self.load_sim_ui, self.btnL)
        self.btnbox.Add(self.btnL, 0)
        self.btnbox.AddStretchSpacer()
        self.btnS = wx.Button(self.win, label="Save")
        self.win.Bind(wx.EVT_BUTTON, self.save_sim_ui, self.btnS)
        self.btnbox.Add(self.btnS, 0)
        self.btnbox.AddStretchSpacer()
        self.btnQ = wx.Button(self.win, label="Quit")
        self.win.Bind(wx.EVT_BUTTON, self.quit, self.btnQ)
        self.btnbox.Add(self.btnQ, 0)
        self.btnbox.AddStretchSpacer()

        self.mainbox.Add(self.plots, 1, wx.EXPAND | wx.ALIGN_TOP)
        self.mainbox.Add(self.btnbox, 0, wx.EXPAND | wx.ALIGN_BOTTOM)

        self.mainbox.Fit(self.win)
        self.win.SetSizer(self.mainbox)
        self.win.SetAutoLayout(1)
        self.win.Layout()
        self.win.Show(True)
Exemplo n.º 2
0
    def __init__(self, argv):
        GenericUI.__init__(self, argv)

        self.plots = Plots()
        self.plots.add_plot("t", "pa")
        self.plots.add_plot("t", "qao")
        self.plots.add_plot("t", "vud")

        self.win = gtk.Window()
        self.win.connect("destroy", self.quit)
        self.win.set_default_size(400,300)
        self.win.set_title("Guyton model")

        self.gtk_settings = gtk.settings_get_default()
        self.gtk_settings.set_long_property("gtk-button-images", 1, "rob")

        self.btnP = gtk.Button(label="Start")
        self.set_button_image(self.btnP, gtk.STOCK_MEDIA_PLAY)
        self.btnP.connect("clicked", self.toggle_simulation)
        self.btnC = gtk.Button(label="Clear")
        self.set_button_image(self.btnC, gtk.STOCK_CLEAR)
        self.btnC.connect("clicked", self.clear_plots_ui)
        self.btnR = gtk.Button(label="Reset")
        self.set_button_image(self.btnR, gtk.STOCK_MEDIA_STOP)
        self.btnR.connect("clicked", self.reset_simulation)
        self.btnL = gtk.Button(label="Load")
        self.set_button_image(self.btnL, gtk.STOCK_OPEN)
        self.btnL.connect("clicked", self.load_sim_ui)
        self.btnS = gtk.Button(label="Save")
        self.set_button_image(self.btnS, gtk.STOCK_SAVE)
        self.btnS.connect("clicked", self.save_sim_ui)
        self.btnQ = gtk.Button(label="Quit")
        self.set_button_image(self.btnQ, gtk.STOCK_QUIT)
        self.btnQ.connect("clicked", self.quit)
        self.btnA = gtk.Button(label="Add Plot")
        self.set_button_image(self.btnA, gtk.STOCK_NEW)
        self.btnA.connect("clicked", self.add_plot_ui)
        self.btnD = gtk.Button(label="Remove Plot")
        self.set_button_image(self.btnD, gtk.STOCK_CLOSE)
        self.btnD.connect("clicked", self.del_plot_ui)

        self.btnbox = gtk.HBox()
        self.btnbox.pack_start(self.btnP, expand=True, fill=False)
        self.btnbox.pack_start(self.btnC, expand=True, fill=False)
        self.btnbox.pack_start(self.btnR, expand=True, fill=False)
        self.btnbox.pack_start(self.btnA, expand=True, fill=False)
        self.btnbox.pack_start(self.btnL, expand=True, fill=False)
        self.btnbox.pack_start(self.btnS, expand=True, fill=False)
        self.btnbox.pack_start(self.btnQ, expand=True, fill=False)

        self.mainbox = gtk.VBox()
        self.mainbox.pack_start(self.plots, expand=True, fill=True)
        self.mainbox.pack_start(self.btnbox, expand=False, fill=False)
        self.win.add(self.mainbox)

        self.win.show_all()
Exemplo n.º 3
0
    def __init__(self, argv):
        GenericUI.__init__(self, argv)

        self.app = QtGui.QApplication(argv)

        self.plots = Plots()
        self.plots.add_plot("t", "pa")
        self.plots.add_plot("t", "qao")
        self.plots.add_plot("t", "vud")

        self.win = QtGui.QWidget()
        self.win.setGeometry(300, 300, 250, 150)
        self.win.setWindowTitle('Icon')

        self.btnP = QtGui.QPushButton('Start', self.win)
        self.set_button_image(self.btnP, "media-playback-start")
        self.btnP.clicked.connect(self.toggle_simulation)
        self.btnC = QtGui.QPushButton('Clear', self.win)
        self.set_button_image(self.btnC, "edit-clear")
        self.btnC.clicked.connect(self.clear_plots_ui)
        self.btnR = QtGui.QPushButton('Reset', self.win)
        self.set_button_image(self.btnR, "media-playback-stop")
        self.btnR.clicked.connect(self.reset_simulation)
        self.btnA = QtGui.QPushButton('Add Plot', self.win)
        self.set_button_image(self.btnA, "document-new")
        self.btnA.clicked.connect(self.add_plot_ui)
        self.btnL = QtGui.QPushButton('Load', self.win)
        self.set_button_image(self.btnL, "document-open")
        self.btnL.clicked.connect(self.load_sim_ui)
        self.btnS = QtGui.QPushButton('Save', self.win)
        self.set_button_image(self.btnS, "document-savee")
        self.btnL.clicked.connect(self.save_sim_ui)
        self.btnQ = QtGui.QPushButton('Quit', self.win)
        self.set_button_image(self.btnQ, "application-exit")
        self.btnQ.clicked.connect(self.quit)

        self.btnbox = QtGui.QHBoxLayout()
        align = QtCore.Qt.AlignHCenter
        self.btnbox.addWidget(self.btnP, stretch=0, alignment=align)
        self.btnbox.addWidget(self.btnC, stretch=0, alignment=align)
        self.btnbox.addWidget(self.btnR, stretch=0, alignment=align)
        self.btnbox.addWidget(self.btnA, stretch=0, alignment=align)
        self.btnbox.addWidget(self.btnL, stretch=0, alignment=align)
        self.btnbox.addWidget(self.btnS, stretch=0, alignment=align)
        self.btnbox.addWidget(self.btnQ, stretch=0, alignment=align)

        self.mainbox = QtGui.QVBoxLayout()
        align = QtCore.Qt.AlignTop
        self.mainbox.addWidget(self.plots, stretch=1, alignment=align)
        self.mainbox.addLayout(self.btnbox, stretch=0)

        self.win.setLayout(self.mainbox)
        self.win.show()