Skip to content

Commit

Permalink
v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
neroist committed Jul 16, 2021
1 parent e86e9d2 commit 565c203
Show file tree
Hide file tree
Showing 22 changed files with 826 additions and 124 deletions.
258 changes: 152 additions & 106 deletions __main__.py

Large diffs are not rendered by default.

Binary file added icons/application.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/dark mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/exit full screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/full screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/light mode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/microphone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified icons/save.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added modules/__pycache__/conversions.cpython-39.pyc
Binary file not shown.
Binary file added modules/__pycache__/stillworking.cpython-39.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions modules/attributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ class Images(object):
i = '<a href="https://icon-library.com/icon/i-icon-29.html">I Icon #285925</a> from <a href="https://icon-library.com/">icon-library.com </a>'
home = '<a href="https://www.rawshorts.com/freeicons/?download=home-icon-8"> Home Icon </a> made by <a href="https://www.rawshorts.com/freeicons/?page_id=243&vendor=rawshorts"> Rawshorts </a>'
open_file = 'Icon made by <a href="https://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>'
dark_mode = 'Icon made by <a href="https://www.freepik.com" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a>'
light_mode = '<div>Icon made from <a href="http://www.onlinewebfonts.com/icon">Icon Fonts</a> is licensed by CC BY 3.0</div>'

29 changes: 12 additions & 17 deletions modules/conversions.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
import base64
import hashlib
from urllib.parse import quote, unquote

msg_encoding = "ascii"


def b85encode(message): return base64.b85encode(message.encode(msg_encoding)).decode(msg_encoding)
def b85decode(message): return base64.b85decode(message.encode(msg_encoding)).decode(msg_encoding)
import unicodedata


def b64encode(message): return base64.b64encode(message.encode(msg_encoding)).decode(msg_encoding)
def b64decode(message): return base64.b64decode(message.encode(msg_encoding)).decode(msg_encoding)

msg_encoding = "ascii"

def b32encode(message): return base64.b32encode(message.encode(msg_encoding)).decode(msg_encoding)
def b32decode(message): return base64.b32decode(message.encode(msg_encoding)).decode(msg_encoding)
def b85encode(message): return base64.b85encode(message.encode(msg_encoding, errors='replace')).decode(msg_encoding, errors='replace')
def b85decode(message): return base64.b85decode(message.encode(msg_encoding)).decode(msg_encoding, errors='replace')

def b64encode(message): return base64.b64encode(message.encode(msg_encoding, errors='replace')).decode(msg_encoding, errors='replace')
def b64decode(message): return base64.b64decode(message.encode(msg_encoding, errors='replace')).decode(msg_encoding, errors='replace')

def b16encode(message): return base64.b16encode(message.encode(msg_encoding)).decode(msg_encoding)
def b16decode(message): return base64.b16decode(message.encode(msg_encoding)).decode(msg_encoding)
def b32encode(message): return base64.b32encode(message.encode(msg_encoding, errors='replace')).decode(msg_encoding, errors='replace')
def b32decode(message): return base64.b32decode(message.encode(msg_encoding, errors='replace')).decode(msg_encoding, errors='replace')

def b16encode(message): return base64.b16encode(message.encode(msg_encoding, errors='replace')).decode(msg_encoding, errors='replace')
def b16decode(message): return base64.b16decode(message.encode(msg_encoding, errors='replace')).decode(msg_encoding, errors='replace')

def a85encode(message): return base64.a85encode(message.encode(msg_encoding)).decode(msg_encoding)
def a85decode(message): return base64.a85decode(message.encode(msg_encoding)).decode(msg_encoding)
def a85encode(message): return base64.a85encode(message.encode(msg_encoding, errors='replace')).decode(msg_encoding, errors='replace')
def a85decode(message): return base64.a85decode(message.encode(msg_encoding, errors='replace')).decode(msg_encoding, errors='replace')


# other stuff
def urlencode(message): return quote(message)
def urldecode(message): return unquote(message)


def md5encode(message): return str(hashlib.md5(message.encode()).hexdigest())


def sha1encode(message): return str(hashlib.sha1(message.encode()).hexdigest())
def sha256encode(message): return str(hashlib.sha256(message.encode()).hexdigest())
def sha512encode(message): return str(hashlib.sha512(message.encode()).hexdigest())
Expand Down
Binary file added modules/dialogs/__pycache__/find.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file added modules/dialogs/__pycache__/web.cpython-39.pyc
Binary file not shown.
34 changes: 34 additions & 0 deletions modules/dialogs/find.py
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()

55 changes: 55 additions & 0 deletions modules/dialogs/replace.py
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()
86 changes: 86 additions & 0 deletions modules/dialogs/web.py
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()
14 changes: 14 additions & 0 deletions modules/stillworking.py
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)
3 changes: 2 additions & 1 deletion requirements.txt
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
Loading

0 comments on commit 565c203

Please sign in to comment.