Exemplo n.º 1
0
 def cancel(self):
     if self.__idle_id:
         gobject.source_remove(self.__idle_id)
         self.__idle_id = 0
     if self.__monid:
         gnomevfs.monitor_cancel(self.__monid)
         self.__monid = None
Exemplo n.º 2
0
 def cancel(self):
     if self.__idle_id:
         gobject.source_remove(self.__idle_id)
         self.__idle_id = 0
     if self.__monid:
         gnomevfs.monitor_cancel(self.__monid)
         self.__monid = None
Exemplo n.º 3
0
    def add(self, folder, monitorType):
        if self._id != None:
            gnomevfs.monitor_cancel(self._id)
            self._id = None

        try:
            self._id = gnomevfs.monitor_add(folder, monitorType, self._monitor_cb)
        except gnomevfs.NotSupportedError:
            # silently fail if we are looking at a folder that doesn't support directory monitoring
            self._id = None
Exemplo n.º 4
0
def delete_files(main_window, forever):
    """Delete the selected files."""
    iconview = main_window.iconview
    selected = iconview.get_selected_items()
    if selected and len(selected)>1:
        if forever:
            message = _('Would you like to permanently delete the '
                        'selected images?')
        else:
            message = _('Would you like to delete the selected images?')

        dlg = gtk.MessageDialog(type=gtk.MESSAGE_QUESTION,
            buttons=gtk.BUTTONS_YES_NO,
            message_format=message)
        response = dlg.run()
        dlg.destroy()
        if response != gtk.RESPONSE_YES:
            return

    banned = open(os.path.expanduser('~/.webilder/banned_photos'), 'a')
    model = iconview.get_model()

    monitor = main_window.collection_monitor
    if monitor['monitor'] is not None:
        gnomevfs.monitor_cancel(monitor['monitor'])
        monitor['monitor'] = None

    for path in selected:
        iterator = model.get_iter(path)
        data = model.get_value(iterator,
            IV_DATA_COLUMN)
        for fname in (data['filename'], data['info_file'], data['thumb']):
            try:
                os.remove(fname)
            except (IOError, OSError):
                pass
        if forever:
            banned.write(os.path.basename(data['filename'])+'\n')
        model.remove(iterator)

    if monitor['dir']:
        monitor['monitor'] = gnomevfs.monitor_add(
            monitor['dir'],
            gnomevfs.MONITOR_DIRECTORY,
            main_window.collection_directory_changed)

    banned.close()
Exemplo n.º 5
0
def delete_files(main_window, forever):
    """Delete the selected files."""
    iconview = main_window.iconview
    selected = iconview.get_selected_items()
    if selected and len(selected) > 1:
        if forever:
            message = _('Would you like to permanently delete the '
                        'selected images?')
        else:
            message = _('Would you like to delete the selected images?')

        dlg = gtk.MessageDialog(type=gtk.MESSAGE_QUESTION,
                                buttons=gtk.BUTTONS_YES_NO,
                                message_format=message)
        response = dlg.run()
        dlg.destroy()
        if response != gtk.RESPONSE_YES:
            return

    banned = open(os.path.expanduser('~/.webilder/banned_photos'), 'a')
    model = iconview.get_model()

    monitor = main_window.collection_monitor
    if monitor['monitor'] is not None:
        gnomevfs.monitor_cancel(monitor['monitor'])
        monitor['monitor'] = None

    for path in selected:
        iterator = model.get_iter(path)
        data = model.get_value(iterator, IV_DATA_COLUMN)
        for fname in (data['filename'], data['info_file'], data['thumb']):
            try:
                os.remove(fname)
            except (IOError, OSError):
                pass
        if forever:
            banned.write(os.path.basename(data['filename']) + '\n')
        model.remove(iterator)

    if monitor['dir']:
        monitor['monitor'] = gnomevfs.monitor_add(
            monitor['dir'], gnomevfs.MONITOR_DIRECTORY,
            main_window.collection_directory_changed)

    banned.close()
Exemplo n.º 6
0
	def close(self):
		gnomevfs.monitor_cancel(self.monitor)
		self.monitor = None
Exemplo n.º 7
0
def file_monitor_cancel(handle):
	"Cancels file monitoring"

	gnomevfs.monitor_cancel(handle)
Exemplo n.º 8
0
 def cancel(self):
     if self._id != None:
         gnomevfs.monitor_cancel(self._id)
         self._id = None