modified the "Delete Year" dialog to default to the year of the currently opened tab
This commit is contained in:
parent
b0b3f177b3
commit
b5314497da
16
frontend.py
16
frontend.py
@ -350,10 +350,6 @@ class AnimeTracker(QMainWindow):
|
||||
else:
|
||||
name_label.setText(html.escape(name))
|
||||
name_label.setStyleSheet("padding-left: 10px;")
|
||||
if entry[4] == 'watching':
|
||||
name_label.setStyleSheet("padding-left: 10px; background-color: yellow;")
|
||||
elif entry[4] == 'completed':
|
||||
name_label.setStyleSheet("padding-left: 10px; background-color: green;")
|
||||
table.setCellWidget(row, col, name_label)
|
||||
col += 1
|
||||
# Type
|
||||
@ -495,10 +491,6 @@ class AnimeTracker(QMainWindow):
|
||||
else:
|
||||
name_label.setText(html.escape(name))
|
||||
name_label.setStyleSheet("padding-left: 10px;")
|
||||
if entry[4] == 'watching':
|
||||
name_label.setStyleSheet("padding-left: 10px; background-color: yellow;")
|
||||
elif entry[4] == 'completed':
|
||||
name_label.setStyleSheet("padding-left: 10px; background-color: green;")
|
||||
table.setCellWidget(row, col, name_label)
|
||||
col += 1
|
||||
# Type
|
||||
@ -547,9 +539,7 @@ class AnimeTracker(QMainWindow):
|
||||
if item:
|
||||
item.setBackground(color)
|
||||
widget = table.cellWidget(r, c)
|
||||
if widget and c != 5: # No padding for action column
|
||||
widget.setStyleSheet(f"background-color: {color.name()}; padding-left: 0px;")
|
||||
elif widget:
|
||||
if widget:
|
||||
widget.setStyleSheet(f"background-color: {color.name()};")
|
||||
layout.addWidget(table)
|
||||
total_entries += len(entries)
|
||||
@ -658,7 +648,9 @@ class AnimeTracker(QMainWindow):
|
||||
|
||||
def delete_year(self):
|
||||
current_year = datetime.now().year
|
||||
year, ok = QInputDialog.getInt(self, "Delete Year", "Enter the year to delete:", 2010, 2010, current_year + 10)
|
||||
current_id = self.get_current_tab_identifier()
|
||||
default_year = 2010 if current_id == 'pre' else current_id
|
||||
year, ok = QInputDialog.getInt(self, "Delete Year", "Enter the year to delete:", default_year, 2010, current_year + 10)
|
||||
if ok:
|
||||
years = self.backend.get_years()
|
||||
if year not in years:
|
||||
|
Loading…
Reference in New Issue
Block a user