Example #1
0
 def fill_table(self, table):
     """fill main table with data according to current table
     """
     self.flush_table()
     headers, data = sql.get_headers(table), sql.get_data(
         table, self.current_page * self.rpp, self.rpp)
     self.ui.tableWidget.setColumnCount(len(headers))
     self.ui.tableWidget.setRowCount(len(data))
     header = self.ui.tableWidget.horizontalHeader()
     for i, title in enumerate(headers):
         item = QtWidgets.QTableWidgetItem()
         item.setText('{} {}'.format(title[1], title[2]))
         self.ui.tableWidget.setHorizontalHeaderItem(i, item)
     for i, line in enumerate(data):
         for j, record in enumerate(line):
             item = QtWidgets.QTableWidgetItem()
             item.setText(str(record))
             self.ui.tableWidget.setItem(i, j, item)
         if self.table != 'ps_transaction':
             self.ui.tableWidget.setColumnCount(len(headers) + 1)
             row = i + self.rpp * self.current_page + 1
             manage_btns = ManageButtons(i, row, line, self)
             self.ui.tableWidget.setCellWidget(i, len(headers), manage_btns)
             self.ui.tableWidget.setColumnWidth(len(headers), 70)
             last_item = QtWidgets.QTableWidgetItem()
             last_item.setText('Action')
             self.ui.tableWidget.setHorizontalHeaderItem(
                 len(headers), last_item)
             header.setSectionResizeMode(len(headers), header.Interactive)
         self.set_row_disabled(i)
     self.ui.tableWidget.resizeColumnsToContents()
Example #2
0
def home():
    # print(f"Request method : {request.method}")
    if request.method == 'GET':
        pass

    if request.method == 'POST':

        User = request.form.get('User')
        Date = request.form.get('Date')
        Stock_Name = request.form.get('Stock_Name')
        Buy_Price = request.form.get('Price')
        Sell_Price = request.form.get('Sell_Price')
        Description = request.form.get('Description')
        Quantity = request.form.get('Quantity')

        insert_data(User,  Stock_Name, Date, Buy_Price,
                    Sell_Price, Quantity, Description)
        
    data = get_data()
    
    return render_template('/home.html', data=data)
Example #3
0
# Author : Троцкий

# 2019-03-06 10:31

from pyecharts import Radar

import sql

radar = Radar("雷达图", "王刚弹幕关键词分布")

radar_data1 = [sql.get_data()]

schema = [("无情铁手", 7000), ("宽油", 7000), ("王刚", 7000), ("宽水", 7000),
          ("劝退", 7000), ("宽饭", 7000), ("摊主", 7000)]

radar.config(schema)

radar.add("弹幕关键词出现次数", radar_data1)

radar.render()
Example #4
0
# Author : Троцкий

# 2019-03-06 10:40


from pyecharts import WordCloud

import sql

name = ['无情铁手','宽油','王刚','宽水','劝退','宽饭','摊主']

value = sql.get_data()

worldcloud = WordCloud(width = 1300,height = 620)

worldcloud.add('',name,value,word_size_range = [20,100])

worldcloud.render()

Example #5
0
# Author : Троцкий

# 2019-03-05 10:30


import numpy as np

import matplotlib.pyplot as plt

from matplotlib.font_manager import FontProperties

import sql

font = FontProperties(fname=r"/Users/apple/PycharmProjects/Bilibili_Project/venv/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/ttf/msyh.ttf", size=14)

N = 7

y = sql.get_data()

x = np.arange(N)

p1 = plt.bar(x,y,color='red')

plt.title('B站UP主"美食作家王刚R"的关键词分布',fontproperties=font)

plt.xticks(range(0,7),['无情铁手','宽油','王刚','宽水','劝退','宽饭','摊主'],fontproperties=font)

plt.show()
Example #6
0
# Author : Троцкий

# 2019-03-05 9:22


import numpy as np

import matplotlib.pyplot as plt

from matplotlib.font_manager import FontProperties

import sql

font = FontProperties(fname=r"/Users/apple/PycharmProjects/Bilibili_Project/venv/lib/python3.7/site-packages/matplotlib/mpl-data/fonts/ttf/msyh.ttf", size=14)

fraces = sql.get_data()

plt.boxplot(fraces,whis=1.5)

plt.title('B站UP主"美食作家王刚R"的关键词分布',fontproperties=font)

plt.show()