UI/CompareDialog.py

branch
Py2 comp.
changeset 3058
0a02c433f52d
parent 3057
10516539f238
parent 3030
4a0a82ddd9d2
child 3060
5883ce99ee12
equal deleted inserted replaced
3057:10516539f238 3058:0a02c433f52d
229 try: 229 try:
230 f1 = open(filename1, "r", encoding="utf-8") 230 f1 = open(filename1, "r", encoding="utf-8")
231 lines1 = f1.readlines() 231 lines1 = f1.readlines()
232 f1.close() 232 f1.close()
233 except IOError: 233 except IOError:
234 E5MessageBox.critical(self, 234 E5MessageBox.critical(
235 self,
235 self.trUtf8("Compare Files"), 236 self.trUtf8("Compare Files"),
236 self.trUtf8( 237 self.trUtf8(
237 """<p>The file <b>{0}</b> could not be read.</p>""") 238 """<p>The file <b>{0}</b> could not be read.</p>""")
238 .format(filename1)) 239 .format(filename1))
239 return 240 return
242 try: 243 try:
243 f2 = open(filename2, "r", encoding="utf-8") 244 f2 = open(filename2, "r", encoding="utf-8")
244 lines2 = f2.readlines() 245 lines2 = f2.readlines()
245 f2.close() 246 f2.close()
246 except IOError: 247 except IOError:
247 E5MessageBox.critical(self, 248 E5MessageBox.critical(
249 self,
248 self.trUtf8("Compare Files"), 250 self.trUtf8("Compare Files"),
249 self.trUtf8( 251 self.trUtf8(
250 """<p>The file <b>{0}</b> could not be read.</p>""") 252 """<p>The file <b>{0}</b> could not be read.</p>""")
251 .format(filename2)) 253 .format(filename2))
252 return 254 return
339 341
340 self.vsb1.setValue(0) 342 self.vsb1.setValue(0)
341 self.vsb2.setValue(0) 343 self.vsb2.setValue(0)
342 self.firstButton.setEnabled(False) 344 self.firstButton.setEnabled(False)
343 self.upButton.setEnabled(False) 345 self.upButton.setEnabled(False)
344 self.downButton.setEnabled(len(self.diffParas) > 0 and 346 self.downButton.setEnabled(
347 len(self.diffParas) > 0 and
345 (self.vsb1.isVisible() or self.vsb2.isVisible())) 348 (self.vsb1.isVisible() or self.vsb2.isVisible()))
346 self.lastButton.setEnabled(len(self.diffParas) > 0 and 349 self.lastButton.setEnabled(
350 len(self.diffParas) > 0 and
347 (self.vsb1.isVisible() or self.vsb2.isVisible())) 351 (self.vsb1.isVisible() or self.vsb2.isVisible()))
348 352
349 self.totalLabel.setText(self.trUtf8('Total: {0}')\ 353 self.totalLabel.setText(self.trUtf8('Total: {0}')\
350 .format(added + deleted + changed)) 354 .format(added + deleted + changed))
351 self.changedLabel.setText(self.trUtf8('Changed: {0}').format(changed)) 355 self.changedLabel.setText(self.trUtf8('Changed: {0}').format(changed))

eric ide

mercurial