Exemplo n.º 1
0
def init(widget):
	global xml
	xml = gtk.glade.XML(config.get('DEFAULT', 'default') + 'glade/open.glade')
	xml.signal_autoconnect({
	#'destroy' : destroy,
	'd_open' : d_open
	})
	xml.get_widget("open_denu").show()
Exemplo n.º 2
0
def init(widget):
	global xml
	xml = gtk.glade.XML(config.get('DEFAULT', 'default') + 'glade/add.glade')
	xml.signal_autoconnect({
	'cancel_add' : destroy,
	'add_entry' : add_entry
	})
	xml.get_widget("add_window").show()
Exemplo n.º 3
0
def init(widget):
	global xml
	xml = gtk.glade.XML(config.get('DEFAULT', 'default') + 'glade/save.glade')
	window = xml.get_widget("save_denu")
	xml.signal_autoconnect({
	#'destroy' : destroy,
	'save_denu' : d_save
	})
	window.show()
Exemplo n.º 4
0
def init(widget):
    viewxml = gtk.glade.XML(config.get("DEFAULT", "default") + "glade/view.glade")
    menu_iterList = []

    def createMenuList(model, path, iter):
        menu_iterList.append(iter)

    treeselection = menuview.get_selection()
    treeselection.selected_foreach(createMenuList)
    installed_iterList = []

    def createInstalledList(model, path, iter):
        installed_iterList.append(iter)

    treeselection2 = installedview.get_selection()
    treeselection2.selected_foreach(createInstalledList)
    if len(menu_iterList) > 0:
        model = menustore
        iter = menu_iterList[0]
        id = menustore.get_value(iter, 2)
        entry = libDenu.viewEntry(id, "menu")
    elif len(installed_iterList) > 0:
        model = installedstore
        iter = installed_iterList[0]
        id = installedstore.get_value(iter, 2)
        entry = libDenu.viewEntry(id, "installed")
    viewstore = gtk.TreeStore(str, str)
    dictToTreestore(entry, viewstore)
    viewview = viewxml.get_widget("viewview")
    viewcolumn = gtk.TreeViewColumn("Entry")
    text_render = gtk.CellRendererText()
    text_render2 = gtk.CellRendererText()
    viewcolumn.pack_start(text_render, True)
    viewcolumn.pack_start(text_render2, True)
    viewcolumn.set_attributes(text_render, text=0)
    viewcolumn.set_attributes(text_render2, text=1)
    viewview.append_column(viewcolumn)
    viewview.set_model(viewstore)

    # Individual fields.
    # Type
    type = entry.keys()[0]
    viewxml.get_widget("view_type").set_text(type)
    # Name
    if entry[type]["name"].has_key(config.get("DEFAULT", "locale")):
        viewxml.get_widget("view_name").set_text(entry[type]["name"][config.get("DEFAULT", "locale")])
    else:  # Default to english
        viewxml.get_widget("view_name").set_text(entry[type]["name"]["en"])
        # Command
    if not type == "folder":
        viewxml.get_widget("view_command").set_text(entry[type]["command"])
        # Icon
    if entry[type].has_key("icon"):
        if pixbuf_manager(entry[type]["icon"]) != "Error: no file.":
            viewxml.get_widget("view_image").set_from_pixbuf(pixbuf_manager(entry[type]["icon"]))
        if entry[type]["icon"].has_key("file"):
            viewxml.get_widget("view_icon").set_text(entry[type]["icon"]["file"])
        elif entry[type]["icon"].has_key("url"):
            viewxml.get_widget("view_icon").set_text(entry[type]["icon"]["url"])
    else:
        viewxml.get_widget("view_icon").set_text("None.")
        # viewxml.signal_autoconnect({'destroy' : destroy})
    viewxml.get_widget("view_window").show()
Exemplo n.º 5
0
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
import pygtk

pygtk.require("2.0")
import gtk
import gtk.glade
import sys
from DenuGUI_config import config, home

sys.path.extend(
    [
        "/usr/share/denu/wms",
        home + "/.denu/wms",
        config.get("DEFAULT", "default"),
        config.get("DEFAULT", "default") + "wms",
        config.get("DEFAULT", "default") + "includes",
    ]
)
from DenuGUI_common import *
import libDenu
from DenuGUI_SharedVars import xml, menuview, installedview


def init(widget):
    viewxml = gtk.glade.XML(config.get("DEFAULT", "default") + "glade/view.glade")
    menu_iterList = []

    def createMenuList(model, path, iter):
        menu_iterList.append(iter)
Exemplo n.º 6
0
def add_entry (widget):
	global xml
	type_array = ['folder', 'program', 'special']
	type = xml.get_widget("add_type").get_active()
	entry = {type_array[type] : {'name' : {}}}
	
	#Name
	name = xml.get_widget("add_name").get_text()
	if config.get('DEFAULT', 'locale'):
		entry[type_array[type]]['name'][config.get('DEFAULT', 'locale')] = name
	else: # Default to english
		entry[type_array[type]]['name']['en'] = name
		
	#Command
	command = xml.get_widget("add_command").get_text()
	if not command == "" and not type == 0:
		entry[type_array[type]]['command'] = command
	elif not type == 0:
		pass
	
	#Portage ID
	pid = xml.get_widget("add_pid").get_text()
	if not pid == "":
		entry[type_array[type]]['portage-id'] = pid
	
	#Folder
	folder = xml.get_widget("add_folder").get_text()
	if not folder == "":
		if type == 0:
			entry[type_array[type]]['key'] = pid
		else:
			entry[type_array[type]]['location'] = pid
	
	#Icon
	icon = xml.get_widget("add_icon").get_filename()
	if not icon == None:
		entry[type_array[type]]['icon'] = {}
		entry[type_array[type]]['icon']['file'] = icon
		
	
	iterList = []
	def createList(model, path, iter):
		iterList.append(iter)
	treeselection = menuview.get_selection()
	treeselection.selected_foreach(createList)
	if len(iterList) > 0:
		if menustore.iter_parent(iterList[0]) == None:
			parent = 0
		else:
			parent = menustore.get_value(menustore.iter_parent(iterList[0]), 2)
		id = libDenu.addEntry(entry, parent, menustore.get_value(iterList[0], 2))[0]
		if entry[entry.keys()[0]].has_key('icon'):
			if not DenuGUI_common.pixbuf_manager(entry[entry.keys()[0]]['icon'], config.getint('DEFAULT', 'pixbuf_size')) == "Error: no file.":
				menustore.insert_before(menustore.iter_parent(iterList[0]), iterList[0], [DenuGUI_common.pixbuf_manager(entry[entry.keys()[0]]['icon'], config.getint('DEFAULT', 'pixbuf_size')), name, id])
			else:
				menustore.insert_before(menustore.iter_parent(iterList[0]), iterList[0], [None, name, id])
		else:
			menustore.insert_before(menustore.iter_parent(iterList[0]), iterList[0], [None, name, id])
	else:
		parent = 0
		id = libDenu.addEntry(entry, parent)[0]
		if entry[entry.keys()[0]].has_key('icon'):
			if not DenuGUI_common.pixbuf_manager(entry[entry.keys()[0]]['icon'], config.getint('DEFAULT', 'pixbuf_size')) == "Error: no file.":
				menustore.append(None, [pixbuf_manager(entry[entry.keys()[0]]['icon'], config.getint('DEFAULT', 'pixbuf_size')), name, id])
			else:
				menustore.append(None, [None, name, id])
		else:
			menustore.append(None, [None, name, id])
	xml.get_widget("add_window").destroy()