Example #1
0
def about_dialog(parent):
    from credits import CREDITS
    from license import LICENSE
    authors = [
        "\nIgor E. Novikov (Gtk+ version)\n\
		<*****@*****.**>\n",
        "Bernhard Herzog (Tcl/Tk version)\n\
		<*****@*****.**>\n",
    ]

    about = gtk.AboutDialog()
    about.set_property('window-position', gtk.WIN_POS_CENTER)
    about.set_icon(parent.get_icon())

    about.set_program_name(parent.app.appdata.app_name)
    about.set_version(parent.app.appdata.version)
    about.set_copyright("Copyright (C) 2003-2011 by Igor E. Novikov\n" + \
         "Copyright (C) 1997-2005 by Bernhard Herzog")
    about.set_comments(_("Vector graphics editor based on sK1 0.9.x") + "\n" + \
           _("and Skencil 0.6.x experience."))
    about.set_website('http://www.sk1project.org')
    logo = os.path.join(config.resource_dir, 'logo.png')
    about.set_logo(gtk.gdk.pixbuf_new_from_file(logo))
    about.set_authors(authors + [CREDITS])
    about.set_license(LICENSE)
    about.run()
    about.destroy()
    def save_as(self):
        doc_file = '' + self.current_doc.doc_file
        if not doc_file:
            doc_file = '' + self.current_doc.doc_name
        if not os.path.splitext(doc_file)[1] == sk1doc.DOC_EXTENSION:
            doc_file = os.path.splitext(doc_file)[0] + sk1doc.DOC_EXTENSION
        if not os.path.lexists(os.path.dirname(doc_file)):
            doc_file = os.path.join(config.save_dir,
                                    os.path.basename(doc_file))
        doc_file = dialogs.get_save_file_name(self.mw, self, doc_file)
        if doc_file:
            old_file = self.current_doc.doc_file
            old_name = self.current_doc.doc_name
            self.current_doc.set_doc_file(doc_file)
            try:
                self.current_doc.save()
            except IOError:
                self.current_doc.set_doc_file(old_file, old_name)

                first = _('Cannot save document')
                sec = _('Please check file name and write permissions')
                msg = ("%s '%s'.") % (first, self.current_doc.doc_name)

                dialogs.msg_dialog(self.mw, self.appdata.app_name, msg, sec)

                return False
            config.save_dir = os.path.dirname(doc_file)
            events.emit(events.APP_STATUS, _('Document saved'))
            return True
        else:
            return False
Example #3
0
def about_dialog(parent):
	from credits import CREDITS
	from license import LICENSE
	authors = [
		"\nIgor E. Novikov (Gtk+ version)\n\
		<*****@*****.**>\n",
		"Bernhard Herzog (Tcl/Tk version)\n\
		<*****@*****.**>\n",
		]

	about = gtk.AboutDialog()
	about.set_property('window-position', gtk.WIN_POS_CENTER)
	about.set_icon(parent.get_icon())

	about.set_program_name(parent.app.appdata.app_name)
	about.set_version(parent.app.appdata.version)
	about.set_copyright("Copyright (C) 2003-2011 by Igor E. Novikov\n" + \
						"Copyright (C) 1997-2005 by Bernhard Herzog")
	about.set_comments(_("Vector graphics editor based on sK1 0.9.x") + "\n" + \
						  _("and Skencil 0.6.x experience."))
	about.set_website('http://www.sk1project.org')
	logo = os.path.join(config.resource_dir, 'logo.png')
	about.set_logo(gtk.gdk.pixbuf_new_from_file(logo))
	about.set_authors(authors + [CREDITS])
	about.set_license(LICENSE)
	about.run()
	about.destroy()
 def open(self):
     doc_file = dialogs.get_open_file_name(self.mw, self, config.open_dir)
     if os.path.lexists(doc_file):
         try:
             doc = DocPresenter(self, doc_file)
         except:
             msg = _('Cannot open file')
             msg = "%s '%s'" % (msg, doc_file)
             sec = _('The file may be corrupted or not supported format')
             dialogs.msg_dialog(self.mw, self.appdata.app_name, msg, sec)
             return
         self.docs.append(doc)
         self.set_current_doc(doc)
         config.open_dir = os.path.dirname(doc_file)
         events.emit(events.APP_STATUS, _('Document opened'))
Example #5
0
def get_save_file_name(parent, app, path):
	result = ''
	dialog = gtk.FileChooserDialog(_('Save file As...'),
				parent,
				gtk.FILE_CHOOSER_ACTION_SAVE,
				(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
					gtk.STOCK_SAVE, gtk.RESPONSE_OK))
	dialog.set_do_overwrite_confirmation(True)

	dialog.set_default_response(gtk.RESPONSE_OK)
	path = expanduser_unicode(path)

	doc_folder = os.path.dirname(path)
	dialog.set_current_folder(doc_folder)

	doc_name = os.path.basename(path)
	dialog.set_current_name(doc_name)

	for filter in _get_save_fiters():
		dialog.add_filter(filter)

	ret = dialog.run()
	if not ret == gtk.RESPONSE_CANCEL:
		result = dialog.get_filename()
	dialog.destroy()
	return result
Example #6
0
def get_save_file_name(parent, app, path):
    result = ''
    dialog = gtk.FileChooserDialog(_('Save file As...'), parent,
                                   gtk.FILE_CHOOSER_ACTION_SAVE,
                                   (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                    gtk.STOCK_SAVE, gtk.RESPONSE_OK))
    dialog.set_do_overwrite_confirmation(True)

    dialog.set_default_response(gtk.RESPONSE_OK)
    path = expanduser_unicode(path)

    doc_folder = os.path.dirname(path)
    dialog.set_current_folder(doc_folder)

    doc_name = os.path.basename(path)
    dialog.set_current_name(doc_name)

    for filter in _get_save_fiters():
        dialog.add_filter(filter)

    ret = dialog.run()
    if not ret == gtk.RESPONSE_CANCEL:
        result = dialog.get_filename()
    dialog.destroy()
    return result
Example #7
0
 def update(self):
     if not self.objs:
         self.center_offset = [0.0, 0.0]
     self.update_bbox()
     eventloop = self.presenter.eventloop
     eventloop.emit(eventloop.SELECTION_CHANGED)
     msg = _('object(s) in selection')
     msg = '%i %s' % (len(self.objs), msg)
     events.emit(events.APP_STATUS, msg)
     events.emit(events.SELECTION_CHANGED, self.presenter)
Example #8
0
	def update(self):
		if not self.objs:
			self.center_offset = [0.0, 0.0]
		self.update_bbox()
		eventloop = self.presenter.eventloop
		eventloop.emit(eventloop.SELECTION_CHANGED)
		msg = _('object(s) in selection')
		msg = '%i %s' % (len(self.objs), msg)
		events.emit(events.APP_STATUS, msg)
		events.emit(events.SELECTION_CHANGED, self.presenter)
Example #9
0
	def __init__(self, master):
		gtk.EventBox.__init__(self)
		self.app = master.app
		self.set_size_request(-1, 22)
		image_dir = os.path.join(config.resource_dir, 'icons', 'palette')
		loader = gtk.gdk.pixbuf_new_from_file
		image = gtk.Image()
		pixbuf = loader(os.path.join(image_dir, 'no-color.png'))
		image.set_from_pixbuf(pixbuf)
		self.add(image)
		self.connect('button-press-event', self.button_press)
		self.set_tooltip_markup('<b>' + _('Empthy pattern') + '</b>')
Example #10
0
def _get_open_fiters():
	result = []
	descr = data.FORMAT_DESCRIPTION
	ext = data.FORMAT_EXTENSION
	items = [] + data.LOADER_FORMATS
	for item in items:
		filter = gtk.FileFilter()
		filter.set_name(descr[item])
		filter.add_pattern('*.' + ext[item])
		result.append(filter)

	filter = gtk.FileFilter()
	filter.set_name(_('All supported formats'))
	for item in items:
		filter.add_pattern('*.' + ext[item])
	result.append(filter)

	filter = gtk.FileFilter()
	filter.set_name(_('All files'))
	filter.add_pattern('*')
	result.append(filter)

	return result
Example #11
0
def _get_open_fiters():
    result = []
    descr = data.FORMAT_DESCRIPTION
    ext = data.FORMAT_EXTENSION
    items = [] + data.LOADER_FORMATS
    for item in items:
        filter = gtk.FileFilter()
        filter.set_name(descr[item])
        filter.add_pattern('*.' + ext[item])
        result.append(filter)

    filter = gtk.FileFilter()
    filter.set_name(_('All supported formats'))
    for item in items:
        filter.add_pattern('*.' + ext[item])
    result.append(filter)

    filter = gtk.FileFilter()
    filter.set_name(_('All files'))
    filter.add_pattern('*')
    result.append(filter)

    return result
    def close(self, doc=None):
        if not self.docs:
            return
        if doc is None:
            doc = self.current_doc

        if not self.mw.nb.page_num(
                doc.docarea) == self.mw.nb.get_current_page():
            self.mw.set_active_tab(doc.docarea)

        if self.inspector.is_doc_not_saved(doc):
            first = _("Document '%s' has been modified.") % (doc.doc_name)
            second = _('Do you want to save your changes?')
            ret = dialogs.warning_dialog(
                self.mw, self.appdata.app_name, first, second,
                [(
                    _("Don't save"),
                    gtk.RESPONSE_NO,
                ), (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL),
                 (gtk.STOCK_SAVE, gtk.RESPONSE_OK)])

            if ret == gtk.RESPONSE_OK:
                if not self.save(): return False
            elif ret == gtk.RESPONSE_NO: pass
            else: return False

        if doc in self.docs:
            self.docs.remove(doc)
            doc.close()
            gc.collect()
            events.emit(events.DOC_CLOSED)
            if not len(self.docs):
                self.current_doc = None
                events.emit(events.NO_DOCS)
                msg = _('To start create new or open existing document')
                events.emit(events.APP_STATUS, msg)
        return True
    def save(self, doc=''):
        if not doc:
            doc = self.current_doc
        if not doc.doc_file:
            return self.save_as()
        ext = os.path.splitext(self.current_doc.doc_file)[1]
        if not ext == sk1doc.DOC_EXTENSION:
            return self.save_as()
        if not os.path.lexists(os.path.dirname(self.current_doc.doc_file)):
            return self.save_as()

        try:
            doc.save()
            events.emit(events.DOC_SAVED, doc)
        except:
            return False
        events.emit(events.APP_STATUS, _('Document saved'))
        return True
Example #14
0
def get_open_file_name(parent, app, start_dir):
    result = ''
    dialog = gtk.FileChooserDialog(_('Open file'), parent,
                                   gtk.FILE_CHOOSER_ACTION_OPEN,
                                   (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                    gtk.STOCK_OPEN, gtk.RESPONSE_OK))

    dialog.set_default_response(gtk.RESPONSE_OK)
    start_dir = expanduser_unicode(start_dir)
    dialog.set_current_folder(start_dir)

    for filter in _get_open_fiters():
        dialog.add_filter(filter)

    ret = dialog.run()
    if not ret == gtk.RESPONSE_CANCEL:
        result = dialog.get_filename()
    dialog.destroy()
    return result
Example #15
0
def get_open_file_name(parent, app, start_dir):
	result = ''
	dialog = gtk.FileChooserDialog(_('Open file'),
				parent,
				gtk.FILE_CHOOSER_ACTION_OPEN,
				(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
					gtk.STOCK_OPEN, gtk.RESPONSE_OK))

	dialog.set_default_response(gtk.RESPONSE_OK)
	start_dir = expanduser_unicode(start_dir)
	dialog.set_current_folder(start_dir)

	for filter in _get_open_fiters():
		dialog.add_filter(filter)

	ret = dialog.run()
	if not ret == gtk.RESPONSE_CANCEL:
		result = dialog.get_filename()
	dialog.destroy()
	return result
Example #16
0
def create_actions(app):
    insp = app.inspector
    proxy = app.proxy
    accelgroup = app.accelgroup
    actiongroup = app.actiongroup
    actions = {}
    entries = [
        #	name, label, tooltip, icon, shortcut, callable, [channels], validator, args
        #gtk.accelerator_name(ord('+'),gtk.gdk.CONTROL_MASK)

        #SELECT_MODE = 0
        #SHAPER_MODE = 1
        #ZOOM_MODE = 2
        #FLEUR_MODE = 3
        #LINE_MODE = 10
        #CURVE_MODE = 11
        #RECT_MODE = 12
        #ELLIPSE_MODE = 13
        #TEXT_MODE = 14
        #POLYGON_MODE = 15
        #ZOOM_OUT_MODE = 16
        #MOVE_MODE = 17
        #COPY_MODE = 18
        [
            'SELECT_MODE',
            _('Selection mode'),
            _('Selection mode'), None, None, proxy.set_select_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'SHAPER_MODE',
            _('Edit mode'),
            _('Edit mode'), None, None, proxy.set_shaper_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'ZOOM_MODE',
            _('Zoom mode'),
            _('Zoom mode'), None, None, proxy.set_zoom_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'FLEUR_MODE',
            _('Fleur mode'),
            _('Fleur mode'), None, None, proxy.set_fleur_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'LINE_MODE',
            _('Create polyline'),
            _('Create polyline'), None, None, proxy.set_line_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'CURVE_MODE',
            _('Create paths'),
            _('Create paths'), None, None, proxy.set_curve_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'RECT_MODE',
            _('Create rectangle'),
            _('Create rectangle'), None, None, proxy.set_rect_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'ELLIPSE_MODE',
            _('Create ellipse'),
            _('Create ellipse'), None, None, proxy.set_ellipse_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'TEXT_MODE',
            _('Create text'),
            _('Create text'), None, None, proxy.set_text_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'POLYGON_MODE',
            _('Create polygon'),
            _('Create polygon'), None, None, proxy.set_polygon_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'ZOOM_OUT_MODE',
            _('Zoom out mode'),
            _('Zoom out mode'), None, None, proxy.set_zoom_out_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'MOVE_MODE',
            _('Move mode'),
            _('Move mode'), None, None, proxy.set_move_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'COPY_MODE',
            _('Copy mode'),
            _('Copy mode'), None, None, proxy.set_copy_mode,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'NEW',
            _('_New'),
            _('New'), gtk.STOCK_NEW, '<Control>N', proxy.new, None, None
        ],
        [
            'OPEN',
            _('_Open'),
            _('Open'), gtk.STOCK_OPEN, '<Control>O', proxy.open, None, None
        ],
        [
            'SAVE',
            _('_Save'),
            _('Save'), gtk.STOCK_SAVE, '<Control>S', proxy.save,
            [NO_DOCS, DOC_CHANGED, DOC_MODIFIED, DOC_SAVED],
            insp.is_doc_not_saved
        ],
        [
            'SAVE_AS',
            _('Save _As...'),
            _('Save As...'), gtk.STOCK_SAVE_AS, None, proxy.save_as,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'SAVE_ALL',
            _('Save All'),
            _('Save All'), None, None, proxy.save_all,
            [NO_DOCS, DOC_CHANGED, DOC_MODIFIED, DOC_SAVED],
            insp.is_any_doc_not_saved
        ],
        [
            'CLOSE',
            _('_Close'),
            _('Close'), gtk.STOCK_CLOSE, '<Control>W', proxy.close,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'CLOSE_ALL',
            _('_Close All'),
            _('Close All'), None, None, proxy.close_all,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'PRINT',
            _('_Print...'),
            _('Print'), gtk.STOCK_PRINT, '<Control>P', proxy.do_print,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'PRINT_SETUP',
            _('Print Setup...'),
            _('Print Setup'), gtk.STOCK_PRINT_PREVIEW, None,
            proxy.do_print_setup, [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'UNDO',
            _('_Undo'),
            _('Undo'), gtk.STOCK_UNDO, '<Control>Z', proxy.undo,
            [
                events.NO_DOCS, events.DOC_CHANGED, events.DOC_MODIFIED,
                events.DOC_CLOSED
            ], insp.is_undo
        ],
        [
            'REDO',
            _('_Redo'),
            _('Redo'), gtk.STOCK_REDO, '<Control><Shift>Z', proxy.redo,
            [
                events.NO_DOCS, events.DOC_CHANGED, events.DOC_MODIFIED,
                events.DOC_CLOSED
            ], insp.is_redo
        ],
        [
            'CLEAR_HISTORY',
            _('Clear undo history'),
            _('Clear undo history'), None, None, proxy.clear_history,
            [
                events.NO_DOCS, events.DOC_CHANGED, events.DOC_MODIFIED,
                events.DOC_CLOSED
            ], insp.is_history
        ],
        [
            'CUT',
            _('Cu_t'),
            _('Cut'), gtk.STOCK_CUT, '<Control>X', proxy.cut,
            [events.NO_DOCS, events.DOC_CHANGED, events.SELECTION_CHANGED],
            insp.is_selection
        ],
        [
            'COPY',
            _('_Copy'),
            _('Copy'), gtk.STOCK_COPY, '<Control>C', proxy.copy,
            [events.NO_DOCS, events.DOC_CHANGED, events.SELECTION_CHANGED],
            insp.is_selection
        ],
        [
            'PASTE',
            _('_Paste'),
            _('Paste'), gtk.STOCK_PASTE, '<Control>V', proxy.paste,
            [events.NO_DOCS, events.CLIPBOARD], insp.is_clipboard
        ],
        [
            'DELETE',
            _('_Delete'),
            _('Delete'), gtk.STOCK_DELETE, 'Delete', proxy.delete,
            [events.NO_DOCS, events.DOC_CHANGED, events.SELECTION_CHANGED],
            insp.is_selection
        ],
        [
            'SELECT_ALL',
            _('_Select All'),
            _('Select All'), gtk.STOCK_SELECT_ALL, '<Control>A',
            proxy.select_all, [events.NO_DOCS, events.DOC_CHANGED], insp.is_doc
        ],
        [
            'DESELECT',
            _('_Deselect'),
            _('Deselect'), None, '<Control><Shift>A', proxy.deselect,
            [events.NO_DOCS, events.DOC_CHANGED, events.SELECTION_CHANGED],
            insp.is_selection
        ],
        [
            'STROKE_VIEW',
            _('Stroke View'),
            _('Stroke View'), None, '<Shift>F9', proxy.stroke_view,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'DRAFT_VIEW',
            _('Draft View'),
            _('Draft View'), None, None, proxy.draft_view,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'ZOOM_IN',
            _('Zoom in'),
            _('Zoom in'), gtk.STOCK_ZOOM_IN, '<Control>equal', proxy.zoom_in,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'ZOOM_OUT',
            _('Zoom out'),
            _('Zoom out'), gtk.STOCK_ZOOM_OUT, '<Control>minus',
            proxy.zoom_out, [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'ZOOM_PAGE',
            _('Fit zoom to page'),
            _('Fit zoom to page'), gtk.STOCK_FILE, '<Shift>F4',
            proxy.fit_zoom_to_page, [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'ZOOM_100',
            _('Zoom 100%'),
            _('Zoom 100%'), gtk.STOCK_ZOOM_100, None, proxy.zoom_100,
            [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'ZOOM_SELECTED',
            _('Zoom selected'),
            _('Zoom selected'), gtk.STOCK_ZOOM_FIT, 'F4', proxy.zoom_selected,
            [events.NO_DOCS, events.DOC_CHANGED, events.SELECTION_CHANGED],
            insp.is_selection
        ],
        [
            'FORCE_REDRAW',
            _('Redraw document'),
            _('Redraw document'), gtk.STOCK_REFRESH, '<Alt>R',
            proxy.force_redraw, [NO_DOCS, DOC_CHANGED], insp.is_doc
        ],
        [
            'PREFERENCES',
            _('Preferences'),
            _('Preferences'), gtk.STOCK_PREFERENCES, None, proxy.preferences,
            None, None
        ],
        [
            'QUIT',
            _('_Exit'),
            _('Exit'), gtk.STOCK_QUIT, '<Control>Q', proxy.exit, None, None
        ],
        [
            'ABOUT',
            _('_About Skencil'),
            _('About Skencil'), gtk.STOCK_ABOUT, None, proxy.about, None, None
        ],
    ]

    for entry in entries:
        action = AppAction(entry[0], entry[1], entry[2], entry[3], entry[4],
                           entry[5], entry[6], entry[7])

        actions[entry[0]] = action
        if not action.shortcut is None:
            actiongroup.add_action_with_accel(action, action.shortcut)
            action.set_accel_group(accelgroup)
        else:
            actiongroup.add_action(action)

    return actions
 def run(self):
     events.emit(events.NO_DOCS)
     events.emit(events.APP_STATUS,
                 _('To start create new or open existing document'))
     gtk.main()
 def get_new_docname(self):
     self.doc_counter += 1
     return _('Untitled') + ' ' + str(self.doc_counter)
 def new(self):
     doc = DocPresenter(self)
     self.docs.append(doc)
     self.set_current_doc(doc)
     events.emit(events.APP_STATUS, _('New document created'))
Example #20
0
def create_actions(app):
	insp = app.inspector
	proxy = app.proxy
	accelgroup = app.accelgroup
	actiongroup = app.actiongroup
	actions = {}
	entries = [
#	name, label, tooltip, icon, shortcut, callable, [channels], validator, args 
#gtk.accelerator_name(ord('+'),gtk.gdk.CONTROL_MASK)

#SELECT_MODE = 0
#SHAPER_MODE = 1
#ZOOM_MODE = 2
#FLEUR_MODE = 3
#LINE_MODE = 10
#CURVE_MODE = 11
#RECT_MODE = 12
#ELLIPSE_MODE = 13
#TEXT_MODE = 14
#POLYGON_MODE = 15
#ZOOM_OUT_MODE = 16
#MOVE_MODE = 17
#COPY_MODE = 18

	['SELECT_MODE', _('Selection mode'), _('Selection mode'), None, None,
	 proxy.set_select_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['SHAPER_MODE', _('Edit mode'), _('Edit mode'), None, None,
	 proxy.set_shaper_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['ZOOM_MODE', _('Zoom mode'), _('Zoom mode'), None, None,
	 proxy.set_zoom_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['FLEUR_MODE', _('Fleur mode'), _('Fleur mode'), None, None,
	 proxy.set_fleur_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['LINE_MODE', _('Create polyline'), _('Create polyline'), None, None,
	 proxy.set_line_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['CURVE_MODE', _('Create paths'), _('Create paths'), None, None,
	 proxy.set_curve_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['RECT_MODE', _('Create rectangle'), _('Create rectangle'), None, None,
	 proxy.set_rect_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['ELLIPSE_MODE', _('Create ellipse'), _('Create ellipse'), None, None,
	 proxy.set_ellipse_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['TEXT_MODE', _('Create text'), _('Create text'), None, None,
	 proxy.set_text_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['POLYGON_MODE', _('Create polygon'), _('Create polygon'), None, None,
	 proxy.set_polygon_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['ZOOM_OUT_MODE', _('Zoom out mode'), _('Zoom out mode'), None, None,
	 proxy.set_zoom_out_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['MOVE_MODE', _('Move mode'), _('Move mode'), None, None,
	 proxy.set_move_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['COPY_MODE', _('Copy mode'), _('Copy mode'), None, None,
	 proxy.set_copy_mode, [NO_DOCS, DOC_CHANGED], insp.is_doc],

	['NEW', _('_New'), _('New'), gtk.STOCK_NEW, '<Control>N',
	 proxy.new, None, None],
	['OPEN', _('_Open'), _('Open'), gtk.STOCK_OPEN, '<Control>O',
	 proxy.open, None, None],
	['SAVE', _('_Save'), _('Save'), gtk.STOCK_SAVE, '<Control>S',
	 proxy.save, [NO_DOCS, DOC_CHANGED, DOC_MODIFIED, DOC_SAVED],
	 insp.is_doc_not_saved],
	['SAVE_AS', _('Save _As...'), _('Save As...'), gtk.STOCK_SAVE_AS, None,
	 proxy.save_as, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['SAVE_ALL', _('Save All'), _('Save All'), None, None,
	 proxy.save_all, [NO_DOCS, DOC_CHANGED, DOC_MODIFIED, DOC_SAVED],
	 insp.is_any_doc_not_saved],
	['CLOSE', _('_Close'), _('Close'), gtk.STOCK_CLOSE, '<Control>W',
	 proxy.close, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['CLOSE_ALL', _('_Close All'), _('Close All'), None, None,
	 proxy.close_all, [NO_DOCS, DOC_CHANGED], insp.is_doc],

	['PRINT', _('_Print...'), _('Print'), gtk.STOCK_PRINT, '<Control>P',
	 proxy.do_print, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['PRINT_SETUP', _('Print Setup...'), _('Print Setup'), gtk.STOCK_PRINT_PREVIEW, None,
	 proxy.do_print_setup, [NO_DOCS, DOC_CHANGED], insp.is_doc],


	['UNDO', _('_Undo'), _('Undo'), gtk.STOCK_UNDO, '<Control>Z',
	 proxy.undo, [events.NO_DOCS, events.DOC_CHANGED, events.DOC_MODIFIED,
	 events.DOC_CLOSED], insp.is_undo],
	['REDO', _('_Redo'), _('Redo'), gtk.STOCK_REDO, '<Control><Shift>Z',
	 proxy.redo, [events.NO_DOCS, events.DOC_CHANGED, events.DOC_MODIFIED,
	 events.DOC_CLOSED], insp.is_redo],
	['CLEAR_HISTORY', _('Clear undo history'), _('Clear undo history'),
	None, None, proxy.clear_history, [events.NO_DOCS, events.DOC_CHANGED,
	 events.DOC_MODIFIED, events.DOC_CLOSED], insp.is_history],


	['CUT', _('Cu_t'), _('Cut'), gtk.STOCK_CUT, '<Control>X',
	 proxy.cut, [events.NO_DOCS, events.DOC_CHANGED,
	events.SELECTION_CHANGED], insp.is_selection],
	['COPY', _('_Copy'), _('Copy'), gtk.STOCK_COPY, '<Control>C',
	 proxy.copy, [events.NO_DOCS, events.DOC_CHANGED,
	events.SELECTION_CHANGED], insp.is_selection],
	['PASTE', _('_Paste'), _('Paste'), gtk.STOCK_PASTE, '<Control>V',
	 proxy.paste, [events.NO_DOCS, events.CLIPBOARD], insp.is_clipboard],
	['DELETE', _('_Delete'), _('Delete'), gtk.STOCK_DELETE, 'Delete',
	 proxy.delete, [events.NO_DOCS, events.DOC_CHANGED,
	events.SELECTION_CHANGED], insp.is_selection],

	['SELECT_ALL', _('_Select All'), _('Select All'), gtk.STOCK_SELECT_ALL, '<Control>A',
	 proxy.select_all, [events.NO_DOCS, events.DOC_CHANGED], insp.is_doc],
	['DESELECT', _('_Deselect'), _('Deselect'), None, '<Control><Shift>A',
	 proxy.deselect, [events.NO_DOCS, events.DOC_CHANGED,
	events.SELECTION_CHANGED], insp.is_selection],

	['STROKE_VIEW', _('Stroke View'), _('Stroke View'), None, '<Shift>F9',
	 proxy.stroke_view, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['DRAFT_VIEW', _('Draft View'), _('Draft View'), None, None,
	 proxy.draft_view, [NO_DOCS, DOC_CHANGED], insp.is_doc],

	['ZOOM_IN', _('Zoom in'), _('Zoom in'), gtk.STOCK_ZOOM_IN, '<Control>equal',
	 proxy.zoom_in, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['ZOOM_OUT', _('Zoom out'), _('Zoom out'), gtk.STOCK_ZOOM_OUT, '<Control>minus',
	 proxy.zoom_out, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['ZOOM_PAGE', _('Fit zoom to page'), _('Fit zoom to page'), gtk.STOCK_FILE, '<Shift>F4',
	 proxy.fit_zoom_to_page, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['ZOOM_100', _('Zoom 100%'), _('Zoom 100%'), gtk.STOCK_ZOOM_100, None,
	 proxy.zoom_100, [NO_DOCS, DOC_CHANGED], insp.is_doc],
	['ZOOM_SELECTED', _('Zoom selected'), _('Zoom selected'), gtk.STOCK_ZOOM_FIT, 'F4',
	 proxy.zoom_selected, [events.NO_DOCS, events.DOC_CHANGED,
	events.SELECTION_CHANGED], insp.is_selection],
	['FORCE_REDRAW', _('Redraw document'), _('Redraw document'),
	gtk.STOCK_REFRESH, '<Alt>R', proxy.force_redraw,
	[NO_DOCS, DOC_CHANGED], insp.is_doc],


	['PREFERENCES', _('Preferences'), _('Preferences'), gtk.STOCK_PREFERENCES, None,
	 proxy.preferences, None, None],
	['QUIT', _('_Exit'), _('Exit'), gtk.STOCK_QUIT, '<Control>Q',
	 proxy.exit, None, None],
	['ABOUT', _('_About Skencil'), _('About Skencil'), gtk.STOCK_ABOUT, None,
	 proxy.about, None, None],
	]

	for entry in entries:
		action = AppAction(entry[0], entry[1], entry[2], entry[3],
						   entry[4], entry[5], entry[6], entry[7])

		actions[entry[0]] = action
		if not action.shortcut is None:
			actiongroup.add_action_with_accel(action, action.shortcut)
			action.set_accel_group(accelgroup)
		else:
			actiongroup.add_action(action)

	return actions