[meld] Update commit message splitting for sourceview dependency and clarity
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Update commit message splitting for sourceview dependency and clarity
- Date: Sat, 29 Jun 2013 21:40:28 +0000 (UTC)
commit d6a2ef01b4583bf8810828381eb2e8691a125c79
Author: Kai Willadsen <kai willadsen gmail com>
Date: Sun Jun 30 07:39:41 2013 +1000
Update commit message splitting for sourceview dependency and clarity
data/ui/preferences.ui | 2 +-
meld/preferences.py | 27 ++++++++++++++++++---------
meld/ui/vcdialogs.py | 12 ++++++------
3 files changed, 25 insertions(+), 16 deletions(-)
---
diff --git a/data/ui/preferences.ui b/data/ui/preferences.ui
index 3a13aec..567bffe 100644
--- a/data/ui/preferences.ui
+++ b/data/ui/preferences.ui
@@ -937,7 +937,7 @@
<property name="left_padding">18</property>
<child>
<object class="GtkCheckButton" id="checkbutton_break_commit_lines">
- <property name="label" translatable="yes">Automatically _break lines at
right margin</property>
+ <property name="label" translatable="yes">Automatically _break lines at
right margin on commit</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
diff --git a/meld/preferences.py b/meld/preferences.py
index c017f34..e1c5027 100644
--- a/meld/preferences.py
+++ b/meld/preferences.py
@@ -163,7 +163,7 @@ class PreferencesDialog(gnomeglade.Component):
self.checkbutton_use_syntax_highlighting.set_active( self.prefs.use_syntax_highlighting )
else:
no_sourceview_text = \
- _("Only available if you have gnome-python-desktop installed")
+ _("Only available if you have PyGtkSourceView 2 installed")
for w in (self.checkbutton_spaces_instead_of_tabs,
self.checkbutton_show_line_numbers,
self.checkbutton_use_syntax_highlighting,
@@ -221,14 +221,23 @@ class PreferencesDialog(gnomeglade.Component):
self.combo_timestamp.set_active(active_idx)
self.combo_timestamp.lock = False
- self.checkbutton_show_commit_margin.set_active(
- self.prefs.vc_show_commit_margin)
- self.spinbutton_commit_margin.set_value(
- self.prefs.vc_commit_margin)
- self.checkbutton_break_commit_lines.set_sensitive(
- self.prefs.vc_show_commit_margin)
- self.checkbutton_break_commit_lines.set_active(
- self.prefs.vc_break_commit_message)
+ if srcviewer.gsv is not None:
+ self.checkbutton_show_commit_margin.set_active(
+ self.prefs.vc_show_commit_margin)
+ self.spinbutton_commit_margin.set_value(
+ self.prefs.vc_commit_margin)
+ self.checkbutton_break_commit_lines.set_sensitive(
+ self.prefs.vc_show_commit_margin)
+ self.checkbutton_break_commit_lines.set_active(
+ self.prefs.vc_break_commit_message)
+ else:
+ no_sourceview_text = \
+ _("Only available if you have PyGtkSourceView 2 installed")
+ for w in (self.checkbutton_show_commit_margin,
+ self.spinbutton_commit_margin,
+ self.checkbutton_break_commit_lines):
+ w.set_sensitive(False)
+ w.set_tooltip_text(no_sourceview_text)
self.widget.show()
diff --git a/meld/ui/vcdialogs.py b/meld/ui/vcdialogs.py
index 1bab324..0014c4d 100644
--- a/meld/ui/vcdialogs.py
+++ b/meld/ui/vcdialogs.py
@@ -79,11 +79,10 @@ class CommitDialog(gnomeglade.Component):
self.widget.show_all()
def run(self):
- margin = self.parent.prefs.vc_commit_margin
- self.textview.set_right_margin_position(
- margin)
- self.textview.set_show_right_margin(
- self.parent.prefs.vc_show_commit_margin)
+ prefs = self.parent.prefs
+ margin = prefs.vc_commit_margin
+ self.textview.set_right_margin_position(margin)
+ self.textview.set_show_right_margin(prefs.vc_show_commit_margin)
self.previousentry.set_active(-1)
self.textview.grab_focus()
@@ -91,7 +90,8 @@ class CommitDialog(gnomeglade.Component):
if response == gtk.RESPONSE_OK:
buf = self.textview.get_buffer()
msg = buf.get_text(*buf.get_bounds(), include_hidden_chars=False)
- if self.parent.prefs.vc_break_commit_message:
+ # This is a dependent option because of the margin column
+ if prefs.set_show_right_margin and prefs.vc_break_commit_message:
paragraphs = msg.split("\n\n")
msg = "\n\n".join(textwrap.fill(p, margin) for p in paragraphs)
self.parent._command_on_selected(
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]