Skip to content

Commit

Permalink
Client Improvement
Browse files Browse the repository at this point in the history
    1. [GUI] Support loading ASR result directly and midway-point saving
    2. [GUI] Support client theme changing
    3. [GUI] Optimize the way to append data to table to increase the loading speed of childwindows
    4. Widget library update (see details in 'QSimpleWidget' repo)
  • Loading branch information
Spr-Aachen committed Apr 14, 2024
1 parent 344fdfc commit 462842f
Show file tree
Hide file tree
Showing 9 changed files with 2,227 additions and 8,732 deletions.
62 changes: 11 additions & 51 deletions EVT_GUI/Components.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def SetColumnLayout(ColumnLayout):
def SetValue(self, Params: list = [['', '', '', 'url'], ]):
self.ClearRows()
for Param in Params:
QApplication.processEvents()
self.AddRow(Param)


Expand Down Expand Up @@ -220,6 +221,7 @@ def SetValue(self, Params: dict = {'%Speaker%': '%Path%'}, FileType: Optional[st
self.ClearRows()
ParamDict = ToIterable(Params)
for Key, Value in ParamDict.items():
QApplication.processEvents()
Param = (Key, Value)
#Index = next((i for i, key in enumerate(ParamDict) if key == Key), None)
self.AddRow(Param, FileType)
Expand Down Expand Up @@ -268,49 +270,6 @@ def AddRow(self, Param: tuple, ComboItems: list):
border-color: rgba(201, 210, 222, 123);
}
'''
ComboBoxStyle = '''
QComboBox {
background-color: transparent;
padding-top: 3px;
padding-left: 6px;
padding-bottom: 3px;
padding-right: 6px;
border-width: 1px;
border-style: solid;
border-color: rgba(201, 210, 222, 123);
}
QComboBox::drop-down {
subcontrol-origin: padding;
subcontrol-position: right;
margin-right: 6px;
border: none;
}
QComboBox::down-arrow {
border-image: url(:/ComboBox_Icon/Sources/DownArrow.png);
}
QComboBox::down-arrow:on {
border-image: url(:/ComboBox_Icon/Sources/UpArrow.png);
}
QComboBox QAbstractItemView {
outline: none;
background-color: transparent;
border: none;
}
QComboBox QAbstractItemView::item {
background-color: transparent;
padding-top: 3px;
padding-left: 6px;
padding-bottom: 3px;
padding-right: 6px;
border: none;
}
QComboBox QAbstractItemView::item:hover {
background-color: rgba(120, 120, 120, 120);
}
QComboBox QAbstractItemView::item:selected {
background-color: rgba(120, 120, 120, 120);
}
'''
ButtonStyle = '''
QPushButton {
background-color: transparent;
Expand All @@ -331,8 +290,7 @@ def SetColumnLayout(ColumnLayout):
SetColumnLayout(Column0Layout)
Column0Layout.addWidget(Label0)

ComboBox = QComboBox()
ComboBox.setStyleSheet(ComboBoxStyle)
ComboBox = ComboBoxBase()
ComboBox.addItems(ComboItems)
ComboBox.setCurrentText(Param[1])
Column1Layout = QHBoxLayout()
Expand Down Expand Up @@ -381,9 +339,15 @@ def SetColumnLayout(ColumnLayout):
RowHeight
)

def SetValue(self, Params: list = [['%Path%', '%Namex%', '%Sim%'], ], ComboItems: list = ['%Name1%', ]):
def SetValue(self, Params: list = [['%Path%', '%Namex%', '%Sim%'], ], ComboItems: Optional[list] = ['%Name1%', ]):
self.ClearRows()
if ComboItems is None:
ComboItems = []
for Param in Params:
ComboItem = Param[1]
ComboItems.append(ComboItem) if ComboItem not in ComboItems else None
for Param in Params:
QApplication.processEvents()
self.AddRow(Param, ComboItems)

def GetValue(self):
Expand All @@ -398,11 +362,6 @@ def GetValue(self):
return ValueDict


class Table_DATResult(TableBase):
'''
'''


class Table_STTResult(TableBase):
'''
'''
Expand Down Expand Up @@ -475,6 +434,7 @@ def SetValue(self, Params: dict = {'%Path%': '%Transcription%'}):
self.ClearRows()
ParamDict = ToIterable(Params)
for Key, Value in ParamDict.items():
QApplication.processEvents()
Param = (Key, Value)
self.AddRow(Param)

Expand Down
31 changes: 29 additions & 2 deletions EVT_GUI/UI_ChildWindow_ASR.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def setupUi(self, ChildWindow_ASR):
self.horizontalLayout_2.setSpacing(0)
self.horizontalLayout_2.setObjectName(u"horizontalLayout_2")
self.horizontalLayout_2.setContentsMargins(0, 0, 0, 0)
self.horizontalSpacer = QSpacerItem(792, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
self.horizontalSpacer = QSpacerItem(792, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)

self.horizontalLayout_2.addItem(self.horizontalSpacer)

Expand Down Expand Up @@ -90,7 +90,7 @@ def setupUi(self, ChildWindow_ASR):
self.gridLayout.setContentsMargins(21, 12, 21, 12)
self.Label_Title = QLabel(self.CentralWidget)
self.Label_Title.setObjectName(u"Label_Title")
sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
sizePolicy = QSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.Label_Title.sizePolicy().hasHeightForWidth())
Expand Down Expand Up @@ -187,6 +187,32 @@ def setupUi(self, ChildWindow_ASR):

self.horizontalLayout.addWidget(self.Button_Cancel)

self.Button_Save = QPushButton(ChildWindow_ASR)
self.Button_Save.setObjectName(u"Button_Save")
self.Button_Save.setStyleSheet(u"QPushButton {\n"
" text-align: center;\n"
" font-size: 12px;\n"
" background-color: transparent;\n"
" padding: 9.9px;\n"
" border-width: 1.5px;\n"
" border-radius: 6px;\n"
" border-style: solid;\n"
" border-color: rgb(90, 90, 90);\n"
"}\n"
"QPushButton:hover {\n"
" border-color: rgb(120, 120, 120);\n"
"}\n"
"\n"
"\n"
"QToolTip {\n"
" color: rgba(255, 255, 255, 210);\n"
" background-color: transparent;\n"
" border-width: 0px;\n"
" border-style: solid;\n"
"}")

self.horizontalLayout.addWidget(self.Button_Save)

self.Button_Confirm = QPushButton(ChildWindow_ASR)
self.Button_Confirm.setObjectName(u"Button_Confirm")
self.Button_Confirm.setStyleSheet(u"QPushButton {\n"
Expand Down Expand Up @@ -228,4 +254,5 @@ def retranslateUi(self, ChildWindow_ASR):
self.Label_Text.setText(QCoreApplication.translate("ChildWindow_ASR", u"Text", None))
self.CheckBox.setText(QCoreApplication.translate("ChildWindow_ASR", u"CheckBox", None))
self.Button_Cancel.setText(QCoreApplication.translate("ChildWindow_ASR", u"PushButton", None))
self.Button_Save.setText(QCoreApplication.translate("ChildWindow_ASR", u"PushButton", None))
self.Button_Confirm.setText(QCoreApplication.translate("ChildWindow_ASR", u"PushButton", None))
Loading

0 comments on commit 462842f

Please sign in to comment.