Skip to content
Snippets Groups Projects
Commit a3b99bac authored by morkolai's avatar morkolai
Browse files

#96 WIP Laget module base funksjoner

parent 4f3fe21b
No related branches found
No related tags found
1 merge request!57#96 Telefonliste & Fiks til høyde på tabeller (rundt oppløsning)
Pipeline #83388 failed
soitool/media/phonetable.png

9.83 KiB

......@@ -10,7 +10,7 @@ from PySide2.QtWidgets import (
QCheckBox,
)
from PySide2.QtCore import Qt, QSize
from PySide2.QtGui import QKeySequence, QBrush, QColor
from PySide2.QtGui import QKeySequence, QBrush, QColor, QIcon
from soitool.modules.module_base import (
ModuleBase,
HEADLINE_FONT,
......@@ -303,24 +303,61 @@ class PhonebookModule(ModuleBase, QWidget, metaclass=Meta):
# !!!!! MODULE BASE OPERATIONS !!!!!
def get_size(self):
return super().get_size()
"""Getter for module size.
Returns
-------
tupple
Size of the module (width, height)
"""
self.resize()
return (self.minimumWidth, self.minimumHeight)
def get_data(self):
return super().get_data()
"""Get module content as serialized data.
Returns
-------
dict
Serialized module content.
"""
data = {}
for column_index in range(self.table.columnCount()):
self.table.setCurrentCell(0, column_index)
header = self.table.currentItem().text()
if self.selected_columns[header]:
row_data = []
for row_index in range(1, self.table.rowCount()):
self.table.setCurrentCell(row_index, column_index)
row_item = self.table.currentItem()
if row_item:
row_data.append(row_item.text())
else:
row_data.append("")
data[header] = row_data
return data
@staticmethod
def get_user_friendly_name():
pass
"""Get user friendly name.
Returns
-------
string
User friendly name.
"""
return "Telefonliste"
@staticmethod
def get_icon():
pass
"""Get icon.
if __name__ == "__main__":
from PySide2.QtWidgets import QApplication
app = QApplication()
module = PhonebookModule()
module.show()
app.exec_()
Returns
-------
QIcon
Picture of module.
"""
return QIcon("soitool/media/phonetable.png")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment