Skip to content

Commit

Permalink
Formatting, snake_case, type hinting, line length, docstrings, whites…
Browse files Browse the repository at this point in the history
…pace

- Sorry for the big commit
- snake_case in all files
	- Overriden base methods from pysides is still camelCase
	- These methods are moved to top in classes where they
	  are overriden
- Type hinting in some parts of the code
- Make some instance variables regular variable
- Add some short docstrings
- Remove unwanted whitespace
  • Loading branch information
mrkickling committed Nov 20, 2024
1 parent 5f27406 commit 18d5999
Show file tree
Hide file tree
Showing 28 changed files with 1,586 additions and 1,249 deletions.
505 changes: 298 additions & 207 deletions mal_gui/AssetsContainer/AssetsContainer.py

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions mal_gui/AssetsContainer/AssetsContainerRectangleBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
class AssetsContainerRectangleBox(QGraphicsRectItem):
def __init__(self, rect, parent=None):
super().__init__(rect, parent)

self.setBrush(QBrush(QColor(0, 0, 255, 50))) #Blue
self.setPen(QPen(QColor(0, 0, 255, 50))) #Blue

36 changes: 20 additions & 16 deletions mal_gui/AssociationTableView.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,45 @@
from PySide6.QtWidgets import QWidget,QTableView,QVBoxLayout
from PySide6.QtGui import QStandardItemModel,QStandardItem


from .MainWindow import MainWindow
class AssociationDefinitions(QWidget):
def __init__(self, parent=None):
def __init__(self, parent: MainWindow):
super().__init__(parent)

self.associationInfo = None
self.mainWindow = parent
self.association_info = None
self.main_window = parent

self.tableAssociationView = QTableView(self)
self.associationInfoModel = QStandardItemModel()
self.table_association_view = QTableView(self)
self.association_info_model = QStandardItemModel()

#headers for the columns
self.associationInfoModel.setHorizontalHeaderLabels(['AssocLeftAsset', 'AssocLeftField', 'AssocName', 'AssocRightField','AssocRightAsset'])
self.association_info_model.setHorizontalHeaderLabels(
['AssocLeftAsset', 'AssocLeftField', 'AssocName',
'AssocRightField','AssocRightAsset']
)

self.associationInfoModel.removeRows(0, self.associationInfoModel.rowCount())
self.association_info_model.removeRows(
0, self.association_info_model.rowCount()
)

for assoc in self.mainWindow.scene.langGraph.associations:
for assoc in self.main_window.scene.lang_graph.associations:
items = [
QStandardItem(assoc.left_field.asset.name),
QStandardItem(assoc.left_field.fieldname),
QStandardItem(assoc.name),
QStandardItem(assoc.right_field.fieldname),
QStandardItem(assoc.right_field.asset.name)
]
self.associationInfoModel.appendRow(items)

self.associationInfo = self.associationInfoModel
self.association_info_model.appendRow(items)

self.tableAssociationView.setModel(self.associationInfoModel)
self.association_info = self.association_info_model
self.table_association_view.setModel(self.association_info_model)

layout = QVBoxLayout()
layout.addWidget(self.tableAssociationView)
layout.addWidget(self.table_association_view)

# Set the layout to the widget
self.setLayout(layout)

def getAssociationInfo(self):
return self.associationInfo
def get_association_info(self):
return self.association_info
Loading

0 comments on commit 18d5999

Please sign in to comment.