Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

status: emit error message and title change signals

Changeset 5cda7b598007

Parent 4bf49be33756

by Steve Borho

Changes to 2 files · Browse files at 5cda7b598007 Showing diff from parent 4bf49be33756 Diff from another changeset...

 
54
55
56
57
 
58
59
60
 
87
88
89
 
 
 
 
 
 
 
90
91
92
 
54
55
56
 
57
58
59
60
 
87
88
89
90
91
92
93
94
95
96
97
98
99
@@ -54,7 +54,7 @@
  for s, val in status.statusTypes.iteritems():   opts[val.name] = s in filetypes   - stwidget = status.StatusWidget(pats, opts, self) + stwidget = status.StatusWidget(pats, opts, repo.root, self)   layout.addWidget(stwidget, 1)     if self.command == 'revert': @@ -87,6 +87,13 @@
  self.restoreGeometry(s.value('quickop/geom').toByteArray())   self.stwidget = stwidget   + self.connect(self.stwidget, QtCore.SIGNAL('errorMessage'), + self.errorMessage) + + def errorMessage(self, msg): + # TODO: Does not appear to work + self.cmd.pmon.set_text(msg) +   def keyPressEvent(self, event):   if event.key() in (QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter):   if event.modifiers() == QtCore.Qt.ControlModifier:
 
19
20
21
22
 
23
24
25
26
27
28
29
30
31
 
47
48
49
50
 
 
 
 
 
 
 
51
52
53
 
54
55
56
 
102
103
104
 
105
106
107
 
108
109
110
 
178
179
180
 
 
 
 
 
 
 
 
181
182
183
 
225
226
227
228
 
 
 
 
 
 
 
 
 
 
229
230
231
 
251
252
253
 
254
255
256
 
327
328
329
330
 
 
331
332
333
 
347
348
349
350
 
 
351
352
353
 
468
469
470
471
472
473
474
475
476
477
 
 
 
478
479
480
 
622
623
624
625
626
 
 
 
 
 
 
627
628
629
630
631
632
 
 
 
 
 
 
 
 
 
633
634
635
 
19
20
21
 
22
23
24
25
26
27
 
28
29
30
 
46
47
48
 
49
50
51
52
53
54
55
56
57
 
58
59
60
61
 
107
108
109
110
111
112
113
114
115
116
117
 
185
186
187
188
189
190
191
192
193
194
195
196
197
198
 
240
241
242
 
243
244
245
246
247
248
249
250
251
252
253
254
255
 
275
276
277
278
279
280
281
 
352
353
354
 
355
356
357
358
359
 
373
374
375
 
376
377
378
379
380
 
495
496
497
 
 
 
 
 
 
 
498
499
500
501
502
503
 
645
646
647
 
 
648
649
650
651
652
653
654
655
656
657
 
 
658
659
660
661
662
663
664
665
666
667
668
669
@@ -19,13 +19,12 @@
 from PyQt4.QtGui import QWidget, QVBoxLayout, QSplitter, QTreeView, QLineEdit  from PyQt4.QtGui import QTextEdit, QFont, QColor, QDrag, QApplication  from PyQt4.QtGui import QFrame, QHBoxLayout, QLabel, QPushButton, QMenu -from PyQt4.QtGui import QIcon, QPixmap, QToolButton, QDialog +from PyQt4.QtGui import QIcon, QPixmap, QToolButton, QDialog, QStatusBar    # This widget can be used as the basis of the commit tool or any other  # working copy browser.    # Technical Debt -# emit error strings to parent status bar  # We need a real icon set for file status types  # Thread refreshWctx, connect to an external progress bar  # Thread rowSelected, connect to an external progress bar @@ -47,10 +46,16 @@
 _colors = {}    class StatusWidget(QWidget): - def __init__(self, pats, opts, parent=None): + '''Working copy status widget + SIGNALS: + loadComplete() + errorMessage(QString) + titleTextChanged(QString) + ''' + def __init__(self, pats, opts, root=None, parent=None):   QWidget.__init__(self, parent)   - root = paths.find_root() + root = paths.find_root(root)   assert(root)   self.repo = hg.repository(ui.ui(), path=root)   self.wctx = self.repo[None] @@ -102,9 +107,11 @@
  self.pats = []   self.refreshWctx()   cpb.setVisible(False) + self.emit(SIGNAL('titleTextChanged'), QString(self.getTitle()))   cpb = QPushButton(_('Remove filter, show root'))   vbox.addWidget(cpb)   cpb.clicked.connect(clearPattern) +   self.countlbl = QLabel()   vbox.addWidget(self.countlbl)   @@ -178,6 +185,14 @@
  self.split = split   self.refreshWctx()   + def getTitle(self): + if self.pats: + return hglib.tounicode(_('%s - status (selection filtered)') % + hglib.get_reponame(self.repo)) + else: + return hglib.tounicode(_('%s - status') % + hglib.get_reponame(self.repo)) +   def restoreState(self, data):   return self.split.restoreState(data)   @@ -225,7 +240,16 @@
  wctx = self.repo[None]   wctx.status(**stopts)   except (OSError, IOError, util.Abort), e: - print e # TODO + err = hglib.tounicode(e) + self.emit(SIGNAL('errorMessage'), QString(err)) + try: + wctx.dirtySubrepos = [] + for s in wctx.substate: + if wctx.sub(s).dirty(): + wctx.dirtySubrepos.append(s) + except (OSError, IOError, util.Abort, error.ConfigError), e: + err = hglib.tounicode(e) + self.emit(SIGNAL('errorMessage'), QString(err))   self.wctx = wctx   self.updateModel()   @@ -251,6 +275,7 @@
  self.connect(self.le, SIGNAL('textEdited(QString)'), tm.setFilter)   self.connect(tm, SIGNAL('checkToggled()'), self.updateCheckCount)   self.updateCheckCount() + self.emit(SIGNAL('loadComplete()'))     def updateCheckCount(self):   text = _('Checkmarked file count: %d') % len(self.getChecked()) @@ -327,7 +352,8 @@
  for s, l in patch.difflabel(self.wctx.diff, match=m, git=True):   hu.write(s, label=l)   except (IOError, error.RepoError, error.LookupError, util.Abort), e: - self.status_error = str(e) + err = hglib.tounicode(e) + self.emit(SIGNAL('errorMessage'), QString(err))   return   o, e = hu.getdata()   diff = o or _('<em>No displayable differences</em>') @@ -347,7 +373,8 @@
  match=m, git=True):   hu.write(s, label=l)   except (IOError, error.RepoError, error.LookupError, util.Abort), e: - self.status_error = str(e) + err = hglib.tounicode(e) + self.emit(SIGNAL('errorMessage'), QString(err))   return   text += '</br><h3>'   text += _('===== Diff to second parent %d:%s =====\n') % ( @@ -468,13 +495,9 @@
  checked[c] = checked.get(c, False)   rows.append(mkrow(c, 'C'))   if opts['subrepo']: - try: - for s in wctx.substate: - if wctx.sub(s).dirty(): - checked[s] = checked.get(s, False) - rows.append(mkrow(s, 'S')) - except (OSError, IOError, error.ConfigError), e: - self.status_error = str(e) + for s in wctx.dirtySubrepos: + checked[s] = checked.get(s, False) + rows.append(mkrow(s, 'S'))   self.headers = ('*', _('Stat'), _('M'), _('Filename'),   _('Type'), _('Size (KB)'))   self.checked = checked @@ -622,14 +645,25 @@
  layout = QVBoxLayout()   layout.setMargin(0)   self.setLayout(layout) - self.stwidget = StatusWidget(pats, opts, self) - layout.addWidget(self.stwidget) + self.stwidget = StatusWidget(pats, opts, None, self) + layout.addWidget(self.stwidget, 1) + + self.stbar = QStatusBar(self) + layout.addWidget(self.stbar) +   s = QSettings()   self.stwidget.restoreState(s.value('status/state').toByteArray())   self.restoreGeometry(s.value('status/geom').toByteArray())   - repo = hg.repository(ui.ui(), path=paths.find_root()) - self.setWindowTitle('%s - status' % hglib.get_reponame(repo)) + self.connect(self.stwidget, SIGNAL('titleTextChanged'), self.setTitle) + self.connect(self.stwidget, SIGNAL('errorMessage'), self.errorMessage) + self.setTitle(self.stwidget.getTitle()) + + def setTitle(self, title): + self.setWindowTitle(title) + + def errorMessage(self, msg): + self.stbar.showMessage(msg)     def accept(self):   s = QSettings()