示例#1
0
def start():
    global _thread
    if not AVAILABLE:
        if utils.is_win32():
            msg = ('file notification: disabled\n'
                   'Note: install pywin32 to enable.\n')
        elif utils.is_linux():
            msg = ('inotify: disabled\n'
                   'Note: install python-pyinotify to enable inotify.\n')
        else:
            return

        if utils.is_debian():
            msg += ('On Debian systems '
                    'try: sudo aptitude install python-pyinotify')
        cola.notifier().broadcast(signals.log_cmd, 0, msg)
        return

    # Start the notification thread
    _thread = GitNotifier()
    _thread.start()
    if utils.is_win32():
        msg = 'file notification: enabled'
    else:
        msg = 'inotify support: enabled'
    cola.notifier().broadcast(signals.log_cmd, 0, msg)
示例#2
0
def start():
    global _thread

    cfg = gitcfg.instance()
    if not cfg.get('cola.inotify', True):
        msg = N_('inotify is disabled because "cola.inotify" is false')
        Interaction.log(msg)
        return

    if not AVAILABLE:
        if utils.is_win32():
            msg = N_('file notification: disabled\n'
                     'Note: install pywin32 to enable.\n')
        elif utils.is_linux():
            msg = N_('inotify: disabled\n'
                     'Note: install python-pyinotify to enable inotify.\n')
        else:
            return

        if utils.is_debian():
            msg += N_('On Debian systems '
                      'try: sudo aptitude install python-pyinotify')
        Interaction.log(msg)
        return

    # Start the notification thread
    _thread = GitNotifier()
    _thread.start()
    if utils.is_win32():
        msg = N_('File notification enabled.')
    else:
        msg = N_('inotify enabled.')
    Interaction.log(msg)
示例#3
0
def start():
    global _thread

    cfg = gitcfg.instance()
    if not cfg.get('cola.inotify', True):
        msg = N_('inotify is disabled because "cola.inotify" is false')
        Interaction.log(msg)
        return

    if not AVAILABLE:
        if utils.is_win32():
            msg = N_('file notification: disabled\n'
                     'Note: install pywin32 to enable.\n')
        elif utils.is_linux():
            msg = N_('inotify: disabled\n'
                     'Note: install python-pyinotify to enable inotify.\n')
        else:
            return

        if utils.is_debian():
            msg += N_('On Debian systems '
                      'try: sudo aptitude install python-pyinotify')
        Interaction.log(msg)
        return

    # Start the notification thread
    _thread = GitNotifier()
    _thread.start()
    if utils.is_win32():
        msg = N_('File notification enabled.')
    else:
        msg = N_('inotify enabled.')
    Interaction.log(msg)
示例#4
0
 def __init__(self, timeout=333):
     """Set up the pyinotify thread"""
     QtCore.QThread.__init__(self)
     ## Git command object
     self._git = main.model().git
     ## pyinotify timeout
     self._timeout = timeout
     ## Path to monitor
     self._path = self._git.worktree()
     ## Signals thread termination
     self._running = True
     ## Directories to watching
     self._dirs_seen = set()
     ## The inotify watch manager instantiated in run()
     self._wmgr = None
     ## Has add_watch() failed?
     self._add_watch_failed = False
     ## Events to capture
     if utils.is_linux():
         self._mask = (EventsCodes.ALL_FLAGS['IN_ATTRIB'] |
                       EventsCodes.ALL_FLAGS['IN_CLOSE_WRITE'] |
                       EventsCodes.ALL_FLAGS['IN_CREATE'] |
                       EventsCodes.ALL_FLAGS['IN_DELETE'] |
                       EventsCodes.ALL_FLAGS['IN_MODIFY'] |
                       EventsCodes.ALL_FLAGS['IN_MOVED_TO'])
示例#5
0
 def __init__(self, timeout=333):
     """Set up the pyinotify thread"""
     QtCore.QThread.__init__(self)
     ## Git command object
     self._git = main.model().git
     ## pyinotify timeout
     self._timeout = timeout
     ## Path to monitor
     self._path = self._git.worktree()
     ## Signals thread termination
     self._running = True
     ## Directories to watching
     self._dirs_seen = set()
     ## The inotify watch manager instantiated in run()
     self._wmgr = None
     ## Has add_watch() failed?
     self._add_watch_failed = False
     ## Events to capture
     if utils.is_linux():
         self._mask = (EventsCodes.ALL_FLAGS['IN_ATTRIB']
                       | EventsCodes.ALL_FLAGS['IN_CLOSE_WRITE']
                       | EventsCodes.ALL_FLAGS['IN_CREATE']
                       | EventsCodes.ALL_FLAGS['IN_DELETE']
                       | EventsCodes.ALL_FLAGS['IN_MODIFY']
                       | EventsCodes.ALL_FLAGS['IN_MOVED_TO'])
示例#6
0
def start():
    global _thread
    if not AVAILABLE:
        if utils.is_win32():
            msg = ('file notification: disabled\n'
                   'Note: install pywin32 to enable.\n')
        elif utils.is_linux():
            msg = ('inotify: disabled\n'
                   'Note: install python-pyinotify to enable inotify.\n')
        else:
            return

        if utils.is_debian():
            msg += ('On Debian systems '
                    'try: sudo aptitude install python-pyinotify')
        cola.notifier().broadcast(signals.log_cmd, 0, msg)
        return

    # Start the notification thread
    _thread = GitNotifier()
    _thread.start()
    if utils.is_win32():
        msg = 'file notification: enabled'
    else:
        msg = 'inotify support: enabled'
    cola.notifier().broadcast(signals.log_cmd, 0, msg)
示例#7
0
def _create_instance():
    thread_class = None
    cfg = gitcfg.current()
    if not cfg.get('cola.inotify', True):
        msg = N_('File system change monitoring: disabled because'
                 ' "cola.inotify" is false.\n')
        Interaction.log(msg)
    elif AVAILABLE == 'inotify':
        thread_class = _InotifyThread
    elif AVAILABLE == 'pywin32':
        thread_class = _Win32Thread
    else:
        if utils.is_win32():
            msg = N_('File system change monitoring: disabled because pywin32'
                     ' is not installed.\n')
            Interaction.log(msg)
        elif utils.is_linux():
            msg = N_('File system change monitoring: disabled because libc'
                     ' does not support the inotify system calls.\n')
            Interaction.log(msg)
    return _Monitor(thread_class)
示例#8
0
def _create_instance():
    thread_class = None
    cfg = gitcfg.current()
    if not cfg.get('cola.inotify', True):
        msg = N_('File system change monitoring: disabled because'
                 ' "cola.inotify" is false.\n')
        Interaction.log(msg)
    elif AVAILABLE == 'inotify':
        thread_class = _InotifyThread
    elif AVAILABLE == 'pywin32':
        thread_class = _Win32Thread
    else:
        if utils.is_win32():
            msg = N_('File system change monitoring: disabled because pywin32'
                     ' is not installed.\n')
            Interaction.log(msg)
        elif utils.is_linux():
            msg = N_('File system change monitoring: disabled because libc'
                     ' does not support the inotify system calls.\n')
            Interaction.log(msg)
    return _Monitor(thread_class)
示例#9
0
from cola import utils
from cola.decorators import memoize

AVAILABLE = None

if utils.is_win32():
    try:
        import pywintypes
        import win32con
        import win32event
        import win32file
    except ImportError:
        pass
    else:
        AVAILABLE = 'pywin32'
elif utils.is_linux():
    try:
        from cola import inotify
    except ImportError:
        pass
    else:
        AVAILABLE = 'inotify'

from PyQt4 import QtCore
from PyQt4.QtCore import SIGNAL

from cola import core
from cola import gitcfg
from cola import gitcmds
from cola.compat import bchr
from cola.git import git
示例#10
0
from cola import utils
from cola.decorators import memoize

AVAILABLE = None

if utils.is_win32():
    try:
        import pywintypes
        import win32con
        import win32event
        import win32file
    except ImportError:
        pass
    else:
        AVAILABLE = 'pywin32'
elif utils.is_linux():
    try:
        from cola import inotify
    except ImportError:
        pass
    else:
        AVAILABLE = 'inotify'

from PyQt4 import QtCore
from PyQt4.QtCore import SIGNAL

from cola import core
from cola import gitcfg
from cola import gitcmds
from cola.compat import bchr
from cola.git import git