예제 #1
0
파일: push.py 프로젝트: khpark0203/mydev
    def update_widgets(self):
        self.log_table.clear()

        repository = ""
        branch = ""

        if not self.git_svn:
            repository = self.repository_selector.repository_opt.get_active_text(
            )
            branch = self.repository_selector.branch_opt.get_active_text()

        if not repository or not branch:
            if self.git_svn:
                pass
            else:
                self.get_widget("ok").set_sensitive(False)
                return

        has_commits = False
        for item in self.push_log:
            self.log_table.append([
                helper.format_datetime(item.date, self.datetime_format),
                helper.format_long_text(item.message.rstrip("\n"))
            ])
            has_commits = True

        self.get_widget("ok").set_sensitive(True)
        if not has_commits:
            self.get_widget("status").set_text(_("No commits found"))
예제 #2
0
    def update_branch_info(self):
        from_branch = self.from_branches.get_revision_object()

        if from_branch.value:
            log = self.git.log(self.path, limit=1, revision=from_branch, showtype="branch")
            if log:
                from_info = log[0]
                self.info['from']['author'].set_text(from_info.author)
                self.info['from']['date'].set_text(helper.format_datetime(from_info.date))
                self.info['from']['revision'].set_text(helper.to_text(from_info.revision)[0:7])
                self.info['from']['message'].set_text(helper.html_escape(helper.format_long_text(from_info.message, 500)))
예제 #3
0
파일: widget.py 프로젝트: zwr8/rabbitvcs
def long_text_filter(row, column, user_data=None):
    """
    Uses the format_long_text helper function to trim and prettify some text.
    """
    text = row[column]

    cols = user_data["cols"]

    if text:
        text = helper.format_long_text(text, cols)

    return text
예제 #4
0
def long_text_filter(row, column, user_data=None):
    """
    Uses the format_long_text helper function to trim and prettify some text.
    """
    text = row[column]

    cols = user_data["cols"]


    if text:
        text = helper.format_long_text(text, cols)

    return text
예제 #5
0
    def update_branch_info(self):
        from_branch = self.from_branches.get_revision_object()

        if from_branch.value:
            log = self.git.log(self.path,
                               limit=1,
                               revision=from_branch,
                               showtype="branch")
            if log:
                from_info = log[0]
                self.info['from']['author'].set_text(from_info.author)
                self.info['from']['date'].set_text(
                    helper.format_datetime(from_info.date))
                self.info['from']['revision'].set_text(
                    helper.to_text(from_info.revision)[0:7])
                self.info['from']['message'].set_text(
                    helper.html_escape(
                        helper.format_long_text(from_info.message, 500)))
예제 #6
0
파일: push.py 프로젝트: rabbitvcs/rabbitvcs
    def update_widgets(self):
        self.log_table.clear()

        repository = self.repository_selector.repository_opt.get_active_text()
        branch = self.repository_selector.branch_opt.get_active_text()

        if not repository or not branch:
            self.get_widget("ok").set_sensitive(False)
            return

        has_commits = False
        for item in self.push_log:
            self.log_table.append([
                helper.format_datetime(item.date),
                helper.format_long_text(item.message.rstrip("\n"))
            ])
            has_commits = True

        self.get_widget("ok").set_sensitive(True)
        if not has_commits:
            self.get_widget("status").set_text(_("No commits found"))
예제 #7
0
    def on_query_tooltip(self, treeview, x, y, kbdmode, tooltip, data=None):
        if kbdmode:
            return False

        try:
            position, enabled_columns = data
            enabled_columns[0]
        except (TypeError, ValueError, IndexError):
            return False

        bx, by = treeview.convert_widget_to_bin_window_coords(x, y)
        t = treeview.get_path_at_pos(bx, by)
        if t is None:
            return False

        path, column, cellx, celly = t
        columns = treeview.get_columns()
        try:
            pos = columns.index(column)
        except ValueError:
            return False
        if not pos in enabled_columns:
            return False

        revision = treeview.get_model()[path][position]
        if not revision:
            return False

        revision = str(revision)
        if not revision in self.log_by_revision:
            return False

        log = self.log_by_revision[revision]
        message = helper.format_long_text(log.message, line1only=True)
        if not message:
            return False

        tooltip.set_text(S(message).display())
        treeview.set_tooltip_cell(tooltip, path)
        return True
예제 #8
0
 def history_popup_menu(self, clickable, widget, event, *args):
     menu = Gtk.Menu()
     width = 0
     for i, revision in list(enumerate(self.history))[:self.history_index +
                                                      6][-11:]:
         message = ""
         revision = self.short_revision(revision)
         if revision in self.log_by_revision:
             log = self.log_by_revision[revision]
             message = helper.format_long_text(log.message,
                                               cols=32,
                                               line1only=True)
         revision = helper.html_escape(revision)
         message = helper.html_escape(message)
         if i == self.history_index:
             revision = "<b>" + revision + "</b>"
             message = "<b>" + message + "</b>"
         row = Gtk.Grid()
         cell1 = Gtk.Label()
         cell1.set_properties(xalign=0, yalign=.5)
         cell1.set_markup(revision)
         row.attach(cell1, 0, 0, 1, 1)
         cell2 = Gtk.Label()
         cell2.set_properties(xalign=0, yalign=.5)
         cell2.set_markup(message)
         row.attach(cell2, 1, 0, 1, 1)
         menuitem = Gtk.MenuItem()
         menuitem.add(row)
         menuitem.connect("activate", self.on_history_menu_activate, i)
         menu.add(menuitem)
     menu.show_all()
     menu.popup_at_pointer(event)
     for menuitem in menu.get_children():
         w = menuitem.get_child().get_child_at(0, 0).get_allocation().width
         if width < w:
             width = w
     width += 4
     for menuitem in menu.get_children():
         menuitem.get_child().get_child_at(0, 0).set_size_request(width, -1)