Exemplo n.º 1
0
    def __init__(self):
        self.scanStack = []
        self.allvfs = {}
        self.inv_dirs = set()

        from tortoisehg.util import menuthg
        self.hgtk = paths.find_in_path(thg_main)
        self.menu = menuthg.menuThg()

        # Get the configuration directory path
        try:
            self.notify = os.environ['XDG_CONFIG_HOME']
        except KeyError:
            self.notify = os.path.join('$HOME', '.config')

        self.notify = os.path.expandvars(
            os.path.join(self.notify, 'TortoiseHg'))

        # Create folder if it does not exist
        if not os.path.isdir(self.notify):
            os.makedirs(self.notify)

        # Create the notify file
        self.notify = os.path.join(self.notify, 'notify')
        open(self.notify, 'w').close()

        self.gmon = Gio.file_new_for_path(self.notify).monitor(
            Gio.FileMonitorFlags.NONE, None)
        self.gmon.connect('changed', self.notified)
Exemplo n.º 2
0
    def __init__(self):
        self.scanStack = []
        self.allvfs = {}
        self.inv_dirs = set()

        from tortoisehg.util import menuthg
        self.hgtk = paths.find_in_path(thg_main)
        self.menu = menuthg.menuThg()

        # Get the configuration directory path
        try:
            self.notify = os.environ['XDG_CONFIG_HOME']
        except KeyError:
            self.notify = os.path.join('$HOME', '.config')

        self.notify = os.path.expandvars(os.path.join(
            self.notify,
            'TortoiseHg'))

        # Create folder if it does not exist
        if not os.path.isdir(self.notify):
            os.makedirs(self.notify)

        # Create the notify file
        self.notify = os.path.join(self.notify, 'notify')
        open(self.notify, 'w').close()

        self.gmon = Gio.file_new_for_path(self.notify).monitor(Gio.FileMonitorFlags.NONE, None)
        self.gmon.connect('changed', self.notified)
Exemplo n.º 3
0
    def __init__(self):
        self.scanStack = []
        self.allvfs = {}
        self.inv_dirs = set()

        from tortoisehg.util import menuthg
        self.hgtk = paths.find_in_path(thg_main)
        self.menu = menuthg.menuThg()
        self.notify = os.path.expanduser('~/.tortoisehg/notify')
        try:
            f = open(self.notify, 'w')
            f.close()
            ds_uri = gnomevfs.get_uri_from_local_path(self.notify)
            self.gmon = gnomevfs.monitor_add(ds_uri,
                      gnomevfs.MONITOR_FILE, self.notified)
        except (gnomevfs.NotSupportedError, IOError), e:
            debugf('no notification because of %s', e)
            self.notify = ''
Exemplo n.º 4
0
    def __init__(self):
        self.scanStack = []
        self.allvfs = {}
        self.inv_dirs = set()

        from tortoisehg.util import menuthg
        self.hgtk = paths.find_in_path(thg_main)
        self.menu = menuthg.menuThg()
        self.notify = os.path.expanduser('~/.tortoisehg/notify')

        try:
            f = open(self.notify, 'w')
            f.close()
            ds_uri = matevfs.get_uri_from_local_path(self.notify)
            self.gmon = matevfs.monitor_add(ds_uri, matevfs.MONITOR_FILE,
                                            self.notified)
        except (matevfs.NotSupportedError, IOError), e:
            debugf('no notification because of %s', e)
            self.notify = ''
Exemplo n.º 5
0
    def __init__(self, callback):
        gtk.TreeView.__init__(self)
        self.callback = callback
        self.cachedroot = None
        self.menu = menuthg.menuThg(internal=True)
        fm = gtk.ListStore(
            str,  # canonical path
            bool,  # Checked
            str,  # basename-UTF8
            bool,  # M
            bool,  # A
            bool,  # R
            bool,  # !
            bool,  # ?
            bool,  # I
            bool,  # C
            bool,
        )  # isfile
        self.set_model(fm)

        self.set_headers_visible(False)
        self.set_reorderable(True)
        self.connect("popup-menu", self.popupmenu)
        self.connect("button-release-event", self.buttonrelease)
        self.connect("row-activated", self.rowactivated)
        self.get_selection().set_mode(gtk.SELECTION_MULTIPLE)
        self.set_reorderable(False)
        self.set_enable_search(True)
        if hasattr(self, "set_rubber_banding"):
            self.set_rubber_banding(True)

        col = gtk.TreeViewColumn(_("status"))
        self.append_column(col)

        def packpixmap(name, id):
            pixbuf = gtklib.get_icon_pixbuf(name)
            cell = gtk.CellRendererPixbuf()
            cell.set_property("pixbuf", pixbuf)
            col.pack_start(cell, expand=False)
            col.add_attribute(cell, "visible", id)

        # packpixmap('filemodify.ico', 3) # this icon does not load for me
        packpixmap("menucommit.ico", 3)  # M
        packpixmap("fileadd.ico", 4)  # A
        packpixmap("filedelete.ico", 5)  # R
        packpixmap("detect_rename.ico", 6)  # missing
        packpixmap("menublame.ico", 7)  # unknown
        # packpixmap('ignore.ico', 8) # ignored
        # packpixmap('hg.ico', 9) # clean

        def cell_seticon(column, cell, model, iter):
            isfile = model.get_value(iter, 10)
            pixbuf = isfile and filepb or folderpb
            cell.set_property("pixbuf", pixbuf)

        col = gtk.TreeViewColumn(_("type"))
        cell = gtk.CellRendererPixbuf()
        col.pack_start(cell, expand=False)
        col.set_cell_data_func(cell, cell_seticon)
        self.append_column(col)

        col = gtk.TreeViewColumn(_("path"), gtk.CellRendererText(), text=2)
        self.append_column(col)