Skip to content

Commit 4221f9c

Browse files
committed
licenses and link to website
1 parent a084bfd commit 4221f9c

8 files changed

Lines changed: 166 additions & 2 deletions

File tree

components/popup.py

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
from PyQt5 import QtWidgets, QtGui
2+
3+
4+
class PopupWindow(QtWidgets.QMessageBox):
5+
def __init__(self, title, text, details=None, width=200, height=400):
6+
super().__init__()
7+
self.setWindowTitle(title)
8+
self.setText(text)
9+
self.setDetailedText(details)
10+
self.setWindowIcon(QtGui.QIcon('ui/icon.png'))
11+
self.setMinimumWidth(width)
12+
self.setMinimumWidth(height)
13+
14+
def pop(self, _):
15+
print("pop")
16+
self.exec_()
17+
18+
19+
class LicenseWidget(QtWidgets.QWidget):
20+
def __init__(self, text, details, parent=None):
21+
super().__init__(parent=parent)
22+
self.setMinimumHeight(300)
23+
24+
self.layout = QtWidgets.QVBoxLayout()
25+
self.setLayout(self.layout)
26+
27+
label = QtWidgets.QLabel(text)
28+
self.layout.addWidget(label)
29+
30+
browser = QtWidgets.QTextBrowser()
31+
browser.setText(details)
32+
self.layout.addWidget(browser)
33+
34+
35+
class LicenseWindow(QtWidgets.QMainWindow):
36+
def __init__(self, parent=None):
37+
super().__init__(parent=parent)
38+
39+
self.mainWidget = QtWidgets.QWidget()
40+
self.mainWidget.layout = QtWidgets.QVBoxLayout()
41+
self.mainWidget.setLayout(self.mainWidget.layout)
42+
self.setCentralWidget(self.mainWidget)
43+
44+
self.setFixedWidth(450)
45+
self.setWindowTitle("Software Licenses")
46+
self.setWindowIcon(QtGui.QIcon('ui/icon.ico'))
47+
48+
self.mainWidget.layout.addWidget(QtWidgets.QLabel("Licenses"))
49+
50+
self.scrollArea = QtWidgets.QScrollArea()
51+
self.scrollArea.setWidgetResizable(True)
52+
53+
self.scrollAreaWidgetContents = QtWidgets.QWidget()
54+
self.scrollAreaWidgetContents.layout = QtWidgets.QVBoxLayout()
55+
self.scrollAreaWidgetContents.setLayout(self.scrollAreaWidgetContents.layout)
56+
self.mainWidget.layout.addWidget(self.scrollAreaWidgetContents)
57+
self.mainWidget.layout.addWidget(self.scrollArea)
58+
59+
self.scrollArea.setWidget(self.scrollAreaWidgetContents)
60+
61+
with open('LICENSE.txt', 'r') as f:
62+
reaper = LicenseWidget("Reaper GPL license", f.read())
63+
self.scrollAreaWidgetContents.layout.addWidget(reaper)
64+
65+
with open('licenses/socialreaper.txt', 'r') as f:
66+
reaper = LicenseWidget("Social Reaper MIT license", f.read())
67+
self.scrollAreaWidgetContents.layout.addWidget(reaper)
68+
69+
with open('LICENSE.txt', 'r') as f:
70+
reaper = LicenseWidget("PyQt GPL license", f.read())
71+
self.scrollAreaWidgetContents.layout.addWidget(reaper)
72+
73+
with open('licenses/requests.txt', 'r') as f:
74+
reaper = LicenseWidget("Requests Apache license", f.read())
75+
self.scrollAreaWidgetContents.layout.addWidget(reaper)
76+
77+
with open('licenses/requests-oauthlib.txt', 'r') as f:
78+
reaper = LicenseWidget("Requests-OAuthLib ISC license", f.read())
79+
self.scrollAreaWidgetContents.layout.addWidget(reaper)
80+
81+
with open('licenses/oauthlib.txt', 'r') as f:
82+
reaper = LicenseWidget("OAuthLib BSD license", f.read())
83+
self.scrollAreaWidgetContents.layout.addWidget(reaper)
84+
85+
def pop(self):
86+
self.show()

licenses/oauthlib.txt

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2011 Idan Gazit and contributors
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice,
8+
this list of conditions and the following disclaimer.
9+
10+
2. Redistributions in binary form must reproduce the above copyright
11+
notice, this list of conditions and the following disclaimer in the
12+
documentation and/or other materials provided with the distribution.
13+
14+
3. Neither the name of this project nor the names of its contributors may
15+
be used to endorse or promote products derived from this software without
16+
specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

licenses/requests-oauthlib.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ISC License
2+
3+
Copyright (c) 2014 Kenneth Reitz.
4+
5+
Permission to use, copy, modify, and/or distribute this software for any
6+
purpose with or without fee is hereby granted, provided that the above
7+
copyright notice and this permission notice appear in all copies.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

licenses/requests.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Copyright 2017 Kenneth Reitz
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.

licenses/socialreaper.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Copyright 2017 Adam Smith
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4+
5+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6+
7+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

mainwindow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ def setupUi(self, MainWindow):
330330
self.menubar.addAction(self.menuHelp.menuAction())
331331

332332
self.retranslateUi(MainWindow)
333-
self.tabWidget.setCurrentIndex(3)
333+
self.tabWidget.setCurrentIndex(0)
334334
self.sourcesTabs.setCurrentIndex(-1)
335335
QtCore.QMetaObject.connectSlotsByName(MainWindow)
336336

reaper.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@
2222
import qdarkstyle
2323
from PyQt5 import QtWidgets
2424
from PyQt5.QtGui import QIcon
25+
from PyQt5.Qt import QDesktopServices
26+
from PyQt5.QtCore import QUrl
2527

2628
from components.job_queue import Queue
2729
from components.keys import KeyPage
2830
from components.sources import SourceTabs
31+
from components.popup import *
2932
from components.widgets.nodes import PrimaryInputWindow
3033
from components.widgets.progress import ProgressWidget
3134
from components.widgets.queue import QueueTable
@@ -56,6 +59,9 @@ def __init__(self, window, app, show=True):
5659

5760
self.add_actions()
5861

62+
# Add windows
63+
self.add_windows()
64+
5965
# Create queue page
6066
self.queue = Queue(self)
6167
self.set_icons()
@@ -90,13 +96,23 @@ def add_actions(self):
9096
self.actionAdvanced_mode.toggled.connect(self.enable_advanced_mode)
9197
self.actionDark_mode.toggled.connect(self.enable_dark_mode)
9298
self.actionQuit.triggered.connect(self.quit)
99+
self.actionHelp.triggered.connect(self.open_website)
100+
self.actionAbout.triggered.connect(self.open_website)
101+
self.actionWebsite.triggered.connect(self.open_website)
102+
103+
def add_windows(self):
104+
self.license_window = LicenseWindow()
105+
self.actionLicenses.triggered.connect(self.license_window.pop)
93106

94107
def set_icons(self):
95108
self.queueUp.setIcon(QIcon('ui/up.png'))
96109
self.queueDown.setIcon(QIcon('ui/down.png'))
97110
self.queueRemove.setIcon(QIcon('ui/remove.png'))
98111
self.window.setWindowIcon(QIcon('ui/icon.ico'))
99112

113+
def open_website(self, _):
114+
QDesktopServices.openUrl(QUrl("http://reaper.social"))
115+
100116
def quit(self, _):
101117
self.app.quit()
102118

ui/mainwindow.ui

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<item>
3131
<widget class="QTabWidget" name="tabWidget">
3232
<property name="currentIndex">
33-
<number>3</number>
33+
<number>0</number>
3434
</property>
3535
<widget class="QWidget" name="introTab">
3636
<property name="enabled">

0 commit comments

Comments
 (0)