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

rejects: use built-in qsci context menu

Changeset a9503c10266e

Parent 96229f19c372

by Steve Borho

Changes to one file · Browse files at a9503c10266e Showing diff from parent 96229f19c372 Diff from another changeset...

 
36
37
38
 
 
39
40
41
 
74
75
76
 
77
78
79
 
86
87
88
 
 
89
90
91
 
93
94
95
96
97
98
99
 
105
106
107
108
 
109
110
111
 
116
117
118
 
 
 
 
119
120
121
 
165
166
167
 
 
168
169
170
 
187
188
189
 
 
190
191
192
 
205
206
207
 
 
 
 
208
209
210
 
36
37
38
39
40
41
42
43
 
76
77
78
79
80
81
82
 
89
90
91
92
93
94
95
96
 
98
99
100
 
101
102
103
 
109
110
111
 
112
113
114
115
 
120
121
122
123
124
125
126
127
128
129
 
173
174
175
176
177
178
179
180
 
197
198
199
200
201
202
203
204
 
217
218
219
220
221
222
223
224
225
226
@@ -36,6 +36,8 @@
  editor.setMarginWidth(1, '000')   editor.setFolding(qsci.BoxedTreeFoldStyle)   editor.installEventFilter(qscilib.KeyPressInterceptor(self)) + editor.setContextMenuPolicy(Qt.CustomContextMenu) + editor.customContextMenuRequested.connect(self.menuRequested)   self.baseLineColor = editor.markerDefine(qsci.Background, -1)   editor.setMarkerBackgroundColor(QColor('lightblue'), self.baseLineColor)   self.layout().addWidget(editor, 3) @@ -74,6 +76,7 @@
  bvbox.addStretch(1)   hbox.addLayout(bvbox, 0)   + self.editor = editor   self.rejectbrowser = RejectBrowser(self)   hbox.addWidget(self.rejectbrowser, 5)   @@ -86,6 +89,8 @@
    s = QSettings()   self.restoreGeometry(s.value('rejects/geometry').toByteArray()) + self.editor.loadSettings(s, 'rejects/editor') + self.rejectbrowser.loadSettings(s, 'rejects/rejbrowse')     f = QFile(path)   f.open(QIODevice.ReadOnly) @@ -93,7 +98,6 @@
  editor.setModified(False)   lexer = lexers.get_lexer(path, f.readData(1024), self)   editor.setLexer(lexer) - self.editor = editor     buf = cStringIO.StringIO()   try: @@ -105,7 +109,7 @@
  try:   header = record.parsepatch(buf)[0]   self.chunks = header.hunks - except patch.PatchError, e: + except (patch.PatchError, IndexError), e:   self.chunks = []     for chunk in self.chunks: @@ -116,6 +120,10 @@
  self.unresolved.setDisabled(True)   QTimer.singleShot(0, lambda: self.chunklist.setCurrentRow(0))   + def menuRequested(self, point): + point = self.editor.mapToGlobal(point) + return self.editor.createStandardContextMenu().exec_(point) +   def updateChunkList(self):   self.updating = True   self.chunklist.clear() @@ -165,6 +173,8 @@
  def saveSettings(self):   s = QSettings()   s.setValue('rejects/geometry', self.saveGeometry()) + self.editor.saveSettings(s, 'rejects/editor') + self.rejectbrowser.saveSettings(s, 'rejects/rejbrowse')     def accept(self):   f = QFile(self.path) @@ -187,6 +197,8 @@
  self.setUtf8(True)     self.installEventFilter(qscilib.KeyPressInterceptor(self)) + self.setContextMenuPolicy(Qt.CustomContextMenu) + self.customContextMenuRequested.connect(self.menuRequested)   self.setCaretLineVisible(False)     self.setMarginType(1, qsci.SymbolMargin) @@ -205,6 +217,10 @@
  lexer = lexers.get_diff_lexer(self)   self.setLexer(lexer)   + def menuRequested(self, point): + point = self.mapToGlobal(point) + return self.createStandardContextMenu().exec_(point) +   def showChunk(self, lines):   utext = []   added = []