Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1.2 and tip

stable qtlib: HgRepoView.forward() must forward keyword parameters

The main side effect of this bug was that "push to revision" and
"push selected branch" where not working.

With the original version of the forward() method it was not really possible to
pass keyword parameters to the forwarded method because the forward() method
itself could receive a keyword parameter named "default". This was used in
several forward calls to "canExit" with "default=True".

The solution has been to add a default canExit() method to the TaskWidget and
DemandWidget classes, and directly call canExit where necessary.

Meanwhile the original forward() method has been modified to no longer accept a
"default" keyword argument, while passing any keyword arguments to the forwarded
method.

Changeset 233ccda15685

Parent 52eb1f25a6ce

by Angel Ezquerra

Changes to 2 files · Browse files at 233ccda15685 Showing diff from parent 52eb1f25a6ce Diff from another changeset...

 
897
898
899
 
 
 
900
901
902
 
919
920
921
922
923
 
 
924
925
926
 
936
937
938
 
 
 
 
 
939
940
941
942
943
944
 
945
946
947
948
949
 
950
951
952
 
897
898
899
900
901
902
903
904
905
 
922
923
924
 
 
925
926
927
928
929
 
939
940
941
942
943
944
945
946
947
948
949
950
951
 
952
953
954
955
956
 
957
958
959
960
@@ -897,6 +897,9 @@
  """Return True if the widget allows to switch away from it"""   return True   + def canExit(self): + return True +  class DemandWidget(QWidget):   'Create a widget the first time it is shown'   @@ -919,8 +922,8 @@
    def forward(self, funcname, *args, **opts):   if self._widget: - return getattr(self._widget, funcname)(*args) - return opts.get('default') + return getattr(self._widget, funcname)(*args, **opts) + return None     def get(self):   """Returns the stored widget""" @@ -936,17 +939,22 @@
  return True   return self._widget.canswitch()   + def canExit(self): + if self._widget is None: + return True + return self._widget.canExit() +   def __getattr__(self, name):   return getattr(self._widget, name)    class Spacer(QWidget):   """Spacer to separate controls in a toolbar""" - +   def __init__(self, width, height, parent=None):   QWidget.__init__(self, parent)   self.width = width   self.height = height - +   def sizeHint(self):   return QSize(self.width, self.height)  
 
947
948
949
950
 
951
952
953
954
 
955
956
957
958
959
 
960
961
962
963
 
964
965
966
 
947
948
949
 
950
951
952
953
 
954
955
956
957
958
 
959
960
961
962
 
963
964
965
966
@@ -947,20 +947,20 @@
  QTimer.singleShot(0, lambda: self.toolbarVisibilityChanged.emit())     def okToContinue(self): - if not self.commitDemand.forward('canExit', default=True): + if not self.commitDemand.canExit():   self.taskTabsWidget.setCurrentIndex(self.commitTabIndex)   self.showMessage(_('Commit tab cannot exit'))   return False - if not self.syncDemand.forward('canExit', default=True): + if not self.syncDemand.canExit():   self.taskTabsWidget.setCurrentIndex(self.syncTabIndex)   self.showMessage(_('Sync tab cannot exit'))   return False   if 'mq' in self.repo.extensions(): - if not self.mqDemand.forward('canExit', default=True): + if not self.mqDemand.canExit():   self.taskTabsWidget.setCurrentIndex(self.mqTabIndex)   self.showMessage(_('MQ tab cannot exit'))   return False - if not self.grepDemand.forward('canExit', default=True): + if not self.grepDemand.canExit():   self.taskTabsWidget.setCurrentIndex(self.grepTabIndex)   self.showMessage(_('Search tab cannot exit'))   return False