Browse Source

use Qt instead of xdg-open to open browser

Thomas Buck 3 years ago
parent
commit
0f940b4a92
1 changed files with 2 additions and 3 deletions
  1. 2
    3
      octotray

+ 2
- 3
octotray View File

5
 # depends on:
5
 # depends on:
6
 # - python-pyqt5
6
 # - python-pyqt5
7
 # - curl
7
 # - curl
8
-# - xdg-open
9
 #
8
 #
10
 # see also:
9
 # see also:
11
 # https://doc.qt.io/qt-5/qtwidgets-widgets-imageviewer-example.html
10
 # https://doc.qt.io/qt-5/qtwidgets-widgets-imageviewer-example.html
20
 import urllib.parse
19
 import urllib.parse
21
 from PyQt5 import QtWidgets, QtGui, QtCore, QtNetwork
20
 from PyQt5 import QtWidgets, QtGui, QtCore, QtNetwork
22
 from PyQt5.QtWidgets import QSystemTrayIcon, QAction, QMenu, QMessageBox, QWidget, QLabel, QVBoxLayout, QHBoxLayout, QDesktopWidget, QSizePolicy, QSlider, QLayout
21
 from PyQt5.QtWidgets import QSystemTrayIcon, QAction, QMenu, QMessageBox, QWidget, QLabel, QVBoxLayout, QHBoxLayout, QDesktopWidget, QSizePolicy, QSlider, QLayout
23
-from PyQt5.QtGui import QIcon, QPixmap, QImageReader
22
+from PyQt5.QtGui import QIcon, QPixmap, QImageReader, QDesktopServices
24
 from PyQt5.QtCore import QCoreApplication, QSettings, QUrl, QTimer, QSize, Qt
23
 from PyQt5.QtCore import QCoreApplication, QSettings, QUrl, QTimer, QSize, Qt
25
 
24
 
26
 class AspectRatioPixmapLabel(QLabel):
25
 class AspectRatioPixmapLabel(QLabel):
276
         sys.exit(self.app.exec_())
275
         sys.exit(self.app.exec_())
277
 
276
 
278
     def openBrowser(self, url):
277
     def openBrowser(self, url):
279
-        os.system("xdg-open http://" + url)
278
+        QDesktopServices.openUrl(QUrl("http://" + url))
280
 
279
 
281
     def showDialog(self, title, text1, text2 = "", question = False, warning = False, error = False):
280
     def showDialog(self, title, text1, text2 = "", question = False, warning = False, error = False):
282
         msg = QMessageBox()
281
         msg = QMessageBox()

Loading…
Cancel
Save