~ubuntu-branches/debian/sid/bzr-explorer/sid

« back to all changes in this revision

Viewing changes to lib/filesystemwatcher.py

  • Committer: Package Import Robot
  • Author(s): Andrew Starr-Bochicchio
  • Date: 2012-02-21 11:10:08 UTC
  • mfrom: (1.1.10)
  • Revision ID: package-import@ubuntu.com-20120221111008-t30vwzwsle647ny5
Tags: 1.2.2-1
* New upstream release.
* Replace debian/bzr-explorer.xpm with higher quality
  png icon, and add it to debian/source/include-binaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2012 Canonical Ltd
 
2
#
 
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.
 
7
#
 
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.
 
12
#
 
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
 
16
 
 
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.
 
20
 
 
21
import sys
 
22
from PyQt4 import QtCore
 
23
 
 
24
 
 
25
class _FakeSignal(object):
 
26
 
 
27
    def __init__(self):
 
28
        pass
 
29
 
 
30
    def connect(self, *args, **kwargs):
 
31
        pass
 
32
 
 
33
 
 
34
class _FakeFileSystemWatcher(object):
 
35
    """We just provide all methods that supported by real object
 
36
    but do nothing instead."""
 
37
 
 
38
    def __init__(self, *args, **kwargs):
 
39
        pass
 
40
 
 
41
    def addPath(self, file):
 
42
        pass
 
43
 
 
44
    def addPaths(self, files):
 
45
        pass
 
46
 
 
47
    def directories(self):
 
48
        return []
 
49
 
 
50
    def files(self):
 
51
        return []
 
52
 
 
53
    def removePath(self, file):
 
54
        pass
 
55
 
 
56
    def removePaths(self, files):
 
57
        pass
 
58
 
 
59
    directoryChanged = _FakeSignal()
 
60
    fileChanged = _FakeSignal()
 
61
 
 
62
 
 
63
QFileSystemWatcher = QtCore.QFileSystemWatcher
 
64
 
 
65
if sys.platform == 'win32':
 
66
    QFileSystemWatcher = _FakeFileSystemWatcher