Exemple #1
0
    def __init__(self):
        gtk.Toolbar.__init__(self)

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        self.insert(separator, -1)
        separator.show()

        self.view_canvas = ToggleToolButton('opensim-canvas')
        self.view_canvas.set_tooltip(_('View model diagram'))
        self.insert(self.view_canvas, -1)
        self.view_canvas.set_active(True)
        self.view_canvas.show()

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        self.insert(separator, -1)
        separator.show()

        self.view_graphs = ToggleToolButton('opensim-graphs')
        self.view_graphs.set_tooltip(_('View simulation graphs'))
        self.insert(self.view_graphs, -1)
        self.view_graphs.show()

        # connect these after both exist to get rid of some of the errors
        # we were getting on activity startup
        self.view_graphs.connect('toggled', self.__toggled)
        self.view_canvas.connect('toggled', self.__toggled)

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        self.insert(separator, -1)
        separator.show()

        self.view_var = ToolComboBox(label_text=_('View behavior of:'))
        #self.timestep.combo.connect('changed', self.__share_changed_cb)
        self.view_var.combo.append_item(1, _('rabbits'))
        self.view_var.combo.append_item(2, _('foxes'))
        self.view_var.combo.append_item(3, _('rabbit births'))
        self.view_var.combo.set_active(0)
        self.insert(self.view_var, -1)
        self.view_var.set_sensitive(False)
        self.view_var.show()

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        self.insert(separator, -1)
        separator.show()
Exemple #2
0
    def __init__(self):
        gtk.Toolbar.__init__(self)

        #Get our 4 buttons & add type attributes to them

        self.start_label = gtk.Label()
        self.start_label.set_text(_('Start time: '))
        self._add_widget(self.start_label)

        self.start = gtk.Entry()
        self.start.set_size_request(int(gtk.gdk.screen_width() / 12), -1)
        self.start.set_text(_('0'))
        self._add_widget(self.start)

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        self.insert(separator, -1)
        separator.show()

        self.end_label = gtk.Label()
        self.end_label.set_text(_('End time: '))
        self._add_widget(self.end_label)

        self.start = gtk.Entry()
        self.start.set_size_request(int(gtk.gdk.screen_width() / 12), -1)
        self.start.set_text(_('100'))
        self._add_widget(self.start)

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        self.insert(separator, -1)
        separator.show()

        self.timestep = ToolComboBox(label_text=_('Timestep:'))
        #self.timestep.combo.connect('changed', self.__share_changed_cb)
        self.timestep.combo.append_item(.125, _('.125'))
        self.timestep.combo.append_item(.25, _('.25'))
        self.timestep.combo.append_item(1, _('1'))
        self.timestep.combo.set_active(0)
        self.insert(self.timestep, -1)
        self.timestep.show()

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        self.insert(separator, -1)
        separator.show()

        self.savestep = ToolComboBox(label_text=_('Savestep:'))
        #self.timestep.combo.connect('changed', self.__share_changed_cb)
        self.savestep.combo.append_item(1, _('1'))
        self.savestep.combo.append_item(.25, _('.25'))
        self.savestep.combo.append_item(.125, _('.125'))
        self.savestep.combo.set_active(0)
        self.insert(self.savestep, -1)
        self.savestep.show()

        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        self.insert(separator, -1)
        separator.show()

        self.run = ToolButton('media-playback-start',
                              tooltip=_('Run Simulation'))
        #self.run.props.accelerator = '<Ctrl>Q'
        #self.run.connect('clicked', self.__stop_clicked_cb)
        self.insert(self.run, -1)
        self.run.show()