diff --git a/poetry.lock b/poetry.lock index 87887c6..054f147 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,3 +1,11 @@ +[[package]] +category = "main" +description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +name = "appdirs" +optional = false +python-versions = "*" +version = "1.4.4" + [[package]] category = "main" description = "An abstract syntax tree for Python with inference support." @@ -11,6 +19,59 @@ lazy-object-proxy = ">=1.4.0,<1.5.0" six = ">=1.12,<2.0" wrapt = ">=1.11,<2.0" +[[package]] +category = "main" +description = "Classes Without Boilerplate" +name = "attrs" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "19.3.0" + +[package.extras] +azure-pipelines = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "pytest-azurepipelines"] +dev = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "sphinx", "pre-commit"] +docs = ["sphinx", "zope.interface"] +tests = ["coverage", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] + +[[package]] +category = "main" +description = "Removes unused imports and unused variables" +name = "autoflake" +optional = false +python-versions = "*" +version = "1.3.1" + +[package.dependencies] +pyflakes = ">=1.1.0" + +[[package]] +category = "main" +description = "The uncompromising code formatter." +name = "black" +optional = false +python-versions = ">=3.6" +version = "19.10b0" + +[package.dependencies] +appdirs = "*" +attrs = ">=18.1.0" +click = ">=6.5" +pathspec = ">=0.6,<1" +regex = "*" +toml = ">=0.9.4" +typed-ast = ">=1.4.0" + +[package.extras] +d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] + +[[package]] +category = "main" +description = "Composable command line interface toolkit" +name = "click" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "7.1.2" + [[package]] category = "main" description = "Cross-platform colored terminal text." @@ -20,6 +81,19 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" version = "0.4.3" +[[package]] +category = "main" +description = "the modular source code checker: pep8 pyflakes and co" +name = "flake8" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" +version = "3.8.3" + +[package.dependencies] +mccabe = ">=0.6.0,<0.7.0" +pycodestyle = ">=2.6.0a1,<2.7.0" +pyflakes = ">=2.2.0,<2.3.0" + [[package]] category = "main" description = "A Python utility / library to sort Python imports." @@ -74,6 +148,22 @@ optional = false python-versions = "*" version = "0.4.3" +[[package]] +category = "main" +description = "Utility library for gitignore style pattern matching of file paths." +name = "pathspec" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "0.8.0" + +[[package]] +category = "main" +description = "Python style guide checker" +name = "pycodestyle" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "2.6.0" + [[package]] category = "main" description = "Data validation and settings management using python 3.6 type hinting" @@ -87,6 +177,14 @@ dotenv = ["python-dotenv (>=0.10.4)"] email = ["email-validator (>=1.0.3)"] typing_extensions = ["typing-extensions (>=3.7.2)"] +[[package]] +category = "main" +description = "passive checker of Python programs" +name = "pyflakes" +optional = false +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "2.2.0" + [[package]] category = "main" description = "python code static checker" @@ -121,6 +219,14 @@ optional = false python-versions = ">=3.5" version = "12.8.0" +[[package]] +category = "main" +description = "Alternative regular expression module, to replace re." +name = "regex" +optional = false +python-versions = "*" +version = "2020.6.8" + [[package]] category = "main" description = "Python 2 and 3 compatibility utilities" @@ -153,6 +259,25 @@ optional = false python-versions = "*" version = "3.7.4.2" +[[package]] +category = "main" +description = "Modifies strings to all use the same (single/double) quote where possible." +name = "unify" +optional = false +python-versions = "*" +version = "0.5" + +[package.dependencies] +untokenize = "*" + +[[package]] +category = "main" +description = "Transforms tokens into original source code (while preserving whitespace)." +name = "untokenize" +optional = false +python-versions = "*" +version = "0.1.1" + [[package]] category = "main" description = "Module for decorators, wrappers and monkey patching." @@ -162,18 +287,41 @@ python-versions = "*" version = "1.12.1" [metadata] -content-hash = "4fb2a9046beef28349a221b9eafb67ef9c826d196cad3451bbb157140b9abc27" +content-hash = "ea51a01477920a61eca32a4fc3f044443fcd9c6a9d376897abe0220a343634a4" python-versions = "^3.8" [metadata.files] +appdirs = [ + {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, + {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, +] astroid = [ {file = "astroid-2.4.2-py3-none-any.whl", hash = "sha256:bc58d83eb610252fd8de6363e39d4f1d0619c894b0ed24603b881c02e64c7386"}, {file = "astroid-2.4.2.tar.gz", hash = "sha256:2f4078c2a41bf377eea06d71c9d2ba4eb8f6b1af2135bec27bbbb7d8f12bb703"}, ] +attrs = [ + {file = "attrs-19.3.0-py2.py3-none-any.whl", hash = "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c"}, + {file = "attrs-19.3.0.tar.gz", hash = "sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72"}, +] +autoflake = [ + {file = "autoflake-1.3.1.tar.gz", hash = "sha256:680cb9dade101ed647488238ccb8b8bfb4369b53d58ba2c8cdf7d5d54e01f95b"}, +] +black = [ + {file = "black-19.10b0-py36-none-any.whl", hash = "sha256:1b30e59be925fafc1ee4565e5e08abef6b03fe455102883820fe5ee2e4734e0b"}, + {file = "black-19.10b0.tar.gz", hash = "sha256:c2edb73a08e9e0e6f65a0e6af18b059b8b1cdd5bef997d7a0b181df93dc81539"}, +] +click = [ + {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, + {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, +] colorama = [ {file = "colorama-0.4.3-py2.py3-none-any.whl", hash = "sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff"}, {file = "colorama-0.4.3.tar.gz", hash = "sha256:e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1"}, ] +flake8 = [ + {file = "flake8-3.8.3-py2.py3-none-any.whl", hash = "sha256:15e351d19611c887e482fb960eae4d44845013cc142d42896e9862f775d8cf5c"}, + {file = "flake8-3.8.3.tar.gz", hash = "sha256:f04b9fcbac03b0a3e58c0ab3a0ecc462e023a9faf046d57794184028123aa208"}, +] isort = [ {file = "isort-4.3.21-py2.py3-none-any.whl", hash = "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"}, {file = "isort-4.3.21.tar.gz", hash = "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1"}, @@ -225,6 +373,14 @@ mypy-extensions = [ {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, ] +pathspec = [ + {file = "pathspec-0.8.0-py2.py3-none-any.whl", hash = "sha256:7d91249d21749788d07a2d0f94147accd8f845507400749ea19c1ec9054a12b0"}, + {file = "pathspec-0.8.0.tar.gz", hash = "sha256:da45173eb3a6f2a5a487efba21f050af2b41948be6ab52b6a1e3ff22bb8b7061"}, +] +pycodestyle = [ + {file = "pycodestyle-2.6.0-py2.py3-none-any.whl", hash = "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367"}, + {file = "pycodestyle-2.6.0.tar.gz", hash = "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"}, +] pydantic = [ {file = "pydantic-1.5.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:2a6904e9f18dea58f76f16b95cba6a2f20b72d787abd84ecd67ebc526e61dce6"}, {file = "pydantic-1.5.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:da8099fca5ee339d5572cfa8af12cf0856ae993406f0b1eb9bb38c8a660e7416"}, @@ -244,6 +400,10 @@ pydantic = [ {file = "pydantic-1.5.1-py36.py37.py38-none-any.whl", hash = "sha256:70f27d2f0268f490fe3de0a9b6fca7b7492b8fd6623f9fecd25b221ebee385e3"}, {file = "pydantic-1.5.1.tar.gz", hash = "sha256:f0018613c7a0d19df3240c2a913849786f21b6539b9f23d85ce4067489dfacfa"}, ] +pyflakes = [ + {file = "pyflakes-2.2.0-py2.py3-none-any.whl", hash = "sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92"}, + {file = "pyflakes-2.2.0.tar.gz", hash = "sha256:35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"}, +] pylint = [ {file = "pylint-2.5.3-py3-none-any.whl", hash = "sha256:d0ece7d223fe422088b0e8f13fa0a1e8eb745ebffcb8ed53d3e95394b6101a1c"}, {file = "pylint-2.5.3.tar.gz", hash = "sha256:7dd78437f2d8d019717dbf287772d0b2dbdfd13fc016aa7faa08d67bccc46adc"}, @@ -274,6 +434,29 @@ pyqt5-sip = [ {file = "PyQt5_sip-12.8.0-cp38-cp38-win_amd64.whl", hash = "sha256:1d65ce08a56282fb0273dd06585b8927b88d4fba71c01a54f8e2ac87ac1ed387"}, {file = "PyQt5_sip-12.8.0.tar.gz", hash = "sha256:0a34b6596bdd28d52da3a51fa8d9bb0b287bcb605c2512aa3251b9028cc71f4d"}, ] +regex = [ + {file = "regex-2020.6.8-cp27-cp27m-win32.whl", hash = "sha256:fbff901c54c22425a5b809b914a3bfaf4b9570eee0e5ce8186ac71eb2025191c"}, + {file = "regex-2020.6.8-cp27-cp27m-win_amd64.whl", hash = "sha256:112e34adf95e45158c597feea65d06a8124898bdeac975c9087fe71b572bd938"}, + {file = "regex-2020.6.8-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:92d8a043a4241a710c1cf7593f5577fbb832cf6c3a00ff3fc1ff2052aff5dd89"}, + {file = "regex-2020.6.8-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:bae83f2a56ab30d5353b47f9b2a33e4aac4de9401fb582b55c42b132a8ac3868"}, + {file = "regex-2020.6.8-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:b2ba0f78b3ef375114856cbdaa30559914d081c416b431f2437f83ce4f8b7f2f"}, + {file = "regex-2020.6.8-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:95fa7726d073c87141f7bbfb04c284901f8328e2d430eeb71b8ffdd5742a5ded"}, + {file = "regex-2020.6.8-cp36-cp36m-win32.whl", hash = "sha256:e3cdc9423808f7e1bb9c2e0bdb1c9dc37b0607b30d646ff6faf0d4e41ee8fee3"}, + {file = "regex-2020.6.8-cp36-cp36m-win_amd64.whl", hash = "sha256:c78e66a922de1c95a208e4ec02e2e5cf0bb83a36ceececc10a72841e53fbf2bd"}, + {file = "regex-2020.6.8-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:08997a37b221a3e27d68ffb601e45abfb0093d39ee770e4257bd2f5115e8cb0a"}, + {file = "regex-2020.6.8-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:2f6f211633ee8d3f7706953e9d3edc7ce63a1d6aad0be5dcee1ece127eea13ae"}, + {file = "regex-2020.6.8-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:55b4c25cbb3b29f8d5e63aeed27b49fa0f8476b0d4e1b3171d85db891938cc3a"}, + {file = "regex-2020.6.8-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:89cda1a5d3e33ec9e231ece7307afc101b5217523d55ef4dc7fb2abd6de71ba3"}, + {file = "regex-2020.6.8-cp37-cp37m-win32.whl", hash = "sha256:690f858d9a94d903cf5cada62ce069b5d93b313d7d05456dbcd99420856562d9"}, + {file = "regex-2020.6.8-cp37-cp37m-win_amd64.whl", hash = "sha256:1700419d8a18c26ff396b3b06ace315b5f2a6e780dad387e4c48717a12a22c29"}, + {file = "regex-2020.6.8-cp38-cp38-manylinux1_i686.whl", hash = "sha256:654cb773b2792e50151f0e22be0f2b6e1c3a04c5328ff1d9d59c0398d37ef610"}, + {file = "regex-2020.6.8-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:52e1b4bef02f4040b2fd547357a170fc1146e60ab310cdbdd098db86e929b387"}, + {file = "regex-2020.6.8-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:cf59bbf282b627130f5ba68b7fa3abdb96372b24b66bdf72a4920e8153fc7910"}, + {file = "regex-2020.6.8-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:5aaa5928b039ae440d775acea11d01e42ff26e1561c0ffcd3d805750973c6baf"}, + {file = "regex-2020.6.8-cp38-cp38-win32.whl", hash = "sha256:97712e0d0af05febd8ab63d2ef0ab2d0cd9deddf4476f7aa153f76feef4b2754"}, + {file = "regex-2020.6.8-cp38-cp38-win_amd64.whl", hash = "sha256:6ad8663c17db4c5ef438141f99e291c4d4edfeaacc0ce28b5bba2b0bf273d9b5"}, + {file = "regex-2020.6.8.tar.gz", hash = "sha256:e9b64e609d37438f7d6e68c2546d2cb8062f3adb27e6336bc129b51be20773ac"}, +] six = [ {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, @@ -310,6 +493,12 @@ typing-extensions = [ {file = "typing_extensions-3.7.4.2-py3-none-any.whl", hash = "sha256:6e95524d8a547a91e08f404ae485bbb71962de46967e1b71a0cb89af24e761c5"}, {file = "typing_extensions-3.7.4.2.tar.gz", hash = "sha256:79ee589a3caca649a9bfd2a8de4709837400dfa00b6cc81962a1e6a1815969ae"}, ] +unify = [ + {file = "unify-0.5.tar.gz", hash = "sha256:8ddce812b2457212b7598fe574c9e6eb3ad69710f445391338270c7f8a71723c"}, +] +untokenize = [ + {file = "untokenize-0.1.1.tar.gz", hash = "sha256:3865dbbbb8efb4bb5eaa72f1be7f3e0be00ea8b7f125c69cbd1f5fda926f37a2"}, +] wrapt = [ {file = "wrapt-1.12.1.tar.gz", hash = "sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7"}, ] diff --git a/pyproject.toml b/pyproject.toml index 2420949..cc8e72e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,11 @@ pylint = "^2.4.4" mypy = "^0.761" pydantic = "^1.4" pyqt5 = "^5.15.0" +black = "^19.10b0" +flake8 = "^3.8.3" +isort = "^4.3.21" +autoflake = "^1.3.1" +unify = "^0.5" [tool.poetry.dev-dependencies] diff --git a/src/currency_window.py b/src/currency_window.py new file mode 100644 index 0000000..df17bac --- /dev/null +++ b/src/currency_window.py @@ -0,0 +1,15 @@ +from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import ( + QMainWindow, +) + +from ui.currency import Ui_CurrencyWindow + + +class CurrencyWindow(Ui_CurrencyWindow, QMainWindow): + def __init__(self, parent): + super().__init__(parent, Qt.WindowCloseButtonHint | Qt.WindowMinimizeButtonHint) + self.setupUi(self) + + def init(self): + self.show() diff --git a/src/login_window.py b/src/login_window.py index bd13df9..cbec61d 100644 --- a/src/login_window.py +++ b/src/login_window.py @@ -1,6 +1,7 @@ -from PyQt5 import QtWidgets, QtCore from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QLineEdit, QPushButton, QVBoxLayout, QHBoxLayout, QWidget, QMainWindow +from PyQt5.QtWidgets import ( + QMainWindow, +) from src.main_window import MainWindow from ui.auth_form import Ui_AuthorizationForm @@ -19,6 +20,8 @@ def __init__(self): def init(self): self.show() + """Тут нужно добавить валидацию, возможно добавить обработку исключений сервера""" + def auth(self): self.close() - self.mainWindow.show() + self.mainWindow.init() diff --git a/src/main.py b/src/main.py index 05b1bef..bd79440 100644 --- a/src/main.py +++ b/src/main.py @@ -3,7 +3,6 @@ from PyQt5.QtWidgets import QApplication from src.login_window import LoginForm -from src.main_window import MainWindow class Main: diff --git a/src/main_window.py b/src/main_window.py index 6ce570f..1c5c230 100644 --- a/src/main_window.py +++ b/src/main_window.py @@ -1,14 +1,133 @@ -from PyQt5 import QtWidgets, QtCore +from typing import NamedTuple + +from PyQt5 import QtWidgets from PyQt5.QtCore import Qt -from PyQt5.QtWidgets import QLineEdit, QPushButton, QVBoxLayout, QHBoxLayout, QWidget, QMainWindow +from PyQt5.QtWidgets import ( + QMainWindow, + QTableWidgetItem, +) from ui.main import Ui_MainWindow +class CurrencyData(NamedTuple): + name: str + price: int + change: str + + +class OperationData(NamedTuple): + type: str + name: str + amount: int + account: str + + +all_currencies_data = [ + CurrencyData('Крипта', 1, '+1%'), + CurrencyData('Биток', 2, '-10%'), + CurrencyData('Эфирbvbvbdfsbbsfbbfb', 20, '+210%'), +] + +my_currencies_data = [ + CurrencyData('Крипта', 1, '+1%'), + CurrencyData('Биток', 2, '-10%'), + CurrencyData('Эфирbvbvbdfsbbsfbbfb', 20, '+210%'), +] + +operation_data = [ + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), + OperationData('Продажа', 'Биток', 20, '+ 20 у. е.'), +] + + class MainWindow(Ui_MainWindow, QMainWindow): def __init__(self, parent): super().__init__(parent, Qt.WindowCloseButtonHint | Qt.WindowMinimizeButtonHint) self.setupUi(self) + self.searchButton.clicked.connect(self.search_item) + self.refreshButton.clicked.connect(self.refresh_tables) + + '''Логика кнопки поиска''' + + def search_item(self): + pass + + '''Логика кнопки обновления''' + + def refresh_tables(self): + pass + + '''Тут чистый треш, но я просто тестил заполнение данных''' + + def fill_all_currencies(self): + self.allCurrenciesTable.clear() + labels = ['Название', 'Цена', 'Изменение'] + create_headers(self.allCurrenciesTable, labels) + + for i in all_currencies_data: + row = self.allCurrenciesTable.rowCount() + self.allCurrenciesTable.setRowCount(row + 1) + + self.allCurrenciesTable.setItem(row, 0, QTableWidgetItem(i.name)) + self.allCurrenciesTable.setItem(row, 1, QTableWidgetItem(str(i.price))) + self.allCurrenciesTable.setItem(row, 2, QTableWidgetItem(i.change)) + + def fill_my_currencies(self): + self.myCurrenciesTable.clear() + labels = ['Название', 'Цена', 'Изменение'] + create_headers(self.myCurrenciesTable, labels) + + for i in my_currencies_data: + row = self.myCurrenciesTable.rowCount() + self.myCurrenciesTable.setRowCount(row + 1) + + self.myCurrenciesTable.setItem(row, 0, QTableWidgetItem(i.name)) + self.myCurrenciesTable.setItem(row, 1, QTableWidgetItem(str(i.price))) + self.myCurrenciesTable.setItem(row, 2, QTableWidgetItem(i.change)) + + def fill_operations(self): + self.operationsTable.clear() + labels = ['Операция', 'Название', 'Количество', 'Счёт'] + create_headers(self.operationsTable, labels) + + for i in operation_data: + row = self.operationsTable.rowCount() + self.operationsTable.setRowCount(row + 1) + + self.operationsTable.setItem(row, 0, QTableWidgetItem(i.type)) + self.operationsTable.setItem(row, 1, QTableWidgetItem(i.name)) + self.operationsTable.setItem(row, 2, QTableWidgetItem(str(i.amount))) + self.operationsTable.setItem(row, 3, QTableWidgetItem(i.account)) + def init(self): self.show() + self.fill_all_currencies() + self.fill_my_currencies() + self.fill_operations() + + +def create_headers(table_name, labels): + table_name.setColumnCount(len(labels)) + table_name.setHorizontalHeaderLabels(labels) + + header = table_name.horizontalHeader() + + for i in range(len(labels)): + header.setSectionResizeMode(i, QtWidgets.QHeaderView.Stretch) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/ui/currency.py b/ui/currency.py new file mode 100644 index 0000000..16d14bd --- /dev/null +++ b/ui/currency.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'currency.ui' +# +# Created by: PyQt5 UI code generator 5.15.0 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_CurrencyWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(800, 558) + self.centralwidget = QtWidgets.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.gridLayout = QtWidgets.QGridLayout(self.centralwidget) + self.gridLayout.setObjectName("gridLayout") + self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget) + self.graphicsView.setObjectName("graphicsView") + self.gridLayout.addWidget(self.graphicsView, 3, 2, 1, 1) + self.buyAndSell = QtWidgets.QWidget(self.centralwidget) + self.buyAndSell.setObjectName("buyAndSell") + self.verticalLayout = QtWidgets.QVBoxLayout(self.buyAndSell) + self.verticalLayout.setObjectName("verticalLayout") + self.buyButton = QtWidgets.QPushButton(self.buyAndSell) + self.buyButton.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(0, 170, 85)") + self.buyButton.setObjectName("buyButton") + self.verticalLayout.addWidget(self.buyButton, 0, QtCore.Qt.AlignTop) + self.sellButton = QtWidgets.QPushButton(self.buyAndSell) + self.sellButton.setStyleSheet("color: rgb(255, 255, 255);\n" +"background-color: rgb(206, 66, 66)") + self.sellButton.setObjectName("sellButton") + self.verticalLayout.addWidget(self.sellButton) + self.gridLayout.addWidget(self.buyAndSell, 3, 0, 1, 1, QtCore.Qt.AlignTop) + self.info = QtWidgets.QHBoxLayout() + self.info.setContentsMargins(-1, 15, -1, -1) + self.info.setObjectName("info") + self.buyingPrice = QtWidgets.QLabel(self.centralwidget) + self.buyingPrice.setObjectName("buyingPrice") + self.info.addWidget(self.buyingPrice) + self.sellingPrice = QtWidgets.QLabel(self.centralwidget) + self.sellingPrice.setObjectName("sellingPrice") + self.info.addWidget(self.sellingPrice) + self.account = QtWidgets.QLabel(self.centralwidget) + self.account.setObjectName("account") + self.info.addWidget(self.account) + self.widget = QtWidgets.QWidget(self.centralwidget) + self.widget.setObjectName("widget") + self.info.addWidget(self.widget) + self.gridLayout.addLayout(self.info, 1, 2, 1, 1) + MainWindow.setCentralWidget(self.centralwidget) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "Валюта")) + self.buyButton.setText(_translate("MainWindow", "Купить")) + self.sellButton.setText(_translate("MainWindow", "Продать")) + self.buyingPrice.setText(_translate("MainWindow", "Стоимость покупки: ")) + self.sellingPrice.setText(_translate("MainWindow", "Стоимость продажи: ")) + self.account.setText(_translate("MainWindow", "Ваш счёт: ")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + MainWindow = QtWidgets.QMainWindow() + ui = Ui_CurrencyWindow() + ui.setupUi(MainWindow) + MainWindow.show() + sys.exit(app.exec_()) diff --git a/ui/currency.ui b/ui/currency.ui new file mode 100644 index 0000000..7f09d3c --- /dev/null +++ b/ui/currency.ui @@ -0,0 +1,85 @@ + + + MainWindow + + + + 0 + 0 + 800 + 558 + + + + MainWindow + + + + + + + + + + + + + color: rgb(255, 255, 255); +background-color: rgb(0, 170, 85) + + + Купить + + + + + + + color: rgb(255, 255, 255); +background-color: rgb(206, 66, 66) + + + Продать + + + + + + + + + + 15 + + + + + Стоимость покупки: + + + + + + + Стоимость продажи: + + + + + + + Ваш счёт: + + + + + + + + + + + + + +