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

quickop: adopt * imports of PyQt4

Changeset 37b6b0324f7a

Parent 3bb72638884e

by Steve Borho

Changes to one file · Browse files at 37b6b0324f7a Showing diff from parent 3bb72638884e Diff from another changeset...

 
9
10
11
12
 
 
13
14
15
 
21
22
23
24
 
25
26
27
28
 
 
 
29
30
31
 
38
39
40
41
 
42
43
44
45
 
 
 
 
 
 
 
 
46
47
48
 
60
61
62
63
 
64
65
66
67
68
69
70
71
72
 
 
 
 
73
74
75
 
83
84
85
86
 
87
88
89
90
91
92
93
94
95
96
 
 
97
98
99
100
 
 
101
102
103
 
104
105
106
 
107
108
109
110
 
111
112
113
 
114
115
116
117
118
119
120
 
121
122
123
 
137
138
139
140
 
141
142
143
 
144
145
146
 
9
10
11
 
12
13
14
15
16
 
22
23
24
 
25
26
27
 
 
28
29
30
31
32
33
 
40
41
42
 
43
44
45
 
 
46
47
48
49
50
51
52
53
54
55
56
 
68
69
70
 
71
72
73
74
 
 
 
 
 
 
75
76
77
78
79
80
81
 
89
90
91
 
92
93
94
95
96
 
 
 
 
 
 
97
98
99
100
 
 
101
102
103
104
 
105
106
107
 
108
109
110
111
 
112
113
114
 
115
116
117
118
119
120
121
 
122
123
124
125
 
139
140
141
 
142
143
144
 
145
146
147
148
@@ -9,7 +9,8 @@
   from mercurial import hg, ui, cmdutil, util   -from PyQt4 import QtCore, QtGui +from PyQt4.QtCore import * +from PyQt4.QtGui import *    from tortoisehg.hgqt.i18n import _  from tortoisehg.util import hglib, shlib, paths @@ -21,11 +22,12 @@
  'revert': (_('Checkmark files to revert'), _('Revert')),   'remove': (_('Checkmark files to remove'), _('Remove')),}   -class QuickOpDialog(QtGui.QDialog): +class QuickOpDialog(QDialog):   """ Dialog for performing quick dirstate operations """   def __init__(self, command, pats, parent=None): - QtGui.QDialog.__init__(self, parent) - self.setWindowFlags(self.windowFlags() & ~QtCore.Qt.WindowContextHelpButtonHint) + QDialog.__init__(self, parent) + self.setWindowFlags(self.windowFlags() & + ~Qt.WindowContextHelpButtonHint)   self.pats = pats     # Handle rm alias @@ -38,11 +40,17 @@
  os.chdir(repo.root)   self.setWindowTitle('%s - hg %s' % (hglib.get_reponame(repo), command))   - layout = QtGui.QVBoxLayout() + layout = QVBoxLayout()   self.setLayout(layout)   - lbl = QtGui.QLabel(LABELS[command][0]) - layout.addWidget(lbl) + hbox = QHBoxLayout() + lbl = QLabel(LABELS[command][0]) + slbl = QLabel() + hbox.addWidget(lbl) + hbox.addStretch(1) + hbox.addWidget(slbl) + self.status_label = slbl + layout.addLayout(hbox)     types = { 'add' : 'I?',   'forget' : 'MAR!C', @@ -60,16 +68,14 @@
    if self.command == 'revert':   ## no backup checkbox - chk = QtGui.QCheckBox(_('Do not save backup files (*.orig)')) + chk = QCheckBox(_('Do not save backup files (*.orig)'))   self.chk = chk   layout.addWidget(chk)   - BB = QtGui.QDialogButtonBox - bb = QtGui.QDialogButtonBox(BB.Ok|BB.Cancel) - self.connect(bb, QtCore.SIGNAL("accepted()"), - self, QtCore.SLOT("accept()")) - self.connect(bb, QtCore.SIGNAL("rejected()"), - self, QtCore.SLOT("reject()")) + BB = QDialogButtonBox + bb = QDialogButtonBox(BB.Ok|BB.Cancel) + self.connect(bb, SIGNAL("accepted()"), self, SLOT("accept()")) + self.connect(bb, SIGNAL("rejected()"), self, SLOT("reject()"))   bb.button(BB.Ok).setDefault(True)   bb.button(BB.Ok).setText(LABELS[command][1])   layout.addWidget(bb) @@ -83,41 +89,37 @@
  cmd.setHidden(True)   self.cmd = cmd   - s = QtCore.QSettings() + s = QSettings()   stwidget.restoreState(s.value('quickop/state').toByteArray())   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) + self.connect(self.stwidget, SIGNAL('errorMessage'), + self.cmd.pmon.set_text)     def keyPressEvent(self, event): - if event.key() in (QtCore.Qt.Key_Return, QtCore.Qt.Key_Enter): - if event.modifiers() == QtCore.Qt.ControlModifier: + if event.key() in (Qt.Key_Return, Qt.Key_Enter): + if event.modifiers() == Qt.ControlModifier:   self.accept() # Ctrl+Enter   return - elif event.key() == QtCore.Qt.Key_Escape: + elif event.key() == Qt.Key_Escape:   self.reject()   return - return super(QtGui.QDialog, self).keyPressEvent(event) + return super(QDialog, self).keyPressEvent(event)     def commandStarted(self):   self.cmd.setShown(True) - self.bb.button(QtGui.QDialogButtonBox.Ok).setEnabled(False) + self.bb.button(QDialogButtonBox.Ok).setEnabled(False)     def commandFinished(self, wrapper): - self.bb.button(QtGui.QDialogButtonBox.Ok).setEnabled(True) + self.bb.button(QDialogButtonBox.Ok).setEnabled(True)   if wrapper.data is not 0:   self.cmd.show_output(True)   else:   self.reject()     def commandCanceled(self): - self.bb.button(QtGui.QDialogButtonBox.Ok).setEnabled(True) + self.bb.button(QDialogButtonBox.Ok).setEnabled(True)     def accept(self):   cmdline = [self.command] @@ -137,10 +139,10 @@
  if self.cmd.core.is_running():   self.cmd.core.cancel()   else: - s = QtCore.QSettings() + s = QSettings()   s.setValue('quickop/state', self.stwidget.saveState())   s.setValue('quickop/geom', self.saveGeometry()) - QtGui.QDialog.reject(self) + QDialog.reject(self)    def run(ui, *pats, **opts):   pats = hglib.canonpaths(pats)