def __init__(self, path, revision=None):
        if os.path.isdir(path):
            MessageBox(_("Cannot annotate a directory"))
            raise SystemExit()
            return

        InterfaceView.__init__(self, "annotate", "Annotate")

        self.get_widget("Annotate").set_title(_("Annotate - %s") % path)
        self.vcs = rabbitvcs.vcs.VCS()

        sm = SettingsManager()
        self.datetime_format = sm.get("general", "datetime_format")
        self.colorize = sm.get("general", "enable_colorize")

        self.log_by_order = []
        self.log_by_revision = {}
        self.author_background = {}
        self.history = [revision or "HEAD"]
        self.history_index = 0
        self.loading_dialog = None

        self.table = self.build_table()
        self.revision = self.get_widget("revision")
        self.history_first = Clickable(self.get_widget("history_first"))
        self.history_prev = Clickable(self.get_widget("history_prev"))
        self.history_next = Clickable(self.get_widget("history_next"))
        self.history_last = Clickable(self.get_widget("history_last"))
        self.history_first.connect("single-click", self.on_history_first)
        self.history_prev.connect("single-click", self.on_history_prev)
        self.history_prev.connect("long-click", self.history_popup_menu)
        self.history_next.connect("single-click", self.on_history_next)
        self.history_next.connect("long-click", self.history_popup_menu)
        self.history_last.connect("single-click", self.on_history_last)
        self.set_history_sensitive()
Example #2
0
def reload_log_settings():
    """
    Refreshes the settings manager and returns a new log instance

    """

    settings = SettingsManager()
    DEFAULT_LEVEL = settings.get("logging", "level").lower()
    DEFAULT_LOG_TYPE = settings.get("logging", "type")

    Log = NullLog
    if DEFAULT_LOG_TYPE == "File":
        Log = FileLog
    elif DEFAULT_LOG_TYPE == "Console":
        Log = ConsoleLog
    elif DEFAULT_LOG_TYPE == "Both":
        Log = DualLog

    return Log
Example #3
0
def reload_log_settings():
    """
    Refreshes the settings manager and returns a new log instance
    
    """

    settings = SettingsManager()
    DEFAULT_LEVEL = settings.get("logging", "level").lower()
    DEFAULT_LOG_TYPE = settings.get("logging", "type")

    Log = NullLog
    if DEFAULT_LOG_TYPE == "File":
        Log = FileLog
    elif DEFAULT_LOG_TYPE == "Console":
        Log = ConsoleLog
    elif DEFAULT_LOG_TYPE == "Both":
        Log = DualLog

    return Log
Example #4
0
 def do_reload_settings():
     globals()["settings"] = SettingsManager()
     globals()["log"] = reload_log_settings()(
         "rabbitvcs.util.extensions.thunar")
     log.debug("Re-scanning settings")
Example #5
0
from rabbitvcs.util.helper import pretty_timedelta
from rabbitvcs.util.helper import to_text, unquote
from rabbitvcs.util.decorators import timeit, disable
from rabbitvcs.util.contextmenu import MenuBuilder, MainContextMenu, SEPARATOR

from rabbitvcs.util.log import Log, reload_log_settings

log = Log("rabbitvcs.util.extensions.thunarx.RabbitVCS")

from rabbitvcs import gettext

_ = gettext.gettext

from rabbitvcs.util.settings import SettingsManager

settings = SettingsManager()

import rabbitvcs.services.service
from rabbitvcs.services.checkerservice import StatusCheckerStub as StatusChecker


class RabbitVCS(GObject.GObject, Thunarx.MenuProvider,
                Thunarx.PropertyPageProvider):
    """
    This is the main class that implements all of our awesome features.

    """

    #: Maps statuses to emblems.
    #: TODO: should probably be possible to create this dynamically
    EMBLEMS = rabbitvcs.ui.STATUS_EMBLEMS
Example #6
0
import os
from os.path import expanduser
import logging
import logging.handlers

from rabbitvcs.util.settings import SettingsManager, get_home_folder

LEVELS = {
    "debug": logging.DEBUG,
    "info": logging.INFO,
    "warning": logging.WARNING,
    "error": logging.ERROR,
    "critical": logging.CRITICAL
}

settings = SettingsManager()
DEFAULT_LEVEL = settings.get("logging", "level").lower()
DEFAULT_LOG_TYPE = settings.get("logging", "type")

# The following merely sets the log type/level if it hasn't already been set
changed = False
if DEFAULT_LEVEL not in LEVELS:
    DEFAULT_LEVEL = "debug"
    settings.set("logging", "level", DEFAULT_LEVEL.title())
    changed = True

if not DEFAULT_LOG_TYPE:
    DEFAULT_LOG_TYPE = "Console"
    settings.set("logging", "type", DEFAULT_LOG_TYPE)
    changed = True
Example #7
0
#
# You should have received a copy of the GNU General Public License
# along with RabbitVCS;  If not, see <http://www.gnu.org/licenses/>.
#

import os.path
from rabbitvcs import gettext
_ = gettext.gettext

from rabbitvcs.util.log import Log
logger = Log("rabbitvcs.vcs")

from rabbitvcs.util.helper import get_exclude_paths
from rabbitvcs.util.settings import SettingsManager

settings = SettingsManager()

EXT_UTIL_ERROR = _("The output from '%s' was not able to be processed.\n%s")

VCS_SVN = 'svn'
VCS_GIT = 'git'
VCS_MERCURIAL = 'mercurial'
VCS_DUMMY = 'unknown'

VCS_FOLDERS = {}
if not settings.get("HideItem", "svn"):
    VCS_FOLDERS[".svn"] = VCS_SVN
if not settings.get("HideItem", "git"):
    VCS_FOLDERS[".git"] = VCS_GIT

def _guess(path):
#
# You should have received a copy of the GNU General Public License
# along with RabbitVCS;  If not, see <http://www.gnu.org/licenses/>.
#

import os.path
from rabbitvcs import gettext
_ = gettext.gettext

from rabbitvcs.util.log import Log
logger = Log("rabbitvcs.vcs")

from rabbitvcs.util.helper import get_exclude_paths
from rabbitvcs.util.settings import SettingsManager

settings = SettingsManager()

EXT_UTIL_ERROR = _("The output from '%s' was not able to be processed.\n%s")

VCS_SVN = 'svn'
VCS_GIT = 'git'
VCS_MERCURIAL = 'mercurial'
VCS_DUMMY = 'unknown'

VCS_FOLDERS = {}
if not settings.get("HideItem", "svn"):
    VCS_FOLDERS[".svn"] = VCS_SVN
if not settings.get("HideItem", "git"):
    VCS_FOLDERS[".git"] = VCS_GIT

Example #9
0
import os
from os.path import expanduser
import logging
import logging.handlers

from rabbitvcs.util.settings import SettingsManager, get_home_folder

LEVELS = {
    "debug": logging.DEBUG,
    "info": logging.INFO,
    "warning": logging.WARNING,
    "error": logging.ERROR,
    "critical": logging.CRITICAL,
}

settings = SettingsManager()
DEFAULT_LEVEL = settings.get("logging", "level").lower()
DEFAULT_LOG_TYPE = settings.get("logging", "type")

# The following merely sets the log type/level if it hasn't already been set
changed = False
if DEFAULT_LEVEL not in LEVELS:
    DEFAULT_LEVEL = "debug"
    settings.set("logging", "level", DEFAULT_LEVEL.title())
    changed = True

if not DEFAULT_LOG_TYPE:
    DEFAULT_LOG_TYPE = "Console"
    settings.set("logging", "type", DEFAULT_LOG_TYPE)
    changed = True