Skip to content

Commit

Permalink
Updates Checks will not pass this commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpdev committed Dec 17, 2021
1 parent a8e1f24 commit 5c8cb74
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 76 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ clean-build: ## remove build artifacts
rm -rfv tests/TESTINGDIR

lint: ## run linters on codebase
pip install --upgrade --force-reinstall --pre torrentfile
pip install --upgrade --force-reinstall --pre --no-cache torrentfile
isort torrentfileQt tests
pyroma .
prospector torrentfileQt
Expand Down
2 changes: 1 addition & 1 deletion coverage.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" ?>
<coverage version="6.2" timestamp="1638500933534" lines-valid="1446" lines-covered="1446" line-rate="1" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
<coverage version="6.2" timestamp="1638669506256" lines-valid="1446" lines-covered="1446" line-rate="1" branches-covered="0" branches-valid="0" branch-rate="0" complexity="0">
<!-- Generated by coverage.py: https://coverage.readthedocs.io -->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
<sources>
Expand Down
49 changes: 20 additions & 29 deletions torrentfileQt/checkTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,17 @@
import logging
import os
import re
from collections.abc import Sequence
# from collections.abc import Sequence
from pathlib import Path

from PySide6.QtCore import Qt, Signal
from PySide6.QtGui import QIcon, QTextOption
from PySide6.QtWidgets import (
QFileDialog,
QFormLayout,
QHBoxLayout,
QLabel,
QLineEdit,
QPlainTextEdit,
QProgressBar,
QPushButton,
QSplitter,
QToolButton,
QTreeWidget,
QTreeWidgetItem,
QVBoxLayout,
QWidget,
)
from torrentfile.progress import CheckerClass
from PySide6.QtWidgets import (QFileDialog, QFormLayout, QHBoxLayout, QLabel,
QLineEdit, QPlainTextEdit, QProgressBar,
QPushButton, QSplitter, QToolButton,
QTreeWidget, QTreeWidgetItem, QVBoxLayout,
QWidget)
from torrentfile.recheck import Checker


def _conf():
Expand Down Expand Up @@ -150,7 +139,7 @@ def submit(self):
metafile = fileInput.text()
content = searchInput.text()
if os.path.exists(metafile):
CheckerClass.register_callback(textEdit.callback)
Checker.register_callback(textEdit.callback)
logging.debug("Registering Callback, setting root")
tree.reChecking.emit(metafile, content)

Expand Down Expand Up @@ -214,7 +203,8 @@ class BrowseFolders(QToolButton):
def __init__(self, parent=None):
"""Construct a BrowseFolders Button Widget."""
super().__init__(parent=parent)
self.window = parent
self.window = parent.window
self.widget = parent
self.setCursor(Qt.CursorShape.PointingHandCursor)
self.mode = None
self.clicked.connect(self.browse)
Expand All @@ -236,12 +226,13 @@ def browse(self, path=None):
if not path: # pragma: no cover
mode = self.modes[self.mode]
path = mode["func"](parent=self, **mode["kwargs"])
if isinstance(path, Sequence):
if not isinstance(path, str):
path, _ = path

if path:
path = os.path.normpath(path)
self.parent().searchInput.clear()
self.parent().searchInput.setText(path)
self.widget.searchInput.clear()
self.widget.searchInput.setText(path)


class LogTextEdit(QPlainTextEdit):
Expand Down Expand Up @@ -354,7 +345,7 @@ def __init__(self, parent=None):
super().__init__(parent=parent)
self.window = parent.window
self.setColumnCount(3)
self.setIndentation(10)
self.setIndentation(15)
self.item = self.invisibleRootItem()
self.item.setExpanded(True)
header = self.header()
Expand Down Expand Up @@ -446,20 +437,20 @@ def __init__(self, metafile, content, tree):
self.metafile = metafile
self.content = content
self.tree = tree
self.checker = CheckerClass(metafile, content)
self.checker = Checker(metafile, content)
self.root = os.path.dirname(self.checker.root)
self.fileinfo = self.checker.fileinfo
self.pathlist = self.checker.paths
self.current = 0

def addTreeWidgets(self):
"""Add tree widgets items to tree widget."""
for path in self.pathlist:
if path == self.root:
for _, val in self.fileinfo.items():
if val["path"] == self.root:
relpath = os.path.dirname(self.root) # pragma: no cover
else:
relpath = os.path.relpath(path, self.root)
length = self.fileinfo[path]["length"]
relpath = os.path.relpath(val["path"], self.root)
length = val["length"]
self.tree.addPathChild.emit(relpath, length)

def iter_hashes(self):
Expand Down
23 changes: 6 additions & 17 deletions torrentfileQt/createTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,10 @@
from pathlib import Path

from PySide6.QtCore import Qt
from PySide6.QtWidgets import (
QCheckBox,
QComboBox,
QFileDialog,
QGridLayout,
QHBoxLayout,
QLabel,
QLineEdit,
QPlainTextEdit,
QPushButton,
QRadioButton,
QSpacerItem,
QToolButton,
QWidget,
)
from PySide6.QtWidgets import (QCheckBox, QComboBox, QFileDialog, QGridLayout,
QHBoxLayout, QLabel, QLineEdit, QPlainTextEdit,
QPushButton, QRadioButton, QSpacerItem,
QToolButton, QWidget)
from torrentfile.utils import path_piece_length

from torrentfileQt.qss import pushButtonEdit
Expand Down Expand Up @@ -74,8 +63,8 @@ def __init__(self, parent=None):
self.hlayout3 = QHBoxLayout()
self.hlayout0 = QHBoxLayout()

self.path_label = QLabel("Path: ", parent=self)
self.output_label = QLabel("Save Path: ", parent=self)
self.path_label = QLabel("Torrent Content: ", parent=self)
self.output_label = QLabel("Save Location: ", parent=self)
self.version_label = QLabel("Meta Version: ", parent=self)
self.comment_label = QLabel("Comment: ", parent=self)
self.announce_label = QLabel("Trackers: ", parent=self)
Expand Down
15 changes: 3 additions & 12 deletions torrentfileQt/editorTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,9 @@

import pyben
from PySide6.QtCore import Qt, Signal
from PySide6.QtWidgets import (
QFileDialog,
QHBoxLayout,
QLabel,
QLineEdit,
QPushButton,
QTableWidget,
QTableWidgetItem,
QToolButton,
QVBoxLayout,
QWidget,
)
from PySide6.QtWidgets import (QFileDialog, QHBoxLayout, QLabel, QLineEdit,
QPushButton, QTableWidget, QTableWidgetItem,
QToolButton, QVBoxLayout, QWidget)


class EditorWidget(QWidget):
Expand Down
13 changes: 3 additions & 10 deletions torrentfileQt/infoTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,9 @@
import pyben
from PySide6.QtCore import Qt, Signal
from PySide6.QtGui import QIcon
from PySide6.QtWidgets import (
QFileDialog,
QGridLayout,
QLabel,
QLineEdit,
QPushButton,
QTreeWidget,
QTreeWidgetItem,
QWidget,
)
from PySide6.QtWidgets import (QFileDialog, QGridLayout, QLabel, QLineEdit,
QPushButton, QTreeWidget, QTreeWidgetItem,
QWidget)

from torrentfileQt.qss import infoLineEdit

Expand Down
7 changes: 2 additions & 5 deletions torrentfileQt/qss.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
"""Module for stylesheets."""
import os

arrow = os.path.join(os.environ["ASSETS"], "icons", "down-arrow16.png").replace(
"\\", "/"
)

stylesheet = (
"""
* {
Expand Down Expand Up @@ -535,7 +531,8 @@
}"""
+ f"""
QComboBox::down-arrow {{
image: url({arrow});
image: url({os.path.join(os.environ["ASSETS"], "icons",
"down-arrow16.png")});
}}
"""
)
Expand Down
3 changes: 2 additions & 1 deletion torrentfileQt/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import sys

from PySide6.QtGui import QIcon
from PySide6.QtWidgets import QApplication, QMainWindow, QTabWidget, QVBoxLayout
from PySide6.QtWidgets import (QApplication, QMainWindow, QTabWidget,
QVBoxLayout)

from torrentfileQt.checkTab import CheckWidget
from torrentfileQt.createTab import CreateWidget
Expand Down

0 comments on commit 5c8cb74

Please sign in to comment.