1
# Copyright (C) 2012 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
# The sad news about QFileSystemWatcher: on Windows using it heavily lead
18
# to many many many bug reports about Permission Errors.
19
# So as a short-time workaround we disable watcher at all for Windows.
22
from PyQt4 import QtCore
25
class _FakeSignal(object):
30
def connect(self, *args, **kwargs):
34
class _FakeFileSystemWatcher(object):
35
"""We just provide all methods that supported by real object
36
but do nothing instead."""
38
def __init__(self, *args, **kwargs):
41
def addPath(self, file):
44
def addPaths(self, files):
47
def directories(self):
53
def removePath(self, file):
56
def removePaths(self, files):
59
directoryChanged = _FakeSignal()
60
fileChanged = _FakeSignal()
63
QFileSystemWatcher = QtCore.QFileSystemWatcher
65
if sys.platform == 'win32':
66
QFileSystemWatcher = _FakeFileSystemWatcher