Merge branch 'main' of g.8f.al:ir/budget

This commit is contained in:
iridiumR 2023-06-04 14:39:03 +08:00
commit c2dc192d2a
No known key found for this signature in database
GPG key ID: 49735733EB1A32C8

View file

@ -1,8 +1,9 @@
from PyQt6.QtWidgets import *
from ._tab import TabPage
from ._pg import PostgresTab
from PyQt6.QtGui import QDoubleValidator
import json
import datetime
class CategoryTab(TabPage):
def __init__(self, parent):
@ -213,3 +214,16 @@ class CategoryTab(TabPage):
except Exception as e:
print(e)
QMessageBox.critical(self, 'Error', str(e))
# self.pg.execute("SELECT c_id, meta ->> 'name' FROM category ORDER BY c_id")
# self.rows = self.pg.fetchall()
print(self.rows)
# 初始化表格
self.transTable.clear()
self.transTable.setRowCount(len(self.rows))
self.transTable.setColumnCount(5) # 时间 账户 类别 金额 描述
self.transTable.setHorizontalHeaderLabels(['Time', 'Account', 'Category', 'Amount', 'Description'])
# 设置自动调整列宽
self.transTable.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeMode.Stretch)