206 self.unittestAct = self.sourceMenu.addAction( |
206 self.unittestAct = self.sourceMenu.addAction( |
207 QCoreApplication.translate('Browser', 'Run unittest...'), |
207 QCoreApplication.translate('Browser', 'Run unittest...'), |
208 self.handleUnittest) |
208 self.handleUnittest) |
209 self.sourceMenu.addSeparator() |
209 self.sourceMenu.addSeparator() |
210 self.mimeTypeAct = self.sourceMenu.addAction( |
210 self.mimeTypeAct = self.sourceMenu.addAction( |
211 self.tr('Show Mime-Type'), self.__showMimeType) |
211 QCoreApplication.translate('Browser', 'Show Mime-Type'), |
|
212 self.__showMimeType) |
212 self.sourceMenu.addSeparator() |
213 self.sourceMenu.addSeparator() |
213 self.sourceMenu.addAction( |
214 self.sourceMenu.addAction( |
214 QCoreApplication.translate('Browser', 'Copy Path to Clipboard'), |
215 QCoreApplication.translate('Browser', 'Copy Path to Clipboard'), |
215 self._copyToClipboard) |
216 self._copyToClipboard) |
216 |
217 |
224 self.editPixmapAct = self.menu.addAction( |
225 self.editPixmapAct = self.menu.addAction( |
225 QCoreApplication.translate('Browser', 'Open in Icon Editor'), |
226 QCoreApplication.translate('Browser', 'Open in Icon Editor'), |
226 self._editPixmap) |
227 self._editPixmap) |
227 self.menu.addSeparator() |
228 self.menu.addSeparator() |
228 self.mimeTypeAct = self.menu.addAction( |
229 self.mimeTypeAct = self.menu.addAction( |
229 self.tr('Show Mime-Type'), self.__showMimeType) |
230 QCoreApplication.translate('Browser', 'Show Mime-Type'), |
|
231 self.__showMimeType) |
230 self.menu.addSeparator() |
232 self.menu.addSeparator() |
231 self.menu.addAction( |
233 self.menu.addAction( |
232 QCoreApplication.translate('Browser', 'Copy Path to Clipboard'), |
234 QCoreApplication.translate('Browser', 'Copy Path to Clipboard'), |
233 self._copyToClipboard) |
235 self._copyToClipboard) |
234 if self.__embeddedBrowser in [1, 2]: |
236 if self.__embeddedBrowser in [1, 2]: |
278 self.dirMenu.addAction( |
280 self.dirMenu.addAction( |
279 QCoreApplication.translate('Browser', 'Configure...'), |
281 QCoreApplication.translate('Browser', 'Configure...'), |
280 self.__configure) |
282 self.__configure) |
281 |
283 |
282 # create the attribute menu |
284 # create the attribute menu |
283 self.gotoMenu = QMenu(self.tr("Goto"), self) |
285 self.gotoMenu = QMenu(QCoreApplication.translate('Browser', "Goto"), |
|
286 self) |
284 self.gotoMenu.aboutToShow.connect(self._showGotoMenu) |
287 self.gotoMenu.aboutToShow.connect(self._showGotoMenu) |
285 self.gotoMenu.triggered.connect(self._gotoAttribute) |
288 self.gotoMenu.triggered.connect(self._gotoAttribute) |
286 |
289 |
287 self.attributeMenu = QMenu(self) |
290 self.attributeMenu = QMenu(self) |
288 self.attributeMenu.addAction( |
291 self.attributeMenu.addAction( |
392 linenos = itm.linenos() |
395 linenos = itm.linenos() |
393 fileName = itm.fileName() |
396 fileName = itm.fileName() |
394 |
397 |
395 for lineno in sorted(linenos): |
398 for lineno in sorted(linenos): |
396 act = self.gotoMenu.addAction( |
399 act = self.gotoMenu.addAction( |
397 self.tr("Line {0}".format(lineno))) |
400 QCoreApplication.translate( |
|
401 'Browser', "Line {0}").format(lineno)) |
398 act.setData([fileName, lineno]) |
402 act.setData([fileName, lineno]) |
399 |
403 |
400 def _gotoAttribute(self, act): |
404 def _gotoAttribute(self, act): |
401 """ |
405 """ |
402 Protected slot to handle the selection of the goto menu. |
406 Protected slot to handle the selection of the goto menu. |
485 if itmList: |
489 if itmList: |
486 mimetype = Utilities.MimeTypes.mimeType(itmList[0].fileName()) |
490 mimetype = Utilities.MimeTypes.mimeType(itmList[0].fileName()) |
487 if mimetype is None: |
491 if mimetype is None: |
488 E5MessageBox.warning( |
492 E5MessageBox.warning( |
489 self, |
493 self, |
490 self.tr("Show Mime-Type"), |
494 QCoreApplication.translate('Browser', "Show Mime-Type"), |
491 self.tr("""The mime type of the file could not be""" |
495 QCoreApplication.translate( |
492 """ determined.""")) |
496 'Browser', |
|
497 """The mime type of the file could not be""" |
|
498 """ determined.""")) |
493 elif mimetype.split("/")[0] == "text": |
499 elif mimetype.split("/")[0] == "text": |
494 E5MessageBox.information( |
500 E5MessageBox.information( |
495 self, |
501 self, |
496 self.tr("Show Mime-Type"), |
502 QCoreApplication.translate('Browser', "Show Mime-Type"), |
497 self.tr("""The file has the mime type <b>{0}</b>.""") |
503 QCoreApplication.translate( |
|
504 'Browser', |
|
505 """The file has the mime type <b>{0}</b>.""") |
498 .format(mimetype)) |
506 .format(mimetype)) |
499 else: |
507 else: |
500 textMimeTypesList = Preferences.getUI("TextMimeTypes") |
508 textMimeTypesList = Preferences.getUI("TextMimeTypes") |
501 if mimetype in textMimeTypesList: |
509 if mimetype in textMimeTypesList: |
502 E5MessageBox.information( |
510 E5MessageBox.information( |
503 self, |
511 self, |
504 self.tr("Show Mime-Type"), |
512 QCoreApplication.translate( |
505 self.tr("""The file has the mime type <b>{0}</b>.""") |
513 'Browser', "Show Mime-Type"), |
|
514 QCoreApplication.translate( |
|
515 'Browser', |
|
516 """The file has the mime type <b>{0}</b>.""") |
506 .format(mimetype)) |
517 .format(mimetype)) |
507 else: |
518 else: |
508 ok = E5MessageBox.yesNo( |
519 ok = E5MessageBox.yesNo( |
509 self, |
520 self, |
510 self.tr("Show Mime-Type"), |
521 QCoreApplication.translate( |
511 self.tr("""The file has the mime type <b>{0}</b>.""" |
522 'Browser', "Show Mime-Type"), |
512 """<br/> Shall it be added to the list of""" |
523 QCoreApplication.translate( |
513 """ text mime types?""").format(mimetype)) |
524 'Browser', |
|
525 """The file has the mime type <b>{0}</b>.""" |
|
526 """<br/> Shall it be added to the list of""" |
|
527 """ text mime types?""").format(mimetype)) |
514 if ok: |
528 if ok: |
515 textMimeTypesList.append(mimetype) |
529 textMimeTypesList.append(mimetype) |
516 Preferences.setUI("TextMimeTypes", textMimeTypesList) |
530 Preferences.setUI("TextMimeTypes", textMimeTypesList) |
517 |
531 |
518 def _editPixmap(self): |
532 def _editPixmap(self): |