Skip to content

Commit

Permalink
fix docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
tobi committed Apr 7, 2022
1 parent 376b692 commit 1773493
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions BlenderUpdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
app = QtWidgets.QApplication(sys.argv)


appversion = "1.10.0"
appversion = "1.10.1"
dir_ = ""
config = configparser.ConfigParser()
btn = {}
Expand Down Expand Up @@ -116,6 +116,9 @@ def progress(self, count, blockSize, totalSize):
self.update.emit(percent)

def run(self):
"""
It downloads the file, emits a signal when it's done, and then unpacks the file
"""
urllib.request.urlretrieve(self.url, self.filename, reporthook=self.progress)
self.finishedDL.emit()
shutil.unpack_archive(self.filename, "./blendertemp/")
Expand Down Expand Up @@ -257,7 +260,9 @@ def about(self):
QtWidgets.QMessageBox.about(self, "About", aboutText)

def check_dir(self):
"""Check if a vaild directory has been set by the user."""
"""
Check if a valid directory has been set by the user
"""
global dir_
dir_ = self.line_path.text()
if not os.path.exists(dir_):
Expand All @@ -272,7 +277,12 @@ def check_dir(self):
self.check()

def hbytes(self, num):
"""Translate to human readable file size."""
"""
Return a human readable file size
:param num: The number of bytes to convert
:return: a string of the number of bytes in a more human readable way.
"""
for x in [" bytes", " KB", " MB", " GB"]:
if num < 1024.0:
return "%3.1f%s" % (num, x)
Expand Down Expand Up @@ -440,7 +450,12 @@ def filterwindows():
filterall()

def download(self, entry):
"""Download routines."""
"""
Download the file
:param entry: The version of Blender you want to download
:return: Nothing.
"""
global dir_

url = "https://builder.blender.org/download/daily/" + entry
Expand Down Expand Up @@ -517,6 +532,9 @@ def updatepb(self, percent):
self.progressBar.setValue(percent)

def extraction(self):
"""
Extract the downloaded file to a temporary directory
"""
logger.info("Extracting to temp directory")
self.lbl_task.setText("Extracting...")
self.btn_Quit.setEnabled(False)
Expand Down Expand Up @@ -588,6 +606,9 @@ def exec_linux(self):


def main():
"""
This function creates an instance of the BlenderUpdater class and passes it to the Qt application
"""
app.setStyleSheet(qdarkstyle.load_stylesheet_pyside2())
window = BlenderUpdater()
window.setWindowTitle(f"Overmind Studios Blender Updater {appversion}")
Expand Down

0 comments on commit 1773493

Please sign in to comment.