Ejemplo n.º 1
0
 def button_press(tree_view, bev):
     if bev.button != 1 or bev.type != gtk.gdk._2BUTTON_PRESS:
         return False
     pos = tree_view.get_path_at_pos(int(bev.x), int(bev.y))
     if not pos:
         return False
     path, col, x, y = pos
     properties.edit(self.model[path][InterfaceBrowser.INTERFACE])
Ejemplo n.º 2
0
    def show_popup_menu(self, iface, bev):
        import bugs

        have_source = properties.have_source_for(self.config, iface)

        global menu  # Fix GC problem in PyGObject
        menu = gtk.Menu()
        for label, cb in [
            (_('Show Feeds'),
             lambda: properties.edit(self.driver, iface, self.compile)),
            (_('Show Versions'), lambda: properties.edit(
                self.driver, iface, self.compile, show_versions=True)),
            (_('Report a Bug...'), lambda: bugs.report_bug(self.driver, iface))
        ]:
            item = gtk.MenuItem()
            item.set_label(label)
            if cb:
                item.connect('activate', lambda item, cb=cb: cb())
            else:
                item.set_sensitive(False)
            item.show()
            menu.append(item)

        item = gtk.MenuItem()
        item.set_label(_('Compile'))
        item.show()
        menu.append(item)
        if have_source:
            compile_menu = gtk.Menu()
            item.set_submenu(compile_menu)

            item = gtk.MenuItem()
            item.set_label(_('Automatic'))
            item.connect('activate',
                         lambda item: self.compile(iface, autocompile=True))
            item.show()
            compile_menu.append(item)

            item = gtk.MenuItem()
            item.set_label(_('Manual...'))
            item.connect('activate',
                         lambda item: self.compile(iface, autocompile=False))
            item.show()
            compile_menu.append(item)
        else:
            item.set_sensitive(False)

        if gtk.pygtk_version >= (2, 90):
            menu.popup(None, None, None, None, bev.button, bev.time)
        else:
            menu.popup(None, None, None, bev.button, bev.time)
Ejemplo n.º 3
0
		def button_press(tree_view, bev):
			pos = tree_view.get_path_at_pos(int(bev.x), int(bev.y))
			if not pos:
				return False
			path, col, x, y = pos

			if (bev.button == 3 or (bev.button < 4 and col is menu_column)) \
			   and bev.type == gtk.gdk.BUTTON_PRESS:
				selection.select_path(path)
				iface = self.model[path][InterfaceBrowser.INTERFACE]
				self.show_popup_menu(iface, bev)
				return True
			if bev.button != 1 or bev.type != gtk.gdk._2BUTTON_PRESS:
				return False
			properties.edit(policy, self.model[path][InterfaceBrowser.INTERFACE], self.compile, show_versions = True)
Ejemplo n.º 4
0
		def button_press(tree_view, bev):
			pos = tree_view.get_path_at_pos(int(bev.x), int(bev.y))
			if not pos:
				return False
			path, col, x, y = pos

			if (bev.button == 3 or (bev.button < 4 and col is menu_column)) \
			   and bev.type == gtk.gdk.BUTTON_PRESS:
				selection.select_path(path)
				iface = self.model[path][InterfaceBrowser.INTERFACE]
				self.show_popup_menu(iface, bev)
				return True
			if bev.button != 1 or bev.type != gtk.gdk._2BUTTON_PRESS:
				return False
			properties.edit(driver, self.model[path][InterfaceBrowser.INTERFACE], self.compile, show_versions = True)
Ejemplo n.º 5
0
	def show_popup_menu(self, iface, bev):
		import bugs

		have_source =  properties.have_source_for(self.config, iface)

		global menu		# Fix GC problem in PyGObject
		menu = gtk.Menu()
		for label, cb in [(_('Show Feeds'), lambda: properties.edit(self.driver, iface, self.compile)),
				  (_('Show Versions'), lambda: properties.edit(self.driver, iface, self.compile, show_versions = True)),
				  (_('Report a Bug...'), lambda: bugs.report_bug(self.driver, iface))]:
			item = gtk.MenuItem()
			item.set_label(label)
			if cb:
				item.connect('activate', lambda item, cb=cb: cb())
			else:
				item.set_sensitive(False)
			item.show()
			menu.append(item)

		item = gtk.MenuItem()
		item.set_label(_('Compile'))
		item.show()
		menu.append(item)
		if have_source:
			compile_menu = gtk.Menu()
			item.set_submenu(compile_menu)

			item = gtk.MenuItem()
			item.set_label(_('Automatic'))
			item.connect('activate', lambda item: self.compile(iface, autocompile = True))
			item.show()
			compile_menu.append(item)

			item = gtk.MenuItem()
			item.set_label(_('Manual...'))
			item.connect('activate', lambda item: self.compile(iface, autocompile = False))
			item.show()
			compile_menu.append(item)
		else:
			item.set_sensitive(False)

		if gtk.pygtk_version >= (2, 90):
			menu.popup(None, None, None, None, bev.button, bev.time)
		else:
			menu.popup(None, None, None, bev.button, bev.time)
    def show_popup_menu(self, iface, bev):
        import bugs
        import compile

        have_source = properties.have_source_for(self.policy, iface)

        menu = gtk.Menu()
        for label, cb in [
            (_('Show Feeds'), lambda: properties.edit(self.policy, iface)),
            (_('Show Versions'),
             lambda: properties.edit(self.policy, iface, show_versions=True)),
            (_('Report a Bug...'), lambda: bugs.report_bug(self.policy, iface))
        ]:
            item = gtk.MenuItem(label)
            if cb:
                item.connect('activate', lambda item, cb=cb: cb())
            else:
                item.set_sensitive(False)
            item.show()
            menu.append(item)

        item = gtk.MenuItem(_('Compile'))
        item.show()
        menu.append(item)
        if have_source:
            compile_menu = gtk.Menu()
            item.set_submenu(compile_menu)

            item = gtk.MenuItem(_('Automatic'))
            item.connect(
                'activate', lambda item: compile.compile(
                    self.policy, iface, autocompile=True))
            item.show()
            compile_menu.append(item)

            item = gtk.MenuItem(_('Manual...'))
            item.connect(
                'activate', lambda item: compile.compile(
                    self.policy, iface, autocompile=False))
            item.show()
            compile_menu.append(item)
        else:
            item.set_sensitive(False)

        menu.popup(None, None, None, bev.button, bev.time)
Ejemplo n.º 7
0
 def edit_selected(action):
     store, iter = selection.get_selected()
     assert iter
     properties.edit(self.model[iter][InterfaceBrowser.INTERFACE])