/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to commit.py

  • Committer: Curtis Hovey
  • Date: 2012-03-22 17:14:22 UTC
  • mto: This revision was merged to the branch mainline in revision 789.
  • Revision ID: sinzui.is@verizon.net-20120322171422-l7bq6muqqgr36nxr
Ensure that the per/file message widget fits at least one line.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    tsort,
31
31
    )
32
32
from bzrlib.plugins.gtk.dialog import question_dialog
 
33
from bzrlib.plugins.gtk.diff import DiffView
33
34
from bzrlib.plugins.gtk.errors import show_bzr_error
34
35
from bzrlib.plugins.gtk.i18n import _i18n
35
36
from bzrlib.plugins.gtk.commitmsgs import SavedCommitMessagesManager
559
560
                                             Gtk.CellRendererText(), text=3))
560
561
 
561
562
    def _construct_diff_view(self):
562
 
        from bzrlib.plugins.gtk.diff import DiffView
563
 
 
564
563
        # TODO: jam 2007-10-30 The diff label is currently disabled. If we
565
564
        #       decide that we really don't ever want to display it, we should
566
565
        #       actually remove it, and other references to it, along with the
575
574
        self._add_to_right_table(self._diff_view, 4, True)
576
575
        self._diff_view.show()
577
576
 
 
577
    @staticmethod
 
578
    def get_line_height(widget):
 
579
        pango_layout = widget.create_pango_layout("X");
 
580
        ink_rectangle, logical_rectangle = pango_layout.get_pixel_extents()
 
581
        return logical_rectangle.height
 
582
 
578
583
    def _construct_file_message(self):
579
584
        scroller = Gtk.ScrolledWindow()
580
585
        scroller.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
587
592
        self._file_message_text_view.modify_font(Pango.FontDescription("Monospace"))
588
593
        self._file_message_text_view.set_wrap_mode(Gtk.WrapMode.WORD)
589
594
        self._file_message_text_view.set_accepts_tab(False)
 
595
        line_height = self.get_line_height(self._file_message_text_view)
 
596
        self._file_message_text_view.set_size_request(-1, line_height * 2)
590
597
        self._file_message_text_view.show()
591
598
 
592
599
        self._file_message_expander = Gtk.Expander(