Skip to content

Commit

Permalink
Merge pull request #6 from matuzalemmuller/v3.0.1
Browse files Browse the repository at this point in the history
v3.0.1
  • Loading branch information
matuzalemmuller committed Jan 31, 2023
2 parents 5bbbaeb + 1cbc11a commit 3a16f14
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 36 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@ __pycache__
/pkg/linux/dummyfilescreator.rpm

# Local notes
TODO.md
TODO.md

# vscode
.vscode
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ For a bash-based (more performant) solution, see [this project](https://github.c

## Installation

Pre-compiled packages for Windows are available on the [releases page](https://github.com/matuzalemmuller/dummy-files-creator/releases). Linux and macOS packages have been discontinued for now.
Pre-compiled packages for Windows are available on the [releases page](https://github.com/matuzalemmuller/dummy-files-creator/releases). Linux and macOS packages may be supported in the future, depending on demand.

### Cross-platform (recommended)

Expand Down
2 changes: 1 addition & 1 deletion design/qt/About.ui
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;2022 &lt;a href=&quot;https://github.com/matuzalemmuller/dummy-files-creator&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Dummy Files Creator&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;by &lt;a href=&quot;https://matuzalemmuller.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Matuzalem (Mat) Muller&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;https://github.com/matuzalemmuller/dummy-files-creator/releases/tag/v3.0.0&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;v3.0.0&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;2023 &lt;a href=&quot;https://github.com/matuzalemmuller/dummy-files-creator&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Dummy Files Creator&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;by &lt;a href=&quot;https://matuzalemmuller.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;Matuzalem (Mat) Muller&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;p align=&quot;center&quot;&gt;&lt;a href=&quot;https://github.com/matuzalemmuller/dummy-files-creator/releases/tag/v3.0.1&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;v3.0.1&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
Expand Down
63 changes: 32 additions & 31 deletions dummyfilescreator/dfc_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,24 @@ def __init__(self): # pylint: disable=too-many-branches
"--output", "-o", required=True, help="Location where files will be created"
)
parser.add_argument(
"--n-files", "-n", required=True, help="Number of files to be created"
"--n-files",
"-n",
required=True,
type=int,
help="Number of files to be created",
)
parser.add_argument(
"--size", "-fs", required=True, help="Size of files to be created"
"--size", "-fs", required=True, type=int, help="Size of files to be created"
)
parser.add_argument(
"--unit",
"-fu",
required=True,
help="Size unit. Accepted values: KiB, MiB, GiB",
)
parser.add_argument("--chunk-size", "-cs", required=False, help="Chunk size")
parser.add_argument(
"--chunk-size", "-cs", required=False, type=int, help="Chunk size"
)
parser.add_argument(
"--chunk-unit",
"-cu",
Expand Down Expand Up @@ -92,8 +98,13 @@ def __init__(self): # pylint: disable=too-many-branches
output = output[:-1]
self.__folder_path = output

self.__number_files = int(args["n_files"])
self.__size_file = int(args["size"])
if args["n_files"] <= 0:
parser.error("argument --n_files/-n must be greater than 0")
self.__number_files = args["n_files"]

if args["size"] <= 0:
parser.error("argument --size/-fs must be greater than 0")
self.__size_file = args["size"]

if args["unit"] == "KiB" or args["unit"] == "MiB" or args["unit"] == "GiB":
self.__size_unit = f"{args['unit']}"
Expand All @@ -109,7 +120,9 @@ def __init__(self): # pylint: disable=too-many-branches
or args["chunk_unit"] == "MiB"
or args["chunk_unit"] == "GiB"
):
self.__chunk_size = int(args["chunk_size"])
if args["chunk_size"] <= 0:
parser.error("argument --chunk-size/-cs must be greater than 0")
self.__chunk_size = args["chunk_size"]
self.__chunk_unit = f"{args['chunk_unit']}"
else:
print(
Expand Down Expand Up @@ -178,19 +191,18 @@ def __update_cli_progress(self):
def run(self):
"""Start the file creation process."""
try:
self.__files_creator = FilesCreator(
folder_path=self.__folder_path,
number_files=self.__number_files,
size_file=self.__size_file,
size_unit=self.__size_unit,
chunk_size=self.__chunk_size,
chunk_unit=self.__chunk_unit,
log_path=self.__log_path,
log_hash=self.__log_hash,
error_function=self.error_function,
)
if self.__progressbar or self.__verbose:
self.__files_creator = FilesCreator(
folder_path=self.__folder_path,
number_files=self.__number_files,
size_file=self.__size_file,
size_unit=self.__size_unit,
chunk_size=self.__chunk_size,
chunk_unit=self.__chunk_unit,
log_path=self.__log_path,
log_hash=self.__log_hash,
error_function=self.error_function,
)

self.__pbar_total = tqdm(
range(self.__number_files), unit=" files", leave=False
)
Expand All @@ -200,19 +212,6 @@ def run(self):
unit=" chunks",
leave=False,
)
else:
self.__files_creator = FilesCreator(
folder_path=self.__folder_path,
number_files=self.__number_files,
size_file=self.__size_file,
size_unit=self.__size_unit,
chunk_size=self.__chunk_size,
chunk_unit=self.__chunk_unit,
log_path=self.__log_path,
log_hash=self.__log_hash,
error_function=self.error_function,
)

self.__files_creator.start()
if self.__progressbar or self.__verbose:
self.__update_thread = threading.Thread(
Expand All @@ -223,10 +222,12 @@ def run(self):
print(f"CLI: Error starting FilesCreator thread: {error}")
sys.exit(1)


def main():
"""Entrypoint in case this file is executed directly."""
app = DFCCli()
app.run()


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion dummyfilescreator/qt_about_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ def setupUi(self, About):
def retranslateUi(self, About):
_translate = QtCore.QCoreApplication.translate
About.setWindowTitle(_translate("About", "About"))
self.label.setText(_translate("About", "<html><head/><body><p align=\"center\">2022 <a href=\"https://github.com/matuzalemmuller/dummy-files-creator\"><span style=\" text-decoration: underline; color:#0000ff;\">Dummy Files Creator</span></a></p><p align=\"center\">by <a href=\"https://matuzalemmuller.com\"><span style=\" text-decoration: underline; color:#0000ff;\">Matuzalem (Mat) Muller</span></a></p><p align=\"center\"><a href=\"https://github.com/matuzalemmuller/dummy-files-creator/releases/tag/v3.0.0\"><span style=\" text-decoration: underline; color:#0000ff;\">v3.0.0</span></a></p></body></html>"))
self.label.setText(_translate("About", "<html><head/><body><p align=\"center\">2023 <a href=\"https://github.com/matuzalemmuller/dummy-files-creator\"><span style=\" text-decoration: underline; color:#0000ff;\">Dummy Files Creator</span></a></p><p align=\"center\">by <a href=\"https://matuzalemmuller.com\"><span style=\" text-decoration: underline; color:#0000ff;\">Matuzalem (Mat) Muller</span></a></p><p align=\"center\"><a href=\"https://github.com/matuzalemmuller/dummy-files-creator/releases/tag/v3.0.1\"><span style=\" text-decoration: underline; color:#0000ff;\">v3.0.1</span></a></p></body></html>"))
2 changes: 1 addition & 1 deletion package.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Info]
description=Desktop & CLI tool to generate dummy files
version=3.0.0
version=3.0.1
author=Matuzalem (Mat) Muller
url=https://github.com/matuzalemmuller/dummy-files-creator
author_email=matuzalemtech@gmail.com
Expand Down

0 comments on commit 3a16f14

Please sign in to comment.