diff --git a/client/gui/graph_page.py b/client/gui/graph_page.py
index 170a273..5798325 100644
--- a/client/gui/graph_page.py
+++ b/client/gui/graph_page.py
@@ -1,8 +1,10 @@
from typing import List
import os
+import time
import numpy as np
import networkx as nx
+from PyQt5.QtGui import QPixmap
from PyQt5.QtWidgets import (
QVBoxLayout,
QWidget,
@@ -29,6 +31,16 @@ def __init__(self, parent=None):
self.graph = None
+ # Путь к ассетам
+ path = os.getcwd() + "/client/gui/resources/"
+
+ # Отображение картинок
+ self.ui.lbl_clock.setPixmap(QPixmap(path + "img/clock.png"))
+
+ # Изначально время скрыто
+ self.ui.lbl_clock.setVisible(False)
+ self.ui.lbl_time.setVisible(False)
+
# Добавляем место для графа на страницу
self.graph_layout = QVBoxLayout()
self.ui.horizontalLayout.insertLayout(0, self.graph_layout)
@@ -91,6 +103,9 @@ def embed_graph(self):
self.canvas.axes.cla()
alogithm = self.ui.cbx_algorithm.currentIndex()
+
+ start = time.time()
+
# Гамма-алгоритм
if alogithm == 0:
gr = GammaAlgorithm(self.graph)
@@ -124,3 +139,10 @@ def embed_graph(self):
nx.draw(G, pos=pos, ax=self.canvas.axes,
with_labels=True, node_color="#0C8CE9")
self.canvas.draw()
+
+ finish = time.time()
+ res = finish - start
+ res_msec = res * 1000
+ self.ui.lbl_time.setText(f"Время работы: {res_msec:.2f} миллисекунд")
+ self.ui.lbl_time.setVisible(True)
+ self.ui.lbl_clock.setVisible(True)
diff --git a/client/gui/resources/styles/main.qss b/client/gui/resources/styles/main.qss
index 5f0ac83..c3fd8e4 100644
--- a/client/gui/resources/styles/main.qss
+++ b/client/gui/resources/styles/main.qss
@@ -52,6 +52,7 @@ GraphPage QLabel {
font-weight: 75;
color: rgb(0, 0, 0);
text-align: left;
+ margin-left: 0;
}
TestPage QLabel {
@@ -71,24 +72,28 @@ TestStartPage QLabel {
font-weight: 75;
color: rgb(0, 0, 0);
margin-bottom: 40px;
+ margin-left: 0;
}
ProfilePage QLabel {
font-size: 16pt;
font-weight: 75;
color: rgb(0, 0, 0);
+ margin-left: 0;
}
StudentProfilePage QLabel {
font-size: 16pt;
font-weight: 75;
color: rgb(0, 0, 0);
+ margin-left: 0;
}
TaskPage QLabel {
font-size: 16pt;
font-weight: 75;
color: rgb(0, 0, 0);
+ margin-left: 0;
}
QWidget QLabel:hover {
diff --git a/client/gui/ui_graph_page.py b/client/gui/ui_graph_page.py
index 3264455..b3e2f2e 100644
--- a/client/gui/ui_graph_page.py
+++ b/client/gui/ui_graph_page.py
@@ -45,14 +45,16 @@ def setupUi(self, GraphPage):
self.btn_draw = QtWidgets.QPushButton(GraphPage)
self.btn_draw.setObjectName("btn_draw")
self.verticalLayout.addWidget(self.btn_draw)
+ self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
+ self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.lbl_algorithm = QtWidgets.QLabel(GraphPage)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.lbl_algorithm.sizePolicy().hasHeightForWidth())
self.lbl_algorithm.setSizePolicy(sizePolicy)
self.lbl_algorithm.setObjectName("lbl_algorithm")
- self.verticalLayout.addWidget(self.lbl_algorithm)
+ self.horizontalLayout_4.addWidget(self.lbl_algorithm)
self.cbx_algorithm = QtWidgets.QComboBox(GraphPage)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Maximum)
sizePolicy.setHorizontalStretch(0)
@@ -63,7 +65,31 @@ def setupUi(self, GraphPage):
self.cbx_algorithm.addItem("")
self.cbx_algorithm.addItem("")
self.cbx_algorithm.addItem("")
- self.verticalLayout.addWidget(self.cbx_algorithm)
+ self.horizontalLayout_4.addWidget(self.cbx_algorithm)
+ self.verticalLayout.addLayout(self.horizontalLayout_4)
+ self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
+ self.horizontalLayout_3.setObjectName("horizontalLayout_3")
+ self.lbl_clock = QtWidgets.QLabel(GraphPage)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.lbl_clock.sizePolicy().hasHeightForWidth())
+ self.lbl_clock.setSizePolicy(sizePolicy)
+ self.lbl_clock.setMaximumSize(QtCore.QSize(20, 20))
+ self.lbl_clock.setText("")
+ self.lbl_clock.setPixmap(QtGui.QPixmap("resources/img/clock.png"))
+ self.lbl_clock.setScaledContents(True)
+ self.lbl_clock.setObjectName("lbl_clock")
+ self.horizontalLayout_3.addWidget(self.lbl_clock)
+ self.lbl_time = QtWidgets.QLabel(GraphPage)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.lbl_time.sizePolicy().hasHeightForWidth())
+ self.lbl_time.setSizePolicy(sizePolicy)
+ self.lbl_time.setObjectName("lbl_time")
+ self.horizontalLayout_3.addWidget(self.lbl_time)
+ self.verticalLayout.addLayout(self.horizontalLayout_3)
self.btn_embed = QtWidgets.QPushButton(GraphPage)
self.btn_embed.setObjectName("btn_embed")
self.verticalLayout.addWidget(self.btn_embed)
@@ -83,4 +109,5 @@ def retranslateUi(self, GraphPage):
self.cbx_algorithm.setItemText(0, _translate("GraphPage", "Гамма-алгоритм"))
self.cbx_algorithm.setItemText(1, _translate("GraphPage", "Алгоритм, основанный на методе отжига"))
self.cbx_algorithm.setItemText(2, _translate("GraphPage", "Алгоритм на PQ-деревьях"))
+ self.lbl_time.setText(_translate("GraphPage", "Время работы алгоритма:"))
self.btn_embed.setText(_translate("GraphPage", "Уложить граф"))
diff --git a/client/gui/ui_graph_page.ui b/client/gui/ui_graph_page.ui
index 172ad35..396b50e 100644
--- a/client/gui/ui_graph_page.ui
+++ b/client/gui/ui_graph_page.ui
@@ -61,45 +61,91 @@
-
-
-
-
- 0
- 0
-
-
-
- Выберите алгоритм:
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- 0
-
+
-
-
- Гамма-алгоритм
-
+
+
+
+ 0
+ 0
+
+
+
+ Выберите алгоритм:
+
+
-
-
- Алгоритм, основанный на методе отжига
-
+
+
+
+ 0
+ 0
+
+
+
+ 0
+
+
-
+
+ Гамма-алгоритм
+
+
+ -
+
+ Алгоритм, основанный на методе отжига
+
+
+ -
+
+ Алгоритм на PQ-деревьях
+
+
+
+
+
+ -
+
-
-
- Алгоритм на PQ-деревьях
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 20
+ 20
+
+
+
+
+
+
+ resources/img/clock.png
+
+
+ true
+
+
-
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Время работы алгоритма:
+
+
+
+
-
diff --git a/client/src/education/task.py b/client/src/education/task.py
index 54a3a2d..caaee0b 100644
--- a/client/src/education/task.py
+++ b/client/src/education/task.py
@@ -81,6 +81,6 @@ def is_misspell(correct_text, text) -> bool:
dl = textdistance.DamerauLevenshtein()
result = dl.normalized_distance(correct_text, text)
- if result > 0.20:
+ if result > 0.3:
return False
return True