diff --git a/chart.py b/chart.py
index 6cf198f..0302c63 100644
--- a/chart.py
+++ b/chart.py
@@ -192,13 +192,13 @@ def rebuild(self):
text_title = text_title.replace(p, '')
regrex_pattern = re.compile(pattern="["
- u"\U00000000-\U00000009"
- u"\U0000000B-\U0000001F"
- u"\U00000080-\U00000400"
- u"\U00000402-\U0000040F"
- u"\U00000450-\U00000450"
- u"\U00000452-\U0010FFFF"
- "]+", flags=re.UNICODE)
+ u"\U00000000-\U00000009"
+ u"\U0000000B-\U0000001F"
+ u"\U00000080-\U00000400"
+ u"\U00000402-\U0000040F"
+ u"\U00000450-\U00000450"
+ u"\U00000452-\U0010FFFF"
+ "]+", flags=re.UNICODE)
text = regrex_pattern.sub(r'', text_title)
diff --git a/model.py b/model.py
index 9dd4cb9..2964715 100644
--- a/model.py
+++ b/model.py
@@ -5,13 +5,13 @@
)
-def make_result_row(video_title: str, video_published_time: str, video_duration: str,
- views: int, video_link: str, channel_title: str, channel_link: str,
+def make_result_row(video_title: str, video_published_time: str, video_duration: str,
+ views: int, video_link: str, channel_title: str, channel_link: str,
channel_subscribers: int, channel_views: int, channel_joined_date: str,
video_preview_link: str, channel_logo_link: str, video_tags: list[str],
video_duration_timedelta):
view_rate = (str(round(views / channel_subscribers * 100, 2)) + "%") if channel_subscribers > 0 else "-"
- return (video_title, video_published_time, video_duration, views, video_link, channel_title,
+ return (video_title, video_published_time, video_duration, views, video_link, channel_title,
channel_link, channel_subscribers, channel_views, channel_joined_date, view_rate, video_preview_link,
channel_logo_link, video_tags, video_duration_timedelta)
@@ -41,8 +41,8 @@ def __init__(self, parent, *args):
QAbstractTableModel.__init__(self, parent, *args)
self.result = []
# TODO: Remove header after export fixing. It's unused in this class.
- self.header = [self.tr("Title"), self.tr("Published Time"), self.tr("Duration"), self.tr("View Count"), self.tr("Link"),
- self.tr("Channel Name"), self.tr("Channel Link"), self.tr("Channel Subscribers"),
+ self.header = [self.tr("Title"), self.tr("Published Time"), self.tr("Duration"), self.tr("View Count"),
+ self.tr("Link"), self.tr("Channel Name"), self.tr("Channel Link"), self.tr("Channel Subscribers"),
self.tr("Channel Views"), self.tr("Channel Joined Date"), self.tr("Views/Subscribers")]
self._fields = [
(ResultFields.VideoTitle, self.tr("Title")),
diff --git a/widgets.py b/widgets.py
index 1f98a0a..3a01e3c 100644
--- a/widgets.py
+++ b/widgets.py
@@ -40,7 +40,7 @@
class PixmapLabel(QLabel):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
super().__init__(parent)
self.setMinimumSize(1, 1)
self.setScaledContents(False)
@@ -170,9 +170,11 @@ def set_current_index(self, index: QModelIndex):
return
row_data = self._model.result[index.row()]
- self._title_label.setText("" + row_data[ResultFields.VideoTitle] + "")
+ self._title_label.setText("" +
+ row_data[ResultFields.VideoTitle] + "")
self._duration_label.setText(row_data[ResultFields.VideoDuration])
- self._channel_title_label.setText("" + row_data[ResultFields.ChannelTitle] + "")
+ self._channel_title_label.setText("" +
+ row_data[ResultFields.ChannelTitle] + "")
update_subscribers = '{0:,}'.format(row_data[ResultFields.ChannelSubscribers]).replace(',', ' ')
self._subscribers_label.setText(update_subscribers + self.tr(" subscribers"))
update_views = '{0:,}'.format(row_data[ResultFields.VideoViews]).replace(',', ' ')
@@ -240,7 +242,7 @@ def __init__(self, model: ResultTableModel, parent: QWidget = None):
self._chart_combobox.addItem(self.tr("Channels distribution chart"))
self._chart_combobox.addItem(self.tr("Video duration chart"))
self._chart_combobox.addItem(self.tr("Popular title words chart"))
-
+
self._chart_combobox.currentIndexChanged.connect(self._on_current_chart_changed)
main_layout.addWidget(self._chart_combobox)
diff --git a/youtube-analyzer.py b/youtube-analyzer.py
index b7b367e..66e4bb6 100644
--- a/youtube-analyzer.py
+++ b/youtube-analyzer.py
@@ -94,10 +94,10 @@ def apply(app: QApplication, theme_index: int):
palette.setColor(QPalette.Highlight, QColor(19, 60, 110))
palette.setColor(QPalette.HighlightedText, Qt.white)
palette.setColor(QPalette.Active, QPalette.Button, QColor(53, 53, 53))
- palette.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(53, 53, 53).lighter());
- palette.setColor(QPalette.Disabled, QPalette.WindowText, QColor(53, 53, 53).lighter());
- palette.setColor(QPalette.Disabled, QPalette.Text, QColor(53, 53, 53).lighter());
- palette.setColor(QPalette.Disabled, QPalette.Light, QColor(53, 53, 53));
+ palette.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(53, 53, 53).lighter())
+ palette.setColor(QPalette.Disabled, QPalette.WindowText, QColor(53, 53, 53).lighter())
+ palette.setColor(QPalette.Disabled, QPalette.Text, QColor(53, 53, 53).lighter())
+ palette.setColor(QPalette.Disabled, QPalette.Light, QColor(53, 53, 53))
app.setPalette(palette)
else:
palette = QPalette()
@@ -106,7 +106,7 @@ def apply(app: QApplication, theme_index: int):
class DontAskAgainQuestionDialog(QMessageBox):
- def __init__(self, title: str, text: str, parent = None):
+ def __init__(self, title: str, text: str, parent=None):
super().__init__(parent)
self.setWindowTitle(title)
self.setText(text)
@@ -122,12 +122,12 @@ def is_dont_ask_again(self):
class AboutDialog(QDialog):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle(self.tr("About"))
layout = QGridLayout()
- layout.setSizeConstraint( QGridLayout.SizeConstraint.SetFixedSize )
-
+ layout.setSizeConstraint(QGridLayout.SizeConstraint.SetFixedSize)
+
row = 0
title = QLabel(app_name)
title.setStyleSheet("font-size: 14px")
@@ -136,11 +136,12 @@ def __init__(self, parent = None):
layout.addWidget(QLabel(self.tr("Software for analyzing of YouTube search output")), row, 0, 1, 2,
Qt.AlignmentFlag.AlignCenter)
row += 1
- layout.addWidget(QLabel(self.tr("Version: ") + version),
+ layout.addWidget(QLabel(self.tr("Version: ") + version),
row, 0, 1, 2, Qt.AlignmentFlag.AlignCenter)
row += 1
- layout.addWidget(QLabel(self.tr("Based on: PySide6, youtube-search-python,\n google-api-python-client, XlsxWriter, isodate.")),
- row, 0, 1, 2, Qt.AlignmentFlag.AlignCenter)
+ layout.addWidget(QLabel(
+ self.tr("Based on: PySide6, youtube-search-python,\n google-api-python-client, XlsxWriter, isodate.")),
+ row, 0, 1, 2, Qt.AlignmentFlag.AlignCenter)
row += 1
vertical_spacer = QSpacerItem(1, 20, QSizePolicy.Minimum, QSizePolicy.Expanding)
layout.addItem(vertical_spacer, row, 0, 1, 2, Qt.AlignmentFlag.AlignCenter)
@@ -168,13 +169,14 @@ def __init__(self, parent = None):
self.setLayout(layout)
+
class AuthorsDialog(QDialog):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
super().__init__(parent)
self.setWindowTitle(self.tr("Authors"))
layout = QGridLayout()
- layout.setSizeConstraint( QGridLayout.SizeConstraint.SetFixedSize )
-
+ layout.setSizeConstraint(QGridLayout.SizeConstraint.SetFixedSize)
+
self._edit_text = QTextEdit()
self._edit_text.setReadOnly(True)
self._edit_text.append(self.tr("The YouTube Analyzer team, in alphabetical order:\n"))
@@ -368,12 +370,13 @@ def _on_search_clicked(self):
video_idx = self._sort_model.index(i, self._model.get_field_column(ResultFields.VideoTitle))
video_item = self._model.result[i]
video_label = self._create_link_label(video_item[ResultFields.VideoLink], video_item[ResultFields.VideoTitle])
- self._table_view.setIndexWidget(video_idx, video_label);
-
+ self._table_view.setIndexWidget(video_idx, video_label)
+
channel_idx = self._sort_model.index(i, self._model.get_field_column(ResultFields.ChannelTitle))
- channel_label = self._create_link_label(video_item[ResultFields.ChannelLink], video_item[ResultFields.ChannelTitle])
- self._table_view.setIndexWidget(channel_idx, channel_label);
-
+ channel_label = self._create_link_label(video_item[ResultFields.ChannelLink],
+ video_item[ResultFields.ChannelTitle])
+ self._table_view.setIndexWidget(channel_idx, channel_label)
+
self._table_view.resizeColumnsToContents()
else:
dialog = QMessageBox()
@@ -382,7 +385,7 @@ def _on_search_clicked(self):
dialog.setIcon(QMessageBox.Critical)
dialog.setDetailedText(engine.error)
dialog.exec()
-
+
QApplication.restoreOverrideCursor()
self._search_line_edit.setDisabled(False)
self._search_button.setDisabled(False)
@@ -461,7 +464,7 @@ def _create_engine(self):
return YoutubeGrepEngine(self._model, request_limit)
else:
return YoutubeApiEngine(self._model, request_limit, api_key)
-
+
def _create_link_label(self, link: str, text: str):
label = QLabel("" + text + "")
label_size_policy = label.sizePolicy()