WebBrowser/WebBrowserWindow.py

branch
QtWebEngine
changeset 4717
5841f229baf7
parent 4715
79009bc4acd5
child 4725
b19ff70ba509
equal deleted inserted replaced
4715:79009bc4acd5 4717:5841f229baf7
1672 menu.addAction(self.findNextAct) 1672 menu.addAction(self.findNextAct)
1673 menu.addAction(self.findPrevAct) 1673 menu.addAction(self.findPrevAct)
1674 1674
1675 menu = mb.addMenu(self.tr('&View')) 1675 menu = mb.addMenu(self.tr('&View'))
1676 menu.setTearOffEnabled(True) 1676 menu.setTearOffEnabled(True)
1677 ## menu.addAction(self.zoomInAct) 1677 menu.addAction(self.zoomInAct)
1678 ## menu.addAction(self.zoomResetAct) 1678 menu.addAction(self.zoomResetAct)
1679 ## menu.addAction(self.zoomOutAct) 1679 menu.addAction(self.zoomOutAct)
1680 ## if self.zoomTextOnlyAct is not None: 1680 ## if self.zoomTextOnlyAct is not None:
1681 ## menu.addAction(self.zoomTextOnlyAct) 1681 ## menu.addAction(self.zoomTextOnlyAct)
1682 menu.addSeparator() 1682 menu.addSeparator()
1683 menu.addAction(self.pageSourceAct) 1683 menu.addAction(self.pageSourceAct)
1684 ## menu.addAction(self.fullScreenAct) 1684 ## menu.addAction(self.fullScreenAct)
1830 edittb = self.addToolBar(self.tr("Edit")) 1830 edittb = self.addToolBar(self.tr("Edit"))
1831 edittb.setObjectName("EditToolBar") 1831 edittb.setObjectName("EditToolBar")
1832 edittb.setIconSize(UI.Config.ToolBarIconSize) 1832 edittb.setIconSize(UI.Config.ToolBarIconSize)
1833 edittb.addAction(self.copyAct) 1833 edittb.addAction(self.copyAct)
1834 1834
1835 ## viewtb = self.addToolBar(self.tr("View")) 1835 viewtb = self.addToolBar(self.tr("View"))
1836 ## viewtb.setObjectName("ViewToolBar") 1836 viewtb.setObjectName("ViewToolBar")
1837 ## viewtb.setIconSize(UI.Config.ToolBarIconSize) 1837 viewtb.setIconSize(UI.Config.ToolBarIconSize)
1838 ## viewtb.addAction(self.zoomInAct) 1838 viewtb.addAction(self.zoomInAct)
1839 ## viewtb.addAction(self.zoomResetAct) 1839 viewtb.addAction(self.zoomResetAct)
1840 ## viewtb.addAction(self.zoomOutAct) 1840 viewtb.addAction(self.zoomOutAct)
1841 ## viewtb.addSeparator() 1841 ## viewtb.addSeparator()
1842 ## viewtb.addAction(self.fullScreenAct) 1842 ## viewtb.addAction(self.fullScreenAct)
1843 1843
1844 findtb = self.addToolBar(self.tr("Find")) 1844 findtb = self.addToolBar(self.tr("Find"))
1845 findtb.setObjectName("FindToolBar") 1845 findtb.setObjectName("FindToolBar")
2543 self.setLoadingActions(cb.isLoading()) 2543 self.setLoadingActions(cb.isLoading())
2544 2544
2545 # set value of zoom widget 2545 # set value of zoom widget
2546 self.__zoomWidget.setValue(cb.zoomValue()) 2546 self.__zoomWidget.setValue(cb.zoomValue())
2547 2547
2548 # TODO: Preferences dialog
2548 def __showPreferences(self): 2549 def __showPreferences(self):
2549 """ 2550 """
2550 Private slot to set the preferences. 2551 Private slot to set the preferences.
2551 """ 2552 """
2552 from Preferences.ConfigurationDialog import ConfigurationDialog 2553 ## from Preferences.ConfigurationDialog import ConfigurationDialog
2553 dlg = ConfigurationDialog( 2554 ## dlg = ConfigurationDialog(
2554 self, 'Configuration', True, fromEric=self.__fromEric, 2555 ## self, 'Configuration', True, fromEric=self.__fromEric,
2555 displayMode=ConfigurationDialog.WebBrowserMode) 2556 ## displayMode=ConfigurationDialog.WebBrowserMode)
2556 dlg.preferencesChanged.connect(self.preferencesChanged) 2557 ## dlg.preferencesChanged.connect(self.preferencesChanged)
2557 dlg.masterPasswordChanged.connect(self.masterPasswordChanged) 2558 ## dlg.masterPasswordChanged.connect(self.masterPasswordChanged)
2558 dlg.show() 2559 ## dlg.show()
2559 if self.__lastConfigurationPageName: 2560 ## if self.__lastConfigurationPageName:
2560 dlg.showConfigurationPageByName(self.__lastConfigurationPageName) 2561 ## dlg.showConfigurationPageByName(self.__lastConfigurationPageName)
2561 else: 2562 ## else:
2562 dlg.showConfigurationPageByName("empty") 2563 ## dlg.showConfigurationPageByName("empty")
2563 dlg.exec_() 2564 ## dlg.exec_()
2564 QApplication.processEvents() 2565 ## QApplication.processEvents()
2565 if dlg.result() == QDialog.Accepted: 2566 ## if dlg.result() == QDialog.Accepted:
2566 dlg.setPreferences() 2567 ## dlg.setPreferences()
2567 Preferences.syncPreferences() 2568 ## Preferences.syncPreferences()
2568 self.preferencesChanged() 2569 ## self.preferencesChanged()
2569 self.__lastConfigurationPageName = dlg.getConfigurationPageName() 2570 ## self.__lastConfigurationPageName = dlg.getConfigurationPageName()
2570 2571
2571 def preferencesChanged(self): 2572 def preferencesChanged(self):
2572 """ 2573 """
2573 Public slot to handle a change of preferences. 2574 Public slot to handle a change of preferences.
2574 """ 2575 """
3574 if codec == "": 3575 if codec == "":
3575 QWebEngineSettings.globalSettings().setDefaultTextEncoding("") 3576 QWebEngineSettings.globalSettings().setDefaultTextEncoding("")
3576 else: 3577 else:
3577 QWebEngineSettings.globalSettings().setDefaultTextEncoding(codec) 3578 QWebEngineSettings.globalSettings().setDefaultTextEncoding(codec)
3578 3579
3579 ## def eventMouseButtons(self): 3580 def eventMouseButtons(self):
3580 ## """ 3581 """
3581 ## Public method to get the last recorded mouse buttons. 3582 Public method to get the last recorded mouse buttons.
3582 ## 3583
3583 ## @return mouse buttons (Qt.MouseButtons) 3584 @return mouse buttons (Qt.MouseButtons)
3584 ## """ 3585 """
3585 ## return self.__eventMouseButtons 3586 return self.__eventMouseButtons
3586 ## 3587
3587 ## def eventKeyboardModifiers(self): 3588 def eventKeyboardModifiers(self):
3588 ## """ 3589 """
3589 ## Public method to get the last recorded keyboard modifiers. 3590 Public method to get the last recorded keyboard modifiers.
3590 ## 3591
3591 ## @return keyboard modifiers (Qt.KeyboardModifiers) 3592 @return keyboard modifiers (Qt.KeyboardModifiers)
3592 ## """ 3593 """
3593 ## return self.__eventKeyboardModifiers 3594 return self.__eventKeyboardModifiers
3594 ## 3595
3595 ## def setEventMouseButtons(self, buttons): 3596 def setEventMouseButtons(self, buttons):
3596 ## """ 3597 """
3597 ## Public method to record mouse buttons. 3598 Public method to record mouse buttons.
3598 ## 3599
3599 ## @param buttons mouse buttons to record (Qt.MouseButtons) 3600 @param buttons mouse buttons to record (Qt.MouseButtons)
3600 ## """ 3601 """
3601 ## self.__eventMouseButtons = buttons 3602 self.__eventMouseButtons = buttons
3602 ## 3603
3603 ## def setEventKeyboardModifiers(self, modifiers): 3604 def setEventKeyboardModifiers(self, modifiers):
3604 ## """ 3605 """
3605 ## Public method to record keyboard modifiers. 3606 Public method to record keyboard modifiers.
3606 ## 3607
3607 ## @param modifiers keyboard modifiers to record (Qt.KeyboardModifiers) 3608 @param modifiers keyboard modifiers to record (Qt.KeyboardModifiers)
3608 ## """ 3609 """
3609 ## self.__eventKeyboardModifiers = modifiers 3610 self.__eventKeyboardModifiers = modifiers
3610 ## 3611
3611 def mousePressEvent(self, evt): 3612 def mousePressEvent(self, evt):
3612 """ 3613 """
3613 Protected method called by a mouse press event. 3614 Protected method called by a mouse press event.
3614 3615
3615 @param evt reference to the mouse event (QMouseEvent) 3616 @param evt reference to the mouse event (QMouseEvent)

eric ide

mercurial