Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0.3, 2.0.4, and 2.0.5

stable status: share status filter button with manifest

introducing filelistToolbar

Changeset 92a2935b3b70

Parent 8698a3edb4cd

by Adrian Buehlmann

Changes to 2 files · Browse files at 92a2935b3b70 Showing diff from parent 8698a3edb4cd Diff from another changeset...

 
176
177
178
179
 
 
180
181
182
 
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
 
176
177
178
 
179
180
181
182
183
 
406
407
408
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
409
410
411
@@ -176,7 +176,8 @@
  qs.setValue(prefix+'/splitter', self._splitter.saveState())     def _initactions(self): - self._statusfilter = _StatusFilterButton(statustext='MAC') + self._statusfilter = status.StatusFilterButton( + statustext='MAC', text=_('Status'))   self._toolbar.addWidget(self._statusfilter)     self._action_annotate_mode = QAction(_('Annotate'), self, checkable=True) @@ -405,51 +406,6 @@
  def _emitPathChanged(self):   self.pathChanged.emit(self.path)   -# TODO: share this menu with status widget? -class _StatusFilterButton(QToolButton): - """Button with drop-down menu for status filter""" - statusChanged = pyqtSignal(str) - - _TYPES = 'MARC' - - def __init__(self, statustext=_TYPES, parent=None, **kwargs): - if 'text' not in kwargs: - kwargs['text'] = _('Status') - super(_StatusFilterButton, self).__init__( - parent, popupMode=QToolButton.InstantPopup, - icon=qtlib.geticon('hg-status'), - toolButtonStyle=Qt.ToolButtonTextBesideIcon, **kwargs) - - self._initactions(statustext) - - def _initactions(self, text): - self._actions = {} - menu = QMenu(self) - for c in self._TYPES: - st = status.statusTypes[c] - a = menu.addAction('%s %s' % (c, st.name)) - a.setCheckable(True) - a.setChecked(c in text) - a.toggled.connect(self._update) - self._actions[c] = a - self.setMenu(menu) - - @pyqtSlot() - def _update(self): - self.statusChanged.emit(self.status()) - - def status(self): - """Return the text for status filter""" - return ''.join(c for c in self._TYPES - if self._actions[c].isChecked()) - - @pyqtSlot(str) - def setStatus(self, text): - """Set the status text""" - assert util.all(c in self._TYPES for c in text) - for c in self._TYPES: - self._actions[c].setChecked(c in text) -  class ManifestTaskWidget(ManifestWidget):   """Manifest widget designed for task tab"""  
 
104
105
106
107
108
109
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
112
113
 
146
147
148
149
150
151
 
 
 
 
 
152
153
154
155
156
157
158
159
160
 
 
161
162
163
 
728
729
730
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
731
732
733
 
104
105
106
 
 
 
 
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
 
159
160
161
 
 
 
162
163
164
165
166
167
 
 
 
 
 
 
 
 
168
169
170
171
172
 
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
@@ -104,10 +104,23 @@
  else:   lbl = QLabel(_('Filter:'))   hbox.addWidget(lbl) - pb = QPushButton(_('Status')) - hbox.addWidget(le) - hbox.addWidget(pb) - hbox.addWidget(tb) + + st = '' + for s in statusTypes: + val = statusTypes[s] + if self.opts[val.name]: + st = st + s + self.statusfilter = StatusFilterButton( + statustext=st, types=StatusType.preferredOrder) + + self.filelistToolbar = QToolBar(_('Status File List Toolbar')) + self.filelistToolbar.setIconSize(QSize(16,16)) + hbox.addWidget(self.filelistToolbar) + self.filelistToolbar.addWidget(le) + self.filelistToolbar.addSeparator() + self.filelistToolbar.addWidget(self.statusfilter) + self.filelistToolbar.addSeparator() + self.filelistToolbar.addWidget(self.refreshBtn)   tv = WctxFileTree(self.repo)   vbox.addLayout(hbox)   vbox.addWidget(tv) @@ -146,18 +159,14 @@
  tv.clicked.connect(self.onRowClicked)   le.textEdited.connect(self.setFilter)   - def statusTypeTrigger(isChecked): - txt = hglib.fromunicode(self.sender().text()) - self.opts[txt[2:]] = isChecked + def statusTypeTrigger(status): + status = str(status) + for s in statusTypes: + val = statusTypes[s] + self.opts[val.name] = s in status   self.refreshWctx() - menu = QMenu(self) - for stat in StatusType.preferredOrder: - val = statusTypes[stat] - a = menu.addAction('%s %s' % (stat, val.name)) - a.setCheckable(True) - a.setChecked(self.opts[val.name]) - a.triggered.connect(statusTypeTrigger) - pb.setMenu(menu) + self.statusfilter.statusChanged.connect(statusTypeTrigger) +   self.tv = tv   self.le = le   @@ -728,6 +737,52 @@
  'status.subrepo'),  }   + +class StatusFilterButton(QToolButton): + """Button with drop-down menu for status filter""" + statusChanged = pyqtSignal(str) + + def __init__(self, statustext, types=None, parent=None, **kwargs): + self._TYPES = 'MARC' + if types is not None: + self._TYPES = types + #if 'text' not in kwargs: + # kwargs['text'] = _('Status') + super(StatusFilterButton, self).__init__( + parent, popupMode=QToolButton.InstantPopup, + icon=qtlib.geticon('hg-status'), + toolButtonStyle=Qt.ToolButtonTextBesideIcon, **kwargs) + + self._initactions(statustext) + + def _initactions(self, text): + self._actions = {} + menu = QMenu(self) + for c in self._TYPES: + st = statusTypes[c] + a = menu.addAction('%s %s' % (c, st.name)) + a.setCheckable(True) + a.setChecked(c in text) + a.toggled.connect(self._update) + self._actions[c] = a + self.setMenu(menu) + + @pyqtSlot() + def _update(self): + self.statusChanged.emit(self.status()) + + def status(self): + """Return the text for status filter""" + return ''.join(c for c in self._TYPES + if self._actions[c].isChecked()) + + @pyqtSlot(str) + def setStatus(self, text): + """Set the status text""" + assert util.all(c in self._TYPES for c in text) + for c in self._TYPES: + self._actions[c].setChecked(c in text) +  class StatusDialog(QDialog):   'Standalone status browser'   def __init__(self, pats, opts, root=None, parent=None):