Re: Python plugin questions



Here is an extremely basic example using the python console code as a reference:

import gtk
import eog

class PhotoMove(eog.Plugin):
        _ui_str = """
        <ui>
          <menubar name="MainMenu">
            <menu name="ToolsMenu" action="Tools">
              <separator/>
              <menuitem name="PhotoMove" action="PhotoMove"/>
              <separator/>
            </menu>
          </menubar>
        </ui>
        """
        def __init__(self):
                eog.Plugin.__init__(self)

        def activate(self, window):
                ui_manager = window.get_ui_manager()
                group = gtk.ActionGroup('PhotoMove')
group.add_actions([('PhotoMove', None, 'M_ove Photo', None, None, self.movePhoto)], window)
                ui_manager.insert_action_group(group, 0)
                ui_id = ui_manager.add_ui_from_string(self._ui_str)

        def deactivate(self, window):
                ui_manager = window.get_ui_manager()
                ui_manager.remove_ui(ui_id)
                ui_manager.remove_action_group(group)
                ui_manager.ensure_update()

        def movePhoto(self, action, window):
                print 'movePhoto'

        def onDelete(self, window, event):
                window.destroy()

When I have time, I hope to use this as a starting point so I can move images to new directory locations. Currently this just prints a message to stdout. You can launch eog from a shell to see the output.

Steve

Giorgos Logiotatidis wrote:
On Κυρ, 2008-04-13 at 11:26 -0700, Steve Detwiler wrote:
Thanks for letting me know. Through some more experimentation I was able to add menu items, so for now I'll just use that.

Regards,

Steve
Hey Steve, it's great you found a solution. Maybe you can post some code
so we can you use it too?

Thanks in advance,
-gl

_______________________________________________
Eog-list mailing list
Eog-list gnome org
http://mail.gnome.org/mailman/listinfo/eog-list


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]