[meld: 5/6] String % subsitution changed to f-strings add_dismissable_msg now closes only the panes given or jus
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld: 5/6] String % subsitution changed to f-strings add_dismissable_msg now closes only the panes given or jus
- Date: Fri, 1 Jan 2021 21:40:38 +0000 (UTC)
commit 1df9683912f3c40972e7f0723254d8044c75354b
Author: Jack <jack vanier16 outlook com>
Date: Thu Dec 31 13:36:36 2020 -0500
String % subsitution changed to f-strings
add_dismissable_msg now closes only the panes given or just current pane
Couple of simple style changes
meld/dirdiff.py | 7 +++----
meld/filediff.py | 13 +++++++------
meld/ui/msgarea.py | 9 +++++----
3 files changed, 15 insertions(+), 14 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index f92fcd75..cf107488 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -918,7 +918,7 @@ class DirDiff(Gtk.VBox, tree.TreeviewCommon, MeldDoc):
if differences:
expanded.add(tree_path_as_tuple(path))
- duplicate_dirs = list(set([p for p in roots if roots.count(p) > 1]))
+ duplicate_dirs = list(set(p for p in roots if roots.count(p) > 1))
if invalid_filenames or shadowed_entries:
self._show_tree_wide_errors(invalid_filenames, shadowed_entries)
elif duplicate_dirs:
@@ -939,10 +939,9 @@ class DirDiff(Gtk.VBox, tree.TreeviewCommon, MeldDoc):
def _show_duplicate_directory(self, duplicate_directory):
for index in range(self.num_panes):
primary = _(
- "Folder %s was loaded more than once" % duplicate_directory)
+ f'Folder {duplicate_directory} is being compared to itself')
self.msgarea_mgr[index].add_dismissable_msg(
- 'dialog-error-symbolic', primary, "",
- self.msgarea_mgr[:index]+self.msgarea_mgr[index+1:])
+ 'dialog-warning-symbolic', primary, '', self.msgarea_mgr)
def _show_identical_status(self):
primary = _("Folders have no differences")
diff --git a/meld/filediff.py b/meld/filediff.py
index ba9ea502..03224f0e 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1809,16 +1809,17 @@ class FileDiff(Gtk.VBox, MeldDoc):
self._cached_match.clean(self.linediffer.diff_count())
self._set_merge_action_sensitivity()
- paths = [tb.data.gfile.get_path() for tb in self.textbuffer
- if tb.data.gfile]
- duplicate_files = list(set([p for p in paths if paths.count(p) > 1]))
+ paths = [
+ tb.data.gfile.get_path()
+ for tb in self.textbuffer if tb.data.gfile
+ ]
+ duplicate_files = list(set(p for p in paths if paths.count(p) > 1))
if duplicate_files:
for index in range(self.num_panes):
primary = _(
- "File %s was loaded more than once." % duplicate_files[0])
+ f'File {duplicate_files[0]} is being compared to itself')
self.msgarea_mgr[index].add_dismissable_msg(
- 'dialog-error-symbolic', primary, "",
- self.msgarea_mgr[:index]+self.msgarea_mgr[index+1:])
+ 'dialog-warning-symbolic', primary, '', self.msgarea_mgr)
elif self.linediffer.sequences_identical():
error_message = True in [m.has_message() for m in self.msgarea_mgr]
if self.num_panes == 1 or error_message:
diff --git a/meld/ui/msgarea.py b/meld/ui/msgarea.py
index 7ac3a866..69520d66 100644
--- a/meld/ui/msgarea.py
+++ b/meld/ui/msgarea.py
@@ -103,12 +103,13 @@ class MsgAreaController(Gtk.HBox):
self.pack_start(msgarea, True, True, 0)
return msgarea
- def add_dismissable_msg(self, icon, primary, secondary, other_panes=None):
+ def add_dismissable_msg(self, icon, primary, secondary, close_panes=None):
def clear_all(*args):
- self.clear()
- if other_panes:
- for pane in other_panes:
+ if close_panes:
+ for pane in close_panes:
pane.clear()
+ else:
+ self.clear()
msgarea = self.new_from_text_and_icon(icon, primary, secondary)
msgarea.add_button(_("Hi_de"), Gtk.ResponseType.CLOSE)
msgarea.connect("response", clear_all)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]