From 0dfbfcc6714665802a7489180e97c8c440349880 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Fri, 21 Dec 2007 02:06:56 -0800 Subject: [PATCH] Allow launching multiple copies of the repo browser Use a cloned model when browsing the repo browser. This lets you several modeless repobrowsers, each viewing a different branch. Signed-off by: David Aguilar --- py/controllers.py | 8 ++++++-- py/model.py | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/py/controllers.py b/py/controllers.py index f1317bc..c131f52 100644 --- a/py/controllers.py +++ b/py/controllers.py @@ -241,7 +241,9 @@ class GitController (QObserver): # Perform the commit output = cmds.git_commit (msg, amend, files) - # Reset commitmsg and rescan + # Reset state + self.view.newCommitRadio.setChecked (True) + self.view.amendRadio.setChecked (False) model.set_commitmsg ('') self.__show_command (output, model) @@ -528,7 +530,9 @@ class GitController (QObserver): def __browse_branch (self, branch): if not branch: return - model = self.model + # Clone the model to allow opening multiple browsers + # with different sets of data + model = self.model.clone() model.set_branch (branch) view = GitCommitBrowser() controller = GitRepoBrowserController(model, view) diff --git a/py/model.py b/py/model.py index d38cdb3..50a13dd 100644 --- a/py/model.py +++ b/py/model.py @@ -47,6 +47,9 @@ class Model(Observable): self.__attributes = list(attributes.keys() + defaults.keys()) self.__list_attrs = {} self.__object_attrs = {} + + def clone (self): + return self.__class__().from_dict (self.to_dict()) def set_list_attrs(self, list_attrs): self.__list_attrs.update(list_attrs) -- 2.11.4.GIT