Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2023-12-29 16:33:48 +07:00
parent 71f6462158
commit 397682fe0e
3 changed files with 27 additions and 99 deletions

117
form.ui
View File

@@ -7,13 +7,19 @@
<x>0</x>
<y>0</y>
<width>720</width>
<height>380</height>
<height>350</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>720</width>
<height>330</height>
<height>350</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>720</width>
<height>350</height>
</size>
</property>
<property name="windowTitle">
@@ -154,88 +160,6 @@
<bool>false</bool>
</property>
</widget>
<widget class="QWidget" name="">
<property name="geometry">
<rect>
<x>280</x>
<y>330</y>
<width>354</width>
<height>19</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="score_1">
<property name="text">
<string>1</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="score_2">
<property name="text">
<string>2</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="score_3">
<property name="text">
<string>3</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="score_4">
<property name="text">
<string>4</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="score_5">
<property name="text">
<string>5</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="score_6">
<property name="text">
<string>6</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="score_7">
<property name="text">
<string>7</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="score_8">
<property name="text">
<string>8</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="score_9">
<property name="text">
<string>9</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="score_10">
<property name="text">
<string>10</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
@@ -256,7 +180,14 @@
<addaction name="separator"/>
<addaction name="actionExit"/>
</widget>
<widget class="QMenu" name="menuList">
<property name="title">
<string>Список</string>
</property>
<addaction name="actionAdd"/>
</widget>
<addaction name="menuOpen"/>
<addaction name="menuList"/>
</widget>
<action name="actionOpen">
<property name="text">
@@ -278,20 +209,18 @@
<string>Закрыть программу</string>
</property>
</action>
<action name="actionAdd">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Добавить</string>
</property>
</action>
</widget>
<tabstops>
<tabstop>target_title</tabstop>
<tabstop>target_title_ru</tabstop>
<tabstop>score_1</tabstop>
<tabstop>score_2</tabstop>
<tabstop>score_3</tabstop>
<tabstop>score_4</tabstop>
<tabstop>score_5</tabstop>
<tabstop>score_6</tabstop>
<tabstop>score_7</tabstop>
<tabstop>score_8</tabstop>
<tabstop>score_9</tabstop>
<tabstop>score_10</tabstop>
</tabstops>
<resources/>
<connections/>

View File

@@ -28,7 +28,7 @@ class JsonIO:
def save_json(self, filename, data):
"""Atomically saves json file"""
with open(filename, encoding="utf-8", mode="w") as f:
dump(data, f, indent=4, separators=(",", " : "))
dump(data, f, indent=4, separators=(",", ": "))
return self.is_valid_json(filename)

View File

@@ -25,16 +25,15 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.ui.setupUi(self)
# self.file_list = jsonIO.load_json("JDM17_animes.json")
# for data in self.file_list:
# item = QListWidgetItem(data["target_title_ru"])
# item.setData(1, data["target_id"])
# self.ui.anime_list.addItem(item)
for key, value in statuses.items():
self.ui.status.addItem(value, key)
self.ui.anime_list.currentItemChanged.connect(self.show_info)
self.ui.anime_list.currentItemChanged.connect(self.show_title_info)
self.ui.actionOpen.triggered.connect(self.action_open_file)
self.ui.actionSave.triggered.connect(self.action_save_file)
self.ui.actionExit.triggered.connect(self.action_close_window)
@@ -47,7 +46,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.ui.rewatches.setValue(0)
self.ui.note.clear()
def show_info(self, item):
def show_title_info(self, item):
self.clear_fields()
target_id = item.data(1)
for data in self.file_list: