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

repoview: use wildcard import for Qt things

Changeset 947ae01ab817

Parent d98470429229

by Adrian Buehlmann

Changes to one file · Browse files at 947ae01ab817 Showing diff from parent d98470429229 Diff from another changeset...

 
16
17
18
19
20
21
22
23
24
25
26
27
 
 
 
 
 
 
28
29
30
31
32
33
34
 
35
36
37
 
40
41
42
43
44
45
 
 
 
46
47
48
 
61
62
63
64
 
65
66
67
68
69
70
 
71
72
73
74
75
76
 
 
77
78
79
 
93
94
95
96
 
97
98
99
 
102
103
104
105
 
106
107
108
 
109
110
111
 
124
125
126
127
128
 
 
129
130
131
 
156
157
158
159
 
160
161
162
 
178
179
180
181
 
182
183
 
184
185
186
187
 
188
189
190
191
192
193
194
 
195
196
197
198
 
199
200
201
 
206
207
208
209
 
210
211
212
 
16
17
18
 
 
 
 
 
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 
35
36
37
38
 
41
42
43
 
 
 
44
45
46
47
48
49
 
62
63
64
 
65
66
67
68
69
70
 
71
72
73
74
75
 
 
76
77
78
79
80
 
94
95
96
 
97
98
99
100
 
103
104
105
 
106
107
108
 
109
110
111
112
 
125
126
127
 
 
128
129
130
131
132
 
157
158
159
 
160
161
162
163
 
179
180
181
 
182
183
 
184
185
186
187
 
188
189
190
191
192
193
194
 
195
196
197
198
 
199
200
201
202
 
207
208
209
 
210
211
212
213
@@ -16,22 +16,23 @@
   from mercurial.error import RepoError   -from PyQt4 import QtCore, QtGui -Qt = QtCore.Qt -connect = QtCore.QObject.connect -SIGNAL = QtCore.SIGNAL -  from tortoisehg.hgqt.qtlib import geticon  from tortoisehg.hgqt.i18n import _  from tortoisehg.hgqt.quickbar import QuickBar   +from PyQt4.QtCore import * +from PyQt4.QtGui import * + +connect = QObject.connect + +  class GotoQuickBar(QuickBar):   def __init__(self, parent):   QuickBar.__init__(self, "Goto", "Ctrl+G", "Goto", parent)     def createActions(self, openkey, desc):   QuickBar.createActions(self, openkey, desc) - self._actions['go'] = QtGui.QAction("Go", self) + self._actions['go'] = QAction("Go", self)   connect(self._actions['go'], SIGNAL('triggered()'),   self.goto)   @@ -40,9 +41,9 @@
    def createContent(self):   QuickBar.createContent(self) - self.compl_model = QtGui.QStringListModel(['tip']) - self.completer = QtGui.QCompleter(self.compl_model, self) - self.entry = QtGui.QLineEdit(self) + self.compl_model = QStringListModel(['tip']) + self.completer = QCompleter(self.compl_model, self) + self.entry = QLineEdit(self)   self.entry.setCompleter(self.completer)   self.addWidget(self.entry)   self.addAction(self._actions['go']) @@ -61,19 +62,19 @@
  # QObject::startTimer: QTimer can only be used with threads started with QThread   self.entry.setCompleter(None)   -class HgRepoView(QtGui.QTableView): +class HgRepoView(QTableView):   """   A QTableView for displaying a HgRepoListModel,   with actions, shortcuts, etc.   """   def __init__(self, parent=None): - QtGui.QTableView.__init__(self, parent) + QTableView.__init__(self, parent)   self.init_variables()   self.setShowGrid(False)   self.verticalHeader().hide()   self.verticalHeader().setDefaultSectionSize(20) - self.setSelectionMode(QtGui.QAbstractItemView.SingleSelection) - self.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) + self.setSelectionMode(QAbstractItemView.SingleSelection) + self.setSelectionBehavior(QAbstractItemView.SelectRows)     self.createActions()   self.createToolbars() @@ -93,7 +94,7 @@
  if event.button() == Qt.MidButton:   self.gotoAncestor(index)   return - QtGui.QTableView.mousePressEvent(self, event) + QTableView.mousePressEvent(self, event)     def createToolbars(self):   self.goto_toolbar = tb = GotoQuickBar(self) @@ -102,10 +103,10 @@
    def _action_defs(self):   a = [('back', _('Back'), 'back', None, - QtGui.QKeySequence(QtGui.QKeySequence.Back), + QKeySequence(QKeySequence.Back),   self.back),   ('forward', _('Forward'), 'forward', None, - QtGui.QKeySequence(QtGui.QKeySequence.Forward), + QKeySequence(QKeySequence.Forward),   self.forward),   ('manifest', _('Show at rev...'), None,   _('Show the manifest at selected revision'), None, @@ -124,8 +125,8 @@
  def createActions(self):   self._actions = {}   for name, desc, icon, tip, key, cb in self._action_defs(): - self._actions[name] = QtGui.QAction(desc, self) - QtCore.QTimer.singleShot(0, self.configureActions) + self._actions[name] = QAction(desc, self) + QTimer.singleShot(0, self.configureActions)     def configureActions(self):   for name, desc, icon, tip, key, cb in self._action_defs(): @@ -156,7 +157,7 @@
  self.emit(SIGNAL('backoutToRevision'), self.current_rev)     def contextMenuEvent(self, event): - menu = QtGui.QMenu(self) + menu = QMenu(self)   for act in ['update', 'manifest', 'merge', 'tag', 'backout',   None, 'back', 'forward']:   if act: @@ -178,24 +179,24 @@
    def setModel(self, model):   self.init_variables() - QtGui.QTableView.setModel(self, model) + QTableView.setModel(self, model)   connect(self.selectionModel(), - QtCore.SIGNAL('currentRowChanged (const QModelIndex & , const QModelIndex & )'), + SIGNAL('currentRowChanged (const QModelIndex & , const QModelIndex & )'),   self.revisionSelected)   self.goto_toolbar.compl_model.setStringList(model.repo.tags().keys())   col = list(model._columns).index('Log') - self.horizontalHeader().setResizeMode(col, QtGui.QHeaderView.Stretch) + self.horizontalHeader().setResizeMode(col, QHeaderView.Stretch)     def enableAutoResize(self, *args):   self._autoresize = True     def disableAutoResize(self, *args):   self._autoresize = False - QtCore.QTimer.singleShot(100, self.enableAutoResize) + QTimer.singleShot(100, self.enableAutoResize)     def resizeEvent(self, event):   # we catch this event to resize smartly tables' columns - QtGui.QTableView.resizeEvent(self, event) + QTableView.resizeEvent(self, event)   if self._autoresize:   self.resizeColumns()   @@ -206,7 +207,7 @@
  if not model:   return   col1_width = self.viewport().width() - fontm = QtGui.QFontMetrics(self.font()) + fontm = QFontMetrics(self.font())   tot_stretch = 0.0   for c in range(model.columnCount()):   if model._columns[c] in model._stretchs: