-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
826 additions
and
124 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from PyQt5.QtWidgets import ( | ||
QDialog, | ||
QDialogButtonBox, | ||
QLineEdit, | ||
QLabel, | ||
QVBoxLayout | ||
) | ||
from PyQt5.QtCore import Qt | ||
|
||
from modules import stillworking | ||
|
||
class FindDialog(QDialog): | ||
def __init__(self, parent=None): | ||
super(FindDialog, self).__init__(parent) | ||
|
||
self.setWindowTitle("Find") | ||
|
||
layout = QVBoxLayout(self) | ||
|
||
label = QLabel("Find:", self) | ||
layout.addWidget(label) | ||
|
||
entry = QLineEdit(self) | ||
layout.addWidget(entry) | ||
|
||
buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) | ||
buttonbox.accepted.connect(self.__find_and_highlight) | ||
buttonbox.rejected.connect(self.reject) | ||
layout.addWidget(buttonbox) | ||
|
||
def __find_and_highlight(self): | ||
stillworking(parent=self) | ||
self.accept() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from PyQt5.QtWidgets import ( | ||
QDialog, | ||
QLabel, | ||
QGridLayout, | ||
QLineEdit, | ||
QDialogButtonBox, | ||
QWidget | ||
) | ||
from PyQt5.QtCore import Qt | ||
|
||
|
||
class ReplaceDialog(QDialog): | ||
|
||
def __init__(self, inputWidget: QWidget, parent=None) -> None: | ||
super(ReplaceDialog, self).__init__(parent) | ||
|
||
self.resize(400, 150) | ||
self.setWindowTitle("Replace") | ||
|
||
self.gridLayout = QGridLayout(self) | ||
|
||
self._inputwidget = inputWidget | ||
|
||
self.withLabel = QLabel("With:", self) | ||
self.gridLayout.addWidget(self.withLabel, 1, 0) | ||
|
||
self.withLineEdit = QLineEdit(self) | ||
self.gridLayout.addWidget(self.withLineEdit, 0, 1) | ||
|
||
self.replaceLabel = QLabel("Replace:", self) | ||
self.gridLayout.addWidget(self.replaceLabel, 0, 0) | ||
|
||
self.replaceLineEdit = QLineEdit(self) | ||
self.gridLayout.addWidget(self.replaceLineEdit, 1, 1) | ||
|
||
self.buttonBox = QDialogButtonBox(self) | ||
self.buttonBox.setOrientation(Qt.Horizontal) | ||
self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) | ||
self.gridLayout.addWidget(self.buttonBox, 3, 1) | ||
|
||
self.buttonBox.accepted.connect(self.__replace) | ||
self.buttonBox.rejected.connect(self.reject) | ||
|
||
self.show() | ||
|
||
def __replace(self): | ||
txt = self._inputwidget.toPlainText() | ||
|
||
if txt: | ||
txt = str(txt).replace(self.withLineEdit.text(), self.replaceLineEdit.text()) | ||
self._inputwidget.setPlainText(txt) | ||
else: | ||
self.accept() | ||
|
||
self.accept() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
from PyQt5.QtWidgets import ( | ||
QDialog, | ||
QDialogButtonBox, | ||
QLabel, | ||
QVBoxLayout, | ||
QLineEdit, | ||
QWidget, | ||
QMessageBox | ||
) | ||
from PyQt5.QtCore import Qt | ||
|
||
import requests | ||
from requests.exceptions import * | ||
|
||
class WebDialog(QDialog): | ||
def __init__(self, inputWidget: QWidget, parent=None): | ||
super(WebDialog, self).__init__(parent) | ||
|
||
self.setWindowTitle("Enter Website URL") | ||
self.resize(500, 100) | ||
self.setMinimumSize(225, 100) | ||
self.setMaximumSize(500, 100) | ||
|
||
self.inputwidget = inputWidget | ||
|
||
layout = QVBoxLayout(self) | ||
|
||
_ = QLabel("Enter website URL:") | ||
layout.addWidget(_) | ||
|
||
self.website = QLineEdit(self) | ||
self.website.setPlaceholderText("eg. www.example.com") | ||
layout.addWidget(self.website) | ||
|
||
buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) | ||
layout.addWidget(buttonbox) | ||
buttonbox.accepted.connect(self.set_text) | ||
buttonbox.rejected.connect(self.reject) | ||
|
||
def set_text(self): | ||
try: | ||
get = requests.get(self.website.text()) | ||
get.raise_for_status() | ||
|
||
except ConnectionError as err: | ||
a = QMessageBox.critical( | ||
self, | ||
"Error", | ||
"There was an error connecting to the URL provided.", | ||
QMessageBox.Ok | ||
) | ||
|
||
return | ||
|
||
except InvalidURL: | ||
a = QMessageBox.critical( | ||
self, | ||
"Error", | ||
"The URL provided was invalid.", | ||
QMessageBox.Ok | ||
) | ||
|
||
return | ||
|
||
except MissingSchema as err: | ||
a = QMessageBox.critical( | ||
self, | ||
"Error", | ||
err.__doc__, | ||
QMessageBox.Ok | ||
) | ||
|
||
return | ||
|
||
except HTTPError as err: | ||
a = QMessageBox.critical( | ||
self, | ||
"Error", | ||
str(err), | ||
QMessageBox.Ok | ||
) | ||
|
||
return | ||
|
||
self.inputwidget.appendPlainText(get.text) | ||
self.accept() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from PyQt5.QtWidgets import QMessageBox, QWidget | ||
|
||
def stillworking(title: str = "Sorry", text: str = "I'm still working on this :/", parent: QWidget = None) -> None: | ||
""" | ||
Display a "Still working" message. | ||
:param title: Message window title | ||
:param text: Message window text | ||
:param parent: Window parent widget | ||
:return: None | ||
""" | ||
|
||
QMessageBox.information(parent, title, text, QMessageBox.Ok, QMessageBox.Ok) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
PyQt5~=5.15.4 | ||
colorlog~=5.0.1 | ||
colorlog~=5.0.1 | ||
requests~=2.25.1 |
Oops, something went wrong.