Instead of hard linking gitk let the user set the preferred history visualization tool in settings dialog. Signed-off by: Marco Costalba <mcostalba@xxxxxxxxx> --- 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(-) 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 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html