-
Notifications
You must be signed in to change notification settings - Fork 0
/
freshrss
executable file
·73 lines (54 loc) · 1.49 KB
/
freshrss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import dataclasses
import PyQt5.QtCore
import PyQt5.QtGui
import PyQt5.QtWidgets
import PyQt5.QtWebEngineWidgets
@dataclasses.dataclass
class AppInfo(object):
Name = "FreshRSS"
Version = "0.20230920"
Description = "Qt Webkit Wrapper for my FreshRSS instance"
WebViewURL = "https://freshrss.rt3x.de/"
class FreshRSSMainWindow(PyQt5.QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
self.title = AppInfo.Name
self.left = 10
self.top = 10
self.width = 800
self.height = 600
self.initUI()
def initUI(self):
self.setWindowTitle(self.title)
self.setGeometry(self.left, self.top, self.width, self.height)
self.webview = PyQt5.QtWebEngineWidgets.QWebEngineView()
self.webview.load(
PyQt5.QtCore.QUrl(AppInfo.WebViewURL)
)
self.setCentralWidget(self.webview)
self.showMaximized()
def version():
print(AppInfo.Name + " " + AppInfo.Version)
print("\t" + AppInfo.Description.replace("\n", "\n\t"))
# print("\n\tWebApp URL: " + AppInfo.WebViewURL)
print()
def usage(out=sys.stdout):
print(f"Usage: {sys.argv[0]} [--version|--help]", file=out)
def main():
app = PyQt5.QtWidgets.QApplication(sys.argv)
main_window = FreshRSSMainWindow()
app.exec()
if __name__ == "__main__":
if "--version" in sys.argv:
version()
sys.exit(0)
elif "--help" in sys.argv:
usage()
sys.exit(0)
elif len(sys.argv) > 1:
print("Unknown option(s): " + sys.argv[1:], file=sys.stderr)
sys.exit(2)
main()