Пример #1
0
 def __init_attributes(self, manager, editor):
     self.__manager = manager
     self.__editor = editor
     self.__toolbar = manager.gui.get_object("Toolbar")
     from gtk import ToggleToolButton
     self.__button = ToggleToolButton()
     return
Пример #2
0
  def __init__(self):
    gtk.Toolbar.__init__(self)

    #Get our 4 buttons & add type attributes to them
    self.stock = ToggleToolButton("opensim-stock")
    self.stock.set_tooltip(_('Create Stocks'))
    self.insert(self.stock, -1)
    self.stock.show()
    self.stock.type = STOCK

    self.flow = ToggleToolButton("opensim-flow")
    self.flow.set_tooltip(_('Create Flows'))
    self.insert(self.flow, -1)
    self.flow.show()
    self.flow.type = FLOW    

    self.variable = ToggleToolButton("opensim-var")
    self.variable.set_tooltip(_('Create Variables'))
    self.insert(self.variable, -1)
    self.variable.show()
    self.variable.type = VARIABLE

    self.influence = ToggleToolButton("opensim-infl")
    self.influence.set_tooltip(_('Create Influence Arrows'))
    self.insert(self.influence, -1)
    self.influence.show()
    self.influence.type = INFLUENCE
Пример #3
0
    def __init__(self):
        gtk.Toolbar.__init__(self)

        #Get our 4 buttons & add type attributes to them
        self.stock = ToggleToolButton("opensim-stock")
        self.stock.set_tooltip(_('Create Stocks'))
        self.insert(self.stock, -1)
        self.stock.show()
        self.stock.type = STOCK

        self.flow = ToggleToolButton("opensim-flow")
        self.flow.set_tooltip(_('Create Flows'))
        self.insert(self.flow, -1)
        self.flow.show()
        self.flow.type = FLOW

        self.variable = ToggleToolButton("opensim-var")
        self.variable.set_tooltip(_('Create Variables'))
        self.insert(self.variable, -1)
        self.variable.show()
        self.variable.type = VARIABLE

        self.influence = ToggleToolButton("opensim-infl")
        self.influence.set_tooltip(_('Create Influence Arrows'))
        self.insert(self.influence, -1)
        self.influence.show()
        self.influence.type = INFLUENCE
Пример #4
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()
Пример #5
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()
Пример #6
0
	def __init_attributes(self, manager, editor):
		self.__manager = manager
		self.__editor = editor
		self.__toolbar = manager.gui.get_object("Toolbar")
		from gtk import ToggleToolButton
		self.__button = ToggleToolButton()
		return
Пример #7
0
class Button(SignalManager):

	def __init__(self, manager, editor):
		SignalManager.__init__(self)
		self.__init_attributes(manager, editor)
		self.__button.set_icon_name("view-restore")
		self.__toolbar.insert(self.__button, -1)
		self.__button.set_tooltip_text(SHOW_TOOLTIP_MESSAGE)
		self.connect(manager, "destroy", self.__destroy_cb)
		self.connect(manager, "toggle-hidden", self.__toggle_hidden_cb)
		self.connect(self.__button, "toggled", self.__toggled_cb)

	def __init_attributes(self, manager, editor):
		self.__manager = manager
		self.__editor = editor
		self.__toolbar = manager.gui.get_object("Toolbar")
		from gtk import ToggleToolButton
		self.__button = ToggleToolButton()
		return

	def __activate(self):
		signal = "show-hidden" if self.__button.get_active() else "hide-hidden"
		message = HIDE_TOOLTIP_MESSAGE if signal == "show-hidden" else SHOW_TOOLTIP_MESSAGE
		self.__button.set_tooltip_text(message)
		from gobject import idle_add
		idle_add(self.__manager.emit, signal)
		return False

	def __toggle(self):
		active = self.__button.get_active()
		self.__button.set_active(not active)
		return False

	def __destroy_cb(self, *args):
		self.disconnect()
		del self
		return False

	def __toggled_cb(self, *args):
		from gobject import idle_add
		idle_add(self.__activate)
		return False

	def __toggle_hidden_cb(self, *args):
		from gobject import idle_add
		idle_add(self.__toggle)
		return False
Пример #8
0
class Button(SignalManager):
    def __init__(self, manager, editor):
        SignalManager.__init__(self)
        self.__init_attributes(manager, editor)
        self.__button.set_icon_name("view-restore")
        self.__toolbar.insert(self.__button, -1)
        self.__button.set_tooltip_text(SHOW_TOOLTIP_MESSAGE)
        self.connect(manager, "destroy", self.__destroy_cb)
        self.connect(manager, "toggle-hidden", self.__toggle_hidden_cb)
        self.connect(self.__button, "toggled", self.__toggled_cb)

    def __init_attributes(self, manager, editor):
        self.__manager = manager
        self.__editor = editor
        self.__toolbar = manager.gui.get_object("Toolbar")
        from gtk import ToggleToolButton
        self.__button = ToggleToolButton()
        return

    def __activate(self):
        signal = "show-hidden" if self.__button.get_active() else "hide-hidden"
        message = HIDE_TOOLTIP_MESSAGE if signal == "show-hidden" else SHOW_TOOLTIP_MESSAGE
        self.__button.set_tooltip_text(message)
        from gobject import idle_add
        idle_add(self.__manager.emit, signal)
        return False

    def __toggle(self):
        active = self.__button.get_active()
        self.__button.set_active(not active)
        return False

    def __destroy_cb(self, *args):
        self.disconnect()
        del self
        return False

    def __toggled_cb(self, *args):
        from gobject import idle_add
        idle_add(self.__activate)
        return False

    def __toggle_hidden_cb(self, *args):
        from gobject import idle_add
        idle_add(self.__toggle)
        return False
Пример #9
0
class ViewToolbar(gtk.Toolbar):
    '''Provides the toolbar containing the basic modeling functions'''
    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()

    def __toggled(self, widget):
        # fight infinite loops!
        if widget.get_active() is False:
            return

        if widget is self.view_graphs:
            self.view_canvas.set_active(False)
            self.view_var.set_sensitive(True)
        else:
            self.view_graphs.set_active(False)
            self.view_var.set_sensitive(False)
Пример #10
0
class ViewToolbar(gtk.Toolbar):
  '''Provides the toolbar containing the basic modeling functions'''

  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()


  def __toggled(self, widget):
    # fight infinite loops!
    if widget.get_active() is False:
      return

    if widget is self.view_graphs:
      self.view_canvas.set_active(False)
      self.view_var.set_sensitive(True)
    else:
      self.view_graphs.set_active(False)
      self.view_var.set_sensitive(False)