118 self.rightMenuAct = \ |
119 self.rightMenuAct = \ |
119 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("1rightarrow.png"), |
120 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("1rightarrow.png"), |
120 self.trUtf8('Move Right'), self.__tabContextMenuMoveRight) |
121 self.trUtf8('Move Right'), self.__tabContextMenuMoveRight) |
121 self.__tabContextMenu.addSeparator() |
122 self.__tabContextMenu.addSeparator() |
122 self.tabContextCloneAct = \ |
123 self.tabContextCloneAct = \ |
123 self.__tabContextMenu.addAction(self.trUtf8("Duplicate Page"), |
124 self.__tabContextMenu.addAction(self.trUtf8("Duplicate Page"), |
124 self.__tabContextMenuClone) |
125 self.__tabContextMenuClone) |
125 self.__tabContextMenu.addSeparator() |
126 self.__tabContextMenu.addSeparator() |
126 self.tabContextCloseAct = \ |
127 self.tabContextCloseAct = \ |
127 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("tabClose.png"), |
128 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("tabClose.png"), |
128 self.trUtf8('Close'), self.__tabContextMenuClose) |
129 self.trUtf8('Close'), self.__tabContextMenuClose) |
129 self.tabContextCloseOthersAct = \ |
130 self.tabContextCloseOthersAct = \ |
130 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("tabCloseOther.png"), |
131 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("tabCloseOther.png"), |
131 self.trUtf8("Close Others"), self.__tabContextMenuCloseOthers) |
132 self.trUtf8("Close Others"), self.__tabContextMenuCloseOthers) |
132 self.__tabContextMenu.addAction(self.trUtf8('Close All'), |
133 self.__tabContextMenu.addAction(self.trUtf8('Close All'), |
133 self.closeAllBrowsers) |
134 self.closeAllBrowsers) |
134 self.__tabContextMenu.addSeparator() |
135 self.__tabContextMenu.addSeparator() |
135 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("printPreview.png"), |
136 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("printPreview.png"), |
136 self.trUtf8('Print Preview'), self.__tabContextMenuPrintPreview) |
137 self.trUtf8('Print Preview'), self.__tabContextMenuPrintPreview) |
137 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("print.png"), |
138 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("print.png"), |
138 self.trUtf8('Print'), self.__tabContextMenuPrint) |
139 self.trUtf8('Print'), self.__tabContextMenuPrint) |
139 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("printPdf.png"), |
140 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("printPdf.png"), |
140 self.trUtf8('Print as PDF'), self.__tabContextMenuPrintPdf) |
141 self.trUtf8('Print as PDF'), self.__tabContextMenuPrintPdf) |
141 self.__tabContextMenu.addSeparator() |
142 self.__tabContextMenu.addSeparator() |
142 self.__tabContextMenu.addAction(self.trUtf8('Bookmark All Tabs'), |
143 self.__tabContextMenu.addAction(self.trUtf8('Bookmark All Tabs'), |
143 self.__mainWindow.bookmarkAll) |
144 self.__mainWindow.bookmarkAll) |
144 |
145 |
145 def __showContextMenu(self, coord, index): |
146 def __showContextMenu(self, coord, index): |
146 """ |
147 """ |
147 Private slot to show the tab context menu. |
148 Private slot to show the tab context menu. |
273 browser.setSource(QUrl(linkName)) |
274 browser.setSource(QUrl(linkName)) |
274 if not browser.documentTitle(): |
275 if not browser.documentTitle(): |
275 self.setTabText(index, self.__elide(linkName, Qt.ElideMiddle)) |
276 self.setTabText(index, self.__elide(linkName, Qt.ElideMiddle)) |
276 self.setTabToolTip(index, linkName) |
277 self.setTabToolTip(index, linkName) |
277 else: |
278 else: |
278 self.setTabText(index, |
279 self.setTabText(index, |
279 self.__elide(browser.documentTitle().replace("&", "&&"))) |
280 self.__elide(browser.documentTitle().replace("&", "&&"))) |
280 self.setTabToolTip(index, browser.documentTitle()) |
281 self.setTabToolTip(index, browser.documentTitle()) |
281 |
282 |
282 def __showNavigationMenu(self): |
283 def __showNavigationMenu(self): |
283 """ |
284 """ |
452 self.trUtf8("Eric Web Browser"), |
453 self.trUtf8("Eric Web Browser"), |
453 self.trUtf8("""<p>Printing is not available due to a bug in PyQt4.""" |
454 self.trUtf8("""<p>Printing is not available due to a bug in PyQt4.""" |
454 """Please upgrade.</p>""")) |
455 """Please upgrade.</p>""")) |
455 return |
456 return |
456 |
457 |
457 def printPreviewBrowser(self, browser = None): |
458 def printPreviewBrowser(self, browser=None): |
458 """ |
459 """ |
459 Public slot called to show a print preview of the displayed file. |
460 Public slot called to show a print preview of the displayed file. |
460 |
461 |
461 @param browser reference to the browser to be printed (HelpBrowserWV) |
462 @param browser reference to the browser to be printed (HelpBrowserWV) |
462 """ |
463 """ |
463 from PyQt4.QtGui import QPrintPreviewDialog |
464 from PyQt4.QtGui import QPrintPreviewDialog |
464 |
465 |
465 if browser is None: |
466 if browser is None: |
466 browser = self.currentBrowser() |
467 browser = self.currentBrowser() |
467 |
468 |
468 printer = QPrinter(mode = QPrinter.HighResolution) |
469 printer = QPrinter(mode=QPrinter.HighResolution) |
469 if Preferences.getPrinter("ColorMode"): |
470 if Preferences.getPrinter("ColorMode"): |
470 printer.setColorMode(QPrinter.Color) |
471 printer.setColorMode(QPrinter.Color) |
471 else: |
472 else: |
472 printer.setColorMode(QPrinter.GrayScale) |
473 printer.setColorMode(QPrinter.GrayScale) |
473 if Preferences.getPrinter("FirstPageFirst"): |
474 if Preferences.getPrinter("FirstPageFirst"): |
516 self.setTabText(self.currentIndex(), self.__elide(title.replace("&", "&&"))) |
517 self.setTabText(self.currentIndex(), self.__elide(title.replace("&", "&&"))) |
517 self.setTabToolTip(self.currentIndex(), title) |
518 self.setTabToolTip(self.currentIndex(), title) |
518 |
519 |
519 self.titleChanged.emit(title) |
520 self.titleChanged.emit(title) |
520 |
521 |
521 def __elide(self, txt, mode = Qt.ElideRight, length = 40): |
522 def __elide(self, txt, mode=Qt.ElideRight, length=40): |
522 """ |
523 """ |
523 Private method to elide some text. |
524 Private method to elide some text. |
524 |
525 |
525 @param txt text to be elided (string) |
526 @param txt text to be elided (string) |
526 @keyparam mode elide mode (Qt.TextElideMode) |
527 @keyparam mode elide mode (Qt.TextElideMode) |
615 Public method to check, if the application should be shut down. |
616 Public method to check, if the application should be shut down. |
616 |
617 |
617 @return flag indicating a shut down (boolean) |
618 @return flag indicating a shut down (boolean) |
618 """ |
619 """ |
619 if self.count() > 1: |
620 if self.count() > 1: |
620 mb = E5MessageBox.E5MessageBox(E5MessageBox.Information, |
621 mb = E5MessageBox.E5MessageBox(E5MessageBox.Information, |
621 self.trUtf8("Are you sure you want to close the window?"), |
622 self.trUtf8("Are you sure you want to close the window?"), |
622 self.trUtf8("""Are you sure you want to close the window?\n""" |
623 self.trUtf8("""Are you sure you want to close the window?\n""" |
623 """You have %n tab(s) open.""", "", self.count()), |
624 """You have %n tab(s) open.""", "", self.count()), |
624 modal = True, |
625 modal=True, |
625 parent = self) |
626 parent=self) |
626 if self.__mainWindow.fromEric: |
627 if self.__mainWindow.fromEric: |
627 quitButton = mb.addButton(self.trUtf8("&Close"), E5MessageBox.AcceptRole) |
628 quitButton = mb.addButton(self.trUtf8("&Close"), E5MessageBox.AcceptRole) |
628 quitButton.setIcon(UI.PixmapCache.getIcon("close.png")) |
629 quitButton.setIcon(UI.PixmapCache.getIcon("close.png")) |
629 else: |
630 else: |
630 quitButton = mb.addButton(self.trUtf8("&Quit"), E5MessageBox.AcceptRole) |
631 quitButton = mb.addButton(self.trUtf8("&Quit"), E5MessageBox.AcceptRole) |
631 quitButton.setIcon(UI.PixmapCache.getIcon("exit.png")) |
632 quitButton.setIcon(UI.PixmapCache.getIcon("exit.png")) |
632 closeTabButton = mb.addButton(self.trUtf8("C&lose Current Tab"), |
633 closeTabButton = mb.addButton(self.trUtf8("C&lose Current Tab"), |
633 E5MessageBox.AcceptRole) |
634 E5MessageBox.AcceptRole) |
634 closeTabButton.setIcon(UI.PixmapCache.getIcon("tabClose.png")) |
635 closeTabButton.setIcon(UI.PixmapCache.getIcon("tabClose.png")) |
635 mb.addButton(E5MessageBox.Cancel) |
636 mb.addButton(E5MessageBox.Cancel) |
636 mb.exec_() |
637 mb.exec_() |
637 if mb.clickedButton() == quitButton: |
638 if mb.clickedButton() == quitButton: |