Skip to content

Commit

Permalink
修复了Webengine横向小的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
LC044 committed Apr 5, 2023
1 parent 6f903a7 commit 87f35e7
Show file tree
Hide file tree
Showing 7 changed files with 406 additions and 327 deletions.
19 changes: 12 additions & 7 deletions app/Ui/chat/chatUi.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(878, 720)
self.horizontalLayout = QtWidgets.QHBoxLayout(Form)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.scrollArea_2 = QtWidgets.QScrollArea(Form)
self.scrollArea_2.setEnabled(True)
Expand Down Expand Up @@ -51,7 +53,8 @@ def setupUi(self, Form):
self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_2.setObjectName("frame_2")
self.verticalLayout = QtWidgets.QVBoxLayout(self.frame_2)
self.verticalLayout.setContentsMargins(0, 5, 0, 0)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setSpacing(0)
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
Expand Down Expand Up @@ -112,11 +115,12 @@ def setupUi(self, Form):
self.btn_sendMsg_2.setMouseTracking(False)
self.btn_sendMsg_2.setAutoFillBackground(False)
self.btn_sendMsg_2.setStyleSheet("QPushButton {\n"
"background-color:rgb(233,233,233);\n"
"padding: 10px;\n"
"color:rgb(5,180,104);}\n"
"QPushButton:hover{\n"
"background-color:rgb(198,198,198)}")
" background-color:rgb(233,233,233);\n"
" padding: 10px;\n"
" color:rgb(5,180,104);}\n"
" QPushButton:hover{\n"
" background-color:rgb(198,198,198)}\n"
" ")
self.btn_sendMsg_2.setIconSize(QtCore.QSize(40, 40))
self.btn_sendMsg_2.setCheckable(False)
self.btn_sendMsg_2.setAutoDefault(True)
Expand Down Expand Up @@ -146,5 +150,6 @@ def retranslateUi(self, Form):
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'SimSun\'; font-size:15pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> </p>\n"
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"> </p></body></html>"))
self.btn_sendMsg_2.setText(_translate("Form", "发送"))
27 changes: 23 additions & 4 deletions app/Ui/chat/chatUi.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_2">
<property name="enabled">
Expand Down Expand Up @@ -117,11 +132,14 @@
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="2,2,60,2,2,1">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>5</number>
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
Expand Down Expand Up @@ -212,9 +230,10 @@
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'SimSun';
font-size:15pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px;
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br
/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; &lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px;
margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;
</string>
</property>
<property name="overwriteMode">
Expand Down
116 changes: 33 additions & 83 deletions app/Ui/contact/analysis/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,33 @@ def m_movie(self):

def initUI(self):
self.label.setVisible(False)
self.setStyleSheet('''QWidget{background-color:rgb(244, 244, 244);}''')
self.setStyleSheet('''QWidget{background-color:rgb(240, 240, 240);}''')

main_box = QVBoxLayout(self)
main_box.setContentsMargins(0, 0, 0, 0)
main_box.setSpacing(0)

self.browser1 = QWebEngineView()
self.browser1.load(QUrl('file:///data/聊天统计/title.html'))
self.browser1.setMinimumSize(810, 60)
self.browser1.setStyleSheet('''QWidget{background-color:rgb(240, 240, 240);}''')
self.browser2 = QWebEngineView()
self.browser2.load(QUrl('file:///data/聊天统计/wordcloud.html'))
self.browser2.setStyleSheet('''QWidget{background-color:rgb(240, 240, 240);}''')
# self.browser2.setMinimumWidth(810)
self.browser2.setMinimumSize(810, 810)
self.browser3 = QWebEngineView()
self.browser3.load(QUrl('file:///data/聊天统计/time.html'))
# self.browser3.resize(800, 600)
self.browser3.setMaximumSize(810, 100)
self.browser3.adjustSize()
self.browser4 = QWebEngineView()
self.browser4.load(QUrl('http://www.baidu.com'))
# self.browser4.resize(800, 600)
self.browser4.resize(800, 600)
self.browser5 = QWebEngineView()
self.browser5.load(QUrl('file:///data/聊天统计/chat_session.html'))
# self.browser5.adjustSize()

# self.browser5.resize(800, 600)
self.browser6 = QWebEngineView()
self.browser6.load(QUrl('file:///data/聊天统计/sports.html'))
self.browser7 = QWebEngineView()
Expand All @@ -80,95 +91,34 @@ def initUI(self):
# self.browser10.
main_box.addWidget(self.browser1)

self.scrollArea = QScrollArea(self)
self.scrollArea = QScrollArea()
self.scrollArea.setEnabled(True)
self.scrollArea.adjustSize()
self.scrollArea.setWidgetResizable(False)

scrollAreaContent = QWidget(self.scrollArea)
Vlayout2 = QVBoxLayout(scrollAreaContent)

# splitter2 = QSplitter(Qt.Vertical)
# splitter2.addWidget(self.browser2)
# # splitter2.resize(800, 600)
# Vlayout2.addWidget(splitter2)
#
# splitter3 = QSplitter(Qt.Vertical)
# splitter3.addWidget(self.browser3)
# Vlayout2.addWidget(splitter3)
#
# splitter4 = QSplitter(Qt.Vertical)
# splitter4.addWidget(self.browser4)
# Vlayout2.addWidget(splitter4)
#
# splitter5 = QSplitter(Qt.Vertical)
# splitter5.addWidget(self.browser6)
# Vlayout2.addWidget(splitter5)

# Vlayout2.addWidget(self.browser3, stretch=1)
# Vlayout2.addWidget(self.browser6, stretch=2)
# Vlayout2.addWidget(self.browser5, stretch=3)
# Vlayout2.addWidget(self.browser7, stretch=4)
# Vlayout2.addWidget(self.browser8, stretch=5)
# Vlayout2.addWidget(self.browser9, stretch=6)
Vlayout2.addWidget(self.browser10, stretch=7)

# Vlayout2.setStretch(0, 1)
# Vlayout2.setStretch(1, 10)
scrollAreaContent.setStyleSheet('''QWidget{background-color:rgb(240, 240, 240);}''')

Vlayout2 = QVBoxLayout()
Vlayout2.setContentsMargins(0, 0, 0, 0)
Vlayout2.setSpacing(0)

Vlayout2.addWidget(self.browser3)
Vlayout2.addWidget(self.browser2)

Vlayout2.addWidget(self.browser8)
Vlayout2.addWidget(self.browser6)
Vlayout2.addWidget(self.browser5)
Vlayout2.addWidget(self.browser7)

Vlayout2.addWidget(self.browser9)
Vlayout2.addWidget(self.browser10)
scrollAreaContent.setLayout(Vlayout2)
# self.scrollArea.setWidget(scrollAreaContent)
self.scrollArea.setWidget(self.browser9)
main_box.addWidget(self.browser10)

self.scrollArea.setWidget(scrollAreaContent)
main_box.addWidget(self.scrollArea)
main_box.setStretch(0, 1)
main_box.setStretch(1, 10)
'''
splitter1 = QSplitter(Qt.Vertical)
splitter2 = QSplitter(Qt.Horizontal)
splitter3 = QSplitter(Qt.Horizontal)
splitter4 = QSplitter(Qt.Vertical)
splitter5 = QSplitter(Qt.Horizontal)
splitter6 = QSplitter(Qt.Vertical)
splitter7 = QSplitter(Qt.Vertical)
splitter8 = QSplitter(Qt.Vertical)
splitter9 = QSplitter(Qt.Vertical)
splitter1.addWidget(self.browser1)
splitter1.addWidget(splitter2)
splitter1.setSizes([1, 13])
splitter2.addWidget(splitter6)
splitter2.addWidget(splitter3)
splitter2.setSizes([1, 3])
splitter3.addWidget(splitter4)
splitter3.addWidget(splitter8)
splitter3.setSizes([2, 1])
splitter4.addWidget(splitter5)
splitter4.addWidget(self.browser2)
splitter4.setSizes([2, 13])
splitter5.addWidget(self.browser3)
# splitter5.addWidget(self.browser4)
splitter6.addWidget(self.browser5)
splitter6.addWidget(splitter7)
splitter6.setSizes([1, 2])
splitter7.addWidget(self.browser6)
splitter7.addWidget(self.browser7)
splitter8.addWidget(self.browser8)
splitter8.addWidget(splitter9)
splitter8.setSizes([1, 2])
splitter9.addWidget(self.browser9)
splitter9.addWidget(self.browser10)
'''
# main_box.addWidget(splitter1)
self.setLayout(main_box)
# self.setLayout(Vlayout1)

def setBackground(self):
palette = QPalette()
Expand Down
14 changes: 9 additions & 5 deletions app/Ui/contact/analysis/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
'436207665': '发红包',
'49': '分享链接'
}
charts_width = 1000
charts_height = 500
wordcloud_width = 1000
wordcloud_height = 500
charts_width = 800
charts_height = 450
wordcloud_width = 780
wordcloud_height = 780


def send_recv_rate(username):
Expand All @@ -44,7 +44,11 @@ def send_recv_rate(username):
total_num = send_num + recv_num
print(send_num, recv_num)
c = (
Pie(init_opts=opts.InitOpts(width=f"{charts_width}px", height=f"{charts_height}px"))
Pie(init_opts=opts.InitOpts(
bg_color='rgb(240,240,240)',
width=f"{charts_width}px",
height=f"{charts_height}px")
)
.add(
"",
[
Expand Down
2 changes: 1 addition & 1 deletion app/Ui/contact/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def initui(self):
self.lay0 = QVBoxLayout()
# self.widget.setLayout(self.lay0)
# self.widget.setStyleSheet('''QWidget{background-color:rgb(255, 255, 255);}''')
self.stackedWidget.setStyleSheet('''QWidget{background-color:rgb(255, 255, 255);}''')
self.stackedWidget.setStyleSheet('''QWidget{background-color:rgb(240, 240, 240);}''')
self.frame = QtWidgets.QFrame()
self.frame.setObjectName("frame")
self.userinfo = userinfoUi.Ui_Frame() # 联系人信息界面
Expand Down
Loading

0 comments on commit 87f35e7

Please sign in to comment.