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)
def destroyPage(w, b): f = b.get_data("file") buf = b.get_data("buffer") if misc.bufferModified(buf, f) is True: if f is None: f = _("Untitled") save = misc.createPopup(_("Save document"), mainwin, \ _("Save changes to document \"%s\"\n before closing?") % os.path.basename(f)) if save == gtk.RESPONSE_YES: if csave(None, False) is False: return False if save == gtk.RESPONSE_CANCEL or save == gtk.RESPONSE_DELETE_EVENT: return False nb.remove_page(nb.page_num(b)) if nb.get_n_pages() < 1: createPage(nb) return True
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)
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)
def destroyPage(w, b): f = b.get_data("file") buf = b.get_data("buffer") if misc.bufferModified(buf, f) is True: if f is None: f = _("Untitled") save = misc.createPopup(_("Save document"), mainwin, \ _("Save changes to document \"%s\"\n before closing?") % os.path.basename(f)) if save == gtk.RESPONSE_YES: if csave(None, False) is False: return False if save == gtk.RESPONSE_CANCEL or save == gtk.RESPONSE_DELETE_EVENT: return False nb.remove_page(nb.page_num(b)) if nb.get_n_pages() < 1: createPage(nb) else: mainwin.set_title(getCurrentPage().get_data("title")) return True
def saveAs(js=False): page = getCurrentPage() buf = page.get_data("buffer") cur_file = page.get_data("file") if misc.bufferModified(buf, cur_file) is False and js is False: return p = gtk.FileChooserDialog(_("Save file"), None, gtk.FILE_CHOOSER_ACTION_SAVE, (gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT, gtk.STOCK_OK, gtk.RESPONSE_ACCEPT)) if cur_file is not None: p.set_filename(cur_file) else: p.set_current_name(_("Untitled")) p.set_default_size(450, 400) p.show_all() if p.run() == gtk.RESPONSE_ACCEPT: f = p.get_filename() p.destroy() return f p.destroy() return None
def butSave(widget, data=None): b = getCurrentPage() f = b.get_data("file") buf = b.get_data("buffer") if misc.bufferModified(buf, f) is True: csave(widget, False)