diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0af92f3..0000000 --- a/.editorconfig +++ /dev/null @@ -1,41 +0,0 @@ -root = true - -[*] -end_of_line = lf -insert_final_newline = true -charset = utf-8 - -[*.md] -trim_trailing_whitespace = false -insert_final_newline = true - - -[*.{py,c,cpp,java}] -indent_style = space -indent_size = 4 - -[*.py] -trim_trailing_whitespace = true -indent_style = space - -[*.{js,ts,json}] -indent_style = space -indent_size = 2 - -[lib/**.js] -indent_style = space -indent_size = 2 - -[Makefile] -indent_style = tab - -[{package.json,.travis.yml}] -indent_style = space -indent_size = 2 - -[*.bat] -indent_style = tab -end_of_line = crlf - -[LICENSE] -insert_final_newline = false diff --git a/.gitignore b/.gitignore index 2301629..6b3388f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ temp/ temp/ testdir/ main.py - +.runner/ # Distribution / packaging .vscode/ TESTINGDIR/ @@ -42,7 +42,6 @@ MANIFEST # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest -*.spec # Installer logs pip-log.txt diff --git a/.prospector.yml b/.prospector.yml index 1bc1047..43862bb 100644 --- a/.prospector.yml +++ b/.prospector.yml @@ -35,6 +35,8 @@ pep8: pylint: run: true + options: + config: pyproject.toml disable: - R1729 diff --git a/.pylintrc b/.pylintrc deleted file mode 100644 index d42281f..0000000 --- a/.pylintrc +++ /dev/null @@ -1,433 +0,0 @@ -[MASTER] - -# A comma-separated list of package or module names from where C extensions may -# be loaded. Extensions are loading into the active Python interpreter and may -# run arbitrary code -extension-pkg-whitelist= - -# Add files or directories to the blacklist. They should be base names, not -# paths. -ignore=CVS - -# Add files or directories matching the regex patterns to the blacklist. The -# regex matches against base names, not paths. -ignore-patterns= - -# Python code to execute, usually for sys.path manipulation such as -# pygtk.require(). -#init-hook= - -# Use multiple processes to speed up Pylint. -# jobs=1 -jobs=2 - -# List of plugins (as comma separated values of python modules names) to load, -# usually to register additional checkers. -load-plugins= - -# Pickle collected data for later comparisons. -persistent=yes - -# Specify a configuration file. -#rcfile= - -# Allow loading of arbitrary C extensions. Extensions are imported into the -# active Python interpreter and may run arbitrary code. -unsafe-load-any-extension=no - - -[MESSAGES CONTROL] - -# Only show warnings with the listed confidence levels. Leave empty to show -# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED -confidence= - -# Disable the message, report, category or checker with the given id(s). You -# can either give multiple identifiers separated by comma (,) or put this -# option multiple times (only on the command line, not in the configuration -# file where it should appear only once).You can also use "--disable=all" to -# disable everything first and then reenable specific checks. For example, if -# you want to run only the similarities checker, you can use "--disable=all -# --enable=similarities". If you want to run only the classes checker, but have -# no Warning level messages displayed, use"--disable=all --enable=classes -# --disable=W" -# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call -disable=redefined-outer-name,unspecified-encoding,protected-access,attribute-defined-outside-init,consider-using-with,use-a-generator,not-callable,useless-super-delegation,invalid-name,no-name-in-module,redefined-builtin, subprocess-run-check,no-member,consider-using-f-string - -# Enable the message, report, category or checker with the given id(s). You can -# either give multiple identifier separated by comma (,) or put this option -# multiple time (only on the command line, not in the configuration file where -# it should appear only once). See also the "--disable" option for examples. -enable= - - -[REPORTS] - -# Python expression which should return a note less than 10 (10 is the highest -# note). You have access to the variables errors warning, statement which -# respectively contain the number of errors / warnings messages and the total -# number of statements analyzed. This is used by the global evaluation report -# (RP0004). -evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) - -# Template used to display messages. This is a python new-style format string -# used to format the message information. See doc for all details -msg-template='{path} {line}: {msg} ({symbol})' - -# Set the output format. Available formats are text, parseable, colorized, json -# and msvs (visual studio).You can also give a reporter class, eg -# mypackage.mymodule.MyReporterClass. -output-format=text - -# Tells whether to display a full report or only the messages -reports=no - -# Activate the evaluation score. -score=yes - - -[REFACTORING] - -# Maximum number of nested blocks for function / method body -max-nested-blocks=5 - - -[LOGGING] - -# Logging modules to check that the string format arguments are in logging -# function parameter format -logging-modules=logging - - -[SPELLING] - -# Spelling dictionary name. Available dictionaries: none. To make it working -# install python-enchant package. -spelling-dict= - -# List of comma separated words that should not be checked. -spelling-ignore-words= - -# A path to a file that contains private dictionary; one word per line. -spelling-private-dict-file= - -# Tells whether to store unknown words to indicated private dictionary in -# --spelling-private-dict-file option instead of raising a message. -spelling-store-unknown-words=no - - -[MISCELLANEOUS] - -# List of note tags to take in consideration, separated by a comma. -# notes=FIXME,XXX,TODO -notes=FIXME,XXX - - -[TYPECHECK] - -# List of decorators that produce context managers, such as -# contextlib.contextmanager. Add to this list to register other decorators that -# produce valid context managers. -contextmanager-decorators=contextlib.contextmanager - -# List of members which are set dynamically and missed by pylint inference -# system, and so shouldn't trigger E1101 when accessed. Python regular -# expressions are accepted. -generated-members= - -# Tells whether missing members accessed in mixin class should be ignored. A -# mixin class is detected if its name ends with "mixin" (case insensitive). -ignore-mixin-members=yes - -# This flag controls whether pylint should warn about no-member and similar -# checks whenever an opaque object is returned when inferring. The inference -# can return multiple potential results while evaluating a Python object, but -# some branches might not be evaluated, which results in partial inference. In -# that case, it might be useful to still emit no-member and other checks for -# the rest of the inferred objects. -ignore-on-opaque-inference=yes - -# List of class names for which member attributes should not be checked (useful -# for classes with dynamically set attributes). This supports the use of -# qualified names. -ignored-classes=optparse.Values,thread._local,_thread._local - -# List of module names for which member attributes should not be checked -# (useful for modules/projects where namespaces are manipulated during runtime -# and thus existing member attributes cannot be deduced by static analysis. It -# supports qualified module names, as well as Unix pattern matching. -ignored-modules= - -# Show a hint with possible names when a member name was not found. The aspect -# of finding the hint is based on edit distance. -missing-member-hint=yes - -# The minimum edit distance a name should have in order to be considered a -# similar match for a missing member name. -missing-member-hint-distance=1 - -# The total number of similar names that should be taken in consideration when -# showing a hint for a missing member. -missing-member-max-choices=1 - - -[VARIABLES] - -# List of additional names supposed to be defined in builtins. Remember that -# you should avoid to define new builtins when possible. -additional-builtins= - -# Tells whether unused global variables should be treated as a violation. -allow-global-unused-variables=yes - -# List of strings which can identify a callback function by name. A callback -# name must start or end with one of those strings. -callbacks=cb_,_cb - -# A regular expression matching the name of dummy variables (i.e. expectedly -# not used). -dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ - -# Argument names that match this expression will be ignored. Default to name -# with leading underscore -ignored-argument-names=_.*|^ignored_|^unused_ - -# Tells whether we should check for unused import in __init__ files. -init-import=no - -# List of qualified module names which can have objects that can redefine -# builtins. -redefining-builtins-modules= - - -[FORMAT] - -# Expected format of line ending, e.g. empty (any line ending), LF or CRLF. -# expected-line-ending-format= -expected-line-ending-format= - -# Regexp for a line that is allowed to be longer than the limit. -ignore-long-lines= - -# Number of spaces of indent required inside a hanging or continued line. -indent-after-paren=4 - -# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 -# tab). -indent-string=' ' - -# Maximum number of characters on a single line. -max-line-length=80 - -# Maximum number of lines in a module -max-module-lines=1000 - -# List of optional constructs for which whitespace checking is disabled. `dict- -# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. -# `trailing-comma` allows a space between comma and closing bracket: (a, ). -# `empty-line` allows space-only lines. -no-space-check=trailing-comma,dict-separator - -# Allow the body of a class to be on the same line as the declaration if body -# contains single statement. -single-line-class-stmt=no - -# Allow the body of an if to be on the same line as the test if there is no -# else. -single-line-if-stmt=yes - - -[SIMILARITIES] - -# Ignore comments when computing similarities. -ignore-comments=yes - -# Ignore docstrings when computing similarities. -ignore-docstrings=no - -# Ignore imports when computing similarities. -ignore-imports=no - -# Minimum lines number of a similarity. -min-similarity-lines=4 - - -[BASIC] - -# Naming hint for argument names -argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Regular expression matching correct argument names -argument-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Naming hint for attribute names -attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Regular expression matching correct attribute names -attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Bad variable names which should always be refused, separated by a comma -bad-names=foo,bar,baz,toto,tutu,tata - -# Naming hint for class attribute names -class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Regular expression matching correct class attribute names -class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$ - -# Naming hint for class names -# class-name-hint=[A-Z_][a-zA-Z0-9]+$ -class-name-hint=[A-Z_][a-zA-Z0-9_]+$ - -# Regular expression matching correct class names -# class-rgx=[A-Z_][a-zA-Z0-9]+$ -class-rgx=[A-Z_][a-zA-Z0-9_]+$ - -# Naming hint for constant names -const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Regular expression matching correct constant names -const-rgx=(([A-Z_][A-Z0-9_]*)|(__.*__))$ - -# Minimum line length for functions/classes that require docstrings, shorter -# ones are exempt. -docstring-min-length=-1 - -# Naming hint for function names -function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Regular expression matching correct function names -function-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Good variable names which should always be accepted, separated by a comma -# good-names=i,j,k,ex,Run,_ -good-names=l,r,g,b,w,i,j,k,v,n,x,y,l,z,ex,ok,fd,d,Run,_ - -# Include a hint for the correct naming format with invalid-name -include-naming-hint=yes - -# Naming hint for inline iteration names -inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$ - -# Regular expression matching correct inline iteration names -inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$ - -# Naming hint for method names -method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Regular expression matching correct method names -method-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$ - -# Naming hint for module names -module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Regular expression matching correct module names -module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ - -# Colon-delimited sets of names that determine each other's naming style when -# the name regexes allow several styles. -name-group= - -# Regular expression which should only match function or class names that do -# not require a docstring. -no-docstring-rgx=^_ - -# List of decorators that produce properties, such as abc.abstractproperty. Add -# to this list to register other decorators that produce valid properties. -property-classes=abc.abstractproperty - -# Naming hint for variable names -variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*)|([A-Z0-9]{2,30}))$ - -# Regular expression matching correct variable names -variable-rgx=(([a-zA-Z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$ - - -[IMPORTS] - -# Allow wildcard imports from modules that define __all__. -allow-wildcard-with-all=no - -# Analyse import fallback blocks. This can be used to support both Python 2 and -# 3 compatible code, which means that the block might have code that exists -# only in one or another interpreter, leading to false positives when analysed. -analyse-fallback-blocks=no - -# Deprecated modules which should not be used, separated by a comma -deprecated-modules=optparse,tkinter.tix - -# Create a graph of external dependencies in the given file (report RP0402 must -# not be disabled) -ext-import-graph= - -# Create a graph of every (i.e. internal and external) dependencies in the -# given file (report RP0402 must not be disabled) -import-graph= - -# Create a graph of internal dependencies in the given file (report RP0402 must -# not be disabled) -int-import-graph= - -# Force import order to recognize a module as part of the standard -# compatibility libraries. -known-standard-library= - -# Force import order to recognize a module as part of a third party library. -known-third-party=enchant - - -[CLASSES] - -# List of method names used to declare (i.e. assign) instance attributes. -defining-attr-methods=__init__,__new__,setUp - -# List of member names, which should be excluded from the protected access -# warning. -exclude-protected=_asdict,_fields,_replace,_source,_make - -# List of valid names for the first argument in a class method. -valid-classmethod-first-arg=cls - -# List of valid names for the first argument in a metaclass class method. -valid-metaclass-classmethod-first-arg=mcs - - -[DESIGN] - -# Maximum number of arguments for function / method -max-args=15 - -# Maximum number of attributes for a class (see R0902). -# max-attributes=7 -max-attributes=35 - -# Maximum number of boolean expressions in a if statement -max-bool-expr=5 - -# Maximum number of branch for function / method body -max-branches=28 - -# Maximum number of locals for function / method body -max-locals=20 - -# Maximum number of parents for a class (see R0901). -max-parents=7 - -# Maximum number of public methods for a class (see R0904). -max-public-methods=20 - -# Maximum number of return / yield for function / method body -max-returns=6 - -# Maximum number of statements in function / method body -max-statements=120 - -# Minimum number of public methods for a class (see R0903). -min-public-methods=0 - - -[EXCEPTIONS] - -# Exceptions that will emit a warning when being caught. Defaults to -# "Exception" -overgeneral-exceptions=Exception diff --git a/MANIFEST.in b/MANIFEST.in index de03dc1..60b0360 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -4,9 +4,11 @@ include Makefile include package.json include requirements.txt -graft assets -graft tests + graft torrentfileQt + +recursive-include torrentfileQt * +recursive-include torrentfileQt/assets * global-exclude *.py[cod] prune **/__pycache__ diff --git a/Makefile b/Makefile index e231b41..b41f327 100644 --- a/Makefile +++ b/Makefile @@ -21,35 +21,6 @@ for line in sys.stdin: endef export PRINT_HELP_PYSCRIPT -define FIXES -import os -from pathlib import Path -from torrentfileQt.version import __version__ - -distpath = Path(os.getcwd()).resolve() / "dist" -for item in distpath.iterdir(): - if item.name == "torrentfileQt.exe": - os.rename(item, distpath / f"torrentfileQt-v{__version__}.exe") - elif item.name == "torrentfileQt.zip": - os.rename(item, distpath / f"torrentfileQt-v{__version__}-Winx64.zip") -endef -export FIXES - -define UNIXES -import os -from pathlib import Path -from torrentfileQt.version import __version__ - -distpath = Path(os.getcwd()).resolve() / "dist" -for item in distpath.iterdir(): - if item.name == "torrentfileQt.exe": - os.rename(item, distpath / f"torrentfileQt-v{__version__}-linux") - elif item.name == "torrentfileQt.zip": - os.rename(item, distpath / f"torrentfileQt-v{__version__}-linux.zip") -endef -export FIXES - - BROWSER := python -c "$$BROWSER_PYSCRIPT" help: @@ -79,7 +50,7 @@ lint: ## run linters on codebase prospector tests test: ## run tests quickly with the default Python - pip install --upgrade --force-reinstall --no-cache -rrequirements.txt + pip install --upgrade --force-reinstall --no-cache torrentfile pyben pytest tests --cov=torrentfileQt --cov=tests coverage report coverage xml -o coverage.xml @@ -89,26 +60,18 @@ push: clean lint test ## push changes to remote git commit -m "$m" git push +start: ## start program + torrentfileQt + release: clean test lint ## release to pypi python setup.py sdist bdist_wheel bdist_egg twine upload dist/* -build: clean +build: clean test lint + python -m pip install --upgrade --no-cache --force-reinstall torrentfile pyben pip wheel setuptools python setup.py sdist bdist_wheel bdist_egg - rm -rfv ../runner - mkdir ../runner - touch ../runner/exe - cp ./torrentfileQt/assets/torrentfile.ico ../runner/torrentfile.ico - cp -rvf ./torrentfileQt ../runner/torrentfileQt - @echo "import torrentfileQt" >> ../runner/exe - @echo "torrentfileQt.start()" >> ../runner/exe - pyinstaller --distpath ../runner/dist --workpath ../runner/build \ - -F -n torrentfileQt -w -i ../runner/torrentfile.ico \ - --specpath ../runner/ ../runner/exe --log-level DEBUG --collect-data torrentfileQt - pyinstaller --distpath ../runner/dist --workpath ../runner/build \ - -D -n torrentfileQt -w -i ../runner/torrentfile.ico \ - --specpath ../runner/ ../runner/exe --log-level DEBUG --collect-data torrentfileQt - cp -rfv ../runner/dist/* ./dist/ - @python -c "$$FIXES" + rm -rfv bin/dist + rm -rfv bin/build + cd bin && pyinstaller ./exec.spec full: clean test push release build diff --git a/README.md b/README.md index e4c4237..fb5ac36 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,11 @@ TorrentFileQt is a GUI Frontend for [TorrentFile CLI](https://github.com/alexpde - Check progress or percentage complete for .torrent file - Edit torrent files. +## Requirements + +- Pyside6 +- torrentfile + ## ScreenShots ![createtorrent.png](./assets/screenshots/create-tab.png) @@ -37,3 +42,26 @@ TorrentFileQt is a GUI Frontend for [TorrentFile CLI](https://github.com/alexpde --------- ![torrentinfo.png](./assets/screenshots/info-tab.png) + +--------- + +## Install + +- From git: + +```bash +git clone https://github.com/alexpdev/torrentfileQt.git +cd torrentfileQt +pip install -r requirements.txt +pip install . +torrentfileQt +``` + +- From PyPi + +```bash +pip install torrentfileQt +torrentfileQt +``` + +> Alternatively you can download a precompiled binary from the release page. diff --git a/assets/__init__.py b/assets/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/bin/exec b/bin/exec new file mode 100644 index 0000000..0225060 --- /dev/null +++ b/bin/exec @@ -0,0 +1,3 @@ +import torrentfileQt + +torrentfileQt.start() diff --git a/bin/exec.spec b/bin/exec.spec new file mode 100644 index 0000000..9dd5b3e --- /dev/null +++ b/bin/exec.spec @@ -0,0 +1,48 @@ +# -*- mode: python ; coding: utf-8 -*- + +block_cipher = None +import os +from os.path import join, dirname, relpath + +assets = join(dirname(os.getcwd()), 'torrentfileQt', 'assets') +assets = os.path.relpath(assets,'.') +lst = [] +for i in [os.path.join(assets,i) for i in os.listdir(assets)]: + lst.append((i, 'torrentfileQt/assets')) + +a = Analysis(['exec'], + pathex=['../torrentfileQt'], + binaries=None, + datas=lst, + hiddenimports=None, + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher, + noarchive=False) + +pyz = PYZ(a.pure, a.zipped_data, + cipher=block_cipher) + +exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + [], + name='torrentfileQt', + icon='../assets/torrentfile.ico', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=False, + disable_windowed_traceback=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None ) diff --git a/coverage.xml b/coverage.xml index 250aa2e..f9492b4 100644 --- a/coverage.xml +++ b/coverage.xml @@ -1,5 +1,5 @@ - + @@ -126,6 +126,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -760,47 +789,37 @@ - - - - - - - - - - + + - + + + - - - - - + @@ -811,235 +830,255 @@ - + + + + + + + + + - - - - - - - - + + - - - + + + + + + + + - - + - - - + + + + + - - - + + - - - - - - - - - - + + + + + - - - - - - + + + + + + + + - - - + + - + + - - - + + - + + - + - - - - - + + - + + + + + - - - - + - + + + + + + + + - - + + - - - - - - - - - - - + + + + + + + - - + - - - - - - + + + + + + + + + - + + - - - + + + - - - - - + - + - + + + + + + + + + + + + + + + + + @@ -1051,39 +1090,29 @@ - - - - - - - - - + + + + - - - - - + - + - + - @@ -1092,21 +1121,21 @@ + + - - - + @@ -1117,8 +1146,8 @@ - + @@ -1129,7 +1158,6 @@ - @@ -1154,132 +1182,143 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + - + - - + - + - + + + + - + - - - - - + + + + + + + + - - - - - - - + + + + + + - - - - - - + + - - - + + - + + + - - - + + + + + + - - - - - - + + - - + + - + + - - - + - + + + + + + + + + @@ -1292,18 +1331,9 @@ - - - + - - - - - - - @@ -1322,7 +1352,9 @@ + + @@ -1343,29 +1375,28 @@ - + + + + - - - + - - - + @@ -1374,135 +1405,140 @@ - + + + + + + - - - - + + + + + + - - - - + - - - - + - + + + + - - - - + + + - - + + + + - - - - - - + + + - + + - - - - + + + - - - - - - - - + + + + + + + + + + + + - - - - - + - + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -1518,34 +1554,27 @@ - - - + + - - - - - - + + - - + + - - @@ -1555,41 +1584,41 @@ + + - - + + + + - - + - - + - + + + - - + - - + - - @@ -1664,94 +1693,97 @@ + + - - - - - + + + + + - - + + - - + + - - + - + + + + + - - - - - + + + - - - - - - - + + + + + + + - - - - - + + + + + + - - + - - + + + - + - - - - + + - - + + + - - + + - - + + @@ -1762,57 +1794,61 @@ - + - - + + - + - + - + - - - + + + - - - + + + - - + + + + + + @@ -2064,13 +2100,12 @@ - - - - + + + @@ -2083,17 +2118,18 @@ + - - - - - + + + + + @@ -2105,21 +2141,21 @@ - - + + - - + + - - - + + + @@ -2136,17 +2172,16 @@ - - - + + + - - + + - - + diff --git a/package.json b/package.json index 750143a..1d3b01a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "torrentfileqt", "displayName": "TorrentfileQt", - "version": "0.3.3", + "version": "0.3.5", "description": "GUI torrentfile creator.", "repository": { "type": "git", @@ -11,7 +11,7 @@ "author": "alexpdev", "url": "https://github.com/alexpdev/torrentfileQt", "email": "alexpdev@protonmail.com", - "license": "Apache", + "license": "Apache 2.0", "bugs": { "url": "https://github.com/alexpdev/TorrentfileQt/issues" }, diff --git a/pyproject.toml b/pyproject.toml index 5602234..691357d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,3 +21,43 @@ testpaths = [ ] console_output_style = "progress" addopts = "--maxfail=5" + +[tool.pylint.messages_control] +disable= [ + 'redefined-outer-name', + 'unspecified-encoding', + 'protected-access', + 'attribute-defined-outside-init', + 'consider-using-with', + 'use-a-generator', + 'not-callable', + 'useless-super-delegation', + 'invalid-name', + 'no-name-in-module', + 'redefined-builtin', + 'subprocess-run-check', + 'no-member', + 'consider-using-f-string' +] + +[tool.pylint.format] +max-line-length=80 +max-module-lines=1000 +no-space-check=['trailing-comma','dict-separator'] +single-line-if-stmt='yes' + +[tool.pylint.basic] +good-names=[ + 'l','r','g','b','w','i','j','k','v','n','x', + 'y','l','z','ex','ok','fd','d','Run','_' +] + +[tool.pylint.design] +max-args=15 +max-attributes=35 +max-branches=28 +max-locals=20 +max-parents=7 +max-public-methods=20 +max-returns=6 +max-statements=120 diff --git a/requirements.txt b/requirements.txt index e13b980..80c148f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,2 @@ -wheel -setuptools -torrentfile==0.7.6 +torrentfile==0.7.9 PySide6 -pyben diff --git a/setup.cfg b/setup.cfg index ac4f1a0..7315e62 100644 --- a/setup.cfg +++ b/setup.cfg @@ -19,3 +19,4 @@ install_requires = torrentfile PySide6 pyben +include_package_data=True diff --git a/tests/test_checktab.py b/tests/test_checktab.py index c3a8488..8505ec3 100644 --- a/tests/test_checktab.py +++ b/tests/test_checktab.py @@ -167,3 +167,35 @@ def test_singlefile(size, ext, index, version, wind): widges = checktab.treeWidget.itemWidgets assert all(i.total == i.value for i in widges.values()) rmpath(tfile, metafile) + + +@pytest.mark.parametrize("version", [1, 2, 3]) +def test_singlefile_large(version, wind): + """Test the singlefile with large size for create and check tabs.""" + window, _ = wind + createtab = window.central.createWidget + checktab = window.central.checkWidget + window.central.setCurrentWidget(checktab) + testfile = str(tempfile(exp=28)) + tfile = testfile + '.dat' + os.rename(testfile, tfile) + metafile = tfile + ".torrent" + createtab.path_input.clear() + createtab.output_input.clear() + createtab.browse_file_button.browse(tfile) + createtab.output_input.setText(metafile) + btns = [createtab.v1button, createtab.v2button, createtab.hybridbutton] + for i, btn in enumerate(btns): + if i + 1 == version: + btn.click() + break + createtab.submit_button.click() + createtab.submit_button.join() + checktab.fileInput.clear() + checktab.searchInput.clear() + checktab.fileInput.setText(metafile) + checktab.searchInput.setText(tfile) + checktab.checkButton.click() + widges = checktab.treeWidget.itemWidgets + assert all(i.total == i.value for i in widges.values()) + rmpath(tfile, metafile) diff --git a/tests/test_edittab.py b/tests/test_edittab.py index 2cb9bf1..374910b 100644 --- a/tests/test_edittab.py +++ b/tests/test_edittab.py @@ -123,7 +123,7 @@ def test_editor_table_fields(wind, ttorrent): for url in ['url8', 'url9']: wig.add_button.click() wig.line_edit.setText(url) - wig.combo.focusOutEvent(None) + wig.add_button.click() lst = [wig.combo.itemText(j) for j in range(wig.combo.count())] assert len([i for i in ['url8', 'url9'] if i in lst]) == 2 wig.remove_button.click() diff --git a/torrentfileQt/__init__.py b/torrentfileQt/__init__.py index ee7e856..7fa2be6 100644 --- a/torrentfileQt/__init__.py +++ b/torrentfileQt/__init__.py @@ -25,9 +25,16 @@ from torrentfileQt.window import Application, Window, alt_start, start -myappid = f'TorrentfileQt.{__version__}' -if sys.platform == 'win32': +myappid = f"TorrentfileQt.{__version__}" +if sys.platform == "win32": ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid) __author__ = "alexpdev" -__all__ = ["Application", "Window", "alt_start", "start", "__version__", "ASSETS"] +__all__ = [ + "Application", + "Window", + "alt_start", + "start", + "__version__", + "ASSETS", +] diff --git a/assets/icons/archive.png b/torrentfileQt/assets/archive.png similarity index 100% rename from assets/icons/archive.png rename to torrentfileQt/assets/archive.png diff --git a/assets/icons/arrow-down.png b/torrentfileQt/assets/arrow-down.png similarity index 100% rename from assets/icons/arrow-down.png rename to torrentfileQt/assets/arrow-down.png diff --git a/assets/icons/arrow-downcopy.png b/torrentfileQt/assets/arrow-downcopy.png similarity index 100% rename from assets/icons/arrow-downcopy.png rename to torrentfileQt/assets/arrow-downcopy.png diff --git a/assets/icons/file.png b/torrentfileQt/assets/file.png similarity index 100% rename from assets/icons/file.png rename to torrentfileQt/assets/file.png diff --git a/assets/icons/folder.png b/torrentfileQt/assets/folder.png similarity index 100% rename from assets/icons/folder.png rename to torrentfileQt/assets/folder.png diff --git a/assets/icons/hash.png b/torrentfileQt/assets/hash.png similarity index 100% rename from assets/icons/hash.png rename to torrentfileQt/assets/hash.png diff --git a/assets/icons/music.png b/torrentfileQt/assets/music.png similarity index 100% rename from assets/icons/music.png rename to torrentfileQt/assets/music.png diff --git a/assets/icons/plus.png b/torrentfileQt/assets/plus.png similarity index 100% rename from assets/icons/plus.png rename to torrentfileQt/assets/plus.png diff --git a/assets/icons/scale.png b/torrentfileQt/assets/scale.png similarity index 100% rename from assets/icons/scale.png rename to torrentfileQt/assets/scale.png diff --git a/torrentfileQt/assets/torrentfile.ico b/torrentfileQt/assets/torrentfile.ico new file mode 100644 index 0000000..51c322b Binary files /dev/null and b/torrentfileQt/assets/torrentfile.ico differ diff --git a/torrentfileQt/assets/torrentfile.png b/torrentfileQt/assets/torrentfile.png new file mode 100644 index 0000000..ffcfa70 Binary files /dev/null and b/torrentfileQt/assets/torrentfile.png differ diff --git a/assets/icons/video.png b/torrentfileQt/assets/video.png similarity index 100% rename from assets/icons/video.png rename to torrentfileQt/assets/video.png diff --git a/torrentfileQt/checkTab.py b/torrentfileQt/checkTab.py index de7a940..dc288dd 100644 --- a/torrentfileQt/checkTab.py +++ b/torrentfileQt/checkTab.py @@ -25,11 +25,22 @@ 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 PySide6.QtWidgets import ( + QFileDialog, + QFormLayout, + QHBoxLayout, + QLabel, + QLineEdit, + QPlainTextEdit, + QProgressBar, + QPushButton, + QSplitter, + QToolButton, + QTreeWidget, + QTreeWidgetItem, + QVBoxLayout, + QWidget, +) from torrentfile.recheck import Checker ASSETS = os.environ["ASSETS"] @@ -307,13 +318,23 @@ def __init__(self, parent=None, size=0): super().__init__(parent=parent) self.total = size self.setValue(0) + size = self.normalize(size) self.setRange(0, size) self.valueChanged.connect(self.addValue) + def normalize(self, val): + """Convert larger values into smaller increments.""" + if self.total > 10_000_000: + val = val // (2**20) + elif self.total > 10_000: + val = val // (2**10) + return val + def addValue(self, value): """Increase value of progressbar.""" currentvalue = self.value() - addedVal = currentvalue + value + out = self.normalize(value) + addedVal = currentvalue + out self.setValue(addedVal) @@ -326,7 +347,7 @@ class TreeWidget(QTreeWidget): parent(`QWidget`, default=None) """ - addPathChild = Signal([str, int]) + addPathChild = Signal([str, str]) reChecking = Signal([str, str]) addValue = Signal([str, int]) addCount = Signal([str, int]) @@ -335,13 +356,14 @@ def __init__(self, parent=None): """Constructor for Tree Widget.""" super().__init__(parent=parent) self.window = parent.window - self.setColumnCount(3) - self.setIndentation(15) + self.setColumnCount(2) + self.setIndentation(12) self.item = self.invisibleRootItem() self.item.setExpanded(True) header = self.header() header.setSectionResizeMode(0, header.ResizeMode.ResizeToContents) header.setSectionResizeMode(1, header.ResizeMode.ResizeToContents) + header.setStretchLastSection(True) self.setHeaderHidden(True) self.itemWidgets = {} self.paths = [] @@ -381,6 +403,7 @@ def clear(self): def add_path_child(self, path, size): """Add branch to tree.""" path = Path(path) + size = int(size) partials = path.parts item, item_tree = None, self.item_tree for i, partial in enumerate(partials): @@ -394,27 +417,23 @@ def add_path_child(self, path, size): item_tree[partial] = {"widget": item} if i == len(partials) - 1: if path.suffix in [".avi", ".mp4", ".mkv", ".mov"]: - fileicon = QIcon(os.path.join(ASSETS, "icons", "video.png")) + fileicon = QIcon(os.path.join(ASSETS, "video.png")) elif path.suffix in [".rar", ".zip", ".7z", ".tar", ".gz"]: - fileicon = QIcon( - os.path.join(ASSETS, "icons", "archive.png") - ) + fileicon = QIcon(os.path.join(ASSETS, "archive.png")) elif re.match(r"\.r\d+$", path.suffix): - fileicon = QIcon( - os.path.join(ASSETS, "icons", "archive.png") - ) + fileicon = QIcon(os.path.join(ASSETS, "archive.png")) elif path.suffix in [".mp3", ".wav", ".flac", ".m4a"]: - fileicon = QIcon(os.path.join(ASSETS, "icons", "music.png")) + fileicon = QIcon(os.path.join(ASSETS, "music.png")) else: - fileicon = QIcon(os.path.join(ASSETS, "icons", "file.png")) + fileicon = QIcon(os.path.join(ASSETS, "file.png")) progressBar = ProgressBar(parent=None, size=size) - self.setItemWidget(item, 2, progressBar) + self.setItemWidget(item, 1, progressBar) item.progbar = progressBar self.itemWidgets[str(path)] = item else: - fileicon = QIcon(os.path.join(ASSETS, "icons", "folder.png")) + fileicon = QIcon(os.path.join(ASSETS, "folder.png")) item.setIcon(0, fileicon) - item.setText(1, partial) + item.setText(0, partial) item_tree = item_tree[partial] self.window.app.processEvents() self.paths.append(path) @@ -442,7 +461,7 @@ def addTreeWidgets(self): else: relpath = os.path.relpath(val["path"], self.root) length = val["length"] - self.tree.addPathChild.emit(relpath, length) + self.tree.addPathChild.emit(relpath, str(length)) def iter_hashes(self): """Iterate through hashes and compare to torrentfile hashes.""" diff --git a/torrentfileQt/createTab.py b/torrentfileQt/createTab.py index 52dbb2c..3be242c 100644 --- a/torrentfileQt/createTab.py +++ b/torrentfileQt/createTab.py @@ -27,10 +27,21 @@ from threading import Thread 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.torrent import TorrentFile, TorrentFileHybrid, TorrentFileV2 from torrentfile.utils import path_piece_length @@ -65,7 +76,7 @@ def __init__(self, parent=None): self.path_label = QLabel("Path: ", parent=self) self.output_label = QLabel("Save To: ", parent=self) - self.version_label = QLabel("Meta Version: ", parent=self) + self.version_label = QLabel("Version: ", parent=self) self.comment_label = QLabel("Comment: ", parent=self) self.announce_label = QLabel("Trackers: ", parent=self) self.web_seed_label = QLabel("Web-Seeds: ") @@ -229,9 +240,9 @@ def submit(self): args["announce"] = announce url_list = self.widget.web_seed_input.toPlainText() - url_list = [i for i in url_list.split('\n') if i] + url_list = [i for i in url_list.split("\n") if i] if url_list: - args['url_list'] = url_list + args["url_list"] = url_list # Calculates piece length if not specified by user. outtext = os.path.realpath(self.widget.output_input.text()) @@ -326,9 +337,9 @@ def browse(self, path=None): self.window.output_input.setText(path + ".torrent") piece_length = path_piece_length(path) if piece_length < (2**20): - val = f"{piece_length//(2**10)}KB" + val = f"{piece_length//(2**10)} KiB" else: - val = f"{piece_length//(2**20)}MB" + val = f"{piece_length//(2**20)} MiB" for i in range(self.window.piece_length.count()): if self.window.piece_length.itemText(i) == val: self.window.piece_length.setCurrentIndex(i) @@ -371,9 +382,9 @@ def browse(self, path=None): except PermissionError: # pragma: no cover return if piece_length < (2**20): - val = f"{piece_length//(2**10)}KB" + val = f"{piece_length//(2**10)} KiB" else: # pragma: no cover - val = f"{piece_length//(2**20)}MB" + val = f"{piece_length//(2**20)} MiB" for i in range(self.window.piece_length.count()): if self.window.piece_length.itemText(i) == val: self.window.piece_length.setCurrentIndex(i) @@ -395,10 +406,10 @@ def __init__(self, parent=None): def piece_length(cls, parent=None): """Create a piece_length combobox.""" box = cls(parent=parent) - for exp in range(14, 26): + for exp in range(14, 28): if exp < 20: - item = str((2**exp) // (2**10)) + "KB" + item = str((2**exp) // (2**10)) + " KiB" else: - item = str((2**exp) // (2**20)) + "MB" + item = str((2**exp) // (2**20)) + " MiB" box.addItem(item, 2**exp) return box diff --git a/torrentfileQt/editorTab.py b/torrentfileQt/editorTab.py index eb5e8d4..783070f 100644 --- a/torrentfileQt/editorTab.py +++ b/torrentfileQt/editorTab.py @@ -24,10 +24,19 @@ import pyben from PySide6.QtCore import Qt, Signal -from PySide6.QtWidgets import (QComboBox, QFileDialog, QHBoxLayout, QLabel, - QLineEdit, QPushButton, QTableWidget, - QTableWidgetItem, QToolButton, QVBoxLayout, - QWidget) +from PySide6.QtWidgets import ( + QComboBox, + QFileDialog, + QHBoxLayout, + QLabel, + QLineEdit, + QPushButton, + QTableWidget, + QTableWidgetItem, + QToolButton, + QVBoxLayout, + QWidget, +) from torrentfileQt.qss import table_styles @@ -87,11 +96,12 @@ def dragMoveEvent(self, event): self.counter += 1 return event.ignore() - def dropEvent(self, event): + def dropEvent(self, event) -> bool: """Drag drop event for widgit.""" urls = event.mimeData().urls() path = urls[0].toLocalFile() if os.path.exists(path): + self.table.clear() self.line.setText(path) self.table.handleTorrent.emit(path) return True @@ -101,7 +111,7 @@ def dropEvent(self, event): class Button(QPushButton): """Button Widget for saving results to .torrent file.""" - def __init__(self, text, parent=None): + def __init__(self, text: str, parent=None): """Constructor for the save button on torrent editor tab.""" super().__init__(text, parent=parent) self.widget = parent @@ -149,7 +159,7 @@ def __init__(self, parent=None): self.window = parent.window self.clicked.connect(self.browse) - def browse(self, path=None): + def browse(self, path: str = None): """Browse method for finding the .torrent file user wishes to edit.""" if not path: # pragma: no coverage path, _ = QFileDialog.getOpenFileName( @@ -169,7 +179,7 @@ class AddItemButton(QToolButton): def __init__(self, parent): """Construct the Button.""" super().__init__(parent) - self.setStyleSheet(table_styles['button']) + self.setStyleSheet(table_styles["button"]) self.parent = parent self.setText("add") self.box = None @@ -183,7 +193,7 @@ def add_item(self): self.box.insertItem(0, current, 2) self.box.insertItem(0, "", 2) self.box.setCurrentIndex(0) - self.box.lineEdit().setFocus() + self.parent.line_edit.setReadOnly(True) class RemoveItemButton(QToolButton): @@ -192,7 +202,7 @@ class RemoveItemButton(QToolButton): def __init__(self, parent): """Construct the Button.""" super().__init__(parent) - self.setStyleSheet(table_styles['button']) + self.setStyleSheet(table_styles["button"]) self.parent = parent self.setText("remove") self.box = None @@ -202,6 +212,7 @@ def remove_item(self): """Take action when button is pressed.""" index = self.box.currentIndex() self.box.removeItem(index) + self.parent.line_edit.setReadOnly(True) class Table(QTableWidget): @@ -291,18 +302,27 @@ class Combo(QComboBox): def __init__(self, parent=None): """Construct a combobox for table widget cell.""" super().__init__(parent=parent) + self.widget = parent self.setStyleSheet(table_styles["ComboBox"]) self.setInsertPolicy(self.InsertPolicy.InsertAtBottom) self.setDuplicatesEnabled(False) + self.widget.line_edit.setReadOnly(True) - def focusOutEvent(self, _): + def focusOutEvent(self, _): # pragma: nocover """Add item when focus changes.""" + super().focusOutEvent(_) current = self.currentText().strip() items = [self.itemText(i) for i in range(self.count())] blanks = [i for i in range(len(items)) if not items[i].strip()] list(map(self.removeItem, blanks[::-1])) if current and current not in items: self.insertItem(0, current, 2) + self.widget.line_edit.setReadOnly(True) + + def focusInEvent(self, _): # pragma: nocover + """Make line edit widget active when clicking in to box.""" + super().focusInEvent(_) + self.widget.line_edit.setReadOnly(False) def __init__(self, parent=None): """Construct the widget and it's sub widgets.""" @@ -311,9 +331,9 @@ def __init__(self, parent=None): self.setLayout(self.layout) self.layout.setSpacing(0) self.layout.setContentsMargins(0, 0, 0, 0) - self.combo = self.Combo() self.line_edit = QLineEdit(parent=self) self.line_edit.setStyleSheet(table_styles["LineEdit"]) + self.combo = self.Combo(parent=self) self.layout.addWidget(self.combo) self.combo.setLineEdit(self.line_edit) self.add_button = AddItemButton(self) diff --git a/torrentfileQt/infoTab.py b/torrentfileQt/infoTab.py index b708508..609aad8 100644 --- a/torrentfileQt/infoTab.py +++ b/torrentfileQt/infoTab.py @@ -27,9 +27,16 @@ 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, infoLineEditLight @@ -76,18 +83,18 @@ def apply_value(self, text, length): if i + 1 == len(partials): _, suffix = os.path.splitext(partial) if suffix in [".mp4", ".mkv"]: - iconpath = os.path.join(ASSETS, "icons", "video.png") + iconpath = os.path.join(ASSETS, "video.png") elif suffix in [".rar", ".zip", ".7z", ".tar", ".gz"]: - iconpath = os.path.join(ASSETS, "icons", "archive.png") + iconpath = os.path.join(ASSETS, "archive.png") elif re.match(r"\.r\d+", suffix): - iconpath = os.path.join(ASSETS, "icons", "archive.png") + iconpath = os.path.join(ASSETS, "archive.png") elif suffix in [".wav", ".mp3", ".flac", ".m4a", ".aac"]: - iconpath = os.path.join(ASSETS, "icons", "music.png") + iconpath = os.path.join(ASSETS, "music.png") else: - iconpath = os.path.join(ASSETS, "icons", "file.png") + iconpath = os.path.join(ASSETS, "file.png") item.setLength(length) else: - iconpath = os.path.join(ASSETS, "icons", "folder.png") + iconpath = os.path.join(ASSETS, "folder.png") icon = QIcon(iconpath) item.setIcon(0, icon) item.setText(1, partial) @@ -109,7 +116,7 @@ def __init__(self, group): def setLength(self, length): """Set length leaf for tree branches.""" child = TreeItem(0) - icon = QIcon(os.path.join(ASSETS, "icons", "scale.png")) + icon = QIcon(os.path.join(ASSETS, "scale.png")) child.setIcon(0, icon) child.setText(1, f"Size: {length} (bytes)") self.setExpanded(True) diff --git a/torrentfileQt/magnetTab.py b/torrentfileQt/magnetTab.py index 9cb174b..6cc2626 100644 --- a/torrentfileQt/magnetTab.py +++ b/torrentfileQt/magnetTab.py @@ -32,7 +32,7 @@ class MagnetWidget(QWidget): """Tab for creating magnet URL's and downloading torrentfiles from them.""" def __init__(self, parent=None): - """Initialize the widget form for creating magnet URI's from a metafile.""" + """Initialize the widget for creating magnet URI's from a metafile.""" super().__init__(parent=parent) self.window = parent.window self.setStyleSheet(""" diff --git a/torrentfileQt/qss.py b/torrentfileQt/qss.py index 03fc3de..4e71ae4 100644 --- a/torrentfileQt/qss.py +++ b/torrentfileQt/qss.py @@ -21,7 +21,7 @@ import os from urllib.request import pathname2url as path2url -arrow = os.path.join(os.environ['ASSETS'], 'icons', 'arrow-down.png') +arrow = os.path.join(os.environ["ASSETS"], "arrow-down.png") dark_theme = """ @@ -763,5 +763,5 @@ padding: 2px; border-radius: 12px; } - """ + """, } diff --git a/torrentfileQt/version.py b/torrentfileQt/version.py index a50cef1..63bc40b 100644 --- a/torrentfileQt/version.py +++ b/torrentfileQt/version.py @@ -18,16 +18,16 @@ import os +__version__ = "0.3.5" + + def _conf(): """Create some enviornment variables.""" parent = os.path.dirname(__file__) - top = os.path.dirname(parent) - assets = os.path.join(top, 'assets') + assets = os.path.join(parent, "assets") path = os.path.relpath(assets, ".") return path ASSETS = str(_conf()) -os.environ['ASSETS'] = ASSETS - -__version__ = "0.3.3" +os.environ["ASSETS"] = ASSETS diff --git a/torrentfileQt/window.py b/torrentfileQt/window.py index b3b5349..b48f52d 100644 --- a/torrentfileQt/window.py +++ b/torrentfileQt/window.py @@ -23,8 +23,7 @@ from PySide6.QtCore import Signal 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 @@ -58,7 +57,7 @@ def __init__(self, parent=None, app=None): super().__init__(parent=parent) self.app = app self.menubar = MenuBar(parent=self) - self.icon = QIcon(os.path.join(ASSETS, "favicon.png")) + self.icon = QIcon(os.path.join(ASSETS, "torrentfile.png")) self.setObjectName("Mainwindow") self.setWindowTitle("TorrentfileQt") self.setWindowIcon(self.icon)