Skip to content

Commit 05486bf

Browse files
committed
black reformats
1 parent b0cac15 commit 05486bf

File tree

9 files changed

+70
-70
lines changed

9 files changed

+70
-70
lines changed

pyqt-calculator-tutorial/examples/dialog.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,21 @@ class Dialog(QDialog):
1818
def __init__(self, parent=None):
1919
"""Initializer."""
2020
super().__init__(parent)
21-
self.setWindowTitle('QDialog')
21+
self.setWindowTitle("QDialog")
2222
dlgLayout = QVBoxLayout()
2323
formLayout = QFormLayout()
24-
formLayout.addRow('Name:', QLineEdit())
25-
formLayout.addRow('Age:', QLineEdit())
26-
formLayout.addRow('Job:', QLineEdit())
27-
formLayout.addRow('Hobbies:', QLineEdit())
24+
formLayout.addRow("Name:", QLineEdit())
25+
formLayout.addRow("Age:", QLineEdit())
26+
formLayout.addRow("Job:", QLineEdit())
27+
formLayout.addRow("Hobbies:", QLineEdit())
2828
dlgLayout.addLayout(formLayout)
2929
btns = QDialogButtonBox()
30-
btns.setStandardButtons(
31-
QDialogButtonBox.Cancel | QDialogButtonBox.Ok)
30+
btns.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok)
3231
dlgLayout.addWidget(btns)
3332
self.setLayout(dlgLayout)
3433

3534

36-
if __name__ == '__main__':
35+
if __name__ == "__main__":
3736
app = QApplication(sys.argv)
3837
dlg = Dialog()
3938
dlg.show()

pyqt-calculator-tutorial/examples/f_layout.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
app = QApplication(sys.argv)
1313
window = QWidget()
14-
window.setWindowTitle('QFormLayout')
14+
window.setWindowTitle("QFormLayout")
1515
layout = QFormLayout()
16-
layout.addRow('Name:', QLineEdit())
17-
layout.addRow('Age:', QLineEdit())
18-
layout.addRow('Job:', QLineEdit())
19-
layout.addRow('Hobbies:', QLineEdit())
16+
layout.addRow("Name:", QLineEdit())
17+
layout.addRow("Age:", QLineEdit())
18+
layout.addRow("Job:", QLineEdit())
19+
layout.addRow("Hobbies:", QLineEdit())
2020
window.setLayout(layout)
2121
window.show()
2222
sys.exit(app.exec_())

pyqt-calculator-tutorial/examples/g_layout.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111

1212
app = QApplication(sys.argv)
1313
window = QWidget()
14-
window.setWindowTitle('QGridLayout')
14+
window.setWindowTitle("QGridLayout")
1515
layout = QGridLayout()
16-
layout.addWidget(QPushButton('Button (0, 0)'), 0, 0)
17-
layout.addWidget(QPushButton('Button (0, 1)'), 0, 1)
18-
layout.addWidget(QPushButton('Button (0, 2)'), 0, 2)
19-
layout.addWidget(QPushButton('Button (1, 0)'), 1, 0)
20-
layout.addWidget(QPushButton('Button (1, 1)'), 1, 1)
21-
layout.addWidget(QPushButton('Button (1, 2)'), 1, 2)
22-
layout.addWidget(QPushButton('Button (2, 0)'), 2, 0)
23-
layout.addWidget(QPushButton('Button (2, 1) + 2 Columns Span'), 2, 1, 1, 2)
16+
layout.addWidget(QPushButton("Button (0, 0)"), 0, 0)
17+
layout.addWidget(QPushButton("Button (0, 1)"), 0, 1)
18+
layout.addWidget(QPushButton("Button (0, 2)"), 0, 2)
19+
layout.addWidget(QPushButton("Button (1, 0)"), 1, 0)
20+
layout.addWidget(QPushButton("Button (1, 1)"), 1, 1)
21+
layout.addWidget(QPushButton("Button (1, 2)"), 1, 2)
22+
layout.addWidget(QPushButton("Button (2, 0)"), 2, 0)
23+
layout.addWidget(QPushButton("Button (2, 1) + 2 Columns Span"), 2, 1, 1, 2)
2424
window.setLayout(layout)
2525
window.show()
2626
sys.exit(app.exec_())

pyqt-calculator-tutorial/examples/h_layout.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
app = QApplication(sys.argv)
1313
window = QWidget()
14-
window.setWindowTitle('QHBoxLayout')
14+
window.setWindowTitle("QHBoxLayout")
1515
layout = QHBoxLayout()
16-
layout.addWidget(QPushButton('Right'))
17-
layout.addWidget(QPushButton('Center'))
18-
layout.addWidget(QPushButton('Left'))
16+
layout.addWidget(QPushButton("Right"))
17+
layout.addWidget(QPushButton("Center"))
18+
layout.addWidget(QPushButton("Left"))
1919
window.setLayout(layout)
2020
window.show()
2121
sys.exit(app.exec_())

pyqt-calculator-tutorial/examples/hello.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414

1515
# 3. Create an instance of your application's GUI
1616
window = QWidget()
17-
window.setWindowTitle('PyQt5 App')
17+
window.setWindowTitle("PyQt5 App")
1818
window.setGeometry(100, 100, 280, 80)
1919
window.move(60, 15)
20-
helloMsg = QLabel('<h1>Hello World!</h1>', parent=window)
20+
helloMsg = QLabel("<h1>Hello World!</h1>", parent=window)
2121
helloMsg.move(60, 15)
2222

2323
# 4.Show your application's GUI

pyqt-calculator-tutorial/examples/main_window.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,28 @@ class Window(QMainWindow):
1717
def __init__(self, parent=None):
1818
"""Initializer."""
1919
super().__init__(parent)
20-
self.setWindowTitle('QMainWindow')
20+
self.setWindowTitle("QMainWindow")
2121
self.setCentralWidget(QLabel("I'm the Central Widget"))
2222
self._createMenu()
2323
self._createToolBar()
2424
self._createStatusBar()
2525

2626
def _createMenu(self):
2727
self.menu = self.menuBar().addMenu("&Menu")
28-
self.menu.addAction('&Exit', self.close)
28+
self.menu.addAction("&Exit", self.close)
2929

3030
def _createToolBar(self):
3131
tools = QToolBar()
3232
self.addToolBar(tools)
33-
tools.addAction('Exit', self.close)
33+
tools.addAction("Exit", self.close)
3434

3535
def _createStatusBar(self):
3636
status = QStatusBar()
3737
status.showMessage("I'm the Status Bar")
3838
self.setStatusBar(status)
3939

4040

41-
if __name__ == '__main__':
41+
if __name__ == "__main__":
4242
app = QApplication(sys.argv)
4343
win = Window()
4444
win.show()

pyqt-calculator-tutorial/examples/signals_slots.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313

1414
def greeting():
1515
"""Slot function."""
16-
msg.setText('Hello World!')
16+
msg.setText("Hello World!")
1717

1818

1919
app = QApplication(sys.argv)
2020
window = QWidget()
21-
window.setWindowTitle('Signals, and Slots')
21+
window.setWindowTitle("Signals, and Slots")
2222
layout = QVBoxLayout()
2323

24-
btn = QPushButton('Greet')
24+
btn = QPushButton("Greet")
2525
btn.clicked.connect(greeting) # Connect clicked to greeting()
2626

2727
layout.addWidget(btn)
28-
msg = QLabel('')
28+
msg = QLabel("")
2929
layout.addWidget(msg)
3030
window.setLayout(layout)
3131
window.show()

pyqt-calculator-tutorial/examples/v_layout.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
app = QApplication(sys.argv)
1313
window = QWidget()
14-
window.setWindowTitle('QVBoxLayout')
14+
window.setWindowTitle("QVBoxLayout")
1515
layout = QVBoxLayout()
16-
layout.addWidget(QPushButton('Top'))
17-
layout.addWidget(QPushButton('Center'))
18-
layout.addWidget(QPushButton('Bottom'))
16+
layout.addWidget(QPushButton("Top"))
17+
layout.addWidget(QPushButton("Center"))
18+
layout.addWidget(QPushButton("Bottom"))
1919
window.setLayout(layout)
2020
window.show()
2121
sys.exit(app.exec_())

pyqt-calculator-tutorial/pycalc/pycalc.py

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
from PyQt5.QtWidgets import QPushButton
2626
from PyQt5.QtCore import Qt
2727

28-
__version__ = '0.1'
29-
__author__ = 'Leodanis Pozo Ramos'
28+
__version__ = "0.1"
29+
__author__ = "Leodanis Pozo Ramos"
3030

31-
ERROR_MSG = 'ERROR'
31+
ERROR_MSG = "ERROR"
3232

3333

3434
# Create a subclass of QMainWindow to setup the calculator's GUI
@@ -39,7 +39,7 @@ def __init__(self):
3939
"""View initializer."""
4040
super().__init__()
4141
# Set some main window's properties
42-
self.setWindowTitle('PyCalc')
42+
self.setWindowTitle("PyCalc")
4343
self.setFixedSize(235, 235)
4444
# Create, and set the central widget, and the general layout
4545
self.generalLayout = QVBoxLayout()
@@ -66,27 +66,28 @@ def _createButtons(self):
6666
self.buttons = {}
6767
buttonsLayout = QGridLayout()
6868
# Button text | position on the QGridLayout
69-
buttons = {'7': (0, 0),
70-
'8': (0, 1),
71-
'9': (0, 2),
72-
'/': (0, 3),
73-
'C': (0, 4),
74-
'4': (1, 0),
75-
'5': (1, 1),
76-
'6': (1, 2),
77-
'*': (1, 3),
78-
'(': (1, 4),
79-
'1': (2, 0),
80-
'2': (2, 1),
81-
'3': (2, 2),
82-
'-': (2, 3),
83-
')': (2, 4),
84-
'0': (3, 0),
85-
'00': (3, 1),
86-
'.': (3, 2),
87-
'+': (3, 3),
88-
'=': (3, 4),
89-
}
69+
buttons = {
70+
"7": (0, 0),
71+
"8": (0, 1),
72+
"9": (0, 2),
73+
"/": (0, 3),
74+
"C": (0, 4),
75+
"4": (1, 0),
76+
"5": (1, 1),
77+
"6": (1, 2),
78+
"*": (1, 3),
79+
"(": (1, 4),
80+
"1": (2, 0),
81+
"2": (2, 1),
82+
"3": (2, 2),
83+
"-": (2, 3),
84+
")": (2, 4),
85+
"0": (3, 0),
86+
"00": (3, 1),
87+
".": (3, 2),
88+
"+": (3, 3),
89+
"=": (3, 4),
90+
}
9091
# Create the buttons, and add them to the grid layout
9192
for btn_text, pos in buttons.items():
9293
self.buttons[btn_text] = QPushButton(btn_text)
@@ -106,7 +107,7 @@ def displayText(self):
106107

107108
def clearDisplay(self):
108109
"""Clear the display."""
109-
self.setDisplayText('')
110+
self.setDisplayText("")
110111

111112

112113
# Create a Model to handle the calculator's operation
@@ -147,12 +148,12 @@ def _buildExpression(self, sub_exp):
147148
def _connectSignals(self):
148149
"""Connect signals, and slots."""
149150
for btn_text, btn in self._view.buttons.items():
150-
if btn_text not in {'=', 'C'}:
151+
if btn_text not in {"=", "C"}:
151152
btn.clicked.connect(partial(self._buildExpression, btn_text))
152153

153-
self._view.buttons['='].clicked.connect(self._calculateResult)
154+
self._view.buttons["="].clicked.connect(self._calculateResult)
154155
self._view.display.returnPressed.connect(self._calculateResult)
155-
self._view.buttons['C'].clicked.connect(self._view.clearDisplay)
156+
self._view.buttons["C"].clicked.connect(self._view.clearDisplay)
156157

157158

158159
# Client code
@@ -170,5 +171,5 @@ def main():
170171
sys.exit(pycalc.exec_())
171172

172173

173-
if __name__ == '__main__':
174+
if __name__ == "__main__":
174175
main()

0 commit comments

Comments
 (0)