Commit acfb876d authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

doc: Change the Firefox button to an open button.

Showing with 15 additions and 17 deletions
+15 -17
...@@ -20,18 +20,16 @@ import os, sys ...@@ -20,18 +20,16 @@ import os, sys
import logging import logging
import subprocess import subprocess
from View.Tools.PamhyrWindow import PamhyrWindow from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QDesktopServices
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QAction
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEngineSettings
from PyQt5.QtCore import QCoreApplication from View.Tools.PamhyrWindow import PamhyrWindow
_translate = QCoreApplication.translate
logger = logging.getLogger() logger = logging.getLogger()
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QAction
from PyQt5.QtCore import QUrl
from PyQt5.QtWebEngineWidgets import QWebEngineView, QWebEngineSettings
class DocWindow(PamhyrWindow): class DocWindow(PamhyrWindow):
_pamhyr_ui = "WebView" _pamhyr_ui = "WebView"
_pamhyr_name = "Doc" _pamhyr_name = "Doc"
...@@ -62,7 +60,6 @@ class DocWindow(PamhyrWindow): ...@@ -62,7 +60,6 @@ class DocWindow(PamhyrWindow):
config = config, config = config,
options = [], options = [],
parent = parent parent = parent
) )
self._path = self._path_file(filename) self._path = self._path_file(filename)
...@@ -75,7 +72,7 @@ class DocWindow(PamhyrWindow): ...@@ -75,7 +72,7 @@ class DocWindow(PamhyrWindow):
self.findChild(QAction, "action_back").triggered.connect(self.back) self.findChild(QAction, "action_back").triggered.connect(self.back)
self.findChild(QAction, "action_forward").triggered.connect(self.forward) self.findChild(QAction, "action_forward").triggered.connect(self.forward)
self.findChild(QAction, "action_firefox").triggered.connect(self.open_in_firefox) self.findChild(QAction, "action_open").triggered.connect(self.open)
def setup_web_engine(self): def setup_web_engine(self):
...@@ -99,8 +96,6 @@ class DocWindow(PamhyrWindow): ...@@ -99,8 +96,6 @@ class DocWindow(PamhyrWindow):
def forward(self): def forward(self):
self._web_view.forward() self._web_view.forward()
def open_in_firefox(self): def open(self):
_ = subprocess.Popen( url = QUrl(f"file://{self._path}")
f"firefox {self._path}", QDesktopServices.openUrl(url)
shell = True
)
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>MainWindow</string>
</property> </property>
<property name="locale">
<locale language="English" country="Europe"/>
</property>
<widget class="QWidget" name="centralwidget"> <widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
...@@ -43,11 +46,11 @@ ...@@ -43,11 +46,11 @@
</attribute> </attribute>
<addaction name="action_back"/> <addaction name="action_back"/>
<addaction name="action_forward"/> <addaction name="action_forward"/>
<addaction name="action_firefox"/> <addaction name="action_open"/>
</widget> </widget>
<action name="action_firefox"> <action name="action_open">
<property name="text"> <property name="text">
<string>Firefox</string> <string>Open</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Open document in Firefox</string> <string>Open document in Firefox</string>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment