feat(trans): 添加流水页面

This commit is contained in:
iridiumR 2023-05-23 20:43:17 +08:00
parent 42b035bf4a
commit 69ddbeb799
No known key found for this signature in database
GPG key ID: 49735733EB1A32C8
2 changed files with 44 additions and 1 deletions

View file

@ -3,6 +3,7 @@ from ._pg import PostgresTab
from ._category import CategoryTab
from ._pg import PostgresTab
from ._account import AccountTab
from ._trans import TransTab
def initUI(self):
@ -12,12 +13,14 @@ def initUI(self):
self.pg = PostgresTab()
self.categoryTab = CategoryTab(self)
self.accountTab = AccountTab(self)
self.transTab = TransTab(self)
# 创建主窗口tab布局
mainWidget = QTabWidget()
mainWidget.addTab(self.pg, 'Connect')
mainWidget.addTab(self.transTab, 'Transaction')
mainWidget.addTab(self.categoryTab, 'Category')
mainWidget.addTab(self.accountTab, 'Account')
mainWidget.addTab(self.pg, 'Connect')
# 槽连接
mainWidget.currentChanged.connect(self.onTabChanged)

40
src/budget/_trans.py Normal file
View file

@ -0,0 +1,40 @@
from PyQt6.QtWidgets import *
from ._tab import TabPage
from ._pg import PostgresTab
import json
class TransTab(TabPage):
def __init__(self, parent):
super().__init__()
self.initUI()
self.pg = parent.pg
self.rows = []
def initUI(self):
# 创建顶部控件
self.transAddButton = QPushButton('Add')
self.transAddButton.clicked.connect(self.onTransAddClicked)
self.transModifyButton = QPushButton('Modify')
self.transModifyButton.clicked.connect(self.onTransModifyClicked)
# 创建控件布局
topLayout = QHBoxLayout()
topLayout.addWidget(self.transAddButton)
topLayout.addWidget(self.transModifyButton)
transTable = QTableWidget()
tableLayout = QVBoxLayout()
tableLayout.addWidget(transTable)
# 创建中间控件
transLayout = QVBoxLayout()
transLayout.addLayout(topLayout)
transLayout.addLayout(tableLayout)
self.setLayout(transLayout)
def onTransAddClicked(self):
pass
def onTransModifyClicked(self):
pass