소스 검색

use Qt instead of xdg-open to open browser

Thomas Buck 3 년 전
부모
커밋
0f940b4a92
1개의 변경된 파일2개의 추가작업 그리고 3개의 파일을 삭제
  1. 2
    3
      octotray

+ 2
- 3
octotray 파일 보기

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…
취소
저장