Skip to content

Commit

Permalink
Add comments to code
Browse files Browse the repository at this point in the history
  • Loading branch information
matuzalemmuller committed May 20, 2019
1 parent af070c6 commit 25b741c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/tfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(self):
self._create_ui()


# Creates all UI elements
def _create_ui(self):
self._window_layout = QGridLayout()
self._window_layout.setContentsMargins(0,0,0,0)
Expand Down Expand Up @@ -144,17 +145,20 @@ def _create_ui(self):
self.setLayout(self._window_layout)


# Opens About window when Help is choosen in top menu
def _about_clicked(self):
About()


# Open native folder dialog to select where test files will be created
def _browse_clicked(self):
dialog = QFileDialog()
path = str(QFileDialog.getExistingDirectory(dialog,
"Select Directory"))
self._path_textbox.setText(path)


# Action to button Create
def _create_clicked(self):
if self._path_textbox.text() == "" or \
self._number_files_textbox.text() == "" or \
Expand Down Expand Up @@ -195,6 +199,7 @@ def _create_clicked(self):
self._change_layout('Running')


# Action to button Close/Quit
def _close_clicked(self):
if self._close_button.text() == "Quit":
msg = QMessageBox()
Expand All @@ -210,6 +215,7 @@ def _close_clicked(self):
sys.exit(0)


# Action to button Cancel
def _cancel_clicked(self):
msg = QMessageBox()
msg.setIcon(QMessageBox.Information)
Expand All @@ -223,6 +229,7 @@ def _cancel_clicked(self):
self._change_layout('Stopped')


# Changes layout when app is creating files / idle
def _change_layout(self, status):
if status == 'Running':
disabled_style = "background-color: rgb(210,210,210); border: gray"
Expand Down Expand Up @@ -271,6 +278,7 @@ def _change_layout(self, status):
self.repaint()


# Method to treat error during file creation
@pyqtSlot(str)
def _abort(self, error: str):
print(error)
Expand All @@ -284,6 +292,7 @@ def _abort(self, error: str):
self._change_layout('Stopped')


# Method to treat files creation completion
@pyqtSlot()
def _done(self):
self._change_layout('Stopped')
Expand All @@ -299,6 +308,7 @@ def _done(self):
msg.exec_()


# Runs when each file is created to change progress bar UI values
@pyqtSlot(str, int)
def _step(self, file_name: str, number_files: int):
self.progress_label.setText(str(self.Files.created_files) + "/" + \
Expand Down

0 comments on commit 25b741c

Please sign in to comment.