threads / patch / 11456

patchAllow user to choose history browser tool

Subject: [PATCH ugit] Allow user to choose history browser tool

## tl;dr

3 messages between Jan 3, 2008 and Jan 3, 2008. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Marco Costalba· Jan 3, 2008, 12:08 UTC · lore
 Instead of hard linking gitk let the user set
 the preferred history visualization tool in settings dialog.

Signed-off by: Marco Costalba <mcostalba@gmail.com> ---

A thing I was not able to figure out is how to save the settings so that at restart of ugit the saved setting is found again (instead of selecting the default 'gitk')

Anyhow a really nice tool this ugit thing, you managed to playing catch-up with git-gui really fast.

 ugitlibs/controllers.py    |    6 ++++--
 ugitlibs/models.py         |    6 +++++-
 ugitlibs/utilcontroller.py |    5 ++++-
 ui/optionsgui.ui           |   39 +++++++++++++++++++++++++++------------
 4 files changed, 40 insertions(+), 16 deletions(-)
Show changes to 4 files +40 −16

ugitlibs/controllers.py, ugitlibs/models.py, ugitlibs/utilcontroller.py, ui/optionsgui.ui

diff --git a/ugitlibs/controllers.py b/ugitlibs/controllers.py
index 411f1c1..6ad7b43 100644
--- a/ugitlibs/controllers.py
+++ b/ugitlibs/controllers.py
@@ -441,11 +441,13 @@ class Controller(QObserver):

 	def viz_all(self):
 		'''Visualizes the entire git history using gitk.'''
-		utils.fork('gitk','--all')
+		browser = self.model.get_history_browser()
+		utils.fork(browser,'--all')

 	def viz_current(self):
 		'''Visualizes the current branch's history using gitk.'''
-		utils.fork('gitk', self.model.get_branch())
+		browser = self.model.get_history_browser()
+		utils.fork(browser, self.model.get_branch())

 	# These actions monitor window resizes, splitter changes, etc.
 	def move_event(self, event):
diff --git a/ugitlibs/models.py b/ugitlibs/models.py
index 3c7ec9b..fe71362 100644
--- a/ugitlibs/models.py
+++ b/ugitlibs/models.py
@@ -117,6 +117,7 @@ class Model(model.Model):
 			'ugit.fontui.size':12,
 			'ugit.fontdiff': '',
 			'ugit.fontdiff.size':12,
+			'ugit.history_browser_line': 'gitk',
 			}

 		default_dict = self.__config_defaults
@@ -251,7 +252,10 @@ class Model(model.Model):
 				self.subtree_types.append(self.types[idx])
 				self.subtree_sha1s.append(self.sha1s[idx])
 				self.subtree_names.append(name)
-	
+
+	def get_history_browser(self):
+		return self.get_param('global.ugit.history_browser_line')
+
 	def get_tree_node(self, idx):
 		return (self.get_types()[idx],
 			self.get_sha1s()[idx],
diff --git a/ugitlibs/utilcontroller.py b/ugitlibs/utilcontroller.py
index 12a7399..c6f87a7 100644
--- a/ugitlibs/utilcontroller.py
+++ b/ugitlibs/utilcontroller.py
@@ -108,12 +108,15 @@ class OptionsController(QObserver):

 			'global.ugit.fontui.size': 'main_font_spinbox',
 			'global.ugit.fontui': 'main_font_combo',
+
+			'global.ugit.history_browser_line': 'history_browser_line',
 		}

 		for m,v in model_to_view.iteritems():
 			self.model_to_view(m,v)

 		self.add_signals('textChanged(const QString&)',
+				view.history_browser_line,
 				view.local_name_line,
 				view.global_name_line,
 				view.local_email_line,
@@ -132,7 +135,7 @@ class OptionsController(QObserver):
 				view.global_diffcontext_spinbox,
 				view.local_verbosity_spinbox,
 				view.global_verbosity_spinbox)
-	
+
 		self.add_signals('currentFontChanged(const QFont&)',
 				view.main_font_combo,
 				view.diff_font_combo)
diff --git a/ui/optionsgui.ui b/ui/optionsgui.ui
index 31bff84..a6fc1cf 100644
--- a/ui/optionsgui.ui
+++ b/ui/optionsgui.ui
@@ -8,8 +8,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>543</width>
-    <height>313</height>
+    <width>598</width>
+    <height>399</height>
    </rect>
   </property>
   <property name="windowTitle" >
@@ -23,7 +23,7 @@
      </property>
     </widget>
    </item>
-   <item row="0" column="1" >
+   <item row="0" column="1" colspan="2" >
     <widget class="QSpinBox" name="main_font_spinbox" >
      <property name="minimum" >
       <number>8</number>
@@ -33,7 +33,7 @@
      </property>
     </widget>
    </item>
-   <item row="0" column="2" colspan="4" >
+   <item row="0" column="3" colspan="4" >
     <widget class="QFontComboBox" name="main_font_combo" >
      <property name="currentFont" >
       <font>
@@ -49,7 +49,7 @@
      </property>
     </widget>
    </item>
-   <item row="1" column="1" >
+   <item row="1" column="1" colspan="2" >
     <widget class="QSpinBox" name="diff_font_spinbox" >
      <property name="minimum" >
       <number>8</number>
@@ -59,19 +59,33 @@
      </property>
     </widget>
    </item>
-   <item row="1" column="2" colspan="4" >
+   <item row="1" column="3" colspan="4" >
     <widget class="QFontComboBox" name="diff_font_combo" >
      <property name="fontFilters" >
       <set>QFontComboBox::MonospacedFonts</set>
      </property>
      <property name="currentFont" >
       <font>
-       <family>Courier</family>
+       <family>Liberation Mono</family>
       </font>
      </property>
     </widget>
    </item>
-   <item row="2" column="0" colspan="3" >
+   <item row="2" column="0" >
+    <widget class="QLabel" name="label_11" >
+     <property name="text" >
+      <string>History browser</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1" colspan="6" >
+    <widget class="QLineEdit" name="history_browser_line" >
+     <property name="text" >
+      <string/>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="0" colspan="4" >
     <widget class="QGroupBox" name="local_groupbox" >
      <property name="title" >
       <string>Local Repository</string>
@@ -151,7 +165,7 @@
      </layout>
     </widget>
    </item>
-   <item row="2" column="3" colspan="3" >
+   <item row="3" column="4" colspan="3" >
     <widget class="QGroupBox" name="globalGroupBox" >
      <property name="title" >
       <string>Global (All Repositories)</string>
@@ -231,7 +245,7 @@
      </layout>
     </widget>
    </item>
-   <item row="3" column="0" colspan="4" >
+   <item row="4" column="0" colspan="5" >
     <spacer>
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
@@ -244,7 +258,7 @@
      </property>
     </spacer>
    </item>
-   <item row="3" column="4" >
+   <item row="4" column="5" >
     <widget class="QPushButton" name="save_button" >
      <property name="text" >
       <string>Save</string>
@@ -254,7 +268,7 @@
      </property>
     </widget>
    </item>
-   <item row="3" column="5" >
+   <item row="4" column="6" >
     <widget class="QPushButton" name="cancel_button" >
      <property name="text" >
       <string>Cancel</string>
@@ -264,4 +278,5 @@
   </layout>
  </widget>
  <resources/>
+ <connections/>
 </ui>
-- 
1.5.4.rc2.14.geab82
David· Jan 3, 2008, 12:35 UTC · re: Marco Costalba · lore

Re: [PATCH ugit] Allow user to choose history browser tool

On Jan 3, 2008 4:08 AM, Marco Costalba <mcostalba@gmail.com> wrote:
Show 6 quoted lines
>  Instead of hard linking gitk let the user set
>  the preferred history visualization tool in settings dialog.
>
> Signed-off by:  Marco Costalba <mcostalba@gmail.com>
> ---
>

Very nice, thank you! I've applied this and fixed it so that the setting shows up on restart. -David

Jeff King· Jan 3, 2008, 22:39 UTC · re: Marco Costalba · lore

Re: [PATCH ugit] Allow user to choose history browser tool

On Thu, Jan 03, 2008 at 01:08:17PM +0100, Marco Costalba wrote:
>  Instead of hard linking gitk let the user set
>  the preferred history visualization tool in settings dialog.

This is the exact situation that the 'git view' builtin alias was designed for. If every porcelain which spawned a viewer used 'git view', then the user would only need to configure one place (but note that 'git view' has never even made it out of next, so I am not recommending it instead of your patch, but just making a note).

-Peff

← back to recent threads