Exemple #1
0
def setupPage(w, page, p):
	misc.set_widget_font(getCurrentView(), config.cur_editor_font)
	getCurrentPage().queue_resize()
	pg = w.get_nth_page(p)
	cl = pg.get_data("close");
	if cl == None: return
	accel = gtk.AccelGroup()
	cl.add_accelerator("activate", accel, ord("w"), gtk.gdk.CONTROL_MASK, 0)
	mainwin.add_accel_group(accel)
	srcview.updatePos(pg.get_data("buffer"), sb2)
Exemple #2
0
def setupPage(w, page, p):
    misc.set_widget_font(getCurrentView(), config.cur_editor_font)
    getCurrentPage().queue_resize()
    pg = w.get_nth_page(p)
    cl = pg.get_data("close")
    if cl == None: return
    accel = gtk.AccelGroup()
    cl.add_accelerator("activate", accel, ord("w"), gtk.gdk.CONTROL_MASK, 0)
    mainwin.add_accel_group(accel)
    srcview.updatePos(pg.get_data("buffer"), sb2)
    config.sketchFile = pg.get_data("file")
Exemple #3
0
def updatePageTitle(w, status):
	page = getCurrentPage()
	f = page.get_data("file")
	l = page.get_data("label")
	if f != None:
		name = os.path.basename(f)
	else:
		name = _("Untitled")

	if (misc.bufferModified(w, f)):
		l.set_text("*"+name)
	else:
		l.set_text(name)
	srcview.updatePos(w, status)
Exemple #4
0
def createPage(nb, f=None):
	hbox = gtk.HBox(False, 0)
	title = os.path.basename(f) if f else _("Untitled")
	flabel = gtk.Label(title)
	mainwin.set_title(title+" - Gnoduino")
	hbox.pack_start(flabel, True, False, 3)
	b = gtk.Button()
	img = gtk.Image()
	img.set_from_icon_name(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
	img.set_pixel_size(11)
	b.set_image(img)
	b.set_relief(gtk.RELIEF_NONE)
	hbox.pack_start(b, True, True)
	hbox.show_all()
	(sbuf,sv) = srcview.createsrcview(sb2, f)
	sbuf.connect("changed", updatePageTitle, sb2)
	sw = gtk.ScrolledWindow()
	sw.add(sv)
	sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
	sw.set_placement(gtk.CORNER_BOTTOM_LEFT)
	sw.set_shadow_type(gtk.SHADOW_IN)
	sw.show_all()
	p = nb.append_page(sw, hbox)
	wp = nb.get_nth_page(p)
	wp.set_data("file", f)		#add file information to the page widget
	wp.set_data("buffer", sbuf)	#add buffer information to the page widget
	wp.set_data("view", sv)	#add buffer information to the page widget
	wp.set_data("label", flabel)	#add source view widget to the page widget
	wp.set_data("close", b)	#add close widget to the page widget
	wp.set_data("title", title + " - Gnoduino")
	nb.set_current_page(p)
	page = nb.get_nth_page(p)
	nb.set_scrollable(True);
	nb.set_tab_reorderable(page, True);
	accel = gtk.AccelGroup()
	for i in range(1, 10):
		accel.connect_group(ord(str(i)), gtk.gdk.MOD1_MASK, 0,
			switchPage)
	mainwin.add_accel_group(accel)
	sv.grab_focus()
	b.connect("clicked", destroyPage, sw)
	accel = gtk.AccelGroup()
	b.add_accelerator("activate", accel, ord("w"), gtk.gdk.CONTROL_MASK, 0)
	mainwin.add_accel_group(accel)
	srcview.updatePos(sbuf, sb2)
	return sv
Exemple #5
0
def createPage(nb, f=None):
    hbox = gtk.HBox(False, 0)
    title = os.path.basename(f) if f else _("Untitled")
    flabel = gtk.Label(title)
    mainwin.set_title(title + " - Gnoduino")
    hbox.pack_start(flabel, True, False, 3)
    b = gtk.Button()
    img = gtk.Image()
    img.set_from_icon_name(gtk.STOCK_CLOSE, gtk.ICON_SIZE_MENU)
    img.set_pixel_size(11)
    b.set_image(img)
    b.set_relief(gtk.RELIEF_NONE)
    hbox.pack_start(b, True, True)
    hbox.show_all()
    (sbuf, sv) = srcview.createsrcview(sb2, f)
    sbuf.connect("changed", updatePageTitle, sb2)
    sw = gtk.ScrolledWindow()
    sw.add(sv)
    sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
    sw.set_placement(gtk.CORNER_BOTTOM_LEFT)
    sw.set_shadow_type(gtk.SHADOW_IN)
    sw.show_all()
    p = nb.append_page(sw, hbox)
    wp = nb.get_nth_page(p)
    wp.set_data("file", f)  #add file information to the page widget
    wp.set_data("buffer", sbuf)  #add buffer information to the page widget
    wp.set_data("view", sv)  #add buffer information to the page widget
    wp.set_data("label", flabel)  #add source view widget to the page widget
    wp.set_data("close", b)  #add close widget to the page widget
    wp.set_data("title", title + " - Gnoduino")
    nb.set_current_page(p)
    page = nb.get_nth_page(p)
    nb.set_scrollable(True)
    nb.set_tab_reorderable(page, True)
    accel = gtk.AccelGroup()
    for i in range(1, 10):
        accel.connect_group(ord(str(i)), gtk.gdk.MOD1_MASK, 0, switchPage)
    mainwin.add_accel_group(accel)
    sv.grab_focus()
    b.connect("clicked", destroyPage, sw)
    accel = gtk.AccelGroup()
    b.add_accelerator("activate", accel, ord("w"), gtk.gdk.CONTROL_MASK, 0)
    mainwin.add_accel_group(accel)
    srcview.updatePos(sbuf, sb2)
    return sv
Exemple #6
0
def updatePageTitle(w, status):
	page = getCurrentPage()
	f = page.get_data("file")
	l = page.get_data("label")
	if f != None:
		name = os.path.basename(f)
	else:
		name = _("Untitled")

	if (misc.bufferModified(w, f)):
		text  = "*" + name
	else:
		text = name

	l.set_text(text)
	mainwin.set_title(text+" - gnoduino")
	page.set_data("title", text+" - gnoduino")
	srcview.updatePos(w, status)
Exemple #7
0
def updatePageTitle(w, status):
    page = getCurrentPage()
    f = page.get_data("file")
    l = page.get_data("label")
    if f != None:
        name = os.path.basename(f)
    else:
        name = _("Untitled")

    if (misc.bufferModified(w, f)):
        text = "*" + name
    else:
        text = name

    l.set_text(text)
    mainwin.set_title(text + " - gnoduino")
    page.set_data("title", text + " - gnoduino")
    srcview.updatePos(w, status)