Exemple #1
0
        def popup(widget):
            menu = widget._menu
            for child in menu.get_children():
                menu.remove(child)
            if not widget.props.active:
                menu.popdown()
                return

            def menu_position(menu, data=None):
                widget_allocation = widget.get_allocation()
                x, y = widget.get_window().get_root_coords(
                    widget_allocation.x, widget_allocation.y)
                return (x, y + widget_allocation.height, False)

            for id_, name, domain, access in self.bookmarks():
                menuitem = Gtk.MenuItem(label=name)
                menuitem.connect('activate', self.bookmark_activate, domain)
                menu.add(menuitem)

            menu.show_all()
            if hasattr(menu, 'popup_at_widget'):
                menu.popup_at_widget(widget, Gdk.Gravity.SOUTH_WEST,
                                     Gdk.Gravity.NORTH_WEST,
                                     Gtk.get_current_event())
            else:
                menu.popup(None, None, menu_position, 0, 0)
Exemple #2
0
 def _clicked_cb(self, button):
     """Handle click events on the initiator button."""
     event = Gtk.get_current_event()
     assert event is not None
     assert event.type == Gdk.EventType.BUTTON_RELEASE, (
         "The docs lie! Current event's type is %r." % (event.type, ), )
     self._grab.activate_from_button_event(event)
Exemple #3
0
    def _on_send_key_button_clicked_cb(self, src):
        event = Gtk.get_current_event()
        win = self._toolbar.get_window()
        rect = Gdk.Rectangle()

        rect.y = win.get_height()
        self._keycombo_menu.popup_at_rect(win, rect,
                Gdk.Gravity.NORTH_WEST, Gdk.Gravity.NORTH_WEST, event)
Exemple #4
0
 def image_button_clicked(button):
     event=Gtk.get_current_event()
     if event.get_state().state & Gdk.ModifierType.CONTROL_MASK:
         self.use_current_position(button)
         return True
     else:
         self.play_from_here(button)
         return True
    def tray_popup(self, widget, button=None, time=None, data=None):
        if time is None:
            time = Gtk.get_current_event().get_time()

        self.menu.show_all()
        self.menu.popup(None, None, lambda w, x:
                        self.icon.position_menu(self.menu, self.icon),
                        self.icon, 3, time)
 def image_button_clicked(button):
     event = Gtk.get_current_event()
     if event.get_state().state & Gdk.ModifierType.CONTROL_MASK:
         self.use_current_position(button)
         return True
     else:
         self.play_from_here(button)
         return True
Exemple #7
0
 def _clicked_cb(self, button):
     """Handle click events on the initiator button."""
     event = Gtk.get_current_event()
     assert event is not None
     assert event.type == Gdk.EventType.BUTTON_RELEASE, (
         "The docs lie! Current event's type is %r." % (event.type,),
     )
     self._grab.activate_from_button_event(event)
Exemple #8
0
    def _on_send_key_button_clicked_cb(self, src):
        event = Gtk.get_current_event()
        win = self._toolbar.get_window()
        rect = Gdk.Rectangle()

        rect.y = win.get_height()
        self._keycombo_menu.popup_at_rect(win, rect, Gdk.Gravity.NORTH_WEST,
                                          Gdk.Gravity.NORTH_WEST, event)
Exemple #9
0
    def tray_popup(self, widget, button=None, time=None, data=None):
        if time is None:
            time = Gtk.get_current_event().get_time()

        self.menu.show_all()
        self.menu.popup(
            None, None,
            lambda w, x: self.icon.position_menu(self.menu, self.icon),
            self.icon, 3, time)
	def checkbutton_handler(self, w) :
		if Gtk.get_event_widget(Gtk.get_current_event()) != w :
			return
		print("cbh")
		va=0
		for k,v in self.bits.items() :
			if v.get_active() :
				va |= (1<<k)
		self.set_value(va)
Exemple #11
0
 def checkbutton_handler(self, w):
     if Gtk.get_event_widget(Gtk.get_current_event()) != w:
         return
     print("cbh")
     va = 0
     for k, v in self.bits.items():
         if v.get_active():
             va |= (1 << k)
     self.set_value(va)
Exemple #12
0
 def _popup_menu_selected(self, menuitem, togglebutton, action, keyword):
     event = Gtk.get_current_event()
     allow_similar = False
     if (event.state & Gdk.ModifierType.CONTROL_MASK
             or event.state & Gdk.ModifierType.MOD1_MASK):
         allow_similar = True
     with Window(hide_current=True, allow_similar=allow_similar):
         self._action(action, keyword)
     togglebutton.props.active = False
Exemple #13
0
 def _action_favorite(widget, id_):
     event = Gtk.get_current_event()
     allow_similar = (event.state & Gdk.ModifierType.MOD1_MASK
                      or event.state & Gdk.ModifierType.SHIFT_MASK)
     with Window(allow_similar=allow_similar):
         # ids is not defined to prevent to add suffix
         Action.exec_keyword('tree_open', {
             'model': self.menu_screen.model_name,
             'id': id_,
         })
Exemple #14
0
 def popup_pan_menu(self, tv, event=None, *args):
     debug("popup_pan_menu (self, tv, *args):", 5)
     self.tv = tv
     if not event:
         event = Gtk.get_current_event()
     t = (event and hasattr(event, 'time') and getattr(event, 'time') or 0)
     btn = (event and hasattr(event, 'button') and getattr(event, 'button')
            or 0)
     self.panpop.popup(None, None, None, btn, t)
     return True
 def tag_editing_started(self, renderer_combo, combobox, path):
     event = Gtk.get_current_event()
     rect = Gdk.Rectangle()
     rect.x = event.x
     rect.y = event.y + 30
     rect.width = rect.height = 1
     combobox.hide()
     popover = self.builder.get_object('tag_popover')
     popover.set_pointing_to(rect)
     GLib.idle_add(popover.show)
Exemple #16
0
            def column_clicked(column, *args):
                # if ctrl is held during the sort click, append a sort key
                # or change order if already sorted
                ctrl_held = False
                event = Gtk.get_current_event()
                if event:
                    ok, state = event.get_state()
                    if ok and state & qltk.get_primary_accel_mod():
                        ctrl_held = True

                self.toggle_column_sort(column, replace=not ctrl_held)
Exemple #17
0
            def column_clicked(column, *args):
                # if ctrl is held during the sort click, append a sort key
                # or change order if already sorted
                ctrl_held = False
                event = Gtk.get_current_event()
                if event:
                    ok, state = event.get_state()
                    if ok and state & Gdk.ModifierType.CONTROL_MASK:
                        ctrl_held = True

                self.toggle_column_sort(column, replace=not ctrl_held)
Exemple #18
0
            def column_clicked(column, *args):
                # if ctrl is held during the sort click, append a sort key
                # or change order if already sorted
                ctrl_held = False
                event = Gtk.get_current_event()
                if event:
                    ok, state = event.get_state()
                    if ok and state & Gdk.ModifierType.CONTROL_MASK:
                        ctrl_held = True

                self.toggle_column_sort(column, replace=not ctrl_held)
Exemple #19
0
    def _popup(self):
        event = Gtk.get_current_event()
        ok, button = event.get_button()
        if not ok:
            button = Gdk.BUTTON_PRIMARY
        time = event.get_time()

        if self._down:
            qltk.popup_menu_under_widget(self.__menu, self, button, time)
        else:
            qltk.popup_menu_above_widget(self.__menu, self, button, time)
Exemple #20
0
            def column_clicked(column, *args):
                # if ctrl is held during the sort click, append a sort key
                # or change order if already sorted
                ctrl_held = False
                event = Gtk.get_current_event()
                if event:
                    ok, state = event.get_state()
                    if ok and state & qltk.get_primary_accel_mod():
                        ctrl_held = True

                self.toggle_column_sort(column, replace=not ctrl_held)
Exemple #21
0
 def menu_cb(widget, data=None):
    event = gtk.get_current_event()
    button = event.button.button
    time = gtk.get_current_event_time()
    menu.show_all()
    menu.popup(
        None,
        None,
        gtk.StatusIcon.position_menu,
        icon,
        button,
        time
    )
Exemple #22
0
 def activate(menuitem, action, atype):
     rec = load(record)
     data = {
         'model': model,
         'id': rec.id,
         'ids': [rec.id],
     }
     event = Gtk.get_current_event()
     allow_similar = False
     if (event.state & Gdk.ModifierType.CONTROL_MASK
             or event.state & Gdk.ModifierType.MOD1_MASK):
         allow_similar = True
     with Window(hide_current=True, allow_similar=allow_similar):
         Action.execute(action, data, context=rec.get_context())
Exemple #23
0
 def __sig_switch(self, treeview, path, column):
     if column._type == 'button':
         return
     allow_similar = False
     event = Gtk.get_current_event()
     if (event.state & Gdk.ModifierType.MOD1_MASK
             or event.state & Gdk.ModifierType.SHIFT_MASK):
         allow_similar = True
     with Window(allow_similar=allow_similar):
         if not self.screen.row_activate() and self.children_field:
             if treeview.row_expanded(path):
                 treeview.collapse_row(path)
             else:
                 treeview.expand_row(path, False)
Exemple #24
0
def popup(menu, widget):
    def menu_position(menu, x, y, user_data):
        widget_allocation = widget.get_allocation()
        x, y = widget.get_window().get_root_coords(widget_allocation.x,
                                                   widget_allocation.y)
        return (x, y + widget_allocation.height, False)

    menu.show_all()
    if hasattr(menu, 'popup_at_widget'):
        menu.popup_at_widget(widget, Gdk.Gravity.SOUTH_WEST,
                             Gdk.Gravity.NORTH_WEST, Gtk.get_current_event())
    else:
        menu.popup(None, None, menu_position, None, 0,
                   Gtk.get_current_event_time())
 def dated_for_editing_started(self, widget, entry, text):
     event = Gtk.get_current_event()
     rect = Gdk.Rectangle()
     rect.x = event.x
     rect.y = event.y + 30
     rect.width = rect.height = 1
     self.dated_for_calendar.set_pointing_to(rect)
     selection = self.builder.get_object('treeview-selection1')
     model, path = selection.get_selected_rows()
     row_id = model[path][0]
     self.cursor.execute(
         "SELECT COALESCE(dated_for, CURRENT_DATE) "
         "FROM resources WHERE id = %s", (row_id, ))
     for row in self.cursor.fetchall():
         self.dated_for_calendar.set_datetime(row[0])
     GLib.idle_add(self.dated_for_calendar.show)  # this hides the entry
     DB.rollback()
Exemple #26
0
    def popup_at_pointer(menu, event):
        if event is None:
            event = Gtk.get_current_event()
        if event is None or event.type != Gdk.EventType.DROP_START:
            # We should be able to use the real popup_at_pointer (button press...)
            menu._real_popup_at_pointer(event)
            return

        # else:
        # Problematic case on win32. Workaround by using a modal.
        popup = Gtk.Window(Gtk.WindowType.POPUP)
        # For some reason, enter_notify is triggered upon creation
        # (even if the pointer is not in it). So guard using multiple
        # enter events before enabling deletion.
        popup.can_delete = -2
        def enable_deletion(w, e=None):
            popup.can_delete += 1
        def conditional_deletion(w, e=None):
            if popup.can_delete > 0:
                popup.destroy()
                return False
        def forced_deletion(w, e=None):
            popup.destroy()
            return False
        newmenu = Gtk.MenuBar()
        newmenu.set_pack_direction(Gtk.PackDirection.TTB)
        popup.add(newmenu)
        # Set our popup as modal wrt. normal menu toplevel
        p = menu.get_parent()
        if p is not None:
            popup.set_transient_for(p.get_toplevel())
            popup.set_modal(True)
        # Take menuitems from menu and reattach them to our new menu
        for menuitem in menu.get_children():
            menu.remove(menuitem)
            newmenu.append(menuitem)
        popup.connect("enter-notify-event", enable_deletion)
        popup.connect("leave-notify-event", conditional_deletion)
        popup.connect("button-press-event", enable_deletion)
        popup.connect("button-release-event", conditional_deletion)
        newmenu.connect("selection-done", forced_deletion)
        newmenu.connect("cancel", forced_deletion)
        center_on_mouse(popup)
        popup.show_all()
        newmenu.set_take_focus(True)
Exemple #27
0
    def on_primary_click(self, widget):
        event = Gtk.get_current_event()
        btn = event.button #this gets the button value of gtk event.
        time = Gtk.get_current_event_time()

        menu = Gtk.Menu()

        menu_item1 = Gtk.MenuItem()

        vbox = Gtk.VBox(False)
        vbox.pack_start(Gtk.Label('test'), expand=False, fill=True, padding=0)

        menu_item1.add(vbox)

        menu.append(menu_item1)

        menu.show_all()
        menu.popup(None, None, None, self, btn.type, time)
Exemple #28
0
    def validate_and_next(self, new):
        """Validate the current annotation and display the next one.
        """
        i = self.index
        annotation = self.annotations[i]
        batch=object()

        event = Gtk.get_current_event()
        if event.get_state().state & Gdk.ModifierType.CONTROL_MASK:
            # Control-key is held. Split the annotation.
            if new > annotation.fragment.begin and new < annotation.fragment.end:
                self.controller.split_annotation(annotation, new)
                self.message(_("Split annotation #%(current)d into #%(current)d and #%(next)d") % {
                        'current': i + 1,
                        'next': i + 2
                        })
            else:
                self.message(_("Cannot split annotation #%(current)d: out of bounds.") % {
                        'current': i + 1,
                        })
            return True

        if new != annotation.fragment.begin:
            logger.debug("Updating annotation begin from %s to %s", helper.format_time(annotation.fragment.begin), helper.format_time_reference(new))
            self.controller.notify('EditSessionStart', element=annotation, immediate=True)
            annotation.fragment.begin = new
            self.controller.notify('AnnotationEditEnd', annotation=annotation, batch=batch)
            self.controller.notify('EditSessionEnd', element=annotation)
            self.undo_button.set_sensitive(True)

        # Update previous annotation end.
        if i > 0:
            annotation = self.annotations[i - 1]
            if new != annotation.fragment.end:
                self.controller.notify('EditSessionStart', element=annotation, immediate=True)
                annotation.fragment.end = new
                self.controller.notify('AnnotationEditEnd', annotation=annotation, batch=batch)
                self.controller.notify('EditSessionEnd', element=annotation)
            self.message(_("Changed cut between #%(first)d and %(second)d") % { 'first': i + 1,
                                                                                  'second': i + 2 })
        else:
            self.message(_("Changed begin time for first annotation"))
        self.set_index(i + 1)
        return True
Exemple #29
0
 def action_keyword(self, ids):
     if not ids:
         return
     ctx = self.group._context.copy()
     if 'active_ids' in ctx:
         del ctx['active_ids']
     if 'active_id' in ctx:
         del ctx['active_id']
     event = Gtk.get_current_event()
     allow_similar = False
     if (event.state & Gdk.ModifierType.CONTROL_MASK
             or event.state & Gdk.ModifierType.MOD1_MASK):
         allow_similar = True
     with Window(hide_current=True, allow_similar=allow_similar):
         return Action.exec_keyword('graph_open', {
                 'model': self.model,
                 'id': ids[0],
                 'ids': ids,
                 }, context=ctx, warning=False)
    def __click_event_cb(self, button):
        event = Gtk.get_current_event()
        if not event:
            # not an event from a user interaction, this can be when
            # the clicked event is emitted on a 'active' property
            # change of ToggleToolButton for example
            return
        if event and button != Gtk.get_event_widget(event):
            # another special case for the ToggleToolButton: this handles
            # the case where we select an item and the active property
            # of the other one changes to 'False'
            return

        if self.props.lock_palette and not self.locked:
            self.locked = True
            if hasattr(self.parent, 'set_expanded'):
                self.parent.set_expanded(True)

        if self.props.toggle_palette:
            self.notify_toggle_state()
    def __click_event_cb(self, button):
        event = Gtk.get_current_event()
        if not event:
            # not an event from a user interaction, this can be when
            # the clicked event is emitted on a 'active' property
            # change of ToggleToolButton for example
            return
        if event and button != Gtk.get_event_widget(event):
            # another special case for the ToggleToolButton: this handles
            # the case where we select an item and the active property
            # of the other one changes to 'False'
            return

        if self.props.lock_palette and not self.locked:
            self.locked = True
            if hasattr(self.parent, 'set_expanded'):
                self.parent.set_expanded(True)

        if self.props.toggle_palette:
            self.notify_toggle_state()
Exemple #32
0
    def action_popup(self, widget):
        button, = widget.get_children()
        button.grab_focus()
        menu = widget._menu
        if not widget.props.active:
            menu.popdown()
            return

        def menu_position(menu, x, y, user_data):
            widget_allocation = widget.get_allocation()
            x, y = widget.get_window().get_root_coords(widget_allocation.x,
                                                       widget_allocation.y)
            return (x, y + widget_allocation.height, False)

        menu.show_all()
        if hasattr(menu, 'popup_at_widget'):
            menu.popup_at_widget(widget, Gdk.Gravity.SOUTH_WEST,
                                 Gdk.Gravity.NORTH_WEST,
                                 Gtk.get_current_event())
        else:
            menu.popup(None, None, menu_position, None, 0,
                       Gtk.get_current_event_time())
Exemple #33
0
 def inner(*args, **kwargs):
     if Gtk.get_current_event() is not None:
         f(*args, **kwargs)
Exemple #34
0
 def set_pos(menu, user_data=None):
     event = Gtk.get_current_event().button
     alloc = button.get_allocation()
     return (event.x, event.y + alloc.height, True)
Exemple #35
0
    def validate_and_next(self, new):
        """Validate the current annotation and display the next one.
        """
        i = self.index
        annotation = self.annotations[i]
        batch = object()

        event = Gtk.get_current_event()
        if event.get_state().state & Gdk.ModifierType.CONTROL_MASK:
            # Control-key is held. Split the annotation.
            if new > annotation.fragment.begin and new < annotation.fragment.end:
                self.controller.split_annotation(annotation, new)
                self.message(
                    _("Split annotation #%(current)d into #%(current)d and #%(next)d"
                      ) % {
                          'current': i + 1,
                          'next': i + 2
                      })
            else:
                self.message(
                    _("Cannot split annotation #%(current)d: out of bounds.") %
                    {
                        'current': i + 1,
                    })
            return True

        if new != annotation.fragment.begin:
            logger.debug("Updating annotation begin from %s to %s",
                         helper.format_time(annotation.fragment.begin),
                         helper.format_time_reference(new))
            self.controller.notify('EditSessionStart',
                                   element=annotation,
                                   immediate=True)
            annotation.fragment.begin = new
            self.controller.notify('AnnotationEditEnd',
                                   annotation=annotation,
                                   batch=batch)
            self.controller.notify('EditSessionEnd', element=annotation)
            self.undo_button.set_sensitive(True)

        # Update previous annotation end.
        if i > 0:
            annotation = self.annotations[i - 1]
            if new != annotation.fragment.end:
                self.controller.notify('EditSessionStart',
                                       element=annotation,
                                       immediate=True)
                annotation.fragment.end = new
                self.controller.notify('AnnotationEditEnd',
                                       annotation=annotation,
                                       batch=batch)
                self.controller.notify('EditSessionEnd', element=annotation)
            self.message(
                _("Changed cut between #%(first)d and %(second)d") % {
                    'first': i + 1,
                    'second': i + 2
                })
        else:
            self.message(_("Changed begin time for first annotation"))
        self.set_index(i + 1)
        return True
Exemple #36
0
    def selection_changed_cb(thumb, self):
        '''
		The file selection in the thumb navigator has changed.  
		Load the new metadata and update the comboboxes accordingly.
		
		If this cb is hit when there are currently unsaved metadata changes
		you will be prompted as to whether to 1) cancel the selection change,
		2) throw away the unsaved changes and load the new file or 3) save
		the changes and load the new file.
		
		'''

        # constanst for isChangeDialog
        CANCEL = 2  # cancel the file change
        NO = 1  # discard the changes and load the new file
        YES = 0  # save the changes and load the new file

        self.curImage = self.window.get_image()
        self.thumbImage = self.thumbview.get_first_selected_image()
        Event = Gtk.get_current_event()

        if self.Debug:
            print('\n\nfile changed ----------------------------------------')
            print('Event: ', Event)
            if Event != None:
                print('Event type: ', Event.type)
            self.showImages()

        if Event != None and self.thumbImage == None:
            # this happens when you use the toolbar next/previous buttons as
            # opposed to the arrow keys or clicking an icon in the thumb nav.
            # seem to be able to safely just discard it and then the various
            # new image selections work the same.
            if self.Debug:
                print('selection event received with no thumbImage.  discard!')
            return False

        # check to see if this callback is from a canceled file change
        if self.ignoreChange:
            # when cancel is selected in isChangedDialog the current image in
            # the thumb nav is forced back to the modified image.  this causes
            # a file changed callback that we want to ignore so that we don't
            # overwrite the combobox modified data with the old file data.
            if self.Debug:
                print('ignoring change')

            self.ignoreChange = False
            return False

        elif self.metaChanged:
            # a new file was selected but there are unsaved changes to the
            # current metadata!

            if self.Debug and Event != None:
                print('\n---------------------------------------------------')
                print ('event: %s (%s) state: %s'%(Event.type,\
                     Event.get_click_count(),Event.get_state()))
                print('device: %s' % Event.get_device())
                print('source: %s' % Event.get_source_device())
                print('button: ', Event.get_button())
                print('keycode: ', Event.get_keycode())
                print('keyval: ', Event.get_keyval())
                print('screen: ', Event.get_screen())
                print('window stat: ', Event.window_state)

            if Event != None and Event.type == Gdk.EventType.BUTTON_PRESS:
                # we got here by clicking a thumbnail in the thumb navigator.
                # throw away the release event or we will be left dragging
                # the thumbnail after the dialog closes (not a critical error,
                # but annoying and forces you to click an extra time in the
                # thumb nav to release it).  We don't seem to need to do
                # anything special if we got here by the arrow keys (Gdk.
                # EventType.KEY_PRESS) or the toolbar Next/Previous (Gdk.
                # EventType.BUTTON_RELEASE)
                self.thumbview.emit('button-release-event', Event)

            # display the dialog asking what to do and then hide it when we
            # get the answer
            tBuff = self.changeDetails.get_buffer()
            tBuff.set_text(self.show_changes())

            self.result = self.isChangedDialog.run()
            self.isChangedDialog.hide()

            if self.result == CANCEL or self.result < 0:  # CANCEL or close
                # stay on the current file.
                if self.changedImage != None:
                    if self.Debug:
                        print ('reset thumb %s'%urlparse(\
                         self.changedImage.get_uri_for_display()).path)
                    # ignore the next file changed callback so that we
                    # revert to the previous photo without modifying the comboboxes
                    self.ignoreChange = True
                    self.thumbview.set_current_image(self.changedImage, True)
                    return False
                else:
                    self.showImages()
                    raise AttributeError('Canceled but nothing to revert to!')

            elif self.result == YES:
                # save the changes. the newly selected image in the thumb nav
                # will still be loaded and the comboboxes will be updated with
                # the new data.
                self.commitButton.clicked()
            else:
                # don't save.  just continue on with the normal file change
                self.metaChanged = False

        if self.thumbImage == None:
            if self.changedImage != None:
                if self.Debug:
                    print('setting thumbImage to changedImage')
                self.thumbImage = self.changedImage

        if self.thumbImage != None:
            if self.Debug:
                print ('loading thumb meta:',\
                 urlparse(self.thumbImage.get_uri_for_display()).path)
            try:
                self.loadMeta(
                    urlparse(self.thumbImage.get_uri_for_display()).path)
            except:
                #print 'loadMeta failed (%s)'%urlparse(self.thumbImage.get_uri_for_display()).path
                #self.showImages()
                # if you select an invalid file you should error out here
                for C in self.combos:
                    self.clearCombo(C)

                self.newTitleEntry.set_text('')
                self.newDateEntry.set_text('')
                self.newCaptionEntry.set_text('')
                self.newKeywordEntry.set_text('')
                self.commitButton.set_state(Gtk.StateType.INSENSITIVE)
                self.revertButton.set_state(Gtk.StateType.INSENSITIVE)
                self.metaChanged = False
        else:
            if self.Debug:
                print('no metadata to load!')
                self.showImages()
            return False

        # return False to let any other callbacks execute as well
        return False
Exemple #37
0
	def	selection_changed_cb(thumb, self):
		'''
		The file selection in the thumb navigator has changed.  
		Load the new metadata and update the comboboxes accordingly.
		
		If this cb is hit when there are currently unsaved metadata changes
		you will be prompted as to whether to 1) cancel the selection change,
		2) throw away the unsaved changes and load the new file or 3) save
		the changes and load the new file.
		
		'''
		
		# constanst for isChangeDialog
		CANCEL=2	# cancel the file change
		NO=1		# discard the changes and load the new file
		YES=0		# save the changes and load the new file
				
		self.curImage = self.window.get_image()
		self.thumbImage = self.thumbview.get_first_selected_image()
		Event = Gtk.get_current_event()
		
		if self.Debug:
			print '\n\nfile changed ----------------------------------------'
			print 'Event: ',Event
			if Event != None:
				print 'Event type: ',Event.type
			self.showImages()
			
		if Event != None and self.thumbImage == None:
			# this happens when you use the toolbar next/previous buttons as 
			# opposed to the arrow keys or clicking an icon in the thumb nav.
			# seem to be able to safely just discard it and then the various
			# new image selections work the same.
			if self.Debug:
				print 'selection event received with no thumbImage.  discard!'
			return False	
		
		# check to see if this callback is from a canceled file change
		if self.ignoreChange: 
			# when cancel is selected in isChangedDialog the current image in
			# the thumb nav is forced back to the modified image.  this causes
			# a file changed callback that we want to ignore so that we don't
			# overwrite the combobox modified data with the old file data. 
			if self.Debug:
				print 'ignoring change'
			
			self.ignoreChange = False							
			return False
			
		elif self.metaChanged:
			# a new file was selected but there are unsaved changes to the 
			# current metadata!
			
			if self.Debug and Event != None:
				print '\n---------------------------------------------------'
				print 'event: %s (%s) state: %s'%(Event.type,\
									Event.get_click_count(),Event.get_state())
				print 'device: %s'%Event.get_device()
				print 'source: %s'%Event.get_source_device()
				print 'button: ',Event.get_button()
				print 'keycode: ',Event.get_keycode()
				print 'keyval: ',Event.get_keyval()
				print 'screen: ',Event.get_screen()
				print 'window stat: ',Event.window_state
			
			if Event != None and Event.type == Gdk.EventType.BUTTON_PRESS:
				# we got here by clicking a thumbnail in the thumb navigator.
				# throw away the release event or we will be left dragging 
				# the thumbnail after the dialog closes (not a critical error, 
				# but annoying and forces you to click an extra time in the 
				# thumb nav to release it).  We don't seem to need to do 
				# anything special if we got here by the arrow keys (Gdk.
				# EventType.KEY_PRESS) or the toolbar Next/Previous (Gdk.
				# EventType.BUTTON_RELEASE)
				self.thumbview.emit('button-release-event', Event)
			
			# display the dialog asking what to do and then hide it when we
			# get the answer
			tBuff = self.changeDetails.get_buffer()
			tBuff.set_text(self.show_changes())
			
			self.result = self.isChangedDialog.run()
			self.isChangedDialog.hide()

			if self.result == CANCEL or self.result < 0: # CANCEL or close
				# stay on the current file.  
				if self.changedImage != None:
					if self.Debug:
						print 'reset thumb %s'%urlparse(\
							self.changedImage.get_uri_for_display()).path
					# ignore the next file changed callback so that we
					# revert to the previous photo without modifying the comboboxes
					self.ignoreChange = True
					self.thumbview.set_current_image(self.changedImage,True)
					return False
				else:
					self.showImages()
					raise AttributeError('Canceled but nothing to revert to!')
				
			elif self.result == YES:
				# save the changes. the newly selected image in the thumb nav
				# will still be loaded and the comboboxes will be updated with
				# the new data.
				self.commitButton.clicked()
			else:
				# don't save.  just continue on with the normal file change
				self.metaChanged = False		

		if self.thumbImage == None:
			if self.changedImage != None:
				if self.Debug:
					print 'setting thumbImage to changedImage'
				self.thumbImage = self.changedImage
		
		if self.thumbImage != None:		
			if self.Debug:
				print 'loading thumb meta:',\
					urlparse(self.thumbImage.get_uri_for_display()).path
			try:
				self.loadMeta(urlparse(self.thumbImage.get_uri_for_display()).path)
			except:
				#print 'loadMeta failed (%s)'%urlparse(self.thumbImage.get_uri_for_display()).path
				#self.showImages()
				# if you select an invalid file you should error out here
				for C in self.combos:
					self.clearCombo(C)
					
				self.newTitleEntry.set_text('')
				self.newDateEntry.set_text('')
				self.newCaptionEntry.set_text('')
				self.newKeywordEntry.set_text('')	
				self.commitButton.set_state(Gtk.StateType.INSENSITIVE)
				self.revertButton.set_state(Gtk.StateType.INSENSITIVE)
				self.metaChanged = False
		else:
			if self.Debug:
				print 'no metadata to load!'
				self.showImages()
			return False

		# return False to let any other callbacks execute as well
		return False
	def inner(*args, **kwargs) :
		if Gtk.get_current_event() is not None :
			f(*args, **kwargs)