Skip to content

Commit ee3a5fe

Browse files
committed
update
1 parent a1c4072 commit ee3a5fe

File tree

7 files changed

+29
-22
lines changed

7 files changed

+29
-22
lines changed

home/CentralBlockTable.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ def CentralBlockTableCellDoubleClicked(self, currentRow, currentColumn):
7474
"""
7575
print("--------------------------------")
7676
print("CentralBlockTableCellDoubleClicked")
77-
guid_book = self.CentralBlockTable.item(currentRow, currentColumn).data(99)
77+
self.CentralBlockTable.item(currentRow, currentColumn)
78+
item = self.CentralBlockTable.item(currentRow, currentColumn)
79+
guid_book = item.data(99)
7880
print("Book GUID : {}".format(guid_book))
7981
if self.currentBook != guid_book:
8082
self.currentBook = guid_book
@@ -102,7 +104,9 @@ def CentralBlockTableItemChanged(self, newItem):
102104
print("Column = {}".format(newItem.column()))
103105
print(newItem.text())
104106
guid_book = newItem.data(99)
107+
book = self.BDD.getBooks(guid_book)[0]
105108
col_type = newItem.data(100)
109+
book[col_type] = newItem.text()
106110
self.BDD.updateBook(guid_book, col_type, newItem.text())
107111

108-
self.setInfoPanel(self.BDD.getBooks(guid_book)[0])
112+
self.setInfoPanel(book)

home/InfoPanel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def setInfoPanel(self, book: dict = None):
6161
icon.addPixmap(image, QtGui.QIcon.Normal, QtGui.QIcon.Off)
6262
self.InfoBlockCover.setIcon(icon)
6363
self.InfoBlockCover.setIconSize(QtCore.QSize(160, 160))
64+
self.InfoBlockCover.setToolTip("<img src='{}'/>".format(book['cover']))
6465
except Exception:
6566
traceback.print_exc()
6667
else:

home/SortingBlockTree.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import traceback
2+
from PyQt5 import QtCore, QtGui, QtWidgets
3+
4+
5+
class HomeWindowSortingBlockTree:
6+
def SortingBlockTreeInit(self):
7+
# Clean sub-tree Authors ans Series
8+
while self.SortingBlockTree.topLevelItem(1).childCount() > 0:
9+
self.SortingBlockTree.topLevelItem(1).removeChild(self.SortingBlockTree.topLevelItem(1).child(0))
10+
while self.SortingBlockTree.topLevelItem(2).childCount() > 0:
11+
self.SortingBlockTree.topLevelItem(2).removeChild(self.SortingBlockTree.topLevelItem(2).child(0))

home/home.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121

2222
from home.CentralBlockTable import *
2323
from home.InfoPanel import *
24+
from home.SortingBlockTree import *
2425

2526

26-
class HomeWindow(QWidget, HomeWindowCentralBlock, HomeWindowInfoPanel):
27+
class HomeWindow(QWidget, HomeWindowCentralBlock, HomeWindowInfoPanel, HomeWindowSortingBlockTree):
2728
def __init__(self, database: bdd.BDD, translation: Lang, env_vars: dict):
2829
self.appDir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
2930
self.currentBook = ''
@@ -41,11 +42,7 @@ def __init__(self, database: bdd.BDD, translation: Lang, env_vars: dict):
4142
self.HeaderBlockBtnSettings.clicked.connect(self.HeaderBlockBtnSettingsClicked)
4243

4344
self.CentralBlockTableDefineSlots()
44-
45-
while self.SortingBlockTree.topLevelItem(1).childCount() > 0:
46-
self.SortingBlockTree.topLevelItem(1).removeChild(self.SortingBlockTree.topLevelItem(1).child(0))
47-
while self.SortingBlockTree.topLevelItem(2).childCount() > 0:
48-
self.SortingBlockTree.topLevelItem(2).removeChild(self.SortingBlockTree.topLevelItem(2).child(0))
45+
self.SortingBlockTreeInit()
4946

5047
self.show() # Show the GUI
5148

@@ -131,9 +128,9 @@ def newBookTableItem(self, guid: str, type: str, value: str, editable: bool = Tr
131128
"""
132129
item = QtWidgets.QTableWidgetItem()
133130
if editable is True:
134-
item.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsEditable|QtCore.Qt.ItemIsUserCheckable|QtCore.Qt.ItemIsEnabled)
131+
item.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsEditable|QtCore.Qt.ItemIsEnabled)
135132
else:
136-
item.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsUserCheckable|QtCore.Qt.ItemIsEnabled)
133+
item.setFlags(QtCore.Qt.ItemIsSelectable|QtCore.Qt.ItemIsEnabled)
137134
item.setTextAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignVCenter)
138135
item.setData(99, guid)
139136
item.setData(100, type)

home/home.ui

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ QPushButton:hover{
4747
}
4848
QPushButton:pressed{
4949
background-color:rgb(75, 75, 75);
50-
}
51-
QLabel * {color: rgb(255, 255, 255) !important;}</string>
50+
}</string>
5251
</property>
5352
<layout class="QVBoxLayout" name="verticalLayout_2">
5453
<item>
@@ -324,6 +323,9 @@ font-family: arial;
324323
font-size: 12px; }
325324
QTableView::item { padding: 0px }</string>
326325
</property>
326+
<property name="editTriggers">
327+
<set>QAbstractItemView::AnyKeyPressed|QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked</set>
328+
</property>
327329
<property name="showDropIndicator" stdset="0">
328330
<bool>false</bool>
329331
</property>
@@ -656,15 +658,7 @@ QTableView::item { padding: 0px }</string>
656658
</size>
657659
</property>
658660
<property name="styleSheet">
659-
<string notr="true">QLabel{
660-
color: rgb(255, 255, 255);
661-
}
662-
QLabel *{
663-
color: rgb(255, 255, 255);
664-
}
665-
QLabel:*{
666-
color: rgb(255, 255, 255);
667-
}</string>
661+
<string notr="true"/>
668662
</property>
669663
<property name="text">
670664
<string>&lt;a href=&quot;test&quot;&gt;test&lt;/a&gt;</string>

tools/tools.zip

5.98 MB
Binary file not shown.

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
13/10/2020
2-
13:00:19,34
2+
15:15:17,67

0 commit comments

Comments
 (0)