13 |
13 |
14 from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl |
14 from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QUrl |
15 from PyQt5.QtGui import QIcon |
15 from PyQt5.QtGui import QIcon |
16 from PyQt5.QtWidgets import QWidget, QHBoxLayout, QMenu, QToolButton, QDialog |
16 from PyQt5.QtWidgets import QWidget, QHBoxLayout, QMenu, QToolButton, QDialog |
17 from PyQt5.QtPrintSupport import QPrinter, QPrintDialog |
17 from PyQt5.QtPrintSupport import QPrinter, QPrintDialog |
18 ##from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkRequest |
|
19 |
18 |
20 from E5Gui.E5TabWidget import E5TabWidget |
19 from E5Gui.E5TabWidget import E5TabWidget |
21 from E5Gui import E5MessageBox |
20 from E5Gui import E5MessageBox |
22 from E5Gui.E5Application import e5App |
21 from E5Gui.E5Application import e5App |
23 |
22 |
250 if idx < 0: |
249 if idx < 0: |
251 idx = self.currentIndex() |
250 idx = self.currentIndex() |
252 if idx < 0 or idx > self.count(): |
251 if idx < 0 or idx > self.count(): |
253 return |
252 return |
254 |
253 |
255 ## req = QNetworkRequest(self.widget(idx).url()) |
|
256 ## req.setRawHeader(b"X-Eric6-UserLoadAction", b"1") |
|
257 ## self.newBrowser(None, (req, QNetworkAccessManager.GetOperation, b"")) |
|
258 url = self.widget(idx).url() |
254 url = self.widget(idx).url() |
259 self.newBrowser(url) |
255 self.newBrowser(url) |
260 |
256 |
261 def __tabContextMenuClose(self): |
257 def __tabContextMenuClose(self): |
262 """ |
258 """ |
465 """ |
461 """ |
466 browser = self.widget(index) |
462 browser = self.widget(index) |
467 if browser is None: |
463 if browser is None: |
468 return |
464 return |
469 |
465 |
470 ## if browser.isModified(): |
|
471 ## ok = E5MessageBox.yesNo( |
|
472 ## self, |
|
473 ## self.tr("Do you really want to close this page?"), |
|
474 ## self.tr("""You have modified this page and when closing it""" |
|
475 ## """ you would lose the modification.\nDo you really""" |
|
476 ## """ want to close this page?""")) |
|
477 ## if not ok: |
|
478 ## return |
|
479 ## |
|
480 urlbar = self.__stackedUrlBar.widget(index) |
466 urlbar = self.__stackedUrlBar.widget(index) |
481 self.__stackedUrlBar.removeWidget(urlbar) |
467 self.__stackedUrlBar.removeWidget(urlbar) |
482 urlbar.deleteLater() |
468 urlbar.deleteLater() |
483 del urlbar |
469 del urlbar |
484 |
470 |
829 """ |
815 """ |
830 Private slot to handle the entering of an URL. |
816 Private slot to handle the entering of an URL. |
831 """ |
817 """ |
832 edit = self.sender() |
818 edit = self.sender() |
833 url = self.__guessUrlFromPath(edit.text()) |
819 url = self.__guessUrlFromPath(edit.text()) |
834 ## request = QNetworkRequest(url) |
|
835 ## request.setRawHeader(b"X-Eric6-UserLoadAction", b"1") |
|
836 if e5App().keyboardModifiers() == Qt.AltModifier: |
820 if e5App().keyboardModifiers() == Qt.AltModifier: |
837 self.newBrowser(url) |
821 self.newBrowser(url) |
838 ## self.newBrowser( |
|
839 ## None, (request, QNetworkAccessManager.GetOperation, b"")) |
|
840 else: |
822 else: |
841 self.currentBrowser().setSource(url) |
823 self.currentBrowser().setSource(url) |
842 ## self.currentBrowser().setSource( |
|
843 ## None, (request, QNetworkAccessManager.GetOperation, b"")) |
|
844 self.currentBrowser().setFocus() |
824 self.currentBrowser().setFocus() |
845 |
825 |
846 def __pathSelected(self, path): |
826 def __pathSelected(self, path): |
847 """ |
827 """ |
848 Private slot called when a URL is selected from the completer. |
828 Private slot called when a URL is selected from the completer. |