def update_statusbar(self):
""" Update the status bar with information"""
cursor_row, cursor_column = self.get_cursor_position()
newline_count = self.text_widget.blockCount()
char_count = self.char_count()
lines_str = 'lines: ' + str(newline_count)
chars_str = ' | chars: ' + str(char_count)
column_str = ' | Col: ' + str(cursor_column)
row_str = ' | Row: ' + str(cursor_row)
ins_str = ' | INS'
ovr_string = ' | OVR'
status_string = lines_str + chars_str + column_str + row_str
status_lbl = QtWidgets.QLabel(status_string)
status_lbl.setAlignment(QtCore.Qt.AlignLeft)
filepath_lbl = QtWidgets.QLabel(str(self.file_path[0]))
filepath_lbl.setToolTip(str(self.file_path[0]))
filepath_lbl.setAlignment(QtCore.Qt.AlignLeft)
syntax_lbl = QtWidgets.QLabel()
syntax_lbl.setAlignment(QtCore.Qt.AlignCenter)
if self.syntax:
syntax_lbl.setText('Python')
else:
syntax_lbl.setText('Default')
custom_status = QtWidgets.QStatusBar()
custom_status.addWidget(filepath_lbl, stretch=2)
custom_status.addWidget(status_lbl, stretch=1)
custom_status.addWidget(syntax_lbl, stretch=0)
custom_status.adjustSize()
self.setStatusBar(custom_status)
if self.insert:
status_lbl.setText(status_string + ins_str)
else:
status_lbl.setText(status_string + ovr_string)
# MENU
评论列表
文章目录